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

fix(data-integrity): add indicator for slow checks #604

Merged
merged 6 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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;
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this to flex, mostly because I prefer using gap instead of margins for spacing between the header and other stuff.

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
Loading