Skip to content

Commit

Permalink
Disable backup option in backing image dropdown if disk not ready
Browse files Browse the repository at this point in the history
Signed-off-by: andy.lee <[email protected]>
  • Loading branch information
a110605 committed Jun 19, 2024
1 parent 5b0a119 commit 2b4a68d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/models/backupTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -58,6 +59,7 @@ export default {
payload,
}, { call, put }) {
yield call(updateBackupTarget, payload)
yield delay(1000)
yield put({ type: 'query' })
},
*bulkDelete({
Expand Down
6 changes: 3 additions & 3 deletions src/routes/backingImage/BackingImageActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
]

Expand Down
3 changes: 1 addition & 2 deletions src/routes/backupTarget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class BackupTarget extends React.Component {
selectedEditRow: record,
editBackupTargetModalVisible: true,
})
this.handleEditModalOpen()
}

handleEditModalClose = () => {
Expand Down Expand Up @@ -216,7 +215,7 @@ class BackupTarget extends React.Component {
<Button className="out-container-button" size="large" type="primary" disabled={loading} onClick={() => this.handleCreateModalOpen()}>
Create Backup Target
</Button>
<BackupTargetList key={Math.random()} {...backupTargetListProps} />
<BackupTargetList {...backupTargetListProps} />
{createBackupTargetModalVisible && <CreateBackupTargetModal {...createBackupTargetModalProps} />}
{editBackupTargetModalVisible && <EditBackupTargetModal {...editBackupTargetModalProps} />}
</div>
Expand Down

0 comments on commit 2b4a68d

Please sign in to comment.