From 53b3b88ca36d6e093ebec16b8549c34d617dd6ac Mon Sep 17 00:00:00 2001 From: "andy.lee" Date: Fri, 10 May 2024 16:24:28 +0800 Subject: [PATCH] add sync backup volume option to allow user manually synchronizing backup volumes Signed-off-by: andy.lee --- src/models/backup.js | 11 ++++++++++- src/routes/backup/BackupVolumeList.js | 4 ++++ src/routes/backup/index.js | 6 ++++++ src/services/backup.js | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/models/backup.js b/src/models/backup.js index 9415397d0..a0f43dabd 100644 --- a/src/models/backup.js +++ b/src/models/backup.js @@ -1,4 +1,4 @@ -import { query, queryBackupList, execAction, restore, deleteBackup, createVolume, deleteAllBackups, getNodeTags, getDiskTags, queryTarget } from '../services/backup' +import { query, queryBackupList, execAction, restore, deleteBackup, syncVolume, createVolume, deleteAllBackups, getNodeTags, getDiskTags, queryTarget } from '../services/backup' import { message } from 'antd' import { wsChanges } from '../utils/websocket' import queryString from 'query-string' @@ -246,6 +246,15 @@ export default { const search = yield select(store => { return store.backup.search }) yield put({ type: 'query', payload: { ...search } }) }, + *syncBackupVolume({ + payload, + }, { call }) { + const resp = yield call(syncVolume, payload.name) + if (resp && resp.status === 200) { + // console.log('backup model call syncVolume, got resp = ', resp) + // do something after got 200. + } + }, *bulkCreateVolume({ payload, }, { call, put, select }) { diff --git a/src/routes/backup/BackupVolumeList.js b/src/routes/backup/BackupVolumeList.js index 6232b5b39..4dd8feca6 100644 --- a/src/routes/backup/BackupVolumeList.js +++ b/src/routes/backup/BackupVolumeList.js @@ -87,6 +87,8 @@ class List extends React.Component { this.props.DeleteAllBackups(record) } else if (e.key === 'restoreLatestBackup') { this.props.restoreLatestBackup(record) + } else if (e.key === 'syncBackupVolume') { + this.props.syncBackupVolume(record) } else if (e.key === 'backingImageInfo') { this.props.showBackingImageInfo(record) } @@ -248,6 +250,7 @@ class List extends React.Component {