From 9a815b42c3bf5f41cf9792b4f817ca973b922591 Mon Sep 17 00:00:00 2001 From: utchoang Date: Thu, 15 Oct 2020 17:01:28 +0700 Subject: [PATCH 1/5] compute: add button and modal `take VM volume snapshot` --- src/components/view/ActionButton.vue | 6 ++++-- src/config/section/compute.js | 18 ++++++++++++++++++ src/locales/en.json | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/components/view/ActionButton.vue b/src/components/view/ActionButton.vue index ce5c129e5..f1f809999 100644 --- a/src/components/view/ActionButton.vue +++ b/src/components/view/ActionButton.vue @@ -36,7 +36,6 @@ (dataView && action.dataView && ('show' in action ? action.show(resource, $store.getters) : true)) )" > {{ $t(action.label) }} + + 0 && ('groupShow' in action ? action.show(resource, $store.getters) : true)))) || (dataView && action.dataView && ('show' in action ? action.show(resource, $store.getters) : true)) )" - :icon="action.icon" :type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')" :shape="!dataView && action.icon === 'plus' ? 'round' : 'circle'" style="margin-left: 5px" @@ -62,6 +62,8 @@ {{ $t(action.label) }} + + diff --git a/src/config/section/compute.js b/src/config/section/compute.js index a283fce97..f3aac3d57 100644 --- a/src/config/section/compute.js +++ b/src/config/section/compute.js @@ -178,6 +178,24 @@ export default { } } }, + { + api: 'createSnapshot', + icon: ['fas', 'camera-retro'], + label: 'label.action.vmstoragesnapshot.create', + docHelp: 'adminguide/virtual_machines.html#virtual-machine-snapshots', + dataView: true, + args: ['volumeid', 'name', 'asyncBackup'], + mapping: { + volumeid: { + api: 'listVolumes', + params: (record) => { + return { + virtualMachineId: record.id + } + } + } + } + }, { api: 'assignVirtualMachineToBackupOffering', icon: 'folder-add', diff --git a/src/locales/en.json b/src/locales/en.json index 1fdbb35f9..57ccfd4be 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2248,6 +2248,7 @@ "label.vnmc.devices": "VNMC Devices", "label.volgroup": "Volume Group", "label.volume": "Volume", +"label.volumeid": "Volume", "label.volume.details": "Volume details", "label.volume.empty": "No data volumes attached to this VM", "label.volume.ids": "Volume ID's", From 76a859986d07912bc1e77c45f1f2e8b1f1699510 Mon Sep 17 00:00:00 2001 From: utchoang Date: Thu, 15 Oct 2020 17:02:24 +0700 Subject: [PATCH 2/5] add awesome camera retro plugins --- src/core/ext.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext.js b/src/core/ext.js index 323c33b2c..ec418a2dd 100644 --- a/src/core/ext.js +++ b/src/core/ext.js @@ -25,9 +25,9 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' // import { far } from '@fortawesome/free-regular-svg-icons' import { faCentos, faUbuntu, faSuse, faRedhat, faFedora, faLinux, faFreebsd, faApple, faWindows, faJava } from '@fortawesome/free-brands-svg-icons' -import { faLanguage, faCompactDisc } from '@fortawesome/free-solid-svg-icons' +import { faLanguage, faCompactDisc, faCameraRetro } from '@fortawesome/free-solid-svg-icons' library.add(faCentos, faUbuntu, faSuse, faRedhat, faFedora, faLinux, faFreebsd, faApple, faWindows, faJava) -library.add(faLanguage, faCompactDisc) +library.add(faLanguage, faCompactDisc, faCameraRetro) Vue.component('font-awesome-icon', FontAwesomeIcon) From b6ce01b44ce1eafe40ea7548437a1400c5c41745 Mon Sep 17 00:00:00 2001 From: utchoang Date: Wed, 21 Oct 2020 10:00:56 +0700 Subject: [PATCH 3/5] modified to using component --- src/config/section/compute.js | 13 +- src/locales/en.json | 2 + src/views/compute/CreateSnapshotWizard.vue | 200 +++++++++++++++++++++ 3 files changed, 204 insertions(+), 11 deletions(-) create mode 100644 src/views/compute/CreateSnapshotWizard.vue diff --git a/src/config/section/compute.js b/src/config/section/compute.js index f3aac3d57..a9760ba59 100644 --- a/src/config/section/compute.js +++ b/src/config/section/compute.js @@ -184,17 +184,8 @@ export default { label: 'label.action.vmstoragesnapshot.create', docHelp: 'adminguide/virtual_machines.html#virtual-machine-snapshots', dataView: true, - args: ['volumeid', 'name', 'asyncBackup'], - mapping: { - volumeid: { - api: 'listVolumes', - params: (record) => { - return { - virtualMachineId: record.id - } - } - } - } + popup: true, + component: () => import('@/views/compute/CreateSnapshotWizard.vue') }, { api: 'assignVirtualMachineToBackupOffering', diff --git a/src/locales/en.json b/src/locales/en.json index 57ccfd4be..885c95ffd 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -620,6 +620,7 @@ "label.create.project.role": "Create Project Role", "label.create.site.vpn.connection": "Create Site-to-Site VPN Connection", "label.create.site.vpn.gateway": "Create Site-to-Site VPN Gateway", +"label.create.snapshot.for.volume": "Created snapshot for volume", "label.create.ssh.key.pair": "Create a SSH Key Pair", "label.create.template": "Create template", "label.create.user": "Create user", @@ -2317,6 +2318,7 @@ "label.welcome.cloud.console": "Welcome to Management Console", "label.what.is.cloudstack": "What is CloudStack™?", "label.windows": "Windows", +"label.with.snapshotid": "with snapshot ID", "label.write": "Write", "label.writeback": "Write-back disk caching", "label.writecachetype": "Write-cache Type", diff --git a/src/views/compute/CreateSnapshotWizard.vue b/src/views/compute/CreateSnapshotWizard.vue new file mode 100644 index 000000000..6f68b967f --- /dev/null +++ b/src/views/compute/CreateSnapshotWizard.vue @@ -0,0 +1,200 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + + + + + From 03ab037ad19bd93a626aee31dda82bc2864a833c Mon Sep 17 00:00:00 2001 From: utchoang Date: Wed, 21 Oct 2020 10:03:36 +0700 Subject: [PATCH 4/5] fix for quiescevm --- src/views/compute/CreateSnapshotWizard.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/compute/CreateSnapshotWizard.vue b/src/views/compute/CreateSnapshotWizard.vue index 6f68b967f..183cd58b2 100644 --- a/src/views/compute/CreateSnapshotWizard.vue +++ b/src/views/compute/CreateSnapshotWizard.vue @@ -174,7 +174,7 @@ export default { onChangeVolume (volumeId) { const volumeFilter = this.listVolumes.filter(volume => volume.id === volumeId) if (volumeFilter && volumeFilter.length > 0) { - this.isQuiesceVm = this.resource.quiescevm + this.isQuiesceVm = volumeFilter[0].quiescevm } }, closeAction () { From bfaa97cb04d00efb7b2752e259acf23a05e46cb3 Mon Sep 17 00:00:00 2001 From: utchoang Date: Fri, 13 Nov 2020 15:24:08 +0700 Subject: [PATCH 5/5] add quiescevm to api params --- src/views/compute/CreateSnapshotWizard.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/compute/CreateSnapshotWizard.vue b/src/views/compute/CreateSnapshotWizard.vue index 183cd58b2..bf9d9ddd2 100644 --- a/src/views/compute/CreateSnapshotWizard.vue +++ b/src/views/compute/CreateSnapshotWizard.vue @@ -132,6 +132,7 @@ export default { params.volumeid = values.volumeid params.name = values.name params.asyncbackup = values.asyncbackup + params.quiescevm = values.quiescevm const title = this.$t('label.action.vmstoragesnapshot.create') const description = values.name || values.volumeid