Skip to content

Commit 3dfbb40

Browse files
committed
Merge release branch 4.18 to main
* 4.18: UI: fix templates/offerings are not listed in autoscale vm profile when login as user (#7343)
2 parents c2cffcc + 11ff2d2 commit 3dfbb40

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

ui/src/views/compute/AutoScaleVmProfile.vue

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243

244244
<script>
245245
import { api } from '@/api'
246+
import { isAdmin, isAdminOrDomainAdmin } from '@/role'
246247
import Status from '@/components/widgets/Status'
247248
import TooltipButton from '@/components/widgets/TooltipButton'
248249
import TooltipLabel from '@/components/widgets/TooltipLabel'
@@ -344,21 +345,29 @@ export default {
344345
})
345346
},
346347
fetchTemplateData () {
347-
api('listTemplates', {
348-
templatefilter: 'all',
348+
const params = {
349349
listall: 'true',
350350
domainid: this.resource.domainid,
351351
account: this.resource.account
352-
}).then(json => {
352+
}
353+
if (isAdmin()) {
354+
params.templatefilter = 'all'
355+
} else {
356+
params.templatefilter = 'executable'
357+
}
358+
api('listTemplates', params).then(json => {
353359
this.templatesList = json.listtemplatesresponse?.template || []
354360
})
355361
},
356362
fetchServiceOfferingData () {
357-
api('listServiceOfferings', {
363+
const params = {
358364
listall: 'true',
359-
isrecursive: 'true',
360365
issystem: 'false'
361-
}).then(json => {
366+
}
367+
if (isAdminOrDomainAdmin()) {
368+
params.isrecursive = 'true'
369+
}
370+
api('listServiceOfferings', params).then(json => {
362371
this.serviceOfferingsList = json.listserviceofferingsresponse?.serviceoffering || []
363372
this.serviceOfferingsList = this.serviceOfferingsList.filter(offering => !offering.iscustomized)
364373
})

ui/src/views/compute/CreateAutoScaleVmGroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ export default {
16521652
if (this.templateId) {
16531653
apiName = 'listTemplates'
16541654
params.listall = true
1655-
params.templatefilter = 'all'
1655+
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
16561656
params.id = this.templateId
16571657
} else if (this.networkId) {
16581658
params.listall = true

ui/src/views/compute/DeployVM.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,11 +1619,11 @@ export default {
16191619
if (this.templateId) {
16201620
apiName = 'listTemplates'
16211621
params.listall = true
1622-
params.templatefilter = 'all'
1622+
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
16231623
params.id = this.templateId
16241624
} else if (this.isoId) {
16251625
params.listall = true
1626-
params.isofilter = 'all'
1626+
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
16271627
params.id = this.isoId
16281628
apiName = 'listIsos'
16291629
} else if (this.networkId) {

0 commit comments

Comments
 (0)