Skip to content

Commit

Permalink
fix(data-integrity): add indicator for slow checks (#604)
Browse files Browse the repository at this point in the history
* fix(data-integrity): add indicator for slow checks

* fix: update run all checks label

* fix: use chip for indicator, add tooltip

* refactor: remove unnecessary css

* style: run prettier

* fix: use tag instead of chip
  • Loading branch information
Birkbjo authored Mar 13, 2024
1 parent 1e27b04 commit a4b7802
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 14 deletions.
14 changes: 10 additions & 4 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: 2024-03-05T14:54:55.437Z\n"
"PO-Revision-Date: 2024-03-05T14:54:55.437Z\n"
"POT-Creation-Date: 2024-03-13T13:19:06.504Z\n"
"PO-Revision-Date: 2024-03-13T13:19:06.504Z\n"

msgid "Something went wrong"
msgstr "Something went wrong"
Expand Down Expand Up @@ -57,15 +57,21 @@ msgstr "Something went wrong whilst fetching options"
msgid "Checks to run"
msgstr "Checks to run"

msgid "Run all available checks"
msgstr "Run all available checks"
msgid "Run all standard checks"
msgstr "Run all standard checks"

msgid "Only run selected checks"
msgstr "Only run selected checks"

msgid "Severity"
msgstr "Severity"

msgid "Slow checks are resource intensive and should be run with caution"
msgstr "Slow checks are resource intensive and should be run with caution"

msgid "Slow"
msgstr "Slow"

msgid "Select checks to run."
msgstr "Select checks to run."

Expand Down
27 changes: 20 additions & 7 deletions src/components/FormFields/Custom/DataIntegrityChecksField.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import {
Radio,
Transfer,
TransferOption,
Tooltip,
ReactFinalForm,
InputFieldFF,
Help,
Tag,
} from '@dhis2/ui'
import cx from 'classnames'
import { useParameterOption } from '../../../hooks/parameter-options'
Expand Down Expand Up @@ -83,7 +85,7 @@ const DataIntegrityChecksField = ({ label, name }) => {
<Radio
name={'checksToRun'}
value={'false'}
label={i18n.t('Run all available checks')}
label={i18n.t('Run all standard checks')}
checked={!runSelected}
onChange={toggle}
/>
Expand All @@ -108,19 +110,30 @@ const DataIntegrityChecksField = ({ label, name }) => {
)
}

const LabelComponent = ({ label, severity, highlighted, disabled }) => (
const LabelComponent = ({ label, severity, highlighted, disabled, isSlow }) => (
<div
className={cx(styles.transferOption, {
[styles.highlighted]: highlighted,
[styles.disabled]: disabled,
})}
>
<div className={styles.optionName}>{label}</div>
<div
className={cx(styles.optionSeverity, {
[styles.highlighted]: highlighted,
})}
>{`${i18n.t('Severity')}: ${severity}`}</div>
<div className={styles.optionSubtitle}>
<span
className={cx(styles.optionSeverity, {
[styles.highlighted]: highlighted,
})}
>{`${i18n.t('Severity')}: ${severity}`}</span>
{isSlow && (
<Tooltip
content={i18n.t(
'Slow checks are resource intensive and should be run with caution'
)}
>
<Tag>{i18n.t('Slow')}</Tag>
</Tooltip>
)}
</div>
</div>
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
.transfer {
margin-top: 8px;
margin-block-start: var(--spacers-dp8);
}

.transferOption {
display: flex;
flex-direction: column;
font-size: 14px;
padding: 4px 0;
gap: 6px;
}

.optionName {
font-weight: 500;
margin-bottom: 4px;
}

.optionSeverity {
.optionSubtitle {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
font-size: 13px;
}

.optionSeverity {
color: var(--colors-grey600);
}

Expand Down

1 comment on commit a4b7802

@dhis2-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.