diff --git a/ui/package.json b/ui/package.json index 62777e9ccbcc..06383ed2a4cf 100644 --- a/ui/package.json +++ b/ui/package.json @@ -27,6 +27,7 @@ "prebuild": "./prebuild.sh", "start": "vue-cli-service lint --no-fix && vue-cli-service serve", "serve": "vue-cli-service lint --no-fix && vue-cli-service serve", + "serve:lint": "vue-cli-service lint --fix && vue-cli-service serve", "build": "vue-cli-service build", "postbuild": "./postbuild.sh", "lint": "vue-cli-service lint", diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index dfa813238be8..c9984acae4ba 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -3111,5 +3111,10 @@ "state.stopping": "Stopping", "state.suspended": "Suspended", "user.login": "Login", -"user.logout": "Logout" +"user.logout": "Logout", +"label.gpuMgn": "GPU Management", +"label.gpuResource": "GPU Resource", +"label.gpuUUID": "UUID", +"label.resouce.owner": "Resource Owner", +"label.extra.config" : "Extra Config" } diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue index a9163ce63cd4..88be2c4b7a2e 100644 --- a/ui/src/components/view/ListView.vue +++ b/ui/src/components/view/ListView.vue @@ -512,7 +512,7 @@ export default { '/project', '/account', '/zone', '/pod', '/cluster', '/host', '/storagepool', '/imagestore', '/systemvm', '/router', '/ilbvm', '/annotation', '/computeoffering', '/systemoffering', '/diskoffering', '/backupoffering', '/networkoffering', '/vpcoffering', - '/tungstenfabric'].join('|')) + '/tungstenfabric', '/GPUManagement'].join('|')) .test(this.$route.path) }, enableGroupAction () { diff --git a/ui/src/config/router.js b/ui/src/config/router.js index 9f4616e97f03..ae4b0da658f0 100644 --- a/ui/src/config/router.js +++ b/ui/src/config/router.js @@ -39,6 +39,7 @@ import config from '@/config/section/config' import tools from '@/config/section/tools' import quota from '@/config/section/plugin/quota' import cloudian from '@/config/section/plugin/cloudian' +import gpu from '@/config/section/gpu' function generateRouterMap (section) { var map = { @@ -240,7 +241,7 @@ export function asyncRouterMap () { generateRouterMap(tools), generateRouterMap(quota), generateRouterMap(cloudian), - + generateRouterMap(gpu), { path: '/exception', name: 'exception', diff --git a/ui/src/config/section/gpu.js b/ui/src/config/section/gpu.js new file mode 100644 index 000000000000..1feb0d9d884d --- /dev/null +++ b/ui/src/config/section/gpu.js @@ -0,0 +1,89 @@ +// 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. + +import { shallowRef, defineAsyncComponent } from 'vue' +// import store from '@/store' + +export default { + name: 'GPUManagement', + title: 'label.gpuMgn', + icon: 'project-outlined', + resourceType: 'GPUmgn', + columns: ['name', 'displayname', 'state', 'ipaddress', 'account', 'hostname'], + details: ['displayname', 'name', 'id', 'state', 'ipaddress', 'ip6address', 'templatename', 'ostypename', + 'serviceofferingname', 'isdynamicallyscalable', 'haenable', 'hypervisor', 'boottype', 'bootmode', 'account', + 'domain', 'zonename', 'userdataid', 'userdataname', 'userdataparams', 'userdatadetails', 'userdatapolicy', 'hostcontrolstate'], + actions: [ + { + api: 'deployVirtualMachine', + icon: 'plus-outlined', + label: 'label.vm.add', + docHelp: 'adminguide/virtual_machines.html#creating-vms', + listView: true, + component: () => import('@/views/compute/DeployVM.vue') + }, + { + api: 'updateVirtualMachine', + icon: 'edit-outlined', + label: 'label.action.edit.instance', + docHelp: 'adminguide/virtual_machines.html#changing-the-vm-name-os-or-group', + dataView: true, + popup: true, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/EditVM.vue'))) + }, + { + api: 'startVirtualMachine', + icon: 'caret-right-outlined', + label: 'label.action.start.instance', + message: 'message.action.start.instance', + docHelp: 'adminguide/virtual_machines.html#stopping-and-starting-vms', + dataView: true, + groupAction: true, + popup: true, + groupMap: (selection, values) => { return selection.map(x => { return { id: x, considerlasthost: values.considerlasthost } }) }, + args: ['considerlasthost'], + show: (record) => { return ['Stopped'].includes(record.state) }, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/StartVirtualMachine.vue'))) + }, + { + api: 'expungeVirtualMachine', + icon: 'delete-outlined', + label: 'label.action.expunge.instance', + message: (record) => { return record.backupofferingid ? 'message.action.expunge.instance.with.backups' : 'message.action.expunge.instance' }, + docHelp: 'adminguide/virtual_machines.html#deleting-vms', + dataView: true, + show: (record, store) => { return ['Destroyed', 'Expunging'].includes(record.state) && store.features.allowuserexpungerecovervm } + }, + { + api: 'destroyVirtualMachine', + icon: 'delete-outlined', + label: 'label.action.destroy.instance', + message: 'message.action.destroy.instance', + docHelp: 'adminguide/virtual_machines.html#deleting-vms', + dataView: true, + groupAction: true, + args: (record, store, group) => { + return (['Admin'].includes(store.userInfo.roletype) || store.features.allowuserexpungerecovervm) + ? ['expunge'] : [] + }, + popup: true, + groupMap: (selection, values) => { return selection.map(x => { return { id: x, expunge: values.expunge } }) }, + show: (record) => { return ['Running', 'Stopped', 'Error'].includes(record.state) }, + component: shallowRef(defineAsyncComponent(() => import('@/views/compute/DestroyVM.vue'))) + } + ] +} diff --git a/ui/src/constant/mockingData.js b/ui/src/constant/mockingData.js new file mode 100644 index 000000000000..c8af67a22ae8 --- /dev/null +++ b/ui/src/constant/mockingData.js @@ -0,0 +1,423 @@ +export const mockingData = + [ + { + ipaddress: '192.168.1.135', + cputotal: '1.0 Ghz', + memorytotal: '1.00 GiB', + networkread: '32.00 MiB', + networkwrite: '16.00 MiB', + diskread: '0.00 MiB', + diskwrite: '0.00 MiB', + diskiopstotal: 0, + id: '920454ce-d9b8-454f-bccf-2fd9385d8b98', + name: 'VM-920454ce-d9b8-454f-bccf-2fd9385d8b98', + displayname: 'VM-920454ce-d9b8-454f-bccf-2fd9385d8b98', + account: 'rick', + userid: '44f2ad70-0d73-4fa7-9791-be7a66d26b3a', + username: 'rick', + domainid: 'b32b3316-6c14-11ed-86c2-1e0093003d07', + domain: 'ROOT', + created: '2023-04-14T04:34:35+0000', + lastupdated: '2023-04-14T04:34:39+0000', + state: 'Running', + haenable: false, + zoneid: '673911f1-d15d-453a-a021-4556b0a6495f', + zonename: 'Sim-Basic', + hostid: '137033ae-9a3c-4d0f-b998-64de09753280', + hostname: 'SimulatedAgent.4d3186fc-ca14-4b28-a859-983b8f347e64', + hostcontrolstate: 'Enabled', + templateid: '0c044204-6c15-11ed-86c2-1e0093003d07', + templatename: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + templatedisplaytext: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + passwordenabled: false, + serviceofferingid: '30e662ef-a37e-46ad-b7c5-35fb6270d6ee', + serviceofferingname: 'Medium Instance', + cpunumber: 1, + cpuspeed: 1000, + memory: 1024, + cpuused: '10%', + networkkbsread: 32768, + networkkbswrite: 16384, + diskkbsread: 0, + diskkbswrite: 0, + memorykbs: 0, + memoryintfreekbs: 0, + memorytargetkbs: 0, + diskioread: 0, + diskiowrite: 0, + guestosid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + rootdeviceid: 0, + rootdevicetype: 'ROOT', + securitygroup: [ + { + id: 'd0e03822-c9f6-49e9-9d91-aebc762557e3', + name: 'default', + description: 'Default Security Group', + account: 'rick', + ingressrule: [], + egressrule: [], + tags: [], + virtualmachineids: [] + } + ], + nic: [ + { + id: '8372f7ae-36ea-4994-b6cf-400e92fbe612', + networkid: '0158f28f-47c1-413f-99ff-ad78e4915a7a', + networkname: 'defaultGuestNetwork', + netmask: '255.255.255.0', + gateway: '192.168.1.1', + ipaddress: '192.168.1.135', + broadcasturi: 'vlan://untagged', + traffictype: 'Guest', + type: 'Shared', + isdefault: true, + macaddress: '1e:00:de:00:00:b0', + secondaryip: [], + extradhcpoption: [], + deviceid: '0' + } + ], + hypervisor: 'Simulator', + instancename: 'i-39-119-VM', + details: {}, + affinitygroup: [], + displayvm: true, + isdynamicallyscalable: false, + ostypeid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + osdisplayname: 'CentOS 5.6 (64-bit)', + bootmode: 'legacy', + boottype: 'Bios', + pooltype: 'NetworkFilesystem', + tags: [], + hasannotations: false + }, + { + ipaddress: '192.168.50.10', + cputotal: '0.5 Ghz', + memorytotal: '0.50 GiB', + networkread: '32.00 MiB', + networkwrite: '16.00 MiB', + diskread: '0.00 MiB', + diskwrite: '0.00 MiB', + diskiopstotal: 0, + id: '85b89915-f399-4575-8ac4-e4671cb4c4c8', + name: 'user-vm1', + displayname: 'user-vm1', + account: 'user', + userid: '62748632-2c71-4181-8559-b12f0b072fc1', + username: 'user', + domainid: 'b32b3316-6c14-11ed-86c2-1e0093003d07', + domain: 'ROOT', + created: '2023-05-24T11:00:10+0000', + lastupdated: '2023-05-24T11:00:14+0000', + state: 'Running', + haenable: false, + zoneid: 'c843ba49-21c3-4616-a3ff-07bb91db3a6b', + zonename: 'Sim-Adv Zone', + hostid: 'ee632f8a-1c75-4eaf-b807-0385050dc5b9', + hostname: 'SimulatedAgent.3d4d6bb6-fe4d-4cc4-8fa0-cc0b51020ff2', + hostcontrolstate: 'Enabled', + templateid: '0c044204-6c15-11ed-86c2-1e0093003d07', + templatename: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + templatedisplaytext: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + passwordenabled: false, + serviceofferingid: '1be5e5c5-1a1e-4a61-b717-b19ba10579aa', + serviceofferingname: 'Small Instance', + cpunumber: 1, + cpuspeed: 500, + memory: 512, + cpuused: '10%', + networkkbsread: 32768, + networkkbswrite: 16384, + diskkbsread: 0, + diskkbswrite: 0, + memorykbs: 0, + memoryintfreekbs: 0, + memorytargetkbs: 0, + diskioread: 0, + diskiowrite: 0, + guestosid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + rootdeviceid: 0, + rootdevicetype: 'ROOT', + securitygroup: [], + nic: [ + { + id: 'dca0aedb-3f74-456d-8924-790e2b2e6218', + networkid: 'eaa6b5e7-3294-4818-923e-14ecf38514d2', + networkname: 'Admin Shared Network', + netmask: '255.255.255.0', + gateway: '192.168.50.1', + ipaddress: '192.168.50.10', + isolationuri: 'vlan://50', + broadcasturi: 'vlan://50', + traffictype: 'Guest', + type: 'Shared', + isdefault: true, + macaddress: '1e:00:55:00:00:f2', + secondaryip: [], + extradhcpoption: [], + deviceid: '0' + } + ], + hypervisor: 'Simulator', + instancename: 'i-57-151-VM', + details: {}, + affinitygroup: [], + displayvm: true, + isdynamicallyscalable: false, + ostypeid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + osdisplayname: 'CentOS 5.6 (64-bit)', + bootmode: 'legacy', + boottype: 'Bios', + pooltype: 'NetworkFilesystem', + tags: [], + hasannotations: false + }, + { + ipaddress: '10.1.1.123', + cputotal: '1.0 Ghz', + memorytotal: '1.00 GiB', + networkread: '32.00 MiB', + networkwrite: '16.00 MiB', + diskread: '0.00 MiB', + diskwrite: '0.00 MiB', + diskiopstotal: 0, + id: '1745f33a-478d-40d8-ae49-0e0bde4c25ff', + name: 'VM-1745f33a-478d-40d8-ae49-0e0bde4c25ff', + displayname: 'VM-1745f33a-478d-40d8-ae49-0e0bde4c25ff', + account: 'admin', + userid: 'fda46cff-6c14-11ed-86c2-1e0093003d07', + username: 'admin', + domainid: 'b32b3316-6c14-11ed-86c2-1e0093003d07', + domain: 'ROOT', + created: '2023-04-11T09:11:59+0000', + lastupdated: '2023-04-11T09:12:04+0000', + state: 'Running', + haenable: false, + zoneid: 'c843ba49-21c3-4616-a3ff-07bb91db3a6b', + zonename: 'Sim-Adv Zone', + hostid: 'ee632f8a-1c75-4eaf-b807-0385050dc5b9', + hostname: 'SimulatedAgent.3d4d6bb6-fe4d-4cc4-8fa0-cc0b51020ff2', + hostcontrolstate: 'Enabled', + templateid: '0c044204-6c15-11ed-86c2-1e0093003d07', + templatename: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + templatedisplaytext: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + passwordenabled: false, + serviceofferingid: '30e662ef-a37e-46ad-b7c5-35fb6270d6ee', + serviceofferingname: 'Medium Instance', + cpunumber: 1, + cpuspeed: 1000, + memory: 1024, + cpuused: '10%', + networkkbsread: 32768, + networkkbswrite: 16384, + diskkbsread: 0, + diskkbswrite: 0, + memorykbs: 0, + memoryintfreekbs: 0, + memorytargetkbs: 0, + diskioread: 0, + diskiowrite: 0, + guestosid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + rootdeviceid: 0, + rootdevicetype: 'ROOT', + securitygroup: [], + nic: [ + { + id: 'fad1120f-aae5-4692-99b5-604925c0dd75', + networkid: '6d625e42-f1cc-4fe1-be95-a28256fc6df2', + networkname: 'Sim-Adv Admin Isolated Network', + netmask: '255.255.255.0', + gateway: '10.1.1.1', + ipaddress: '10.1.1.123', + isolationuri: 'vlan://3773', + broadcasturi: 'vlan://3773', + traffictype: 'Guest', + type: 'Isolated', + isdefault: true, + macaddress: '02:00:70:1b:00:0f', + secondaryip: [], + extradhcpoption: [], + deviceid: '0' + } + ], + hypervisor: 'Simulator', + instancename: 'i-2-118-VM', + details: {}, + affinitygroup: [], + displayvm: true, + isdynamicallyscalable: false, + ostypeid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + osdisplayname: 'CentOS 5.6 (64-bit)', + bootmode: 'legacy', + boottype: 'Bios', + pooltype: 'NetworkFilesystem', + tags: [], + hasannotations: false + }, + { + ipaddress: '10.7.7.777', + cputotal: '1.0 Ghz', + memorytotal: '1.00 GiB', + networkread: '32.00 MiB', + networkwrite: '16.00 MiB', + diskread: '0.00 MiB', + diskwrite: '0.00 MiB', + diskiopstotal: 0, + id: '2139vm-0b9j-8124098n124vn', + name: 'VM-83210vn-478d-40d8-ae49-weivrm93148v', + displayname: 'Dummy VM 1', + account: 'admin', + userid: 'fda46cff-6c14-11ed-86c2-1e0093003d07', + username: 'admin', + domainid: 'b32b3316-6c14-11ed-86c2-1e0093003d07', + domain: 'ROOT', + created: '2023-04-11T09:11:59+0000', + lastupdated: '2023-04-11T09:12:04+0000', + state: 'Running', + haenable: false, + zoneid: 'c843ba49-21c3-4616-a3ff-07bb91db3a6b', + zonename: 'Sim-Adv Zone', + hostid: 'ee632f8a-1c75-4eaf-b807-0385050dc5b9', + hostname: 'SimulatedAgent.3d4d6bb6-fe4d-4cc4-8fa0-cc0b51020ff2', + hostcontrolstate: 'Enabled', + templateid: '0c044204-6c15-11ed-86c2-1e0093003d07', + templatename: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + templatedisplaytext: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + passwordenabled: false, + serviceofferingid: '30e662ef-a37e-46ad-b7c5-35fb6270d6ee', + serviceofferingname: 'Medium Instance', + cpunumber: 1, + cpuspeed: 1000, + memory: 1024, + cpuused: '10%', + networkkbsread: 32768, + networkkbswrite: 16384, + diskkbsread: 0, + diskkbswrite: 0, + memorykbs: 0, + memoryintfreekbs: 0, + memorytargetkbs: 0, + diskioread: 0, + diskiowrite: 0, + guestosid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + rootdeviceid: 0, + rootdevicetype: 'ROOT', + securitygroup: [], + nic: [ + { + id: 'fad1120f-aae5-4692-99b5-604925c0dd75', + networkid: '6d625e42-f1cc-4fe1-be95-a28256fc6df2', + networkname: 'Sim-Adv Admin Isolated Network', + netmask: '255.255.255.0', + gateway: '10.1.1.1', + ipaddress: '10.1.1.123', + isolationuri: 'vlan://3773', + broadcasturi: 'vlan://3773', + traffictype: 'Guest', + type: 'Isolated', + isdefault: true, + macaddress: '02:00:70:1b:00:0f', + secondaryip: [], + extradhcpoption: [], + deviceid: '0' + } + ], + hypervisor: 'Simulator', + instancename: 'i-2-118-VM', + details: {}, + affinitygroup: [], + displayvm: true, + isdynamicallyscalable: false, + ostypeid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + osdisplayname: 'CentOS 5.6 (64-bit)', + bootmode: 'legacy', + boottype: 'Bios', + pooltype: 'NetworkFilesystem', + tags: [], + hasannotations: false + }, + { + ipaddress: '10.9.9.999', + cputotal: '1.0 Ghz', + memorytotal: '1.00 GiB', + networkread: '32.00 MiB', + networkwrite: '16.00 MiB', + diskread: '0.00 MiB', + diskwrite: '0.00 MiB', + diskiopstotal: 0, + id: '128390128ae49-8124098n124vn', + name: 'VM-1745f33a-478d-40d8-ae49-0e0bde4c25ff', + displayname: 'Dummy VM 2', + account: 'admin', + userid: 'fda46cff-6c14-11ed-86c2-1e0093003d07', + username: 'admin', + domainid: 'b32b3316-6c14-11ed-86c2-1e0093003d07', + domain: 'ROOT', + created: '2023-04-11T09:11:59+0000', + lastupdated: '2023-04-11T09:12:04+0000', + state: 'Stopped', + haenable: false, + zoneid: 'c843ba49-21c3-4616-a3ff-07bb91db3a6b', + zonename: 'Sim-Adv Zone', + hostid: 'ee632f8a-1c75-4eaf-b807-0385050dc5b9', + hostname: 'SimulatedAgent.3d4d6bb6-fe4d-4cc4-8fa0-cc0b51020ff2', + hostcontrolstate: 'Enabled', + templateid: '0c044204-6c15-11ed-86c2-1e0093003d07', + templatename: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + templatedisplaytext: 'CentOS 5.6 (64-bit) no GUI (Simulator)', + passwordenabled: false, + serviceofferingid: '30e662ef-a37e-46ad-b7c5-35fb6270d6ee', + serviceofferingname: 'Medium Instance', + cpunumber: 1, + cpuspeed: 1000, + memory: 1024, + cpuused: '10%', + networkkbsread: 32768, + networkkbswrite: 16384, + diskkbsread: 0, + diskkbswrite: 0, + memorykbs: 0, + memoryintfreekbs: 0, + memorytargetkbs: 0, + diskioread: 0, + diskiowrite: 0, + guestosid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + rootdeviceid: 0, + rootdevicetype: 'ROOT', + securitygroup: [], + nic: [ + { + id: 'fad1120f-aae5-4692-99b5-604925c0dd75', + networkid: '6d625e42-f1cc-4fe1-be95-a28256fc6df2', + networkname: 'Sim-Adv Admin Isolated Network', + netmask: '255.255.255.0', + gateway: '10.1.1.1', + ipaddress: '10.1.1.123', + isolationuri: 'vlan://3773', + broadcasturi: 'vlan://3773', + traffictype: 'Guest', + type: 'Isolated', + isdefault: true, + macaddress: '02:00:70:1b:00:0f', + secondaryip: [], + extradhcpoption: [], + deviceid: '0' + } + ], + hypervisor: 'Simulator', + instancename: 'i-2-118-VM', + details: {}, + affinitygroup: [], + displayvm: true, + isdynamicallyscalable: false, + ostypeid: 'b3471af4-6c14-11ed-86c2-1e0093003d07', + osdisplayname: 'CentOS 5.6 (64-bit)', + bootmode: 'legacy', + boottype: 'Bios', + pooltype: 'NetworkFilesystem', + tags: [], + hasannotations: false + } + ] diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index fd241fee1633..34b70a0388fa 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -459,6 +459,7 @@ import OsLogo from '@/components/widgets/OsLogo' import ResourceIcon from '@/components/view/ResourceIcon' import BulkActionProgress from '@/components/view/BulkActionProgress' import TooltipLabel from '@/components/widgets/TooltipLabel' +import { mockingData } from '@/constant/mockingData' export default { name: 'Resource', @@ -727,6 +728,10 @@ export default { }) }, fetchData (params = {}) { + if (this.$route.name === 'GPUManagement') { + this.handleGPUCase(mockingData) + return + } if (this.$route.name === 'deployVirtualMachine') { return } @@ -814,6 +819,10 @@ export default { } if (this.apiName === '' || this.apiName === undefined) { + if (this.$route.path.includes('GPUManagement')) { + this.handleGPUparam(mockingData) + return + } return } @@ -1825,6 +1834,47 @@ export default { if (screenWidth <= 768) { this.modalWidth = '450px' } + }, + handleGPUCase (resource) { + this.resource = resource + this.items = resource + this.columnKeys = this.$route.meta.columns + this.itemCount = this.resource.length + + if (this.$route.meta.actions) { + this.actions = this.$route.meta.actions + } + + for (var columnKey of this.columnKeys) { + let key = columnKey + let title = columnKey === 'cidr' && this.columnKeys.includes('ip6cidr') ? 'ipv4.cidr' : columnKey + if (typeof columnKey === 'object') { + if ('customTitle' in columnKey && 'field' in columnKey) { + key = columnKey.field + title = columnKey.customTitle + } else { + key = Object.keys(columnKey)[0] + title = Object.keys(columnKey)[0] + } + } + this.columns.push({ + key: key, + title: this.$t('label.' + String(title).toLowerCase()), + dataIndex: key, + sorter: function (a, b) { return genericCompare(a[key] || '', b[key] || '') } + }) + this.selectedColumns.push(key) + } + this.dataView = false + + // this.$emit('change-resource', this.resource) + }, + handleGPUparam (resource) { + console.warn('GPU') + const idx = resource.findIndex(x => x.id === this.$route.params.id) + const data = resource[idx] + this.resource = data + this.$emit('change-resource', this.resource) } } } diff --git a/ui/src/views/compute/EditVM.vue b/ui/src/views/compute/EditVM.vue index a90f50fc5401..604c375a6b28 100644 --- a/ui/src/views/compute/EditVM.vue +++ b/ui/src/views/compute/EditVM.vue @@ -91,6 +91,13 @@ + + + + +