Skip to content

Commit 4875fde

Browse files
Hide inactive offerings from User type accounts (#12865)
* Hide inactive offerings from User type accounts * Fix merge conflict * Implement custom state query param handler in AutogenView * Update ui/src/config/section/offering.js Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com> --------- Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com>
1 parent 44ab7dd commit 4875fde

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎ui/src/config/section/offering.js‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ export default {
3232
permission: ['listServiceOfferings'],
3333
searchFilters: ['name', 'gpuenabled', 'zoneid', 'domainid', 'cpunumber', 'cpuspeed', 'memory'],
3434
params: () => {
35-
var params = {}
3635
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
37-
params = { isrecursive: 'true' }
36+
return { isrecursive: 'true' }
3837
}
39-
return params
38+
return { state: 'Active' }
39+
},
40+
filters: () => {
41+
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
42+
return ['active', 'inactive']
43+
}
44+
return []
4045
},
41-
filters: ['active', 'inactive'],
4246
columns: ['name', 'displaytext', 'state', 'cpunumber', 'cpuspeed', 'memory', 'gpu', 'domain', 'zone', 'order'],
4347
details: () => {
4448
var fields = ['name', 'id', 'displaytext', 'offerha', 'provisioningtype', 'storagetype', 'iscustomized', 'iscustomizediops', 'limitcpuuse', 'cpunumber', 'cpuspeed', 'memory', 'hosttags', 'tags', 'storageaccessgroups', 'storagetags', 'domain', 'zone', 'created', 'dynamicscalingenabled', 'diskofferingstrictness', 'encryptroot', 'purgeresources', 'leaseduration', 'gpucardid', 'gpucardname', 'vgpuprofileid', 'vgpuprofilename', 'gpucount', 'gpudisplay', 'leaseexpiryaction', 'externaldetails']

‎ui/src/views/AutogenView.vue‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,10 @@ export default {
12021202
delete params.listall
12031203
}
12041204
1205+
if (!['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype) && ['computeoffering'].includes(this.routeName)) {
1206+
delete params.state
1207+
}
1208+
12051209
callAPI(this.apiName, params).then(json => {
12061210
var responseName
12071211
var objectName

0 commit comments

Comments
 (0)