Skip to content

Commit

Permalink
fix: remove merge mode from metadata import UI
Browse files Browse the repository at this point in the history
  • Loading branch information
d-rita committed Mar 1, 2024
1 parent 325afa6 commit 1a6d6fb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
10 changes: 8 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: 2024-02-12T17:08:02.188Z\n"
"PO-Revision-Date: 2024-02-12T17:08:02.189Z\n"
"POT-Creation-Date: 2024-03-01T15:50:32.586Z\n"
"PO-Revision-Date: 2024-03-01T15:50:32.586Z\n"

msgid "Something went wrong when loading the current user!"
msgstr "Something went wrong when loading the current user!"
Expand Down Expand Up @@ -694,6 +694,12 @@ msgstr "Indexes"
msgid "Details by type"
msgstr "Details by type"

msgid "All existing property values will be replaced"
msgstr "All existing property values will be replaced"

msgid "Values will be overwritten, even if the new value is null"
msgstr "Values will be overwritten, even if the new value is null"

msgid "Advanced options"
msgstr "Advanced options"

Expand Down
27 changes: 27 additions & 0 deletions src/components/MergeOperation/MergeOperation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import i18n from '@dhis2/d2-i18n'
import { NoticeBox } from '@dhis2/ui'
import React from 'react'

const mergeOperation = 'REPLACE'

const MERGE_NOTICE_TITLE = i18n.t(
'All existing property values will be replaced'
)
const MERGE_NOTICE_TEXT = i18n.t(
'Values will be overwritten, even if the new value is null'
)

const MergeOperationNotice = () => {
return (
<div style={{ maxWidth: '80%' }}>
<NoticeBox
dataTest={'merge-operation-notice'}
title={MERGE_NOTICE_TITLE}
>
{MERGE_NOTICE_TEXT}
</NoticeBox>
</div>
)
}

export { mergeOperation, MergeOperationNotice }
4 changes: 4 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ export { SchemeContainer } from './ElementSchemes/SchemeContainer.js'
export { StyledField } from './StyledField/StyledField.js'
export { Tooltip } from './Tooltip/Tooltip.js'
export { ValidationSummary } from './ValidationSummary/ValidationSummary.js'
export {
mergeOperation,
MergeOperationNotice,
} from './MergeOperation/MergeOperation.js'
8 changes: 4 additions & 4 deletions src/pages/MetadataImport/MetadataImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
MoreOptions,
BasicOptions,
ValidationSummary,
mergeOperation,
MergeOperationNotice,
} from '../../components/index.js'
import {
FileUpload,
Expand All @@ -26,8 +28,6 @@ import {
defaultImportStrategyOption,
AtomicMode,
defaultAtomicModeOption,
MergeMode,
defaultMergeModeOption,
FlushMode,
defaultFlushModeOption,
SkipSharing,
Expand Down Expand Up @@ -67,7 +67,7 @@ const createInitialValues = (prevJobDetails) => ({
defaultFirstRowIsHeaderOption
),
atomicMode: prevJobDetails.atomicMode || defaultAtomicModeOption,
mergeMode: prevJobDetails.mergeMode || defaultMergeModeOption,
mergeMode: prevJobDetails.mergeMode || mergeOperation,
flushMode: prevJobDetails.flushMode || defaultFlushModeOption,
inclusionStrategy:
prevJobDetails.inclusionStrategy || defaultInclusionStrategyOption,
Expand Down Expand Up @@ -146,7 +146,7 @@ const MetadataImport = () => {
<ImportReportMode />
<ImportStrategy value={values.importStrategy} />
<AtomicMode />
<MergeMode />
<MergeOperationNotice />
</BasicOptions>
<MoreOptions>
<FlushMode />
Expand Down

0 comments on commit 1a6d6fb

Please sign in to comment.