diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index 97b6ec0f3c3..a283fce97eb 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -30,7 +30,13 @@ export default { docHelp: 'adminguide/virtual_machines.html', permission: ['listVirtualMachinesMetrics'], resourceType: 'UserVm', - filters: ['self', 'running', 'stopped'], + filters: () => { + const filters = ['running', 'stopped'] + if (!(store.getters.project && store.getters.project.id)) { + filters.unshift('self') + } + return filters + }, columns: () => { const fields = ['name', 'state', 'ipaddress'] const metricsFields = ['cpunumber', 'cpuused', 'cputotal', diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index a3e6daefa22..5e627599b37 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -43,16 +43,18 @@ {{ $t('label.filterby') }} {{ $t('label.all') }} - + {{ $t('label.' + filter) }} @@ -379,6 +381,7 @@ export default { currentAction: {}, showAction: false, dataView: false, + projectView: false, selectedFilter: '', filters: [], searchFilters: [], @@ -495,6 +498,12 @@ export default { delete params.irefresh this.searchFilters = this.$route && this.$route.meta && this.$route.meta.searchFilters + this.filters = this.$route && this.$route.meta && this.$route.meta.filters + if (typeof this.filters === 'function') { + this.filters = this.filters() + } + + this.projectView = Boolean(store.getters.project && store.getters.project.id) if (this.$route && this.$route.params && this.$route.params.id) { this.dataView = true