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

Remove offline replica rebuilding UI components (backport #780) #781

Merged
merged 1 commit into from
Jul 29, 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
34 changes: 0 additions & 34 deletions src/models/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ export default {
previousNamespace: '',
recurringJobList: [],
softAntiAffinityKey: '',
offlineReplicaRebuildingKey: '',
updateReplicaSoftAntiAffinityVisible: false,
updateOfflineReplicaRebuildingVisible: false,
changeVolumeModalKey: Math.random(),
updateOfflineReplicaRebuildingModalKey: Math.random(),
bulkChangeVolumeModalKey: Math.random(),
bulkExpandVolumeModalKey: Math.random(),
createPVAndPVCModalSingleKey: Math.random(),
Expand Down Expand Up @@ -437,12 +434,6 @@ export default {
yield payload.urls.map(url => call(execAction, url, payload.params))
yield put({ type: 'query' })
},
*updateOfflineReplicaRebuildingModal({
payload,
}, { call, put }) {
yield payload.urls.map(url => call(execAction, url, payload.params))
yield put({ type: 'query' })
},
*bulkDelete({
payload,
}, { call, put }) {
Expand Down Expand Up @@ -1017,31 +1008,6 @@ export default {
updateReplicaSoftAntiAffinityVisible: false,
}
},
showBulkOfflineReplicaRebuildingModal(state, action) {
return {
...state,
selectedRows: action?.payload?.volumes,
updateOfflineReplicaRebuildingVisible: true,
offlineReplicaRebuildingKey: action?.payload?.offlineReplicaRebuildingKey,
updateOfflineReplicaRebuildingModalKey: Math.random(),
}
},
showOfflineReplicaRebuildingModal(state, action) {
return {
...state,
selected: action?.payload?.volume,
updateOfflineReplicaRebuildingVisible: true,
offlineReplicaRebuildingKey: action?.payload?.offlineReplicaRebuildingKey,
updateOfflineReplicaRebuildingModalKey: Math.random(),
}
},
hideOfflineReplicaRebuildingModal(state) {
return {
...state,
offlineReplicaRebuildingKey: '',
updateOfflineReplicaRebuildingVisible: false,
}
},
updateWs(state, action) {
return { ...state, ws: action.payload }
},
Expand Down
9 changes: 0 additions & 9 deletions src/routes/volume/CreateVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,6 @@ const modal = ({
<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>
</Select>)}
</FormItem>}
<FormItem label="Freeze Filesystem For Snapshot" hasFeedback {...formItemLayoutForAdvanced}>
{getFieldDecorator('freezeFilesystemForSnapshot', {
initialValue: 'ignored',
Expand Down
5 changes: 0 additions & 5 deletions src/routes/volume/VolumeActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function actions({
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
showUpdateFreezeFilesystemForSnapshotModal,
commandKeyDown,
}) {
Expand Down Expand Up @@ -156,9 +155,6 @@ function actions({
case 'updateReplicaDiskSoftAntiAffinity':
showUpdateReplicaDiskSoftAntiAffinityModal(record)
break
case 'updateOfflineReplicaRebuilding':
showOfflineReplicaRebuildingModal(record)
break
case 'updateFreezeFilesystemForSnapshot':
showUpdateFreezeFilesystemForSnapshotModal(record)
break
Expand Down Expand Up @@ -234,7 +230,6 @@ function actions({
{ key: 'updateSnapshotMaxCount', name: 'Update Snapshot Max Count', disabled: false },
{ key: 'updateSnapshotMaxSize', name: 'Update Snapshot Max Size', disabled: false },
{ key: 'updateReplicaDiskSoftAntiAffinity', name: 'Update Replica Disk Soft Anti Affinity', disabled: false },
{ key: 'updateOfflineReplicaRebuilding', name: 'Update Offline Replica Rebuilding', disabled: false || selected.dataEngine !== 'v2' },
{ key: 'updateFreezeFilesystemForSnapshot', name: 'Update Freeze Filesystem For Snapshot', disabled: false },
]
const availableActions = [{ key: 'backups', name: 'Backups', disabled: selected.standby || isRestoring(selected) }, { key: 'delete', name: 'Delete' }]
Expand Down
5 changes: 0 additions & 5 deletions src/routes/volume/VolumeBulkActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function bulkActions({
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
showUpdateBulkFreezeFilesystemForSnapshotModal,
}) {
const deleteWranElement = (rows) => {
Expand Down Expand Up @@ -138,9 +137,6 @@ function bulkActions({
case 'updateReplicaDiskSoftAntiAffinity':
showUpdateReplicaDiskSoftAntiAffinityModal(selectedRows)
break
case 'updateOfflineReplicaRebuilding':
showOfflineReplicaRebuildingModal(selectedRows)
break
case 'updateFreezeFilesystemForSnapshot':
showUpdateBulkFreezeFilesystemForSnapshotModal(selectedRows)
break
Expand Down Expand Up @@ -211,7 +207,6 @@ function bulkActions({
{ key: 'updateReplicaSoftAntiAffinity', name: 'Update Replica Soft Anti Affinity', disabled() { return selectedRows.length === 0 } },
{ key: 'updateReplicaZoneSoftAntiAffinity', name: 'Update Replica Zone Soft Anti Affinity', disabled() { return selectedRows.length === 0 } },
{ key: 'updateReplicaDiskSoftAntiAffinity', name: 'Update Replica Disk Soft Anti Affinity', disabled() { return selectedRows.length === 0 } },
{ key: 'updateOfflineReplicaRebuilding', name: 'Update Offline Replica Rebuilding', disabled() { return selectedRows.length === 0 || selectedRows.some((item) => item.dataEngine !== 'v2') } },
{ key: 'trimFilesystem', name: 'Trim Filesystem', disabled() { return selectedRows.length === 0 || notAttached() } },
{ key: 'updateFreezeFilesystemForSnapshot', name: 'Update Freeze Filesystem For Snapshot', disabled() { return selectedRows.length === 0 } },
]
Expand Down
18 changes: 8 additions & 10 deletions src/routes/volume/VolumeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function list({
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
showUpdateFreezeFilesystemForSnapshotModal,
onRowClick = f => f,
}) {
Expand Down Expand Up @@ -98,7 +97,6 @@ function list({
showUpdateReplicaSoftAntiAffinityModal,
showUpdateReplicaZoneSoftAntiAffinityModal,
showUpdateReplicaDiskSoftAntiAffinityModal,
showOfflineReplicaRebuildingModal,
showUpdateFreezeFilesystemForSnapshotModal,
onRowClick,
}
Expand Down Expand Up @@ -185,14 +183,14 @@ function list({
{ha}{state}{ !record.ready ? statusForWorkload : '' }
</div>)
} else if (text.hyphenToHump() === 'attached' && record.robustness === 'degraded') {
return (<Tooltip title={record.dataEngine === 'v2' && 'Replica rebuilding will be automatically triggered when the degraded volume is detached'}>
<div
className={classnames({ [record.robustness.toLowerCase()]: true, capitalize: true })}
style={{ display: 'flex', alignItems: 'center' }}
>
{ha}{state}{ !record.ready ? statusForWorkload : '' }
</div>
</Tooltip>)
return (
<div
className={classnames({ [record.robustness.toLowerCase()]: true, capitalize: true })}
style={{ display: 'flex', alignItems: 'center' }}
>
{ha}{state}{ !record.ready ? statusForWorkload : '' }
</div>
)
} else if (text.hyphenToHump() === 'detached' && record.robustness === 'faulted') {
return (<div
className={classnames({ [record.robustness.toLowerCase()]: true, capitalize: true })}
Expand Down
20 changes: 0 additions & 20 deletions src/routes/volume/detail/VolumeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {
needToWaitDone,
frontends,
extractImageVersion,
getOfflineRebuiltStatus,
getOfflineRebuiltStatusWithoutFrontend,
} from '../helper/index'
import styles from './VolumeInfo.less'
import { diskTagColor, nodeTagColor } from '../../../utils/constants'
Expand Down Expand Up @@ -210,20 +208,6 @@ function VolumeInfo({ selectedVolume, snapshotModalState, engineImages, hosts, c
return (
<div>
{errorMsg}
{getOfflineRebuiltStatus(selectedVolume) && <Alert
style={{ marginTop: 5 }}
message="Offline Rebuilding"
description="The volume is being offline rebuilding"
type="warning"
showIcon
/>}
{getOfflineRebuiltStatusWithoutFrontend(selectedVolume) && <Alert
style={{ marginTop: 5 }}
message="Offline Rebuilding"
description={selectedVolume.offlineReplicaRebuildingRequired ? 'The volume rebuilding will be automatically triggered after detachment' : 'Offline Replica Rebuilding is disabled, the volume rebuilding will not be automatically triggered after detachment'}
type="warning"
showIcon
/>}
{restoreProgress}
<div className={styles.row}>
<span className={styles.label}> State:</span>
Expand Down Expand Up @@ -263,10 +247,6 @@ function VolumeInfo({ selectedVolume, snapshotModalState, engineImages, hosts, c
<span className={styles.label}> Data Engine:</span>
{selectedVolume.dataEngine}
</div>
<div className={styles.row}>
<span className={styles.label}> Offline Replica Rebuilding:</span>
{selectedVolume.offlineReplicaRebuilding}
</div>
{!selectedVolume.disableFrontend ? <div className={styles.row}>
<span className={styles.label}> Attached Node &amp; Endpoint:</span>
{selectedVolume.controllers ? selectedVolume.controllers.filter(item => item.hostId !== '' && item.endpoint !== '').map(item => <div style={{ fontFamily: 'monospace', margin: '2px 0px' }} key={item.hostId}>{item.hostId} <br /> <span style={{ backgroundColor: '#f2f4f5' }}> {item.endpoint} </span></div>) : ''}
Expand Down
15 changes: 0 additions & 15 deletions src/routes/volume/detail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
getUpdateSnapshotDataIntegrityProps,
getUpdateReplicaSoftAntiAffinityModalProps,
getDetachHostModalProps,
getUpdateOfflineReplicaRebuildingModalProps,
getUpdateSnapshotMaxCountModalProps,
getUpdateSnapshotMaxSizeModalProps,
getUpdateFreezeFilesystemForSnapshotModalProps,
Expand Down Expand Up @@ -149,9 +148,6 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog,
softAntiAffinityKey,
updateReplicaSoftAntiAffinityVisible,
updateReplicaSoftAntiAffinityModalKey,
updateOfflineReplicaRebuildingVisible,
offlineReplicaRebuildingKey,
updateOfflineReplicaRebuildingModalKey,
detachHostModalVisible,
detachHostModalKey,
updateSnapshotMaxCountModalVisible,
Expand Down Expand Up @@ -485,15 +481,6 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog,
},
})
},
showOfflineReplicaRebuildingModal(record) {
dispatch({
type: 'volume/showOfflineReplicaRebuildingModal',
payload: {
volumes: record,
offlineReplicaRebuildingKey: 'updateOfflineReplicaRebuilding',
},
})
},
trimFilesystem(record) {
if (record?.actions?.trimFilesystem) {
dispatch({
Expand All @@ -520,7 +507,6 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog,
const engineUpgradeModalProps = getEngineUpgradeModalProps([selectedVolume], engineImages, engineUpgradePerNodeLimit, engineUpgradeModalVisible, dispatch)
const updateReplicaAutoBalanceModalProps = getUpdateReplicaAutoBalanceModalProps([selectedVolume], updateReplicaAutoBalanceModalVisible, dispatch)
const updateReplicaSoftAntiAffinityModalProps = getUpdateReplicaSoftAntiAffinityModalProps(selectedVolume, [], updateReplicaSoftAntiAffinityVisible, softAntiAffinityKey, dispatch)
const updateOfflineReplicaRebuildingModalProps = getUpdateOfflineReplicaRebuildingModalProps(selectedVolume, [], updateOfflineReplicaRebuildingVisible, offlineReplicaRebuildingKey, dispatch)

const recurringJobProps = {
dataSource: volumeRecurringJobs,
Expand Down Expand Up @@ -751,7 +737,6 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog,
{ updateSnapshotMaxSizeModalVisible ? <UpdateSnapshotMaxSizeModal {...updateSnapshotMaxSizeModalProps} /> : '' }
{updateReplicaAutoBalanceModalVisible ? <UpdateReplicaAutoBalanceModal key={updateReplicaAutoBalanceModalKey} {...updateReplicaAutoBalanceModalProps} /> : ''}
{updateReplicaSoftAntiAffinityVisible ? <CommonModal key={updateReplicaSoftAntiAffinityModalKey} {...updateReplicaSoftAntiAffinityModalProps} /> : ''}
{updateOfflineReplicaRebuildingVisible ? <CommonModal key={updateOfflineReplicaRebuildingModalKey} {...updateOfflineReplicaRebuildingModalProps} /> : ''}
{updateFreezeFilesystemForSnapshotModalVisible ? <UpdateFreezeFilesystemForSnapshotModal key={updateFreezeFilesystemForSnapshotModalKey} {...updateFreezeFilesystemForSnapshotModalProps} /> : ''}
</div>
</div>
Expand Down
59 changes: 0 additions & 59 deletions src/routes/volume/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,57 +621,6 @@ export function getUpdateReplicaSoftAntiAffinityModalProps(volume, volumes, upda
}
}

export function getUpdateOfflineReplicaRebuildingModalProps(volume, volumes, updateOfflineReplicaRebuildingVisible, key, dispatch) {
let offlineReplicaRebuildingVolumes = []
let fields = {}
switch (key) {
case 'updateOfflineReplicaRebuilding':
fields = {
actionKey: 'updateOfflineReplicaRebuilding',
key: 'offlineReplicaRebuilding',
name: 'Offline Replica Rebuilding',
}
offlineReplicaRebuildingVolumes = [volume]
break
case 'updateBulkOfflineReplicaRebuilding':
fields = {
actionKey: 'updateOfflineReplicaRebuilding',
key: 'offlineReplicaRebuilding',
name: 'Offline Replica Rebuilding',
}
offlineReplicaRebuildingVolumes = volumes
break
default:
}
return {
items: offlineReplicaRebuildingVolumes,
visible: updateOfflineReplicaRebuildingVisible,
onCancel() {
dispatch({
type: 'volume/hideOfflineReplicaRebuildingModal',
})
},
onOk(v, urls) {
dispatch({
type: 'volume/updateOfflineReplicaRebuildingModal',
payload: {
params: v,
urls,
},
})
dispatch({
type: 'volume/hideOfflineReplicaRebuildingModal',
})
},
options: [
{ value: 'enabled', label: 'Enabled' },
{ value: 'disabled', label: 'Disabled' },
{ value: 'ignored', label: 'Ignored (Follow the global setting)' },
],
fields,
}
}

export function getHealthState(state) {
return state.toLowerCase() === 'unknown' ? 'unknown' : state.hyphenToHump()
}
Expand All @@ -680,14 +629,6 @@ export function needToWaitDone(state, replicas) {
return state === '' || state.endsWith('ing') || replicas.findIndex(item => item.mode.toLowerCase() === 'wo') > -1
}

export function getOfflineRebuiltStatus(volume) {
return volume.disableFrontend && volume.dataEngine === 'v2' && volume.offlineReplicaRebuildingRequired && volume.state === 'attached'
}

export function getOfflineRebuiltStatusWithoutFrontend(volume) {
return !volume.disableFrontend && volume.dataEngine === 'v2' && volume.state === 'attached' && volume.robustness === 'degraded'
}

export const frontends = [
{ label: 'Block Device', value: 'blockdev' },
{ label: 'iSCSI', value: 'iscsi' },
Expand Down
24 changes: 0 additions & 24 deletions src/routes/volume/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import {
getUpdateBulkSnapshotDataIntegrityModalProps,
getUpdateSnapshotDataIntegrityProps,
getUpdateReplicaSoftAntiAffinityModalProps,
getUpdateOfflineReplicaRebuildingModalProps,
getDetachHostModalProps,
getUpdateSnapshotMaxCountModalProps,
getUpdateSnapshotMaxSizeModalProps,
Expand Down Expand Up @@ -201,9 +200,6 @@ class Volume extends React.Component {
softAntiAffinityKey,
updateReplicaSoftAntiAffinityVisible,
updateReplicaSoftAntiAffinityModalKey,
updateOfflineReplicaRebuildingVisible,
updateOfflineReplicaRebuildingModalKey,
offlineReplicaRebuildingKey,
isBulkDetach,
updateSnapshotMaxCountModalVisible,
updateSnapshotMaxSizeModalVisible,
Expand Down Expand Up @@ -608,15 +604,6 @@ class Volume extends React.Component {
},
})
},
showOfflineReplicaRebuildingModal(record) {
dispatch({
type: 'volume/showOfflineReplicaRebuildingModal',
payload: {
volume: record,
offlineReplicaRebuildingKey: 'updateOfflineReplicaRebuilding',
},
})
},
rowSelection: {
selectedRowKeys: selectedRows.map(item => item.id),
onChange(_, records) {
Expand Down Expand Up @@ -1145,15 +1132,6 @@ class Volume extends React.Component {
},
})
},
showOfflineReplicaRebuildingModal(record) {
dispatch({
type: 'volume/showBulkOfflineReplicaRebuildingModal',
payload: {
volumes: record,
offlineReplicaRebuildingKey: 'updateBulkOfflineReplicaRebuilding',
},
})
},
trimBulkFilesystem(record) {
if (record?.length > 0) {
dispatch({
Expand Down Expand Up @@ -1263,7 +1241,6 @@ class Volume extends React.Component {
}

const updateReplicaSoftAntiAffinityModalProps = getUpdateReplicaSoftAntiAffinityModalProps(selected, selectedRows, updateReplicaSoftAntiAffinityVisible, softAntiAffinityKey, dispatch)
const updateOfflineReplicaRebuildingModalProps = getUpdateOfflineReplicaRebuildingModalProps(selected, selectedRows, updateOfflineReplicaRebuildingVisible, offlineReplicaRebuildingKey, dispatch)
const updateReplicaCountModalProps = getUpdateReplicaCountModalProps(selected, updateReplicaCountModalVisible, dispatch)
const updateBulKReplicaCountModalProps = getUpdateBulkReplicaCountModalProps(selectedRows, updateBulkReplicaCountModalVisible, dispatch)
const updateDataLocalityModalProps = getUpdateDataLocalityModalProps(selected, updateDataLocalityModalVisible, defaultDataLocalityOption, dispatch)
Expand Down Expand Up @@ -1326,7 +1303,6 @@ class Volume extends React.Component {
{updateSnapshotDataIntegrityModalVisible ? <UpdateSnapshotDataIntegrityModal key={updateSnapshotDataIntegrityModalKey} {...updateSnapshotDataIntegrityModalProps} /> : ''}
{updateBulkSnapshotDataIntegrityModalVisible ? <UpdateBulkSnapshotDataIntegrityModal key={updateBulkSnapshotDataIntegrityModalKey} {...updateBulkSnapshotDataIntegrityModalProps} /> : ''}
{updateReplicaSoftAntiAffinityVisible ? <CommonModal key={updateReplicaSoftAntiAffinityModalKey} {...updateReplicaSoftAntiAffinityModalProps} /> : ''}
{updateOfflineReplicaRebuildingVisible ? <CommonModal key={updateOfflineReplicaRebuildingModalKey} {...updateOfflineReplicaRebuildingModalProps} /> : ''}
{updateFreezeFilesystemForSnapshotModalVisible ? <UpdateFreezeFilesystemForSnapshotModal key={updateFreezeFilesystemForSnapshotModalKey} {...updateFreezeFilesystemForSnapshotModalProps} /> : ''}
{updateBulkFreezeFilesystemForSnapshotModalVisible ? <UpdateBulkFreezeFilesystemForSnapshotModal key={updateBulkFreezeFilesystemForSnapshotModalKey} {...updateBulkFreezeFilesystemForSnapshotModalProps} /> : ''}
{me.state.createBackModalVisible ? <CreateBackupModal key={me.state.createBackModalKey} {...createBackModalProps} /> : ''}
Expand Down