mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ui: fix dashboard retrievals based on permissions (#9237)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
abbc61c01e
commit
19e9020c9b
@ -51,7 +51,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<a-divider style="margin: 6px 0px; border-width: 0px"/>
|
<a-divider style="margin: 6px 0px; border-width: 0px"/>
|
||||||
<a-row :gutter="[10, 10]">
|
<a-row :gutter="[10, 10]">
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listVirtualMachines' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/vm' }">
|
<router-link :to="{ path: '/vm' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.instances')"
|
:title="$t('label.instances')"
|
||||||
@ -63,7 +63,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listKubernetesClusters' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/kubernetes' }">
|
<router-link :to="{ path: '/kubernetes' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.kubernetes.cluster')"
|
:title="$t('label.kubernetes.cluster')"
|
||||||
@ -75,7 +75,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listVolumes' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/volume' }">
|
<router-link :to="{ path: '/volume' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.volumes')"
|
:title="$t('label.volumes')"
|
||||||
@ -87,7 +87,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listSnapshots' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/snapshot' }">
|
<router-link :to="{ path: '/snapshot' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.snapshots')"
|
:title="$t('label.snapshots')"
|
||||||
@ -99,7 +99,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listNetworks' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/guestnetwork' }">
|
<router-link :to="{ path: '/guestnetwork' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.guest.networks')"
|
:title="$t('label.guest.networks')"
|
||||||
@ -111,7 +111,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listVPCs' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/vpc' }">
|
<router-link :to="{ path: '/vpc' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.vpcs')"
|
:title="$t('label.vpcs')"
|
||||||
@ -123,7 +123,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listPublicIpAddresses' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/publicip' }">
|
<router-link :to="{ path: '/publicip' }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.public.ips')"
|
:title="$t('label.public.ips')"
|
||||||
@ -135,7 +135,7 @@
|
|||||||
</a-statistic>
|
</a-statistic>
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12" v-if="'listTemplates' in $store.getters.apis">
|
||||||
<router-link :to="{ path: '/template', query: { templatefilter: 'self', filter: 'self' } }">
|
<router-link :to="{ path: '/template', query: { templatefilter: 'self', filter: 'self' } }">
|
||||||
<a-statistic
|
<a-statistic
|
||||||
:title="$t('label.templates')"
|
:title="$t('label.templates')"
|
||||||
@ -150,7 +150,7 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</chart-card>
|
</chart-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xs="{ span: 24 }" :lg="{ span: 12 }" :xl="{ span: 8 }" :xxl="{ span: 8 }">
|
<a-col :xs="{ span: 24 }" :lg="{ span: 12 }" :xl="{ span: 8 }" :xxl="{ span: 8 }" v-if="'listVirtualMachines' in $store.getters.apis">
|
||||||
<chart-card :loading="loading" class="dashboard-card">
|
<chart-card :loading="loading" class="dashboard-card">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
@ -315,7 +315,7 @@
|
|||||||
</a-list>
|
</a-list>
|
||||||
</chart-card>
|
</chart-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xs="{ span: 24 }" :lg="{ span: 12 }" :xl="{ span: 8 }" :xxl="{ span: 8 }">
|
<a-col :xs="{ span: 24 }" :lg="{ span: 12 }" :xl="{ span: 8 }" :xxl="{ span: 8 }" v-if="'listEvents' in $store.getters.apis">
|
||||||
<chart-card :loading="loading" class="dashboard-card dashboard-event">
|
<chart-card :loading="loading" class="dashboard-card dashboard-event">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
@ -482,37 +482,60 @@ export default {
|
|||||||
}
|
}
|
||||||
this.listInstances()
|
this.listInstances()
|
||||||
this.listEvents()
|
this.listEvents()
|
||||||
this.loading = true
|
if ('listKubernetesClusters' in this.$store.getters.apis) {
|
||||||
api('listKubernetesClusters', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
this.loading = true
|
||||||
this.loading = false
|
api('listKubernetesClusters', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
this.data.kubernetes = json?.listkubernetesclustersresponse?.count
|
this.loading = false
|
||||||
})
|
this.data.kubernetes = json?.listkubernetesclustersresponse?.count
|
||||||
api('listVolumes', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
})
|
||||||
this.loading = false
|
}
|
||||||
this.data.volumes = json?.listvolumesresponse?.count
|
if ('listVolumes' in this.$store.getters.apis) {
|
||||||
})
|
this.loading = true
|
||||||
api('listSnapshots', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
api('listVolumes', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.data.snapshots = json?.listsnapshotsresponse?.count
|
this.data.volumes = json?.listvolumesresponse?.count
|
||||||
})
|
})
|
||||||
api('listNetworks', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
}
|
||||||
this.loading = false
|
if ('listSnapshots' in this.$store.getters.apis) {
|
||||||
this.data.networks = json?.listnetworksresponse?.count
|
this.loading = true
|
||||||
})
|
api('listSnapshots', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
api('listVPCs', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
this.loading = false
|
||||||
this.loading = false
|
this.data.snapshots = json?.listsnapshotsresponse?.count
|
||||||
this.data.vpcs = json?.listvpcsresponse?.count
|
})
|
||||||
})
|
}
|
||||||
api('listPublicIpAddresses', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
if ('listNetworks' in this.$store.getters.apis) {
|
||||||
this.loading = false
|
this.loading = true
|
||||||
this.data.ips = json?.listpublicipaddressesresponse?.count
|
api('listNetworks', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
})
|
this.loading = false
|
||||||
api('listTemplates', { templatefilter: 'self', listall: true, page: 1, pagesize: 1 }).then(json => {
|
this.data.networks = json?.listnetworksresponse?.count
|
||||||
this.loading = false
|
})
|
||||||
this.data.templates = json?.listtemplatesresponse?.count
|
}
|
||||||
})
|
if ('listVPCs' in this.$store.getters.apis) {
|
||||||
|
this.loading = true
|
||||||
|
api('listVPCs', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
|
this.loading = false
|
||||||
|
this.data.vpcs = json?.listvpcsresponse?.count
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if ('listPublicIpAddresses' in this.$store.getters.apis) {
|
||||||
|
this.loading = true
|
||||||
|
api('listPublicIpAddresses', { listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
|
this.loading = false
|
||||||
|
this.data.ips = json?.listpublicipaddressesresponse?.count
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if ('listTemplates' in this.$store.getters.apis) {
|
||||||
|
this.loading = true
|
||||||
|
api('listTemplates', { templatefilter: 'self', listall: true, page: 1, pagesize: 1 }).then(json => {
|
||||||
|
this.loading = false
|
||||||
|
this.data.templates = json?.listtemplatesresponse?.count
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
listInstances (zone) {
|
listInstances () {
|
||||||
|
if (!('listVirtualMachines' in this.$store.getters.apis)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.loading = true
|
this.loading = true
|
||||||
api('listVirtualMachines', { listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
|
api('listVirtualMachines', { listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@ -528,6 +551,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
listEvents () {
|
listEvents () {
|
||||||
|
if (!('listEvents' in this.$store.getters.apis)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const params = {
|
const params = {
|
||||||
page: 1,
|
page: 1,
|
||||||
pagesize: 8,
|
pagesize: 8,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user