-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into do-not-extend-eslint-conf
- Loading branch information
Showing
30 changed files
with
574 additions
and
93 deletions.
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,87 @@ | ||
name: 'DHIS2: Verify' | ||
|
||
on: push | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Run linters | ||
run: | | ||
yarn d2-style js check | ||
yarn d2-style text check | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Test | ||
run: yarn test |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -40,6 +40,9 @@ jobs: | |
- name: Build | ||
run: yarn build | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
|
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
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 @@ | ||
import { configure } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
|
||
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
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
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
File renamed without changes.
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,10 @@ | ||
import React from 'react' | ||
import { Layer, CenteredContent, CircularLoader, layers } from '@dhis2/ui' | ||
|
||
export const LoadingMask = () => ( | ||
<Layer translucent level={layers.alert}> | ||
<CenteredContent> | ||
<CircularLoader /> | ||
</CenteredContent> | ||
</Layer> | ||
) |
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
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,58 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Provider } from '@dhis2/app-runtime' | ||
import { parseServerVersion } from '../utils/parseServerVersion' | ||
import { LoadingMask } from './LoadingMask' | ||
import { get } from '../utils/api' | ||
|
||
export const ServerVersionProvider = ({ url, apiVersion, children }) => { | ||
const [{ loading, error, systemInfo }, setState] = useState({ | ||
loading: true, | ||
}) | ||
|
||
useEffect(() => { | ||
setState(state => (state.loading ? state : { loading: true })) | ||
const request = get(`${url}/api/system/info`) | ||
request | ||
.then(systemInfo => { | ||
setState({ loading: false, systemInfo }) | ||
}) | ||
.catch(e => { | ||
setState({ loading: false, error: e }) | ||
}) | ||
|
||
return () => { | ||
request.abort() | ||
} | ||
}, [url]) | ||
|
||
if (loading) { | ||
return <LoadingMask /> | ||
} | ||
|
||
if (error) { | ||
return children | ||
} | ||
|
||
const serverVersion = parseServerVersion(systemInfo.version) | ||
const realApiVersion = serverVersion.minor | ||
|
||
return ( | ||
<Provider | ||
config={{ | ||
baseUrl: url, | ||
apiVersion: apiVersion || realApiVersion, | ||
serverVersion, | ||
systemInfo, | ||
}} | ||
> | ||
{children} | ||
</Provider> | ||
) | ||
} | ||
|
||
ServerVersionProvider.propTypes = { | ||
url: PropTypes.string.isRequired, | ||
apiVersion: PropTypes.number, | ||
children: PropTypes.element, | ||
} |
2 changes: 1 addition & 1 deletion
2
...dary/__tests__/FatalErrorBoundary.test.js → ...ents/__tests__/FatalErrorBoundary.test.js
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.