From 7bd84c96ed0dc62f769ac36a3d5f6cf0dea03d76 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Sun, 1 Sep 2019 02:13:07 +0530 Subject: [PATCH] new instance component and several other fixes Signed-off-by: Rohit Yadav --- ui/src/components/CloudMonkey/Resource.vue | 110 +++++++++++---- ui/src/components/page/GlobalHeader.vue | 2 + ui/src/components/widgets/DataView.vue | 44 ++++++ ui/src/components/widgets/InstanceView.vue | 152 +++++++++++++++++++++ ui/src/config/section/compute.js | 78 +++++++---- ui/src/config/section/storage.js | 35 +++-- 6 files changed, 347 insertions(+), 74 deletions(-) create mode 100644 ui/src/components/widgets/DataView.vue create mode 100644 ui/src/components/widgets/InstanceView.vue diff --git a/ui/src/components/CloudMonkey/Resource.vue b/ui/src/components/CloudMonkey/Resource.vue index 99e53ae83b9..694fea2e1fb 100644 --- a/ui/src/components/CloudMonkey/Resource.vue +++ b/ui/src/components/CloudMonkey/Resource.vue @@ -10,7 +10,7 @@ --> - + - + @@ -36,26 +36,64 @@ shape="circle" style="margin-right: 5px" @click="execAction(action)" + :disabled="'hidden' in action ? dataView && action.hidden(resource) : false" > - + + + + + + + + + + + + + - - + + + + @@ -81,7 +119,9 @@ v-for="(field, fieldIndex) in currentAction.params" :key="fieldIndex" :label="field.name" - :v-bind="field.name"> + :v-bind="field.name" + v-if="field.name !== 'id'" + >
- - - -

Name

- -
-
- - -

ID

- -
-
- - -

{{ key }}

- -
-
-
+ +
{ @@ -470,8 +518,12 @@ export default { message: 'Request Failed', description: error.response.headers['x-description'] }) - }).then(function () { }) + + const fetchData = this.fetchData + setTimeout(function() { + fetchData() + }, 2500) } }) }, @@ -550,7 +602,7 @@ export default { .ant-breadcrumb { vertical-align: text-bottom; - margin-bottom: 6px; + margin-bottom: 8px; } .ant-breadcrumb .anticon { diff --git a/ui/src/components/page/GlobalHeader.vue b/ui/src/components/page/GlobalHeader.vue index e6002da2974..2bc8c5de072 100644 --- a/ui/src/components/page/GlobalHeader.vue +++ b/ui/src/components/page/GlobalHeader.vue @@ -12,6 +12,7 @@ :type="collapsed ? 'menu-unfold' : 'menu-fold'" @click="toggle"/> +
diff --git a/ui/src/components/widgets/DataView.vue b/ui/src/components/widgets/DataView.vue new file mode 100644 index 00000000000..a1af7a7acce --- /dev/null +++ b/ui/src/components/widgets/DataView.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/ui/src/components/widgets/InstanceView.vue b/ui/src/components/widgets/InstanceView.vue new file mode 100644 index 00000000000..016b3b76dbd --- /dev/null +++ b/ui/src/components/widgets/InstanceView.vue @@ -0,0 +1,152 @@ + + + + + diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index ebb6f3dc47b..ae06a31f197 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -10,7 +10,8 @@ export default { permission: [ 'listVirtualMachinesMetrics', 'listVirtualMachines' ], component: () => import('@/components/CloudMonkey/Resource.vue'), columns: [ - 'displayname', 'state', 'instancename', { 'ipaddress': (record) => { return record.nic[0].ipaddress } }, 'account', 'zonename', + { 'name': (record) => { return record.displayname } }, 'state', 'instancename', + { 'ipaddress': (record) => { return record.nic[0].ipaddress } }, 'account', 'zonename', 'cpunumber', 'cpuused', 'cputotal', 'memoryintfreekbs', 'memorytotal', 'networkread', 'networkwrite', 'diskkbsread', 'diskkbswrite', 'diskiopstotal' ], @@ -24,33 +25,56 @@ export default { listView: true }, { - api: 'startVirtualMachine', - icon: 'right-square', - label: 'View Console', + api: 'updateVirtualMachine', + icon: 'edit', + label: 'Update VM', dataView: true }, - { api: 'startVirtualMachine', icon: 'caret-right', label: 'Start VM', - params: ['name', 'zoneid', 'diskofferingid'], - listView: true, - dataView: true + dataView: true, + groupAction: true, + hidden: (record) => { return record.state !== 'Stopped' }, + options: ['podid', 'clusterid', 'hostid'] }, { api: 'stopVirtualMachine', icon: 'stop', label: 'Stop VM', - params: ['name', 'zoneid', 'diskofferingid'], - listView: true, - dataView: true + dataView: true, + groupAction: true, + options: ['podid', 'clusterid', 'hostid'], + hidden: (record) => { return record.state !== 'Running' } }, { api: 'rebootVirtualMachine', icon: 'sync', label: 'Reboot VM', - dataView: true + dataView: true, + hidden: (record) => { return record.state !== 'Running' }, + }, + { + api: 'restoreVirtualMachine', + icon: 'usb', + label: 'Reinstall Instance', + dataView: true, + params: ['virtualmachineid'] + }, + { + api: 'updateVMAffinityGroup', + icon: 'swap', + label: 'Update Affinity Group', + dataView: true, + params: ['id', 'serviceofferingid'] + }, + { + api: 'changeServiceForVirtualMachine', + icon: 'sliders', + label: 'Change Service Offering', + dataView: true, + params: ['id', 'serviceofferingid'] }, { api: 'createVMSnapshot', @@ -58,17 +82,17 @@ export default { label: 'Create VM Snapshot', dataView: true }, - { - api: 'restoreVirtualMachine', - icon: 'to-top', - label: 'Reinstall Instance', - dataView: true, - params: ['virtualmachineid'] - }, { api: 'attachIso', icon: 'paper-clip', - label: 'Attach ISO to Instance', + label: 'Attach ISO', + dataView: true, + params: ['id', 'virtualmachineid'] + }, + { + api: 'detachIso', + icon: 'link', + label: 'Detach ISO', dataView: true, params: ['id', 'virtualmachineid'] }, @@ -76,7 +100,8 @@ export default { api: 'migrateVirtualMachine', icon: 'drag', label: 'Migrate VM', - dataView: true + dataView: true, + hidden: (record) => { return record.state !== 'Running' } }, { api: 'resetPasswordForVirtualMachine', @@ -91,20 +116,13 @@ export default { label: 'Reset SSH Key', dataView: true }, - { - api: 'changeServiceForVirtualMachine', - icon: 'swap', - label: 'Change Service Offering', - dataView: true, - params: ['id', 'serviceofferingid'] - }, { api: 'destroyVirtualMachine', icon: 'delete', label: 'Destroy VM', params: ['id'], - listView: true, - dataView: true + dataView: true, + groupAction: true } ] }, diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js index 06de086a39b..d503484b410 100644 --- a/ui/src/config/section/storage.js +++ b/ui/src/config/section/storage.js @@ -33,6 +33,22 @@ export default { params: ['@file', 'name', 'zoneid', 'format', 'checksum'], listView: true }, + { + api: 'attachVolume', + icon: 'paper-clip', + label: 'Attach Volume', + params: ['id', 'virtualmachineid'], + dataView: true, + hidden: (record) => { return record.virtualmachineid } + }, + { + api: 'detachVolume', + icon: 'link', + label: 'Detach Volume', + params: ['id', 'virtualmachineid'], + dataView: true, + hidden: (record) => { return !record.virtualmachineid } + }, { api: 'migrateVolume', icon: 'drag', @@ -47,19 +63,8 @@ export default { type: 'main', params: ['id', 'virtualmachineid'], dataView: true - }, { - api: 'attachVolume', - icon: 'paper-clip', - label: 'Attach Volume', - params: ['id', 'virtualmachineid'], - dataView: true - }, { - api: 'detachVolume', - icon: 'link', - label: 'Detach Volume', - params: ['id', 'virtualmachineid'], - dataView: true - }, { + }, + { api: 'extractVolume', icon: 'cloud-download', label: 'Download Volume', @@ -76,8 +81,8 @@ export default { icon: 'delete', label: 'Delete Volume', params: ['id'], - listView: true, - dataView: true + dataView: true, + groupAction: true } ] },