Skip to content

Commit

Permalink
fix: lowercase options name in volume page
Browse files Browse the repository at this point in the history
Signed-off-by: andy.lee <andy.lee@suse.com>
  • Loading branch information
a110605 authored and derekbit committed Sep 12, 2024
1 parent 0fadadb commit fcd377e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
30 changes: 15 additions & 15 deletions src/routes/volume/CreateVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,45 +348,45 @@ const modal = ({
{getFieldDecorator('unmapMarkSnapChainRemoved', {
initialValue: 'ignored',
})(<Select>
<Option key={'enabled'} value={'enabled'}>Enabled</Option>
<Option key={'disabled'} value={'disabled'}>Disabled</Option>
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
<Option key={'enabled'} value={'enabled'}>enabled</Option>
<Option key={'disabled'} value={'disabled'}>disabled</Option>
<Option key={'ignored'} value={'ignored'}>ignored (follow the global setting)</Option>
</Select>)}
</FormItem>
<FormItem label="Replica Soft Anti Affinity" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('replicaSoftAntiAffinity', {
initialValue: 'ignored',
})(<Select>
<Option key={'enabled'} value={'enabled'}>Enabled</Option>
<Option key={'disabled'} value={'disabled'}>Disabled</Option>
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
<Option key={'enabled'} value={'enabled'}>enabled</Option>
<Option key={'disabled'} value={'disabled'}>disabled</Option>
<Option key={'ignored'} value={'ignored'}>ignored (follow the global setting)</Option>
</Select>)}
</FormItem>
<FormItem label="Replica Zone Soft Anti Affinity" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('replicaZoneSoftAntiAffinity', {
initialValue: 'ignored',
})(<Select>
<Option key={'enabled'} value={'enabled'}>Enabled</Option>
<Option key={'disabled'} value={'disabled'}>Disabled</Option>
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
<Option key={'enabled'} value={'enabled'}>enabled</Option>
<Option key={'disabled'} value={'disabled'}>disabled</Option>
<Option key={'ignored'} value={'ignored'}>ignored (follow the global setting)</Option>
</Select>)}
</FormItem>
<FormItem label="Replica Disk Soft Anti Affinity" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('replicaDiskSoftAntiAffinity', {
initialValue: 'ignored',
})(<Select>
<Option key={'enabled'} value={'enabled'}>Enabled</Option>
<Option key={'disabled'} value={'disabled'}>Disabled</Option>
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
<Option key={'enabled'} value={'enabled'}>enabled</Option>
<Option key={'disabled'} value={'disabled'}>disabled</Option>
<Option key={'ignored'} value={'ignored'}>ignored (follow the global setting)</Option>
</Select>)}
</FormItem>
{ getFieldsValue().dataEngine === 'v2' && <FormItem label="Offline Replica Rebuilding" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('offlineReplicaRebuilding', {
initialValue: 'ignored',
})(<Select>
<Option key={'enabled'} value={'enabled'}>Enabled</Option>
<Option key={'disabled'} value={'disabled'}>Disabled</Option>
<Option key={'ignored'} value={'ignored'}>Ignored (Follow the global setting)</Option>
<Option key={'enabled'} value={'enabled'}>enabled</Option>
<Option key={'disabled'} value={'disabled'}>disabled</Option>
<Option key={'ignored'} value={'ignored'}>ignored (follow the global setting)</Option>
</Select>)}
</FormItem>}
<FormItem label="Disable Revision Counter" {...formItemLayoutForAdvanced}>
Expand Down
8 changes: 5 additions & 3 deletions src/routes/volume/detail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog,
const defaultDataLocalitySetting = settings.find(s => s.id === 'default-data-locality')
const defaultSnapshotDataIntegritySetting = settings.find(s => s.id === 'snapshot-data-integrity')
const engineUpgradePerNodeLimit = settings.find(s => s.id === 'concurrent-automatic-engine-upgrade-per-node-limit')
const defaultDataLocalityOption = defaultDataLocalitySetting && defaultDataLocalitySetting.definition && defaultDataLocalitySetting.definition.options ? defaultDataLocalitySetting.definition.options : []
const defaultSnapshotDataIntegrityOption = defaultSnapshotDataIntegritySetting?.definition?.options ? defaultSnapshotDataIntegritySetting.definition.options.map((item) => { return { key: item.firstUpperCase(), value: item } }) : []

const defaultDataLocalityOption = defaultDataLocalitySetting?.definition?.options || []
const defaultSnapshotDataIntegrityOption = defaultSnapshotDataIntegritySetting?.definition?.options.map((item) => ({ key: item.toLowerCase(), value: item })) || []

if (defaultSnapshotDataIntegrityOption.length > 0) {
defaultSnapshotDataIntegrityOption.push({ key: 'Ignored (Follow the global setting)', value: 'ignored' })
defaultSnapshotDataIntegrityOption.push({ key: 'ignored (follow the global setting)', value: 'ignored' })
}
const hasReplica = (selected, name) => {
if (selected && selected.replicas && selected.replicas.length > 0) {
Expand Down
24 changes: 12 additions & 12 deletions src/routes/volume/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ export function getUpdateDataLocalityModalProps(volume, visible, defaultDataLoca

export function getUnmapMarkSnapChainRemovedModalProps(volume, visible, dispatch) {
let option = [
{ key: 'Enabled', value: 'enabled' },
{ key: 'Disabled', value: 'disabled' },
{ key: 'Ignored (Follow the global setting)', value: 'ignored' },
{ key: 'enabled', value: 'enabled' },
{ key: 'disabled', value: 'disabled' },
{ key: 'ignored (follow the global setting)', value: 'ignored' },
]

return {
Expand Down Expand Up @@ -305,9 +305,9 @@ export function getUpdateSnapshotDataIntegrityProps(volume, visible, defaultSnap

export function getBulkUnmapMarkSnapChainRemovedModalProps(volumes, visible, dispatch) {
let option = [
{ key: 'Enabled', value: 'enabled' },
{ key: 'Disabled', value: 'disabled' },
{ key: 'Ignored (Follow the global setting)', value: 'ignored' },
{ key: 'enabled', value: 'enabled' },
{ key: 'disabled', value: 'disabled' },
{ key: 'ignored (follow the global setting)', value: 'ignored' },
]

return {
Expand Down Expand Up @@ -549,9 +549,9 @@ export function getUpdateReplicaSoftAntiAffinityModalProps(volume, volumes, upda
})
},
options: [
{ value: 'enabled', lable: 'Enabled' },
{ value: 'disabled', lable: 'Disabled' },
{ value: 'ignored', lable: 'Ignored (Follow the global setting)' },
{ value: 'enabled', label: 'enabled' },
{ value: 'disabled', label: 'disabled' },
{ value: 'ignored', label: 'ignored (follow the global setting)' },
],
feilds,
}
Expand Down Expand Up @@ -600,9 +600,9 @@ export function getUpdateOfflineReplicaRebuildingModalProps(volume, volumes, upd
})
},
options: [
{ value: 'enabled', lable: 'Enabled' },
{ value: 'disabled', lable: 'Disabled' },
{ value: 'ignored', lable: 'Ignored (Follow the global setting)' },
{ value: 'enabled', label: 'enabled' },
{ value: 'disabled', label: 'disabled' },
{ value: 'ignored', label: 'ignored (follow the global setting)' },
],
feilds,
}
Expand Down
6 changes: 4 additions & 2 deletions src/routes/volume/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ class Volume extends React.Component {
const defaultDataLocalityOption = defaultDataLocalitySetting?.definition?.options ? defaultDataLocalitySetting.definition.options : []
const defaultDataLocalityValue = defaultDataLocalitySetting?.value ? defaultDataLocalitySetting.value : 'disabled'
const defaultRevisionCounterValue = defaultRevisionCounterSetting?.value === 'true'
const defaultSnapshotDataIntegrityOption = defaultSnapshotDataIntegritySetting?.definition?.options ? defaultSnapshotDataIntegritySetting.definition.options.map((item) => { return { key: item.firstUpperCase(), value: item } }) : []

const v1DataEngineEnabled = v1DataEngineEnabledSetting?.value === 'true'
const v2DataEngineEnabled = v2DataEngineEnabledSetting?.value === 'true'

const defaultSnapshotDataIntegrityOption = defaultSnapshotDataIntegritySetting?.definition?.options.map((item) => ({ key: item.toLowerCase(), value: item })) || []
if (defaultSnapshotDataIntegrityOption.length > 0) {
defaultSnapshotDataIntegrityOption.push({ key: 'Ignored (Follow the global setting)', value: 'ignored' })
defaultSnapshotDataIntegrityOption.push({ key: 'ignored (follow the global setting)', value: 'ignored' })
}

const volumeFilterMap = {
Expand Down

0 comments on commit fcd377e

Please sign in to comment.