From eebf7fac8ac50608247ad3ea430778a5d884c6d3 Mon Sep 17 00:00:00 2001 From: Gregor Riepl Date: Fri, 22 Nov 2019 15:43:23 +0100 Subject: [PATCH] eslint: fix missing eslint dependencies and lint errors (#19) Fixes: #17 Fixes: #18 These dependencies are necessary or eslint will fail with the standard vue.js rule set. The PR also includes fixes for all lint errors. Signed-off-by: Rohit Yadav --- ui/package-lock.json | 56 +++++++++---------- ui/package.json | 6 +- ui/src/api/index.js | 4 +- ui/src/components/header/HeaderNotice.vue | 12 ++-- ui/src/components/header/ProjectMenu.vue | 2 +- ui/src/components/multitab/MultiTab.vue | 2 +- ui/src/components/view/InfoCard.vue | 20 +++---- ui/src/components/widgets/OsLogo.vue | 2 +- ui/src/config/router.js | 2 +- ui/src/config/section/compute.js | 9 +-- ui/src/config/section/config.js | 16 +++--- ui/src/config/section/iam.js | 14 ++--- ui/src/config/section/image.js | 8 +-- ui/src/config/section/infra.js | 14 ++--- ui/src/config/section/infra/clusters.js | 8 +-- ui/src/config/section/infra/hosts.js | 10 ++-- ui/src/config/section/infra/pods.js | 6 +- .../config/section/infra/primaryStorages.js | 6 +- ui/src/config/section/infra/routers.js | 6 +- .../config/section/infra/secondaryStorages.js | 6 +- ui/src/config/section/infra/systemVms.js | 6 +- ui/src/config/section/infra/zones.js | 8 +-- ui/src/config/section/monitor.js | 6 +- ui/src/config/section/network.js | 12 ++-- ui/src/config/section/offering.js | 40 ++++++------- ui/src/config/section/plugin.js | 4 +- ui/src/config/section/project.js | 2 +- ui/src/config/section/storage.js | 10 ++-- ui/src/utils/request.js | 4 +- ui/src/views/AutogenView.vue | 38 ++++++------- ui/src/views/compute/DeployVM.vue | 30 +++++----- ui/src/views/compute/InstanceHardware.vue | 2 +- ui/src/views/dashboard/Dashboard.vue | 2 +- 33 files changed, 188 insertions(+), 185 deletions(-) diff --git a/ui/package-lock.json b/ui/package-lock.json index 6c5a402b6af..6e8f81678cc 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -4618,16 +4618,12 @@ } }, "@vue/eslint-config-standard": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@vue/eslint-config-standard/-/eslint-config-standard-4.0.0.tgz", - "integrity": "sha512-bQghq1cw1BuMRHNhr3tRpAJx1tpGy0QtajQX873kLtA9YVuOIoXR7nAWnTN09bBHnSUh2N288vMsqPi2fI4Hzg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-standard/-/eslint-config-standard-5.0.0.tgz", + "integrity": "sha512-t1mQIqtoQ3FsAx/8RnzT9VCCdbKD0O1pzvVzsN5WrIVIgos5RVII7aSTdh3HjAVn5+UmWLnG/OK+fow4EY7YsA==", "dev": true, "requires": { - "eslint-config-standard": "^12.0.0", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-node": "^8.0.0", - "eslint-plugin-promise": "^4.0.1", - "eslint-plugin-standard": "^4.0.0" + "eslint-config-standard": "^14.1.0" } }, "@vue/preload-webpack-plugin": { @@ -9903,9 +9899,9 @@ } }, "eslint-config-standard": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz", - "integrity": "sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.0.tgz", + "integrity": "sha512-EF6XkrrGVbvv8hL/kYa/m6vnvmUT+K82pJJc4JJVMM6+Qgqh0pnwprSxdduDLB9p/7bIxD+YV5O0wfb8lmcPbA==", "dev": true }, "eslint-import-resolver-node": { @@ -10022,13 +10018,21 @@ } }, "eslint-plugin-es": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.4.1.tgz", - "integrity": "sha512-5fa/gR2yR3NxQf+UXkeLeP8FBBl6tSgdrAz1+cF84v1FMM4twGwQoqTnn+QxFLcPOrF4pdKEJKDB/q9GoyJrCA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-2.0.0.tgz", + "integrity": "sha512-f6fceVtg27BR02EYnBhgWLFQfK6bN4Ll0nQFrBHOlCsAyxeZkn0NHns5O0YZOPrV1B3ramd6cgFwaoFLcSkwEQ==", "dev": true, "requires": { "eslint-utils": "^1.4.2", - "regexpp": "^2.0.1" + "regexpp": "^3.0.0" + }, + "dependencies": { + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + } } }, "eslint-plugin-html": { @@ -10177,17 +10181,17 @@ } }, "eslint-plugin-node": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-8.0.1.tgz", - "integrity": "sha512-ZjOjbjEi6jd82rIpFSgagv4CHWzG9xsQAVp1ZPlhRnnYxcTgENUVBvhYmkQ7GvT1QFijUSo69RaiOJKhMu6i8w==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-10.0.0.tgz", + "integrity": "sha512-1CSyM/QCjs6PXaT18+zuAXsjXGIGo5Rw630rSKwokSs2jrYURQc4R5JZpoanNCqwNmepg+0eZ9L7YiRUJb8jiQ==", "dev": true, "requires": { - "eslint-plugin-es": "^1.3.1", - "eslint-utils": "^1.3.1", - "ignore": "^5.0.2", + "eslint-plugin-es": "^2.0.0", + "eslint-utils": "^1.4.2", + "ignore": "^5.1.1", "minimatch": "^3.0.4", - "resolve": "^1.8.1", - "semver": "^5.5.0" + "resolve": "^1.10.1", + "semver": "^6.1.0" }, "dependencies": { "ignore": { @@ -10195,12 +10199,6 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true } } }, diff --git a/ui/package.json b/ui/package.json index 1115bdfda67..e10e713af90 100644 --- a/ui/package.json +++ b/ui/package.json @@ -67,7 +67,7 @@ "@vue/cli-plugin-eslint": "^4.0.5", "@vue/cli-plugin-unit-jest": "^4.0.5", "@vue/cli-service": "^4.0.5", - "@vue/eslint-config-standard": "^4.0.0", + "@vue/eslint-config-standard": "^5.0.0", "@vue/test-utils": "^1.0.0-beta.20", "babel-core": "7.0.0-bridge.0", "babel-eslint": "^10.0.3", @@ -76,6 +76,10 @@ "eslint": "^6.6.0", "eslint-plugin-html": "^6.0.0", "eslint-plugin-vue": "^6.0.1", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-node": "^10.0.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-standard": "^4.0.1", "less": "^3.10.3", "less-loader": "^5.0.0", "vue-cli-plugin-i18n": "^0.6.0", diff --git a/ui/src/api/index.js b/ui/src/api/index.js index cd2b904e313..2a5846f7e47 100644 --- a/ui/src/api/index.js +++ b/ui/src/api/index.js @@ -18,8 +18,8 @@ import { axios } from '@/utils/request' export function api (command, args = {}) { - args['command'] = command - args['response'] = 'json' + args.command = command + args.response = 'json' return axios.get('/', { params: args }) diff --git a/ui/src/components/header/HeaderNotice.vue b/ui/src/components/header/HeaderNotice.vue index 949ed86fb28..6170d89f485 100644 --- a/ui/src/components/header/HeaderNotice.vue +++ b/ui/src/components/header/HeaderNotice.vue @@ -61,9 +61,9 @@ export default { jobs: [], poller: null, notificationAvatar: { - 'done': { 'icon': 'check-circle', 'style': 'backgroundColor:#87d068' }, - 'progress': { 'icon': 'loading', 'style': 'backgroundColor:#ffbf00' }, - 'failed': { 'icon': 'close-circle', 'style': 'backgroundColor:#f56a00' } + done: { icon: 'check-circle', style: 'backgroundColor:#87d068' }, + progress: { icon: 'loading', style: 'backgroundColor:#ffbf00' }, + failed: { icon: 'close-circle', style: 'backgroundColor:#f56a00' } } } }, @@ -85,11 +85,11 @@ export default { var hasUpdated = false for (var i in this.jobs) { if (this.jobs[i].status === 'progress') { - await api('queryAsyncJobResult', { 'jobid': this.jobs[i].jobid }).then(json => { + await api('queryAsyncJobResult', { jobid: this.jobs[i].jobid }).then(json => { var result = json.queryasyncjobresultresponse if (result.jobstatus === 1 && this.jobs[i].status !== 'done') { hasUpdated = true - this.$notification['success']({ + this.$notification.success({ message: this.jobs[i].title, description: this.jobs[i].description }) @@ -100,7 +100,7 @@ export default { if (result.jobresult.errortext !== null) { this.jobs[i].description = '(' + this.jobs[i].description + ') ' + result.jobresult.errortext } - this.$notification['error']({ + this.$notification.error({ message: this.jobs[i].title, description: this.jobs[i].description }) diff --git a/ui/src/components/header/ProjectMenu.vue b/ui/src/components/header/ProjectMenu.vue index d3407e5f0cd..35c0a5570ec 100644 --- a/ui/src/components/header/ProjectMenu.vue +++ b/ui/src/components/header/ProjectMenu.vue @@ -84,7 +84,7 @@ export default { getNextPage() }, isDisabled () { - return !store.getters.apis.hasOwnProperty('listProjects') + return !Object.prototype.hasOwnProperty.call(store.getters.apis, 'listProjects') }, setSelectedProject (project) { this.selectedProject = project.displaytext || project.name diff --git a/ui/src/components/multitab/MultiTab.vue b/ui/src/components/multitab/MultiTab.vue index bfe6e1df65b..bb3d2a05c13 100644 --- a/ui/src/components/multitab/MultiTab.vue +++ b/ui/src/components/multitab/MultiTab.vue @@ -150,7 +150,7 @@ export default { } }, watch: { - '$route': function (newVal) { + $route: function (newVal) { this.activeKey = newVal.fullPath if (this.fullPathList.indexOf(newVal.fullPath) < 0) { this.fullPathList.push(newVal.fullPath) diff --git a/ui/src/components/view/InfoCard.vue b/ui/src/components/view/InfoCard.vue index 236e901b072..abbd4af2183 100644 --- a/ui/src/components/view/InfoCard.vue +++ b/ui/src/components/view/InfoCard.vue @@ -496,7 +496,7 @@ export default { return } this.tags = [] - api('listTags', { 'listall': true, 'resourceid': this.resource.id, 'resourcetype': this.resourceType }).then(json => { + api('listTags', { listall: true, resourceid: this.resource.id, resourcetype: this.resourceType }).then(json => { if (json.listtagsresponse && json.listtagsresponse.tag) { this.tags = json.listtagsresponse.tag } @@ -507,7 +507,7 @@ export default { return } this.notes = [] - api('listAnnotations', { 'entityid': this.resource.id, 'entitytype': this.annotationType }).then(json => { + api('listAnnotations', { entityid: this.resource.id, entitytype: this.annotationType }).then(json => { if (json.listannotationsresponse && json.listannotationsresponse.annotation) { this.notes = json.listannotationsresponse.annotation } @@ -527,8 +527,8 @@ export default { }, handleInputConfirm () { const args = {} - args['resourceids'] = this.resource.id - args['resourcetype'] = this.resourceType + args.resourceids = this.resource.id + args.resourcetype = this.resourceType args['tags[0].key'] = this.inputKey args['tags[0].value'] = this.inputValue api('createTags', args).then(json => { @@ -542,8 +542,8 @@ export default { }, handleDeleteTag (tag) { const args = {} - args['resourceids'] = tag.resourceid - args['resourcetype'] = tag.resourcetype + args.resourceids = tag.resourceid + args.resourcetype = tag.resourcetype args['tags[0].key'] = tag.key args['tags[0].value'] = tag.value api('deleteTags', args).then(json => { @@ -560,9 +560,9 @@ export default { } this.showNotesInput = false const args = {} - args['entityid'] = this.resource.id - args['entitytype'] = this.annotationType - args['annotation'] = this.annotation + args.entityid = this.resource.id + args.entitytype = this.annotationType + args.annotation = this.annotation api('addAnnotation', args).then(json => { }).finally(e => { this.getNotes() @@ -571,7 +571,7 @@ export default { }, deleteNote (annotation) { const args = {} - args['id'] = annotation.id + args.id = annotation.id api('removeAnnotation', args).then(json => { }).finally(e => { this.getNotes() diff --git a/ui/src/components/widgets/OsLogo.vue b/ui/src/components/widgets/OsLogo.vue index a26609048f2..528b8f207f1 100644 --- a/ui/src/components/widgets/OsLogo.vue +++ b/ui/src/components/widgets/OsLogo.vue @@ -76,7 +76,7 @@ export default { return } this.name = 'linux' - api('listOsTypes', { 'id': osId }).then(json => { + api('listOsTypes', { id: osId }).then(json => { if (json && json.listostypesresponse && json.listostypesresponse.ostype && json.listostypesresponse.ostype.length > 0) { this.discoverOsLogo(json.listostypesresponse.ostype[0].description) } else { diff --git a/ui/src/config/router.js b/ui/src/config/router.js index cfda0ea2c01..54038cf8378 100644 --- a/ui/src/config/router.js +++ b/ui/src/config/router.js @@ -96,7 +96,7 @@ export function generateRouterMap (section) { title: child.title, name: child.name, keepAlive: true, - permission: [ action.api ] + permission: [action.api] }, component: action.component, hidden: true diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index e2a51880b16..5bb1eb207bc 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -24,11 +24,12 @@ export default { name: 'vm', title: 'Instances', icon: 'desktop', - permission: [ 'listVirtualMachinesMetrics', 'listVirtualMachines' ], + permission: ['listVirtualMachinesMetrics', 'listVirtualMachines'], resourceType: 'UserVm', columns: [ 'name', 'state', 'instancename', 'ipaddress', 'cpunumber', 'cpuused', 'cputotal', - { 'memoryused': + { + memoryused: (record) => { return record.memorykbs && record.memoryintfreekbs ? parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%' : '0.0%' } @@ -230,7 +231,7 @@ export default { name: 'ssh', title: 'SSH Key Pairs', icon: 'key', - permission: [ 'listSSHKeyPairs' ], + permission: ['listSSHKeyPairs'], columns: ['name', 'fingerprint', 'account', 'domain'], details: ['name', 'fingerprint', 'account', 'domain'], actions: [ @@ -261,7 +262,7 @@ export default { name: 'affinitygroup', title: 'Affinity Groups', icon: 'swap', - permission: [ 'listAffinityGroups' ], + permission: ['listAffinityGroups'], columns: ['name', 'type', 'description', 'account', 'domain'], details: ['name', 'id', 'description', 'type', 'account', 'domain'], actions: [ diff --git a/ui/src/config/section/config.js b/ui/src/config/section/config.js index 896f0fef9f2..26bf6795a14 100644 --- a/ui/src/config/section/config.js +++ b/ui/src/config/section/config.js @@ -19,22 +19,22 @@ export default { name: 'config', title: 'Configuration', icon: 'setting', - permission: [ 'listConfigurations' ], + permission: ['listConfigurations'], children: [ { name: 'globalsetting', title: 'Global Settings', icon: 'setting', - permission: [ 'listConfigurations' ], - columns: [ 'name', 'description', 'category', 'value' ], - details: [ 'name', 'category', 'description', 'value' ] + permission: ['listConfigurations'], + columns: ['name', 'description', 'category', 'value'], + details: ['name', 'category', 'description', 'value'] }, { name: 'ldapsetting', title: 'LDAP Configuration', icon: 'team', - permission: [ 'listLdapConfigurations' ], - columns: [ 'hostname', 'port' ], + permission: ['listLdapConfigurations'], + columns: ['hostname', 'port'], actions: [ { api: 'addLdapConfiguration', @@ -51,8 +51,8 @@ export default { name: 'hypervisorcapability', title: 'Hypervisor Capabilities', icon: 'database', - permission: [ 'listHypervisorCapabilities' ], - columns: [ 'hypervisor', 'hypervisorversion', 'maxguestlimit', 'maxdatavolumeslimit', 'maxhostspercluster' ], + permission: ['listHypervisorCapabilities'], + columns: ['hypervisor', 'hypervisorversion', 'maxguestlimit', 'maxdatavolumeslimit', 'maxhostspercluster'], actions: [ { api: 'updateHypervisorCapabilities', diff --git a/ui/src/config/section/iam.js b/ui/src/config/section/iam.js index 47861ff51db..868783aff04 100644 --- a/ui/src/config/section/iam.js +++ b/ui/src/config/section/iam.js @@ -19,13 +19,13 @@ export default { name: 'iam', title: 'Identity and Access', icon: 'solution', - permission: [ 'listAccounts', 'listUsers', 'listDomains', 'listRoles' ], + permission: ['listAccounts', 'listUsers', 'listDomains', 'listRoles'], children: [ { name: 'accountuser', title: 'Users', icon: 'user', - permission: [ 'listUsers' ], + permission: ['listUsers'], columns: ['username', 'state', 'firstname', 'lastname', 'email', 'account', 'domain'], details: ['username', 'id', 'firstname', 'lastname', 'email', 'usersource', 'timezone', 'rolename', 'roletype', 'account', 'domain', 'created'], actions: [ @@ -86,7 +86,7 @@ export default { name: 'account', title: 'Accounts', icon: 'team', - permission: [ 'listAccounts' ], + permission: ['listAccounts'], columns: ['name', 'state', 'firstname', 'lastname', 'rolename', 'roletype', 'domain'], details: ['name', 'id', 'rolename', 'roletype', 'domain', 'networkdomain', 'iptotal', 'vmtotal', 'volumetotal', 'receivedbytes', 'sentbytes', 'vmlimit', 'iplimit', 'volumelimit', 'snapshotlimit', 'templatelimit', 'vpclimit', 'cpulimit', 'memorylimit', 'networklimit', 'primarystoragelimit', 'secondarystoragelimit'], actions: [ @@ -118,7 +118,7 @@ export default { dataView: true, show: (record) => { return record.state === 'disabled' || record.state === 'locked' }, args: ['id'], - params: { 'lock': 'false' } + params: { lock: 'false' } }, { api: 'disableAccount', @@ -127,7 +127,7 @@ export default { dataView: true, show: (record) => { return record.state === 'enabled' }, args: ['id'], - params: { 'lock': 'false' } + params: { lock: 'false' } }, { api: 'disableAccount', @@ -153,7 +153,7 @@ export default { name: 'domain', title: 'Domains', icon: 'block', - permission: [ 'listDomains' ], + permission: ['listDomains'], resourceType: 'Domain', columns: ['name', 'state', 'path', 'parentdomainname', 'level'], details: ['name', 'id', 'path', 'parentdomainname', 'level', 'networkdomain', 'iptotal', 'vmtotal', 'volumetotal', 'vmlimit', 'iplimit', 'volumelimit', 'snapshotlimit', 'templatelimit', 'vpclimit', 'cpulimit', 'memorylimit', 'networklimit', 'primarystoragelimit', 'secondarystoragelimit'], @@ -193,7 +193,7 @@ export default { name: 'role', title: 'Roles', icon: 'idcard', - permission: [ 'listRoles' ], + permission: ['listRoles'], columns: ['name', 'type', 'description'], details: ['name', 'id', 'type', 'description'], actions: [ diff --git a/ui/src/config/section/image.js b/ui/src/config/section/image.js index c0fdd16c4e2..1190800f750 100644 --- a/ui/src/config/section/image.js +++ b/ui/src/config/section/image.js @@ -24,8 +24,8 @@ export default { name: 'template', title: 'Templates', icon: 'save', - permission: [ 'listTemplates' ], - params: { 'templatefilter': 'executable' }, + permission: ['listTemplates'], + params: { templatefilter: 'executable' }, resourceType: 'Template', columns: ['name', 'ostypename', 'status', 'hypervisor', 'account', 'domain'], details: ['name', 'id', 'displaytext', 'checksum', 'hypervisor', 'format', 'ostypename', 'size', 'isready', 'passwordenabled', 'directdownload', 'isextractable', 'isdynamicallyscalable', 'ispublic', 'isfeatured', 'crosszones', 'type', 'account', 'domain', 'created'], @@ -97,8 +97,8 @@ export default { name: 'iso', title: 'ISOs', icon: 'usb', - permission: [ 'listIsos' ], - params: { 'isofilter': 'executable' }, + permission: ['listIsos'], + params: { isofilter: 'executable' }, resourceType: 'ISO', columns: ['name', 'ostypename', 'account', 'domain'], details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'crosszones', 'account', 'domain', 'created'], diff --git a/ui/src/config/section/infra.js b/ui/src/config/section/infra.js index 0f8e0545e0c..b8746409cb0 100644 --- a/ui/src/config/section/infra.js +++ b/ui/src/config/section/infra.js @@ -28,13 +28,13 @@ export default { name: 'infra', title: 'Infrastructure', icon: 'bank', - permission: [ 'listInfrastructure' ], + permission: ['listInfrastructure'], children: [ { name: 'infrasummary', title: 'Summary', icon: 'read', - permission: [ 'listInfrastructure' ], + permission: ['listInfrastructure'], component: () => import('@/views/infra/InfraSummary.vue') }, zones, @@ -49,16 +49,16 @@ export default { name: 'cpusocket', title: 'CPU Sockets', icon: 'api', - permission: [ 'listHosts' ], - params: { 'type': 'routing' }, - columns: [ 'hypervisor', 'hosts', 'cpusockets' ] + permission: ['listHosts'], + params: { type: 'routing' }, + columns: ['hypervisor', 'hosts', 'cpusockets'] }, { name: 'managementserver', title: 'Management Servers', icon: 'rocket', - permission: [ 'listManagementServers' ], - columns: [ 'name', 'state', 'version' ] + permission: ['listManagementServers'], + columns: ['name', 'state', 'version'] } ] } diff --git a/ui/src/config/section/infra/clusters.js b/ui/src/config/section/infra/clusters.js index 8c17960d7bf..231803c2678 100644 --- a/ui/src/config/section/infra/clusters.js +++ b/ui/src/config/section/infra/clusters.js @@ -19,9 +19,9 @@ export default { name: 'cluster', title: 'Clusters', icon: 'cluster', - permission: [ 'listClustersMetrics', 'listClusters' ], - columns: [ 'name', 'state', 'clustertype', 'hypervisortype', 'hosts', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'podname', 'zonename' ], - details: [ 'name', 'id', 'allocationstate', 'clustertype', 'hypervisortype', 'podname', 'zonename' ], + permission: ['listClustersMetrics', 'listClusters'], + columns: ['name', 'state', 'clustertype', 'hypervisortype', 'hosts', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'podname', 'zonename'], + details: ['name', 'id', 'allocationstate', 'clustertype', 'hypervisortype', 'podname', 'zonename'], actions: [ { api: 'addCluster', @@ -44,7 +44,7 @@ export default { icon: 'play-circle', label: 'label.action.disable.cluster', dataView: true, - args: [ 'id' ], + args: ['id'], defaultArgs: { allocationstate: 'Enabled' }, show: (record) => { return record.allocationstate === 'Disabled' } }, diff --git a/ui/src/config/section/infra/hosts.js b/ui/src/config/section/infra/hosts.js index 75eaa60cffe..a54e9f68641 100644 --- a/ui/src/config/section/infra/hosts.js +++ b/ui/src/config/section/infra/hosts.js @@ -19,11 +19,11 @@ export default { name: 'host', title: 'Hosts', icon: 'desktop', - permission: [ 'listHostsMetrics', 'listHosts' ], + permission: ['listHostsMetrics', 'listHosts'], resourceType: 'Host', - params: { 'type': 'routing' }, - columns: [ 'name', 'state', 'resourcestate', 'powerstate', 'ipaddress', 'hypervisor', 'instances', 'cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite', 'clustername', 'zonename' ], - details: [ 'name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'hypervisorversion', 'version', 'type', 'oscategoryname', 'hosttags', 'clustername', 'podname', 'zonename', 'created' ], + params: { type: 'routing' }, + columns: ['name', 'state', 'resourcestate', 'powerstate', 'ipaddress', 'hypervisor', 'instances', 'cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite', 'clustername', 'zonename'], + details: ['name', 'id', 'resourcestate', 'ipaddress', 'hypervisor', 'hypervisorversion', 'version', 'type', 'oscategoryname', 'hosttags', 'clustername', 'podname', 'zonename', 'created'], actions: [ { api: 'addHost', @@ -69,7 +69,7 @@ export default { icon: 'play-circle', label: 'Enable Host', dataView: true, - args: [ 'id' ], + args: ['id'], defaultArgs: { allocationstate: 'Enable' }, show: (record) => { return record.resourcestate === 'Disabled' } }, diff --git a/ui/src/config/section/infra/pods.js b/ui/src/config/section/infra/pods.js index 7b75e530c2d..5df31a8ac13 100644 --- a/ui/src/config/section/infra/pods.js +++ b/ui/src/config/section/infra/pods.js @@ -19,9 +19,9 @@ export default { name: 'pod', title: 'Pods', icon: 'appstore', - permission: [ 'listPods' ], - columns: [ 'name', 'allocationstate', 'gateway', 'netmask', 'zonename' ], - details: [ 'name', 'id', 'allocationstate', 'netmask', 'gateway', 'zonename' ], + permission: ['listPods'], + columns: ['name', 'allocationstate', 'gateway', 'netmask', 'zonename'], + details: ['name', 'id', 'allocationstate', 'netmask', 'gateway', 'zonename'], actions: [ { api: 'createPod', diff --git a/ui/src/config/section/infra/primaryStorages.js b/ui/src/config/section/infra/primaryStorages.js index 47d6bf9651c..0ebc1db298b 100644 --- a/ui/src/config/section/infra/primaryStorages.js +++ b/ui/src/config/section/infra/primaryStorages.js @@ -19,9 +19,9 @@ export default { name: 'storagepool', title: 'Primary Storage', icon: 'database', - permission: [ 'listStoragePoolsMetrics', 'listStoragePools' ], - columns: [ 'name', 'state', 'ipaddress', 'type', 'path', 'scope', 'disksizeusedgb', 'disksizetotalgb', 'disksizeallocatedgb', 'disksizeunallocatedgb', 'clustername', 'zonename' ], - details: [ 'name', 'id', 'ipaddress', 'type', 'scope', 'path', 'provider', 'hypervisor', 'overprovisionfactor', 'disksizetotal', 'disksizeallocated', 'disksizeused', 'clustername', 'podname', 'zonename', 'created' ], + permission: ['listStoragePoolsMetrics', 'listStoragePools'], + columns: ['name', 'state', 'ipaddress', 'type', 'path', 'scope', 'disksizeusedgb', 'disksizetotalgb', 'disksizeallocatedgb', 'disksizeunallocatedgb', 'clustername', 'zonename'], + details: ['name', 'id', 'ipaddress', 'type', 'scope', 'path', 'provider', 'hypervisor', 'overprovisionfactor', 'disksizetotal', 'disksizeallocated', 'disksizeused', 'clustername', 'podname', 'zonename', 'created'], actions: [ { api: 'createStoragePool', diff --git a/ui/src/config/section/infra/routers.js b/ui/src/config/section/infra/routers.js index 27b7d6a689b..07377d0bff6 100644 --- a/ui/src/config/section/infra/routers.js +++ b/ui/src/config/section/infra/routers.js @@ -19,9 +19,9 @@ export default { name: 'router', title: 'Virtual Routers', icon: 'fork', - permission: [ 'listRouters' ], - columns: [ 'name', 'state', 'publicip', 'guestnetworkname', 'vpcname', 'redundantstate', 'version', 'hostname', 'account', 'zonename', 'requiresupgrade' ], - details: [ 'name', 'id', 'version', 'requiresupgrade', 'guestnetworkname', 'vpcname', 'publicip', 'guestipaddress', 'linklocalip', 'serviceofferingname', 'networkdomain', 'isredundantrouter', 'redundantstate', 'hostname', 'account', 'zonename', 'created' ], + permission: ['listRouters'], + columns: ['name', 'state', 'publicip', 'guestnetworkname', 'vpcname', 'redundantstate', 'version', 'hostname', 'account', 'zonename', 'requiresupgrade'], + details: ['name', 'id', 'version', 'requiresupgrade', 'guestnetworkname', 'vpcname', 'publicip', 'guestipaddress', 'linklocalip', 'serviceofferingname', 'networkdomain', 'isredundantrouter', 'redundantstate', 'hostname', 'account', 'zonename', 'created'], actions: [ { api: 'startRouter', diff --git a/ui/src/config/section/infra/secondaryStorages.js b/ui/src/config/section/infra/secondaryStorages.js index 1c11ae1f7cd..4b9861f543e 100644 --- a/ui/src/config/section/infra/secondaryStorages.js +++ b/ui/src/config/section/infra/secondaryStorages.js @@ -19,9 +19,9 @@ export default { name: 'imagestore', title: 'Secondary Storages', icon: 'picture', - permission: [ 'listImageStores' ], - columns: [ 'name', 'url', 'protocol', 'scope', 'zonename' ], - details: [ 'name', 'id', 'url', 'protocol', 'provider', 'scope', 'zonename' ], + permission: ['listImageStores'], + columns: ['name', 'url', 'protocol', 'scope', 'zonename'], + details: ['name', 'id', 'url', 'protocol', 'provider', 'scope', 'zonename'], actions: [ { api: 'addImageStore', diff --git a/ui/src/config/section/infra/systemVms.js b/ui/src/config/section/infra/systemVms.js index 5364c98290b..4aaaf0e3f39 100644 --- a/ui/src/config/section/infra/systemVms.js +++ b/ui/src/config/section/infra/systemVms.js @@ -19,9 +19,9 @@ export default { name: 'systemvm', title: 'System VMs', icon: 'thunderbolt', - permission: [ 'listSystemVms' ], - columns: [ 'name', 'state', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'hostname', 'zonename' ], - details: [ 'name', 'id', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'gateway', 'hostname', 'zonename', 'created', 'activeviewersessions' ], + permission: ['listSystemVms'], + columns: ['name', 'state', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'hostname', 'zonename'], + details: ['name', 'id', 'agentstate', 'systemvmtype', 'publicip', 'privateip', 'linklocalip', 'gateway', 'hostname', 'zonename', 'created', 'activeviewersessions'], actions: [ { api: 'startSystemVm', diff --git a/ui/src/config/section/infra/zones.js b/ui/src/config/section/infra/zones.js index 1d05adb24af..ad2bda0ecd8 100644 --- a/ui/src/config/section/infra/zones.js +++ b/ui/src/config/section/infra/zones.js @@ -19,9 +19,9 @@ export default { name: 'zone', title: 'Zones', icon: 'global', - permission: [ 'listZonesMetrics', 'listZones' ], - columns: [ 'name', 'state', 'networktype', 'clusters', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal' ], - details: [ 'name', 'id', 'allocationstate', 'networktype', 'guestcidraddress', 'localstorageenabled', 'securitygroupsenabled', 'dns1', 'dns2', 'internaldns1', 'internaldns2' ], + permission: ['listZonesMetrics', 'listZones'], + columns: ['name', 'state', 'networktype', 'clusters', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal'], + details: ['name', 'id', 'allocationstate', 'networktype', 'guestcidraddress', 'localstorageenabled', 'securitygroupsenabled', 'dns1', 'dns2', 'internaldns1', 'internaldns2'], actions: [ { api: 'createZone', @@ -61,7 +61,7 @@ export default { icon: 'play-circle', label: 'label.action.enable.zone', dataView: true, - args: [ 'id' ], + args: ['id'], defaultArgs: { allocationstate: 'Enabled' }, show: (record) => { return record.allocationstate === 'Disabled' } }, diff --git a/ui/src/config/section/monitor.js b/ui/src/config/section/monitor.js index b3aa93a3d49..ea436eed02e 100644 --- a/ui/src/config/section/monitor.js +++ b/ui/src/config/section/monitor.js @@ -19,13 +19,13 @@ export default { name: 'monitor', title: 'Monitor', icon: 'compass', - permission: [ 'listEvents', 'listAlerts' ], + permission: ['listEvents', 'listAlerts'], children: [ { name: 'event', title: 'Events', icon: 'schedule', - permission: [ 'listEvents' ], + permission: ['listEvents'], columns: ['username', 'description', 'state', 'level', 'type', 'account', 'domain', 'created'], details: ['username', 'id', 'description', 'state', 'level', 'type', 'account', 'domain', 'created'], actions: [ @@ -49,7 +49,7 @@ export default { name: 'alert', title: 'Alerts', icon: 'flag', - permission: [ 'listAlerts' ], + permission: ['listAlerts'], columns: ['name', 'description', 'type', 'sent'], details: ['name', 'id', 'type', 'sent', 'description'], actions: [ diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js index a1e8476d933..99fa485dd51 100644 --- a/ui/src/config/section/network.js +++ b/ui/src/config/section/network.js @@ -24,7 +24,7 @@ export default { name: 'guestnetwork', title: 'Guest Networks', icon: 'gateway', - permission: [ 'listNetworks' ], + permission: ['listNetworks'], resourceType: 'Network', columns: ['name', 'state', 'type', 'cidr', 'ip6cidr', 'broadcasturi', 'account', 'zonename'], details: ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'broadcasturi', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'zonename', 'account', 'domain'], @@ -76,7 +76,7 @@ export default { name: 'vpc', title: 'VPC', icon: 'deployment-unit', - permission: [ 'listVPCs' ], + permission: ['listVPCs'], resourceType: 'Vpc', columns: ['name', 'state', 'displaytext', 'cidr', 'account', 'zonename'], details: ['name', 'id', 'displaytext', 'cidr', 'networkdomain', 'ispersistent', 'redundantvpcrouter', 'restartrequired', 'zonename', 'account', 'domain'], @@ -122,7 +122,7 @@ export default { name: 'securitygroups', title: 'Security Groups', icon: 'fire', - permission: [ 'listSecurityGroups' ], + permission: ['listSecurityGroups'], resourceType: 'SecurityGroup', columns: ['name', 'description', 'account', 'domain'], details: ['name', 'id', 'description', 'account', 'domain'], @@ -158,7 +158,7 @@ export default { name: 'publicip', title: 'Public IP Addresses', icon: 'environment', - permission: [ 'listPublicIpAddresses' ], + permission: ['listPublicIpAddresses'], resourceType: 'PublicIpAddress', columns: ['ipaddress', 'state', 'associatednetworkname', 'virtualmachinename', 'allocated', 'account', 'zonename'], details: ['ipaddress', 'id', 'associatednetworkname', 'virtualmachinename', 'networkid', 'issourcenat', 'isstaticnat', 'virtualmachinename', 'vmipaddress', 'vlan', 'allocated', 'account', 'zonename'], @@ -224,7 +224,7 @@ export default { name: 'vpnuser', title: 'VPN Users', icon: 'user', - permission: [ 'listVpnUsers' ], + permission: ['listVpnUsers'], columns: ['username', 'state', 'account', 'domain'], details: ['username', 'state', 'account', 'domain'], actions: [ @@ -248,7 +248,7 @@ export default { name: 'vpngateway', title: 'VPN Gateway', icon: 'lock', - permission: [ 'listVpnCustomerGateways' ], + permission: ['listVpnCustomerGateways'], resourceType: 'VpnGateway', columns: ['name', 'ipaddress', 'gateway', 'cidrlist', 'ipsecpsk', 'account', 'domain'], details: ['name', 'id', 'ipaddress', 'gateway', 'cidrlist', 'ipsecpsk', 'account', 'domain'], diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js index 58b6a412312..4951b01a795 100644 --- a/ui/src/config/section/offering.js +++ b/ui/src/config/section/offering.js @@ -19,15 +19,15 @@ export default { name: 'offering', title: 'Offerings', icon: 'shopping', - permission: [ 'listServiceOfferings' ], + permission: ['listServiceOfferings'], children: [ { name: 'computeoffering', title: 'Compute Offerings', icon: 'cloud', - permission: [ 'listServiceOfferings' ], - columns: [ 'name', 'displaytext', 'cpunumber', 'cpuspeed', 'memory', 'tags', 'domain', 'zone' ], - details: [ 'name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'tags', 'domain', 'zone', 'created' ], + permission: ['listServiceOfferings'], + columns: ['name', 'displaytext', 'cpunumber', 'cpuspeed', 'memory', 'tags', 'domain', 'zone'], + details: ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'tags', 'domain', 'zone', 'created'], actions: [{ api: 'createServiceOffering', icon: 'plus', @@ -53,16 +53,16 @@ export default { name: 'systemoffering', title: 'System Offerings', icon: 'setting', - permission: [ 'listServiceOfferings', 'listInfrastructure' ], - params: { 'issystem': 'true' }, - columns: [ 'name', 'systemvmtype', 'cpunumber', 'cpuspeed', 'memory', 'storagetype', 'tags' ], - details: [ 'name', 'id', 'displaytext', 'systemvmtype', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'tags', 'domain', 'zone', 'created' ], + permission: ['listServiceOfferings', 'listInfrastructure'], + params: { issystem: 'true' }, + columns: ['name', 'systemvmtype', 'cpunumber', 'cpuspeed', 'memory', 'storagetype', 'tags'], + details: ['name', 'id', 'displaytext', 'systemvmtype', 'provisioningtype', 'storagetype', 'iscustomized', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'tags', 'domain', 'zone', 'created'], actions: [{ api: 'createServiceOffering', icon: 'plus', label: 'Add Offering', listView: true, - params: { 'issystem': 'true' }, + params: { issystem: 'true' }, popup: true, component: () => import('@/views/offering/AddComputeOffering.vue') }, { @@ -70,14 +70,14 @@ export default { icon: 'edit', label: 'Edit Offering', dataView: true, - params: { 'issystem': 'true' }, + params: { issystem: 'true' }, args: ['id', 'name', 'displaytext'] }, { api: 'deleteServiceOffering', icon: 'delete', label: 'Delete Offering', dataView: true, - params: { 'issystem': 'true' }, + params: { issystem: 'true' }, args: ['id'] }] }, @@ -85,9 +85,9 @@ export default { name: 'diskoffering', title: 'Disk Offerings', icon: 'hdd', - permission: [ 'listDiskOfferings' ], - columns: [ 'name', 'displaytext', 'disksize', 'tags', 'domain', 'zone' ], - details: [ 'name', 'id', 'displaytext', 'disksize', 'provisioningtype', 'storagetype', 'iscustomized', 'tags', 'domain', 'zone', 'created' ], + permission: ['listDiskOfferings'], + columns: ['name', 'displaytext', 'disksize', 'tags', 'domain', 'zone'], + details: ['name', 'id', 'displaytext', 'disksize', 'provisioningtype', 'storagetype', 'iscustomized', 'tags', 'domain', 'zone', 'created'], actions: [{ api: 'createDiskOffering', icon: 'plus', @@ -113,9 +113,9 @@ export default { name: 'networkoffering', title: 'Network Offerings', icon: 'wifi', - permission: [ 'listNetworkOfferings' ], - columns: [ 'name', 'state', 'guestiptype', 'traffictype', 'networkrate', 'tags', 'domain', 'zone' ], - details: [ 'name', 'id', 'displaytext', 'guestiptype', 'traffictype', 'networkrate', 'ispersistent', 'egressdefaultpolicy', 'availability', 'conservemode', 'specifyvlan', 'specifyipranges', 'supportspublicaccess', 'supportsstrechedl2subnet', 'service', 'tags', 'domain', 'zone' ], + permission: ['listNetworkOfferings'], + columns: ['name', 'state', 'guestiptype', 'traffictype', 'networkrate', 'tags', 'domain', 'zone'], + details: ['name', 'id', 'displaytext', 'guestiptype', 'traffictype', 'networkrate', 'ispersistent', 'egressdefaultpolicy', 'availability', 'conservemode', 'specifyvlan', 'specifyipranges', 'supportspublicaccess', 'supportsstrechedl2subnet', 'service', 'tags', 'domain', 'zone'], actions: [{ api: 'createNetworkOffering', icon: 'plus', @@ -141,10 +141,10 @@ export default { name: 'vpcoffering', title: 'VPC Offerings', icon: 'deployment-unit', - permission: [ 'listVPCOfferings' ], + permission: ['listVPCOfferings'], resourceType: 'VpcOffering', - columns: [ 'name', 'state', 'displaytext', 'domain', 'zone' ], - details: [ 'name', 'id', 'displaytext', 'distributedvpcrouter', 'service', 'tags', 'domain', 'zone', 'created' ], + columns: ['name', 'state', 'displaytext', 'domain', 'zone'], + details: ['name', 'id', 'displaytext', 'distributedvpcrouter', 'service', 'tags', 'domain', 'zone', 'created'], actions: [{ api: 'createVPCOffering', icon: 'plus', diff --git a/ui/src/config/section/plugin.js b/ui/src/config/section/plugin.js index 1aa0282d181..687cc237c4d 100644 --- a/ui/src/config/section/plugin.js +++ b/ui/src/config/section/plugin.js @@ -24,13 +24,13 @@ export default { name: 'quota', title: 'Quota', icon: 'pie-chart', - permission: [ 'quotaSummary', 'quotaIsEnabled' ] + permission: ['quotaSummary', 'quotaIsEnabled'] }, { name: 'cloudian', title: 'Cloudian Storage', icon: 'cloud-download', - permission: [ 'cloudianSsoLogin', 'cloudianIsEnabled' ] + permission: ['cloudianSsoLogin', 'cloudianIsEnabled'] } ] } diff --git a/ui/src/config/section/project.js b/ui/src/config/section/project.js index ff37136e419..e5155ff5712 100644 --- a/ui/src/config/section/project.js +++ b/ui/src/config/section/project.js @@ -19,7 +19,7 @@ export default { name: 'project', title: 'Projects', icon: 'project', - permission: [ 'listProjects' ], + permission: ['listProjects'], resourceType: 'Project', columns: ['name', 'state', 'displaytext', 'account', 'domain'], details: ['name', 'id', 'displaytext', 'projectaccountname', 'vmtotal', 'cputotal', 'memorytotal', 'volumetotal', 'iptotal', 'vpctotal', 'templatetotal', 'primarystoragetotal', 'account', 'domain'], diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js index ca753abcb94..cdc25ffef39 100644 --- a/ui/src/config/section/storage.js +++ b/ui/src/config/section/storage.js @@ -24,7 +24,7 @@ export default { name: 'volume', title: 'Volumes', icon: 'hdd', - permission: [ 'listVolumesMetrics', 'listVolumes' ], + permission: ['listVolumesMetrics', 'listVolumes'], resourceType: 'Volume', columns: ['name', 'state', 'type', 'vmname', 'size', 'physicalsize', 'utilization', 'diskkbsread', 'diskkbswrite', 'diskiopstotal', 'storage', 'account', 'zonename'], details: ['name', 'id', 'type', 'deviceid', 'sizegb', 'physicalsize', 'provisioningtype', 'utilization', 'diskkbsread', 'diskkbswrite', 'diskioread', 'diskiowrite', 'diskiopstotal', 'path'], @@ -105,8 +105,8 @@ export default { label: 'Download Volume', args: ['id', 'zoneid', 'mode'], paramOptions: { - 'mode': { - 'value': 'HTTP_DOWNLOAD' + mode: { + value: 'HTTP_DOWNLOAD' } }, dataView: true @@ -133,7 +133,7 @@ export default { name: 'snapshot', title: 'Snapshots', icon: 'build', - permission: [ 'listSnapshots' ], + permission: ['listSnapshots'], resourceType: 'Snapshot', columns: ['name', 'state', 'volumename', 'intervaltype', 'created', 'account'], details: ['name', 'id', 'volumename', 'intervaltype', 'account', 'domain', 'created'], @@ -172,7 +172,7 @@ export default { name: 'vmsnapshot', title: 'VM Snapshots', icon: 'camera', - permission: [ 'listVMSnapshot' ], + permission: ['listVMSnapshot'], resourceType: 'VMSnapshot', columns: ['name', 'state', 'type', 'current', 'parent', 'created', 'account'], details: ['name', 'id', 'displayname', 'description', 'type', 'current', 'parent', 'virtualmachineid', 'account', 'domain', 'created'], diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js index 924471ac190..c38e7f40682 100644 --- a/ui/src/utils/request.js +++ b/ui/src/utils/request.js @@ -59,9 +59,9 @@ const err = (error) => { service.interceptors.request.use(config => { const project = Vue.ls.get(CURRENT_PROJECT) if (config && config.params) { - config.params['response'] = 'json' + config.params.response = 'json' if (project && project.id) { - config.params['projectid'] = project.id + config.params.projectid = project.id } } return config diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index c86437bdbcb..ae8ca6f90c0 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -295,7 +295,7 @@ export default { } if (this.searchQuery !== '') { - params['keyword'] = this.searchQuery + params.keyword = this.searchQuery } if (this.$route && this.$route.params && this.$route.params.id) { @@ -320,7 +320,7 @@ export default { } if (!this.columnKeys || this.columnKeys.length === 0) { - for (const field of store.getters.apis[this.apiName]['response']) { + for (const field of store.getters.apis[this.apiName].response) { this.columnKeys.push(field.name) } this.columnKeys = [...new Set(this.columnKeys)] @@ -349,13 +349,13 @@ export default { this.loading = true if (this.$route.params && this.$route.params.id) { - params['id'] = this.$route.params.id + params.id = this.$route.params.id if (this.$route.path.startsWith('/ssh/')) { - params['name'] = this.$route.params.id + params.name = this.$route.params.id } } - params['page'] = this.page - params['pagesize'] = this.pageSize + params.page = this.page + params.pagesize = this.pageSize api(this.apiName, params).then(json => { var responseName var objectName @@ -367,7 +367,7 @@ export default { } for (const key in json[responseName]) { if (key === 'count') { - this.itemCount = json[responseName]['count'] + this.itemCount = json[responseName].count continue } objectName = key @@ -378,7 +378,7 @@ export default { this.items = [] } for (let idx = 0; idx < this.items.length; idx++) { - this.items[idx]['key'] = idx + this.items[idx].key = idx for (const key in customRender) { const func = customRender[key] if (func && typeof func === 'function') { @@ -393,7 +393,7 @@ export default { } }).catch(error => { // handle error - this.$notification['error']({ + this.$notification.error({ message: 'Request Failed', description: error.response.headers['x-description'] }) @@ -434,7 +434,7 @@ export default { return } this.currentAction = action - var params = store.getters.apis[this.currentAction.api]['params'] + var params = store.getters.apis[this.currentAction.api].params params.sort(function (a, b) { if (a.name === 'name' && b.name !== 'name') { return -1 } if (a.name !== 'name' && b.name === 'name') { return -1 } @@ -444,17 +444,17 @@ export default { return 0 }) if (action.args && action.args.length > 0) { - this.currentAction['params'] = action.args.map(function (arg) { + this.currentAction.params = action.args.map(function (arg) { return params.filter(function (param) { return param.name.toLowerCase() === arg.toLowerCase() })[0] }) } else { - this.currentAction['params'] = params + this.currentAction.params = params } this.showAction = true - for (const param of this.currentAction['params']) { + for (const param of this.currentAction.params) { if (param.type === 'uuid' || param.name === 'account') { this.listUuidOpts(param) } @@ -482,7 +482,7 @@ export default { param.opts = [] var params = { listall: true } if (possibleApi === 'listTemplates') { - params['templatefilter'] = 'executable' + params.templatefilter = 'executable' } api(possibleApi, params).then(json => { param.loading = false @@ -513,7 +513,7 @@ export default { const params = {} for (const key in values) { const input = values[key] - for (const param of this.currentAction['params']) { + for (const param of this.currentAction.params) { if (param.name === key) { if (input === undefined) { if (param.type === 'boolean') { @@ -522,7 +522,7 @@ export default { break } if (param.type === 'uuid') { - params[key] = param.opts[input]['id'] + params[key] = param.opts[input].id } else { params[key] = input } @@ -538,7 +538,7 @@ export default { } if ('id' in this.resource) { - params['id'] = this.resource['id'] + params.id = this.resource.id } api(this.currentAction.api, params).then(json => { @@ -546,7 +546,7 @@ export default { if (obj.includes('response')) { for (const res in json[obj]) { if (res === 'jobid') { - this.$store.dispatch('AddAsyncJob', { 'title': this.$t(this.currentAction.label), 'jobid': json[obj][res], 'description': this.resource.name, 'status': 'progress' }) + this.$store.dispatch('AddAsyncJob', { title: this.$t(this.currentAction.label), jobid: json[obj][res], description: this.resource.name, status: 'progress' }) break } } @@ -558,7 +558,7 @@ export default { } }).catch(error => { console.log(error) - this.$notification['error']({ + this.$notification.error({ message: 'Request Failed', description: error.response.headers['x-description'] }) diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index 45456f62599..8daf0adee99 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -199,29 +199,29 @@ export default { this.zone = this.zoneId.opts.find((option) => option.id === instanceConfig.zoneid) if (this.zone) { - this.vm['zoneid'] = this.zone.id - this.vm['zonename'] = this.zone.name + this.vm.zoneid = this.zone.id + this.vm.zonename = this.zone.name } if (this.template) { - this.vm['templateid'] = this.template.id - this.vm['templatename'] = this.template.displaytext - this.vm['ostypeid'] = this.template.ostypeid - this.vm['ostypename'] = this.template.ostypename + this.vm.templateid = this.template.id + this.vm.templatename = this.template.displaytext + this.vm.ostypeid = this.template.ostypeid + this.vm.ostypename = this.template.ostypename } if (this.serviceOffering) { - this.vm['serviceofferingid'] = this.serviceOffering.id - this.vm['serviceofferingname'] = this.serviceOffering.displaytext - this.vm['cpunumber'] = this.serviceOffering.cpunumber - this.vm['cpuspeed'] = this.serviceOffering.cpuspeed - this.vm['memory'] = this.serviceOffering.memory + this.vm.serviceofferingid = this.serviceOffering.id + this.vm.serviceofferingname = this.serviceOffering.displaytext + this.vm.cpunumber = this.serviceOffering.cpunumber + this.vm.cpuspeed = this.serviceOffering.cpuspeed + this.vm.memory = this.serviceOffering.memory } if (this.diskOffering) { - this.vm['diskofferingid'] = this.diskOffering.id - this.vm['diskofferingname'] = this.diskOffering.displaytext - this.vm['diskofferingsize'] = this.diskOffering.disksize + this.vm.diskofferingid = this.diskOffering.id + this.vm.diskofferingname = this.diskOffering.displaytext + this.vm.diskofferingsize = this.diskOffering.disksize } } }, @@ -235,7 +235,7 @@ export default { this.form.getFieldDecorator('computeofferingid', { initialValue: [], preserve: true }) }, created () { - this.params = store.getters.apis[this.$route.name]['params'] + this.params = store.getters.apis[this.$route.name].params this.filteredParams.forEach((param) => { this.fetchOptions(param) }) diff --git a/ui/src/views/compute/InstanceHardware.vue b/ui/src/views/compute/InstanceHardware.vue index 9456e582837..921e5116b2e 100644 --- a/ui/src/views/compute/InstanceHardware.vue +++ b/ui/src/views/compute/InstanceHardware.vue @@ -147,7 +147,7 @@ export default { if (!this.vm || !this.vm.id) { return } - api('listVolumes', { 'listall': true, 'virtualmachineid': this.vm.id }).then(json => { + api('listVolumes', { listall: true, virtualmachineid: this.vm.id }).then(json => { this.volumes = json.listvolumesresponse.volume if (this.volumes) { this.volumes.sort((a, b) => { return a.deviceid - b.deviceid }) diff --git a/ui/src/views/dashboard/Dashboard.vue b/ui/src/views/dashboard/Dashboard.vue index 23303dd13ae..5f787143dd1 100644 --- a/ui/src/views/dashboard/Dashboard.vue +++ b/ui/src/views/dashboard/Dashboard.vue @@ -44,7 +44,7 @@ export default { } }, mounted () { - this.showCapacityDashboard = store.getters.apis.hasOwnProperty('listCapacity') + this.showCapacityDashboard = Object.prototype.hasOwnProperty.call(store.getters.apis, 'listCapacity') this.project = store.getters.project !== undefined && store.getters.project.id !== undefined this.$store.watch( (state, getters) => getters.project,