diff --git a/ui/src/config/router.js b/ui/src/config/router.js index 16599a0c3673..aa85f452b734 100644 --- a/ui/src/config/router.js +++ b/ui/src/config/router.js @@ -75,7 +75,6 @@ function generateRouterMap (section) { icon: child.icon, docHelp: vueProps.$applyDocHelpMappings(child.docHelp), permission: child.permission, - getApiToCall: child.getApiToCall, resourceType: child.resourceType, filters: child.filters, params: child.params ? child.params : {}, diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index 5a82c1ce48a0..3c20ae3501fa 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -28,8 +28,7 @@ export default { title: 'label.instances', icon: 'cloud-server-outlined', docHelp: 'adminguide/virtual_machines.html', - permission: ['listVirtualMachines', 'listVirtualMachinesMetrics'], - getApiToCall: () => store.getters.metrics ? 'listVirtualMachinesMetrics' : 'listVirtualMachines', + permission: ['listVirtualMachinesMetrics'], resourceType: 'UserVm', params: () => { var params = { details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff' } diff --git a/ui/src/config/section/infra/clusters.js b/ui/src/config/section/infra/clusters.js index c7edc6560ef2..0b2cf6b8abcd 100644 --- a/ui/src/config/section/infra/clusters.js +++ b/ui/src/config/section/infra/clusters.js @@ -26,8 +26,8 @@ export default { permission: ['listClustersMetrics'], searchFilters: ['name', 'zoneid', 'podid', 'hypervisor'], columns: () => { - const fields = ['name', 'state', 'allocationstate', 'clustertype', 'hypervisortype', 'hosts'] - const metricsFields = ['cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'drsimbalance'] + const fields = ['name', 'allocationstate', 'clustertype', 'hypervisortype', 'hosts'] + const metricsFields = ['state', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'drsimbalance'] if (store.getters.metrics) { fields.push(...metricsFields) } diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index bfdde77191ee..39e2144042ef 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -829,7 +829,12 @@ export default { } if (this.$route && this.$route.meta && this.$route.meta.permission) { - this.apiName = (this.$route.meta.getApiToCall && this.$route.meta.getApiToCall()) || this.$route.meta.permission[0] + this.apiName = this.$route.meta.permission[0] + if (!store.getters.metrics && !this.dataView && + this.apiName && this.apiName.endsWith('Metrics') && + store.getters.apis[this.apiName.replace(/Metrics$/, '')]) { + this.apiName = this.apiName.replace(/Metrics$/, '') + } if (this.$route.meta.columns) { const columns = this.$route.meta.columns if (columns && typeof columns === 'function') {