From 243f2ddbd90c71ee32faceef39f2694d2e685caa Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 11 Dec 2019 02:20:42 +0530 Subject: [PATCH 1/3] backup and recovery UI Signed-off-by: Rohit Yadav --- src/components/view/InfoCard.vue | 10 ++-- src/config/section/compute.js | 83 +++++++++++++++++++++++++++----- src/config/section/offering.js | 20 ++++++++ src/config/section/storage.js | 52 ++++++++++++++++++++ src/locales/en.json | 2 +- 5 files changed, 151 insertions(+), 16 deletions(-) diff --git a/src/components/view/InfoCard.vue b/src/components/view/InfoCard.vue index b8f4ab58d..a25d8f6bd 100644 --- a/src/components/view/InfoCard.vue +++ b/src/components/view/InfoCard.vue @@ -29,7 +29,7 @@

- {{ resource.displayname || resource.name }} + {{ resource.displayname || resource.name || resource.virtualmachinename }}

@@ -154,7 +154,7 @@ :percent="parseFloat(resource.memoryallocated)" />
-
+
{{ (resource.volumes.reduce((total, item) => total += item.size, 0) / (1024 * 1024 * 1024.0)).toFixed(2) }} GB Storage {{ resource.sizegb }} @@ -253,6 +253,10 @@ {{ resource.diskofferingname || resource.diskofferingid }}
+
+ + {{ resource.backupofferingname || resource.backupofferingid }} +
{{ resource.networkofferingname || resource.networkofferingid }} @@ -282,7 +286,7 @@
- {{ resource.zonename || resource.zoneid }} + {{ resource.zonename || resource.zone || resource.zoneid }}
diff --git a/src/config/section/compute.js b/src/config/section/compute.js index a4241a2d2..7b52bc7a2 100644 --- a/src/config/section/compute.js +++ b/src/config/section/compute.js @@ -46,6 +46,10 @@ export default { name: 'vmsnapshot', title: 'VM Snapshots', param: 'virtualmachineid' + }, { + name: 'backup', + title: 'Backups', + param: 'virtualmachineid' }, { name: 'affinitygroup', title: 'Affinity Groups', @@ -112,6 +116,35 @@ export default { } } }, + { + api: 'attachIso', + icon: 'paper-clip', + label: 'label.action.attach.iso', + dataView: true, + args: ['id', 'virtualmachineid'], + show: (record) => { return !record.isoid }, + mapping: { + id: { + api: 'listIsos' + }, + virtualmachineid: { + value: (record, params) => { return record.id } + } + } + }, + { + api: 'detachIso', + icon: 'link', + label: 'label.action.detach.iso', + dataView: true, + args: ['virtualmachineid'], + show: (record) => { return 'isoid' in record && record.isoid }, + mapping: { + virtualmachineid: { + value: (record, params) => { return record.id } + } + } + }, { api: 'createVMSnapshot', icon: 'camera', @@ -126,28 +159,54 @@ export default { } }, { - api: 'attachIso', - icon: 'paper-clip', - label: 'label.action.attach.iso', + api: 'assignVirtualMachineToBackupOffering', + icon: 'folder-add', + label: 'Assign VM to Backup Offering', dataView: true, - args: ['id', 'virtualmachineid'], - show: (record) => { return !record.isoid }, + args: ['virtualmachineid', 'backupofferingid'], + show: (record) => { return !record.backupofferingid }, mapping: { - id: { - api: 'listIsos' - }, virtualmachineid: { value: (record, params) => { return record.id } } } }, { - api: 'detachIso', - icon: 'link', - label: 'label.action.detach.iso', + api: 'createBackup', + icon: 'cloud-upload', + label: 'Create Backup', dataView: true, args: ['virtualmachineid'], - show: (record) => { return 'isoid' in record && record.isoid }, + show: (record) => { return record.backupofferingid }, + mapping: { + virtualmachineid: { + value: (record, params) => { return record.id } + } + } + }, + { + api: 'createBackupSchedule', + icon: 'schedule', + label: 'Configure Backup Schedule', + dataView: true, + args: ['virtualmachineid', 'intervaltype', 'schedule', 'timezone'], + show: (record) => { return record.backupofferingid }, + mapping: { + virtualmachineid: { + value: (record, params) => { return record.id } + }, + intervaltype: { + options: ['HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY'] + } + } + }, + { + api: 'removeVirtualMachineFromBackupOffering', + icon: 'scissor', + label: 'Remove VM from Backup Offering', + dataView: true, + args: ['virtualmachineid', 'forced'], + show: (record) => { return record.backupofferingid }, mapping: { virtualmachineid: { value: (record, params) => { return record.id } diff --git a/src/config/section/offering.js b/src/config/section/offering.js index 2483d9c78..da8d7a05d 100644 --- a/src/config/section/offering.js +++ b/src/config/section/offering.js @@ -116,6 +116,26 @@ export default { dataView: true }] }, + { + name: 'backupoffering', + title: 'Backup Offerings', + icon: 'cloud-upload', + permission: ['listBackupOfferings'], + columns: ['name', 'description', 'zoneid'], + details: ['name', 'id', 'description', 'externalid', 'zone', 'created'], + actions: [{ + api: 'importBackupOffering', + icon: 'plus', + label: 'Import Offering', + listView: true, + args: ['name', 'description', 'zoneid', 'externalid'] + }, { + api: 'deleteBackupOffering:', + icon: 'delete', + label: 'Delete Offering', + dataView: true + }] + }, { name: 'networkoffering', title: 'Network Offerings', diff --git a/src/config/section/storage.js b/src/config/section/storage.js index 649e7bedc..2b4dc9db9 100644 --- a/src/config/section/storage.js +++ b/src/config/section/storage.js @@ -247,6 +247,58 @@ export default { } } ] + }, + { + name: 'backup', + title: 'Backups', + icon: 'cloud-upload', + permission: ['listBackups'], + columns: [{ name: (record) => { return record.virtualmachinename } }, 'status', 'type', 'created', 'account', 'zone'], + details: ['virtualmachinename', 'id', 'type', 'externalid', 'size', 'virtualsize', 'volumes', 'backupofferingname', 'zone', 'account', 'domain', 'created'], + actions: [ + { + api: 'restoreBackup', + icon: 'sync', + label: 'Restore Backup', + dataView: true + }, + { + api: 'restoreVolumeFromBackupAndAttachToVM', + icon: 'paper-clip', + label: 'Restore Volume and Attach', + dataView: true, + args: ['backupid', 'virtualmachineid', 'volumeid'], + mapping: { + backupid: { + value: (record) => { return record.id } + }, + volumeid: { + options: ['todo: handle custom volume ID'] + } + } + }, + { + api: 'removeVirtualMachineFromBackupOffering', + icon: 'scissor', + label: 'Expunge Offering Assignment and Delete Backups', + dataView: true, + args: ['forced', 'virtualmachineid'], + mapping: { + forced: { + value: (record) => { return true } + }, + virtualmachineid: { + value: (record) => { return record.virtualmachineid } + } + } + }, + { + api: 'deleteBackup', + icon: 'delete', + label: 'Delete Backup', + dataView: true + } + ] } ] } diff --git a/src/locales/en.json b/src/locales/en.json index b2477f5e9..ef9add7ca 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -915,7 +915,7 @@ "volumegroup": "Volume Group", "volumeids": "Volumes to be deleted", "volumename": "Volume Name", -"volumes": "Volumes to be deleted", +"volumes": "Volumes", "volumetotal": "Volume", "vpcLimit": "VPC limits", "vpcid": "VPC", From 05b210d8cb402e3e63ddd755d3a0e99b13fcf5ca Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 25 Mar 2020 17:02:54 +0530 Subject: [PATCH 2/3] fixes Signed-off-by: Rohit Yadav --- src/components/view/InfoCard.vue | 22 ++++++------ src/config/section/compute.js | 58 ++++++++++++++++---------------- src/config/section/offering.js | 2 +- src/locales/en.json | 2 ++ 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/src/components/view/InfoCard.vue b/src/components/view/InfoCard.vue index 79d55a0be..be2a5fec7 100644 --- a/src/components/view/InfoCard.vue +++ b/src/components/view/InfoCard.vue @@ -332,6 +332,17 @@ {{ resource.vpcname || resource.vpcid }}
+
+
{{ $t('affinitygroup') }}
+ + + {{ group.name }} + , + +
{{ $t('serviceofferingname') }}
@@ -355,6 +366,7 @@
{{ $t('backupofferingid') }}
+ {{ resource.backupofferingname || resource.backupofferingid }}
@@ -445,16 +457,6 @@ {{ resource.created }}
-
- - - {{ group.name }} - , - -
+
+
+ {{ volume.type }} - {{ volume.path }} ({{ parseFloat(volume.size / (1024.0 * 1024.0 * 1024.0)).toFixed(1) }} GB) +
+
{{ resource[item] }}
diff --git a/src/components/view/InfoCard.vue b/src/components/view/InfoCard.vue index be2a5fec7..516188f7f 100644 --- a/src/components/view/InfoCard.vue +++ b/src/components/view/InfoCard.vue @@ -214,8 +214,8 @@
{{ $t('disksize') }}
- {{ (resource.volumes.reduce((total, item) => total += item.size, 0) / (1024 * 1024 * 1024.0)).toFixed(2) }} GB Storage - {{ resource.sizegb }} + {{ (resource.volumes.reduce((total, item) => total += item.size, 0) / (1024 * 1024 * 1024.0)).toFixed(2) }} GB Storage + {{ resource.sizegb || (resource.size/1024.0) }}
Read {{ toSize(resource.diskkbsread) }}