mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: improve metrics api use in list views (#9825)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
7e2aa0efe4
commit
c453aaea2c
@ -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 : {},
|
||||
|
||||
@ -29,8 +29,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' }
|
||||
|
||||
@ -26,8 +26,8 @@ export default {
|
||||
permission: ['listClustersMetrics'],
|
||||
searchFilters: ['name', 'zoneid', 'podid', 'arch', 'hypervisor'],
|
||||
columns: () => {
|
||||
const fields = ['name', 'state', 'allocationstate', 'clustertype', 'arch', 'hypervisortype', 'hosts']
|
||||
const metricsFields = ['cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'drsimbalance']
|
||||
const fields = ['name', 'allocationstate', 'clustertype', 'arch', 'hypervisortype']
|
||||
const metricsFields = ['state', 'hosts', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal', 'drsimbalance']
|
||||
if (store.getters.metrics) {
|
||||
fields.push(...metricsFields)
|
||||
}
|
||||
|
||||
@ -33,12 +33,10 @@ export default {
|
||||
params: { type: 'routing' },
|
||||
columns: () => {
|
||||
const fields = [
|
||||
'name', 'state', 'resourcestate', 'ipaddress',
|
||||
'arch', 'hypervisor', 'instances',
|
||||
{ field: 'systeminstances', customTitle: 'system.vms' },
|
||||
'powerstate', 'version'
|
||||
'name', 'state', 'resourcestate', 'ipaddress', 'arch', 'hypervisor',
|
||||
{ field: 'systeminstances', customTitle: 'system.vms' }, 'version'
|
||||
]
|
||||
const metricsFields = ['cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite']
|
||||
const metricsFields = ['instances', 'powerstate', 'cpunumber', 'cputotalghz', 'cpuusedghz', 'cpuallocatedghz', 'memorytotalgb', 'memoryusedgb', 'memoryallocatedgb', 'networkread', 'networkwrite']
|
||||
if (store.getters.metrics) {
|
||||
fields.push(...metricsFields)
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@ export default {
|
||||
permission: ['listZonesMetrics'],
|
||||
searchFilters: ['name', 'domainid', 'tags'],
|
||||
columns: () => {
|
||||
const fields = ['name', 'allocationstate', 'type', 'networktype', 'clusters']
|
||||
const metricsFields = ['cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal']
|
||||
const fields = ['name', 'allocationstate', 'type', 'networktype']
|
||||
const metricsFields = ['clusters', 'cpuused', 'cpumaxdeviation', 'cpuallocated', 'cputotal', 'memoryused', 'memorymaxdeviation', 'memoryallocated', 'memorytotal']
|
||||
if (store.getters.metrics) {
|
||||
fields.push(...metricsFields)
|
||||
}
|
||||
|
||||
@ -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') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user