From d892f8838d785b50e817c0d0bc04df5d0c0f3f35 Mon Sep 17 00:00:00 2001 From: "andy.lee" Date: Mon, 29 Jul 2024 11:12:02 +0800 Subject: [PATCH] Remove offline replica rebuilding related UI components and model Signed-off-by: andy.lee (cherry picked from commit eea00e8d354d9373f46ddf7de20b3bae255486d1) --- src/models/volume.js | 34 --------------- src/routes/volume/CreateVolume.js | 9 ---- src/routes/volume/VolumeActions.js | 5 --- src/routes/volume/VolumeBulkActions.js | 5 --- src/routes/volume/VolumeList.js | 18 ++++---- src/routes/volume/detail/VolumeInfo.js | 20 --------- src/routes/volume/detail/index.js | 15 ------- src/routes/volume/helper/index.js | 59 -------------------------- src/routes/volume/index.js | 24 ----------- 9 files changed, 8 insertions(+), 181 deletions(-) diff --git a/src/models/volume.js b/src/models/volume.js index 332c13d5..b7287201 100755 --- a/src/models/volume.js +++ b/src/models/volume.js @@ -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(), @@ -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 }) { @@ -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 } }, diff --git a/src/routes/volume/CreateVolume.js b/src/routes/volume/CreateVolume.js index 5215a253..2a6c4b73 100644 --- a/src/routes/volume/CreateVolume.js +++ b/src/routes/volume/CreateVolume.js @@ -519,15 +519,6 @@ const modal = ({ )} - { getFieldsValue().dataEngine === 'v2' && - {getFieldDecorator('offlineReplicaRebuilding', { - initialValue: 'ignored', - })()} - } {getFieldDecorator('freezeFilesystemForSnapshot', { initialValue: 'ignored', diff --git a/src/routes/volume/VolumeActions.js b/src/routes/volume/VolumeActions.js index 6d3a13c4..9b31f174 100644 --- a/src/routes/volume/VolumeActions.js +++ b/src/routes/volume/VolumeActions.js @@ -33,7 +33,6 @@ function actions({ showUpdateReplicaSoftAntiAffinityModal, showUpdateReplicaZoneSoftAntiAffinityModal, showUpdateReplicaDiskSoftAntiAffinityModal, - showOfflineReplicaRebuildingModal, showUpdateFreezeFilesystemForSnapshotModal, commandKeyDown, }) { @@ -156,9 +155,6 @@ function actions({ case 'updateReplicaDiskSoftAntiAffinity': showUpdateReplicaDiskSoftAntiAffinityModal(record) break - case 'updateOfflineReplicaRebuilding': - showOfflineReplicaRebuildingModal(record) - break case 'updateFreezeFilesystemForSnapshot': showUpdateFreezeFilesystemForSnapshotModal(record) break @@ -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' }] diff --git a/src/routes/volume/VolumeBulkActions.js b/src/routes/volume/VolumeBulkActions.js index 1864d988..805d4f5a 100644 --- a/src/routes/volume/VolumeBulkActions.js +++ b/src/routes/volume/VolumeBulkActions.js @@ -32,7 +32,6 @@ function bulkActions({ showUpdateReplicaSoftAntiAffinityModal, showUpdateReplicaZoneSoftAntiAffinityModal, showUpdateReplicaDiskSoftAntiAffinityModal, - showOfflineReplicaRebuildingModal, showUpdateBulkFreezeFilesystemForSnapshotModal, }) { const deleteWranElement = (rows) => { @@ -138,9 +137,6 @@ function bulkActions({ case 'updateReplicaDiskSoftAntiAffinity': showUpdateReplicaDiskSoftAntiAffinityModal(selectedRows) break - case 'updateOfflineReplicaRebuilding': - showOfflineReplicaRebuildingModal(selectedRows) - break case 'updateFreezeFilesystemForSnapshot': showUpdateBulkFreezeFilesystemForSnapshotModal(selectedRows) break @@ -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 } }, ] diff --git a/src/routes/volume/VolumeList.js b/src/routes/volume/VolumeList.js index a448155f..b37bd2e5 100755 --- a/src/routes/volume/VolumeList.js +++ b/src/routes/volume/VolumeList.js @@ -58,7 +58,6 @@ function list({ showUpdateReplicaSoftAntiAffinityModal, showUpdateReplicaZoneSoftAntiAffinityModal, showUpdateReplicaDiskSoftAntiAffinityModal, - showOfflineReplicaRebuildingModal, showUpdateFreezeFilesystemForSnapshotModal, onRowClick = f => f, }) { @@ -98,7 +97,6 @@ function list({ showUpdateReplicaSoftAntiAffinityModal, showUpdateReplicaZoneSoftAntiAffinityModal, showUpdateReplicaDiskSoftAntiAffinityModal, - showOfflineReplicaRebuildingModal, showUpdateFreezeFilesystemForSnapshotModal, onRowClick, } @@ -185,14 +183,14 @@ function list({ {ha}{state}{ !record.ready ? statusForWorkload : '' } ) } else if (text.hyphenToHump() === 'attached' && record.robustness === 'degraded') { - return ( -
- {ha}{state}{ !record.ready ? statusForWorkload : '' } -
-
) + return ( +
+ {ha}{state}{ !record.ready ? statusForWorkload : '' } +
+ ) } else if (text.hyphenToHump() === 'detached' && record.robustness === 'faulted') { return (
{errorMsg} - {getOfflineRebuiltStatus(selectedVolume) && } - {getOfflineRebuiltStatusWithoutFrontend(selectedVolume) && } {restoreProgress}
State: @@ -263,10 +247,6 @@ function VolumeInfo({ selectedVolume, snapshotModalState, engineImages, hosts, c Data Engine: {selectedVolume.dataEngine}
-
- Offline Replica Rebuilding: - {selectedVolume.offlineReplicaRebuilding} -
{!selectedVolume.disableFrontend ?
Attached Node & Endpoint: {selectedVolume.controllers ? selectedVolume.controllers.filter(item => item.hostId !== '' && item.endpoint !== '').map(item =>
{item.hostId}
{item.endpoint}
) : ''} diff --git a/src/routes/volume/detail/index.js b/src/routes/volume/detail/index.js index 8acaef19..1ba95f5d 100644 --- a/src/routes/volume/detail/index.js +++ b/src/routes/volume/detail/index.js @@ -43,7 +43,6 @@ import { getUpdateSnapshotDataIntegrityProps, getUpdateReplicaSoftAntiAffinityModalProps, getDetachHostModalProps, - getUpdateOfflineReplicaRebuildingModalProps, getUpdateSnapshotMaxCountModalProps, getUpdateSnapshotMaxSizeModalProps, getUpdateFreezeFilesystemForSnapshotModalProps, @@ -149,9 +148,6 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog, softAntiAffinityKey, updateReplicaSoftAntiAffinityVisible, updateReplicaSoftAntiAffinityModalKey, - updateOfflineReplicaRebuildingVisible, - offlineReplicaRebuildingKey, - updateOfflineReplicaRebuildingModalKey, detachHostModalVisible, detachHostModalKey, updateSnapshotMaxCountModalVisible, @@ -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({ @@ -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, @@ -751,7 +737,6 @@ function VolumeDetail({ snapshotModal, dispatch, backup, engineimage, eventlog, { updateSnapshotMaxSizeModalVisible ? : '' } {updateReplicaAutoBalanceModalVisible ? : ''} {updateReplicaSoftAntiAffinityVisible ? : ''} - {updateOfflineReplicaRebuildingVisible ? : ''} {updateFreezeFilesystemForSnapshotModalVisible ? : ''}
diff --git a/src/routes/volume/helper/index.js b/src/routes/volume/helper/index.js index 82d0f71c..8c331b2c 100644 --- a/src/routes/volume/helper/index.js +++ b/src/routes/volume/helper/index.js @@ -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() } @@ -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' }, diff --git a/src/routes/volume/index.js b/src/routes/volume/index.js index ae80672f..afd7bfb3 100644 --- a/src/routes/volume/index.js +++ b/src/routes/volume/index.js @@ -57,7 +57,6 @@ import { getUpdateBulkSnapshotDataIntegrityModalProps, getUpdateSnapshotDataIntegrityProps, getUpdateReplicaSoftAntiAffinityModalProps, - getUpdateOfflineReplicaRebuildingModalProps, getDetachHostModalProps, getUpdateSnapshotMaxCountModalProps, getUpdateSnapshotMaxSizeModalProps, @@ -201,9 +200,6 @@ class Volume extends React.Component { softAntiAffinityKey, updateReplicaSoftAntiAffinityVisible, updateReplicaSoftAntiAffinityModalKey, - updateOfflineReplicaRebuildingVisible, - updateOfflineReplicaRebuildingModalKey, - offlineReplicaRebuildingKey, isBulkDetach, updateSnapshotMaxCountModalVisible, updateSnapshotMaxSizeModalVisible, @@ -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) { @@ -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({ @@ -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) @@ -1326,7 +1303,6 @@ class Volume extends React.Component { {updateSnapshotDataIntegrityModalVisible ? : ''} {updateBulkSnapshotDataIntegrityModalVisible ? : ''} {updateReplicaSoftAntiAffinityVisible ? : ''} - {updateOfflineReplicaRebuildingVisible ? : ''} {updateFreezeFilesystemForSnapshotModalVisible ? : ''} {updateBulkFreezeFilesystemForSnapshotModalVisible ? : ''} {me.state.createBackModalVisible ? : ''}