-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from EyeSeeTea/development
Release 0.0.1
- Loading branch information
Showing
102 changed files
with
21,654 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
> 0.5% | ||
last 2 versions | ||
Firefox ESR | ||
ie 11 | ||
not dead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SKIP_PREFLIGHT_CHECK=true | ||
PORT=8081 | ||
BROWSER=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/**/*.d.ts | ||
/src/locales |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** @format */ | ||
|
||
module.exports = { | ||
extends: [ | ||
"react-app", | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:prettier/recommended", | ||
"plugin:cypress/recommended", | ||
], | ||
rules: { | ||
"no-console": "off", | ||
"@typescript-eslint/explicit-function-return-type": ["off"], | ||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }], | ||
"react/prop-types": "off", | ||
"no-unused-expressions": "off", | ||
"no-useless-concat": "off", | ||
"no-useless-constructor": "off", | ||
"default-case": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-empty-interface": "off", | ||
"@typescript-eslint/ban-ts-ignore": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"react-hooks/exhaustive-deps": "warn", | ||
}, | ||
plugins: ["cypress"], | ||
env: { "cypress/globals": true }, | ||
settings: { | ||
react: { | ||
pragma: "React", | ||
version: "16.6.0", | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### :pushpin: References | ||
|
||
- **Issue:** Closes #? | ||
|
||
### :memo: Implementation | ||
|
||
- | ||
|
||
### :art: Screenshots | ||
|
||
### :fire: How to test it? (If there is any special consideration or the reviewer does not know how to test it) | ||
|
||
### :bookmark_tabs: Others | ||
|
||
- [ ] Any change in the [API repo](https://github.com/EyeSeeTea/d2-api)? If so, what branch/PR? | ||
- [ ] Any change in the [GUI library](https://github.com/EyeSeeTea/d2-ui-components)? If so, what branch/PR? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
manifest.webapp | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
*.sublime-project | ||
*.sublime-workspace | ||
*.code-workspace | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
src/locales/ | ||
src/react-app.d.ts | ||
src/react-app-env.d.ts | ||
|
||
# cypress | ||
cypress/screenshots/ | ||
cypress/videos/ | ||
|
||
# IntelliJ | ||
.idea/* | ||
|
||
# Custom | ||
bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @format */ | ||
|
||
module.exports = { | ||
printWidth: 100, | ||
tabWidth: 4, | ||
useTabs: false, | ||
semi: true, | ||
singleQuote: false, | ||
trailingComma: 'es5', | ||
bracketSpacing: true, | ||
jsxBracketSameLine: false, | ||
arrowParens: 'avoid', | ||
rangeStart: 0, | ||
rangeEnd: Infinity, | ||
proseWrap: 'preserve', | ||
requirePragma: false, | ||
insertPragma: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language: node_js | ||
node_js: | ||
- 12.13.0 | ||
dist: bionic | ||
cache: | ||
directories: | ||
- "$HOME/.cache" | ||
install: | ||
- yarn install --frozen-lockfile | ||
- yarn build-webapp | ||
addons: | ||
apt: | ||
packages: | ||
- libgconf-2-4 | ||
notifications: | ||
slack: | ||
secure: eyeseetea:ftMfk0oeXVhQVbdks9mZVunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,92 @@ | ||
# dhis2-gee-app | ||
DHIS2 webapp that extracts values from Google Earth Engine for a given subset of DHIS2 OUs, a certain period and datasets/variables mapping and injects them into DHIS2 | ||
|
||
DHIS2 webapp that extracts values from Google Earth Engine for a given subset of DHIS2 OUs, a certain period and datasets/variables mapping and injects them into DHIS2. | ||
|
||
## Setup | ||
|
||
``` | ||
$ yarn install | ||
``` | ||
|
||
## Development | ||
|
||
Start development server: | ||
|
||
``` | ||
$ PORT=8082 REACT_APP_DHIS2_BASE_URL="https://play.dhis2.org/dev" yarn start | ||
``` | ||
|
||
Linting: | ||
|
||
``` | ||
$ yarn lint | ||
``` | ||
|
||
## Tests | ||
|
||
Run unit tests: | ||
|
||
``` | ||
$ yarn test | ||
``` | ||
|
||
Run integration tests locally: | ||
|
||
``` | ||
$ export CYPRESS_DHIS2_AUTH='admin:district' | ||
$ export CYPRESS_EXTERNAL_API="http://localhost:8080" | ||
$ export CYPRESS_ROOT_URL=http://localhost:8081 | ||
# non-interactive | ||
$ yarn cy:e2e:run | ||
# interactive UI | ||
$ yarn cy:e2e:open | ||
``` | ||
|
||
For this to work in Travis CI, you will have to create an environment variable CYPRESS_DHIS2_AUTH (Settings -> Environment Variables) with the password used in your testing DHIS2 instance. | ||
|
||
Travis project: https://travis-ci.org/EyeSeeTea/dhis2-gee-app/builds | ||
|
||
Cypress Dashboard: https://dashboard.cypress.io/projects/49be3z | ||
|
||
## Build app ZIP | ||
|
||
``` | ||
$ yarn build-webapp | ||
``` | ||
|
||
## Some development tips | ||
|
||
### Structure | ||
|
||
- `i18n/`: Contains literal translations (gettext format) | ||
- `public/`: Main app folder with a `index.html`, exposes the APP, contains the feedback-tool | ||
- `src/pages`: Main React components. | ||
- `src/components`: Reusable React components. | ||
- `src/models`: Models that hold all the logic of the app (pages/components only should contain view logic). | ||
- `src/types`: `.d.ts` file definitions for modules without Typescript definitions. | ||
- `src/utils`: Misc utilities. | ||
- `src/locales`: Auto-generated, don't change nor add to version control. | ||
- `cypress/integration/`: Contains the integration Cypress tests. | ||
|
||
### i18n | ||
|
||
``` | ||
$ yarn update-po | ||
# ... add/edit translations in i18n/*.po files ... | ||
$ yarn localize | ||
``` | ||
|
||
### App context | ||
|
||
File `src/contexts/app-context.ts` holds some general App context so typical infrastructure objects (`api`, `d2`, `currentUser`...) are readily available. Add your own objects if necessary. | ||
|
||
``` | ||
import { useAppContext } from "./path/to/contexts/app-context"; | ||
const SomeComponent: React.FunctionComponent = () => { | ||
const { d2, api, currentUser } = useAppContext(); | ||
... | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = process.env.CYPRESS_ENV ? {} : { | ||
"presets": ["babel-preset-react-app"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Turns file imports into dummy objects | ||
|
||
module.exports = "test-file-stub"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Turns style imports into empty objects | ||
|
||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function getD2Stub() { | ||
return { | ||
system: { | ||
systemInfo: {}, | ||
}, | ||
currentUser: {}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { configure } from "enzyme"; | ||
import Adapter from "enzyme-adapter-react-16"; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
|
||
configure({ adapter: new Adapter() }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"projectId": "49be3z", | ||
"defaultCommandTimeout": 10000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference types='Cypress' /> | ||
|
||
context("Example page", () => { | ||
before(() => { | ||
cy.login("who"); | ||
cy.visit("#/"); | ||
}); | ||
|
||
it("has page title", () => { | ||
cy.title().should("equal", "GEE App"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
|
||
on("task", { | ||
logRequest(req) { | ||
console.debug(req, config); | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.