From 2b4a68dbd854404a1789913f19355e1e2e24b136 Mon Sep 17 00:00:00 2001 From: "andy.lee" Date: Wed, 19 Jun 2024 12:14:14 +0800 Subject: [PATCH] Disable backup option in backing image dropdown if disk not ready Signed-off-by: andy.lee --- src/models/backupTarget.js | 2 ++ src/routes/backingImage/BackingImageActions.js | 6 +++--- src/routes/backupTarget/index.js | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/models/backupTarget.js b/src/models/backupTarget.js index 2a8e2c7b5..efc97e3ef 100644 --- a/src/models/backupTarget.js +++ b/src/models/backupTarget.js @@ -3,6 +3,7 @@ import { message } from 'antd' import { wsChanges, updateState } from '../utils/websocket' import queryString from 'query-string' import { enableQueryData } from '../utils/dataDependency' +import { delay } from 'dva/saga' export default { ws: null, @@ -58,6 +59,7 @@ export default { payload, }, { call, put }) { yield call(updateBackupTarget, payload) + yield delay(1000) yield put({ type: 'query' }) }, *bulkDelete({ diff --git a/src/routes/backingImage/BackingImageActions.js b/src/routes/backingImage/BackingImageActions.js index 38fa6cbfd..6cff28228 100644 --- a/src/routes/backingImage/BackingImageActions.js +++ b/src/routes/backingImage/BackingImageActions.js @@ -29,11 +29,11 @@ function actions({ selected, deleteBackingImage, downloadBackingImage, openBacku } } - const disableDownloadAction = !hasReadyBackingDisk(selected) + const disableAction = !hasReadyBackingDisk(selected) const availableActions = [ - { key: 'download', name: 'Download', disabled: disableDownloadAction, tooltip: disableDownloadAction ? 'Missing disk with ready state' : '' }, - { key: 'backup', name: 'Backup' }, + { key: 'download', name: 'Download', disabled: disableAction, tooltip: disableAction ? 'Missing disk with ready state' : '' }, + { key: 'backup', name: 'Backup', disabled: disableAction, tooltip: disableAction ? 'Missing disk with ready state' : '' }, { key: 'delete', name: 'Delete' }, ] diff --git a/src/routes/backupTarget/index.js b/src/routes/backupTarget/index.js index dc72b2331..660c97f87 100644 --- a/src/routes/backupTarget/index.js +++ b/src/routes/backupTarget/index.js @@ -70,7 +70,6 @@ class BackupTarget extends React.Component { selectedEditRow: record, editBackupTargetModalVisible: true, }) - this.handleEditModalOpen() } handleEditModalClose = () => { @@ -216,7 +215,7 @@ class BackupTarget extends React.Component { - + {createBackupTargetModalVisible && } {editBackupTargetModalVisible && }