Skip to content

Commit

Permalink
updates to upload tool
Browse files Browse the repository at this point in the history
  • Loading branch information
dqgorelick committed Oct 1, 2020
1 parent cfcb83d commit b8bf79c
Show file tree
Hide file tree
Showing 291 changed files with 22,673 additions and 1,806 deletions.
11 changes: 11 additions & 0 deletions .build_scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e # halt script on error

echo "Get ready, we're pushing to gh-pages!"
cd dist
git init
git config user.name "Travis-CI"
git config user.email "[email protected]"
git add .
git commit -m "CI deploy to gh-pages"
git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" master:gh-pages > /dev/null 2>&1
6 changes: 3 additions & 3 deletions .build_scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -e # halt script on error
# If deploying, don't balk on lint errors
if [ $TRAVIS_PULL_REQUEST = "false" ] && [ $TRAVIS_BRANCH = ${PRODUCTION_BRANCH} ]; then
npm run lint || true
if [ $TRAVIS_PULL_REQUEST = "false" ] && [ $TRAVIS_BRANCH = ${DEPLOY_BRANCH} ]; then
yarn run lint || true
else
npm run lint
yarn run lint
fi
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js}]
charset = utf-8

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
15 changes: 7 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
"es6": true,
"browser": true
},
"plugins": [
"react"
],
"plugins": ["react"],
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 2018,
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": [2, "always"],
"jsx-quotes": [2, "prefer-single"],
"no-extra-semi": 2,
"semi-spacing": [2, { "before": false, "after": true }],
"react/display-name": 1 ,
"react/display-name": 1,
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 2,
Expand All @@ -29,7 +28,7 @@
"react/no-direct-mutation-state": 2,
"react/no-is-mounted": 2,
"react/no-unknown-property": 2,
"react/prop-types": 2,
"react/react-in-jsx-scope": 2
"react/react-in-jsx-scope": 2,
"prefer-promise-reject-errors": 0
}
}
}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
################################################

app/assets/scripts/config/local.js
app/assets/content


################################################
Expand Down Expand Up @@ -81,6 +80,7 @@ lib-cov
*.out
*.pid
npm-debug.log
yarn-error.log


################################################
Expand All @@ -102,6 +102,7 @@ _README.md
*~
*#
.DS_STORE
.DS_Store
.netbeans
nbproject
.idea
Expand All @@ -110,4 +111,5 @@ nbproject
temp
tmp
.tmp
dist
dist
app/assets/styles/_collecticons\.scss
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
41 changes: 30 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
language: node_js
node_js:
- '4'
- '10'
env:
global:
- PRODUCTION_BRANCH=publish
cache:
directories:
- node_modules
before_install:
- chmod +x ./.build_scripts/lint.sh
script:
# - npm test
# - ./.build_scripts/lint.sh
- npm run build
- STAGING_BRANCH=develop
- PRODUCTION_BRANCH=master
cache: npm
script: npm run lint
after_success:
- '[[ $TRAVIS_BRANCH == $STAGING_BRANCH ]] && npm run stage'
- '[[ $TRAVIS_BRANCH == $PRODUCTION_BRANCH ]] && npm run build'
deploy:
- provider: s3
access_key_id: AKIAIHACHLPCT2PIL4TA
secret_access_key:
secure: JmalFAU1SCF2NruC1FjpsfvBPMyyZAc0FrFefki8mC6r8QamQyv/xesq0KPQlraA1Lll0dE1b7qMdoSZNZIR8itzOlDQZXC4Hnu4HEd+vOhAkkVlCPSxF3yGvL/i2OGL+ocJmY5tlGcPzWD8TSBpLFlML5dUhUwAWIhxDXnHQuAFaC/yIkmO2lq3ldSwAy/4CVX+24wh2kg8pNms0T9FVTGSirERJwMsUFLKzXtcUd0QLWZ1j2Fao1CClSiiRX2841F0UNIkQOm5XFbIii4iCr+xtq+U1LmqoMnGi78WwR0JuZ+WgbPFfxXuHHVtQrVngOWGrSm0SJwx+IplqwVq1u/IQM+vAK36UIv0at5vZ77eGP4wOnpBA2J/Vdie/41/4+E4aIxcUBFZmtdfwolSdT9LXJrJP8KgmV3suwcbX5h/8/6dsI+7pGTi+CX9fQ4Ecs0rUtBmynNV4SP6jgJoylDRoZHAf/HZCs//JsA2nbO8E5JUf5tLAHTU0aDEI7EaMdtDO46EYnQhbeHp5MdnFrz6jZm42FqkYsIaA423X4cYsDuRph1IV6gqJiSzeGwfyDxDCFYke2+uEm3CDu10jCdTaNMcchdpg7/1VUjdq3V+A+uz8Eq/OeK1JRfPkFD7RzcJx18nNNMjHQQkiknjJc8/jNKzc9GZSjADXWFRpoo=
bucket: metadata.openaq-staging.org
acl: public_read
local_dir: dist
skip_cleanup: true
on:
repo: openaq/openaq-metadata-editor
branch: ${STAGING_BRANCH}
- provider: s3
access_key_id: AKIAIHACHLPCT2PIL4TA
secret_access_key:
secure: JmalFAU1SCF2NruC1FjpsfvBPMyyZAc0FrFefki8mC6r8QamQyv/xesq0KPQlraA1Lll0dE1b7qMdoSZNZIR8itzOlDQZXC4Hnu4HEd+vOhAkkVlCPSxF3yGvL/i2OGL+ocJmY5tlGcPzWD8TSBpLFlML5dUhUwAWIhxDXnHQuAFaC/yIkmO2lq3ldSwAy/4CVX+24wh2kg8pNms0T9FVTGSirERJwMsUFLKzXtcUd0QLWZ1j2Fao1CClSiiRX2841F0UNIkQOm5XFbIii4iCr+xtq+U1LmqoMnGi78WwR0JuZ+WgbPFfxXuHHVtQrVngOWGrSm0SJwx+IplqwVq1u/IQM+vAK36UIv0at5vZ77eGP4wOnpBA2J/Vdie/41/4+E4aIxcUBFZmtdfwolSdT9LXJrJP8KgmV3suwcbX5h/8/6dsI+7pGTi+CX9fQ4Ecs0rUtBmynNV4SP6jgJoylDRoZHAf/HZCs//JsA2nbO8E5JUf5tLAHTU0aDEI7EaMdtDO46EYnQhbeHp5MdnFrz6jZm42FqkYsIaA423X4cYsDuRph1IV6gqJiSzeGwfyDxDCFYke2+uEm3CDu10jCdTaNMcchdpg7/1VUjdq3V+A+uz8Eq/OeK1JRfPkFD7RzcJx18nNNMjHQQkiknjJc8/jNKzc9GZSjADXWFRpoo=
bucket: metadata.openaq.org
acl: public_read
local_dir: dist
skip_cleanup: true
on:
repo: openaq/openaq-metadata-editor
branch: ${PRODUCTION_BRANCH}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Development Seed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 0 additions & 12 deletions LICENSE.md

This file was deleted.

53 changes: 21 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
# OpenAQ Uploader Page
A page used to upload CSV data to the OpenAQ project, which checks the data against rules in a JSON schema and delivers helpful error messages in cases of nonconformance.
# openaq-upload-tool

## Development environment
To set up the development environment for this website, you'll need to install the following on your system:
A tool to upload research-grade data to the OpenAQ platform

- Node (v4.2.x) & Npm ([nvm](https://github.com/creationix/nvm) usage is advised)
## Dev dependencies

> The versions mentioned are the ones used during development. It could work with newer ones.
- [gulp](https://github.com/gulpjs/gulp)
- [nvm](https://github.com/nvm-sh/nvm#install-script)

After these basic requirements are met, run the following commands in the website's folder:
```
$ npm install
```

## Development environment (server)
This site depends on the server to acquire credentials for uploading to S3. At present, it sends
a file name to an API which returns the parameters necessary to sign an AWS S3 upload submission form, as listed below:
```
data.append('acl', params.acl);
data.append('key', params.key);
data.append('policy', params.policy);
data.append('success_action_status', params['success_action_status']);
data.append('x-amz-algorithm', params['x-amz-algorithm']);
data.append('x-amz-credential', params['x-amz-credential']);
data.append('x-amz-date', params['x-amz-date']);
data.append('x-amz-signature', params['x-amz-signature']);
data.append('file', file);
```
## Getting started

In production, this API will integrated with the larger OpenAQ project, but a development server can be launched locally from the __server__ directory of this project. After running `npm install` in the __server__ directory, the server can be launched using the command `env S3_ACCESS_KEY=xxx S3_SECRET_KEY=xxx S3_BUCKET=xxx S3_REGION=xxx node server.js`, with the credentials to the desired S3 bucket. The bucket will need to have a CORS policy permissive of uploads from localhost. The server launches on port 5000, which is the endpoint used in this development version of the upload form.
1. Install [nvm](https://github.com/nvm-sh/nvm#install-script)
2. Run `nvm use` and `nvm install` to install the correct version of node for the project
3. Run `npm install` to install node modules
4. Install gulp globally `npm install -g gulp`
5. Run `npm run serve` to start project

### Getting started

```
$ npm run serve
```
Compiles the sass files, javascript, and launches the server making the site available at `http://localhost:3000/` The system will watch files and execute tasks whenever one of them changes. The site will automatically refresh since it is bundled with livereload.
Compiles the sass files, javascript, and launches the server making the site available at `http://localhost:3000/`
The system will watch files and execute tasks whenever one of them changes.
The site will automatically refresh since it is bundled with livereload.

### Other commands
Compile the sass files, javascript... Use this instead of ```npm run serve``` if you don't want to watch.
```
$ npm run build
```

### Troubleshooting:

- If you run into issues running `npm run serve`, you may not have the correct version of node or gulp. Please make sure you follow the steps using `nvm` above in "Getting started"

- If you follow the steps above and `npm run serve` is still not running, try tunning `npm rebuild node-sass
`. More info on this solution [here](https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node/58022933#58022933)
Empty file.
Binary file removed app/assets/graphics/content/page-hero-default.png
Binary file not shown.
Empty file.
Binary file added app/assets/graphics/layout/header-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/assets/graphics/meta/apple-touch-icon-57x57.png
Binary file not shown.
Binary file removed app/assets/graphics/meta/apple-touch-icon-72x72.png
Binary file not shown.
Binary file removed app/assets/graphics/meta/apple-touch-icon-76x76.png
Binary file not shown.
Binary file removed app/assets/graphics/meta/default-meta-image.png
Binary file not shown.
Binary file removed app/assets/graphics/meta/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-down-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-down-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-loop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-return.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-semi-spin-ccw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-semi-spin-cw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-spin-ccw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-spin-cw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-up-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-up-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/arrow-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/assets/icons/collecticons/bell.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/blow.svg
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/book-bookmark.svg
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/book.svg
Loading

0 comments on commit b8bf79c

Please sign in to comment.