Skip to content

Commit

Permalink
add bulk clone volume action
Browse files Browse the repository at this point in the history
Signed-off-by: andy.lee <andy.lee@suse.com>
  • Loading branch information
a110605 committed Jul 2, 2024
1 parent d83e380 commit a85cde3
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 5 deletions.
33 changes: 31 additions & 2 deletions src/models/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default {
WorkloadDetailModalVisible: false,
recurringJobModalVisible: false,
attachHostModalVisible: false,
bulkCloneVolumeVisible: false,
bulkAttachHostModalVisible: false,
detachHostModalVisible: false,
engineUpgradeModalVisible: false,
Expand Down Expand Up @@ -218,10 +219,19 @@ export default {
yield put({ type: 'query' })
}
},
*showCloneVolumeModalBefore({
*bulkCloneVolume({
payload,
}, { call, put }) {
yield put({ type: 'showCloneVolumeModal', payload })
yield put({ type: 'hideBulkCloneVolume' })
for (const vol of payload) {
yield call(create, vol)
}
yield put({ type: 'query' })
},
*showBulkCloneVolumeModalBefore({
payload,
}, { call, put }) {
yield put({ type: 'showBulkCloneVolume', payload })

const nodeTags = yield call(getNodeTags, payload)
const diskTags = yield call(getDiskTags, payload)
Expand All @@ -231,6 +241,19 @@ export default {
yield put({ type: 'changeTagsLoading', payload: { tagsLoading: false } })
}
},
*showCloneVolumeModalBefore({
payload,
}, { call, put }) {
yield put({ type: 'showCloneVolumeModal', payload })

const nodeTags = yield call(getNodeTags)
const diskTags = yield call(getDiskTags)
if (nodeTags.status === 200 && diskTags.status === 200) {
yield put({ type: 'changeTagsLoading', payload: { nodeTags: nodeTags.data, diskTags: diskTags.data, tagsLoading: false } })
} else {
yield put({ type: 'changeTagsLoading', payload: { tagsLoading: false } })
}
},
*showCreateVolumeModalBefore({
payload,
}, { call, put, all }) {
Expand Down Expand Up @@ -802,9 +825,15 @@ export default {
showAttachHostModal(state, action) {
return { ...state, ...action.payload, attachHostModalVisible: true, attachHostModalKey: Math.random() }
},
showBulkCloneVolume(state, action) {
return { ...state, ...action.payload, bulkCloneVolumeVisible: true }
},
showBulkAttachHostModal(state, action) {
return { ...state, ...action.payload, bulkAttachHostModalVisible: true, bulkAttachHostModalKey: Math.random() }
},
hideBulkCloneVolume(state) {
return { ...state, bulkCloneVolumeVisible: false }
},
hideAttachHostModal(state) {
return { ...state, attachHostModalVisible: false }
},
Expand Down
Loading

0 comments on commit a85cde3

Please sign in to comment.