Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add checkboxes for skipping tracked entity and outlier data (DHIS2-16143) #1014

Merged
merged 8 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-preview-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: actions/cache@v2
id: yarn-cache
Expand All @@ -69,7 +69,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: actions/cache@v2
id: yarn-cache
Expand All @@ -94,7 +94,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- uses: actions/download-artifact@v2
with:
Expand All @@ -116,7 +116,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 16.x

- name: Publish release to GitHub
run: npx @dhis2/cli-utils release
7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-03-09T00:41:03.216Z\n"
"PO-Revision-Date: 2023-03-09T00:41:03.216Z\n"
"POT-Creation-Date: 2023-11-09T10:55:29.694Z\n"
"PO-Revision-Date: 2023-11-09T10:55:29.694Z\n"

msgid "Open user guide"
msgstr "Open user guide"
Expand Down Expand Up @@ -210,6 +210,9 @@ msgstr "Skip generation of enrollment data"
msgid "Skip generation of organisation unit ownership data"
msgstr "Skip generation of organisation unit ownership data"

msgid "Skip generation of outlier data"
msgstr "Skip generation of outlier data"

msgid "Data Statistics"
msgstr "Data Statistics"

Expand Down
1 change: 1 addition & 0 deletions src/i18n-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const i18nKeys = {
skipOrgUnitOwnership: i18n.t(
'Skip generation of organisation unit ownership data'
),
skipOutliers: i18n.t('Skip generation of outlier data'),
},
},
dataStatistics: {
Expand Down
18 changes: 10 additions & 8 deletions src/pages/analytics/analytics.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ export const lastYearElements = lastYearValues

/* Form checkboxes */
export const analyticsCheckboxes = [
'skipAggregate',
'skipResourceTables',
'skipEvents',
'skipEnrollment',
'skipOrgUnitOwnership',
].map((key) => ({
key,
label: i18nKeys.analytics.checkboxes[key],
{ key: 'skipAggregate' },
{ key: 'skipResourceTables' },
{ key: 'skipEvents' },
{ key: 'skipEnrollment' },
{ key: 'skipOrgUnitOwnership' },
{ key: 'skipOutliers', checked: true },
].map((obj) => ({
key: obj.key,
checked: Boolean(obj.checked),
label: i18nKeys.analytics.checkboxes[obj.key],
}))
12 changes: 2 additions & 10 deletions src/pages/analytics/use-checkboxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@ import { useState } from 'react'
import { analyticsCheckboxes } from './analytics.conf.js'

export const useCheckboxes = () => {
const [checkboxes, setCheckboxes] = useState(() => {
const checkboxes = {}
analyticsCheckboxes.forEach((checkbox) => {
checkboxes[checkbox.key] = {
checked: false,
label: checkbox.label,
}
})
return checkboxes
})
const [checkboxes, setCheckboxes] = useState(analyticsCheckboxes)

const toggleCheckbox = (key) => {
setCheckboxes({
...checkboxes,
Expand Down
Loading