-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ismay
committed
Feb 29, 2024
1 parent
aca86f3
commit 5596c30
Showing
22 changed files
with
103 additions
and
40 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
File renamed without changes.
File renamed without changes.
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
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
47 changes: 47 additions & 0 deletions
47
src/components/FormFields/Custom/PushAnalyticsModeField.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import i18n from '@dhis2/d2-i18n' | ||
import { | ||
SingleSelectField, | ||
ReactFinalForm, | ||
SingleSelectFieldFF, | ||
} from '@dhis2/ui' | ||
import { pushAnalyticsModes } from '../../../services/server-translations' | ||
|
||
const { Field } = ReactFinalForm | ||
|
||
const PushAnalyticsModeField = ({ label, name, constants }) => { | ||
if (constants.length === 0) { | ||
return ( | ||
<SingleSelectField | ||
label={label} | ||
helpText={i18n.t('No options available')} | ||
disabled | ||
/> | ||
) | ||
} | ||
|
||
const options = constants.map((option) => ({ | ||
value: option, | ||
label: pushAnalyticsModes[option] || option, | ||
})) | ||
|
||
return ( | ||
<Field | ||
name={name} | ||
component={SingleSelectFieldFF} | ||
options={options} | ||
label={label} | ||
/> | ||
) | ||
} | ||
|
||
const { string, arrayOf } = PropTypes | ||
|
||
PushAnalyticsModeField.propTypes = { | ||
constants: arrayOf(string).isRequired, | ||
label: string.isRequired, | ||
name: string.isRequired, | ||
} | ||
|
||
export default PushAnalyticsModeField |
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
2 changes: 1 addition & 1 deletion
2
...ts/FormFields/SkipTableTypesField.test.js → ...Fields/Custom/SkipTableTypesField.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
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
2 changes: 1 addition & 1 deletion
2
...s/QueueOrderField/QueueOrderField.test.js → ...onents/FormFields/QueueOrderField.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
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
File renamed without changes.
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
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,3 +1,4 @@ | ||
export { default as analyticsTableTypes } from './analyticsTableTypes' | ||
export { default as jobTypesMap } from './jobTypesMap' | ||
export { default as jobStatusMap } from './jobStatusMap' | ||
export { default as pushAnalyticsModes } from './pushAnalyticsModes' |
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 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
|
||
const pushAnalyticsModes = { | ||
EXECUTOR: i18n.t('Executor'), | ||
RECEIVER: i18n.t('Receiver'), | ||
} | ||
|
||
export default pushAnalyticsModes |