Skip to content

Commit

Permalink
add sync backup volume option to allow user manually synchronizing ba…
Browse files Browse the repository at this point in the history
…ckup volumes

Signed-off-by: andy.lee <andy.lee@suse.com>
  • Loading branch information
a110605 committed May 10, 2024
1 parent 638c918 commit b5eee34
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/models/backup.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -246,6 +246,11 @@ export default {
const search = yield select(store => { return store.backup.search })
yield put({ type: 'query', payload: { ...search } })
},
*syncBackupVolume({
payload,
}, { call }) {
yield call(syncVolume, payload.name)
},
*bulkCreateVolume({
payload,
}, { call, put, select }) {
Expand Down
4 changes: 4 additions & 0 deletions src/routes/backup/BackupVolumeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -248,6 +250,7 @@ class List extends React.Component {
<DropOption menuOptions={[
{ key: 'recovery', name: 'Create Disaster Recovery Volume', disabled: !record.lastBackupName || (record.messages && record.messages.error) },
{ key: 'restoreLatestBackup', name: 'Restore Latest Backup', disabled: !record.lastBackupName || (record.messages && record.messages.error) },
{ key: 'syncBackupVolume', name: 'Sync Backup Volume' },
{ key: 'deleteAll', name: 'Delete All Backups' },
{ key: 'backingImageInfo', name: 'Backing Image Info', disabled: !hasBackingImage, tooltip: hasBackingImage ? '' : 'No backing image is used' },
]}
Expand Down Expand Up @@ -313,6 +316,7 @@ List.propTypes = {
DeleteAllBackups: PropTypes.func,
dispatch: PropTypes.func,
restoreLatestBackup: PropTypes.func,
syncBackupVolume: PropTypes.func,
showBackingImageInfo: PropTypes.func,
showWorkloadsStatusDetail: PropTypes.func,
}
Expand Down
6 changes: 6 additions & 0 deletions src/routes/backup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ function Backup({ host, backup, loading, setting, backingImage, dispatch, locati
showBackingImageInfo(record) {
showBackingImageInfo(record)
},
syncBackupVolume(record) {
dispatch({
type: 'backup/syncBackupVolume',
payload: record,
})
},
restoreLatestBackup(record) {
dispatch({
type: 'backup/restoreLatestBackup',
Expand Down
10 changes: 10 additions & 0 deletions src/services/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ export async function createVolume(params) {
})
}

export async function syncVolume(volumeName) {
return request({
url: `/v1/backupvolumes/${volumeName}?action=backupVolumeSync`,
method: 'post',
data: {
syncBackupVolume: true,
},
})
}

export async function execAction(url, params) {
return request({
url,
Expand Down

0 comments on commit b5eee34

Please sign in to comment.