UI: fix templates/offerings are not listed in autoscale vm profile when login as user (#7343)

This commit is contained in:
Wei Zhou 2023-03-30 09:29:55 +02:00 committed by GitHub
parent 16694d8bec
commit 11ff2d20e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -243,6 +243,7 @@
<script>
import { api } from '@/api'
import { isAdmin, isAdminOrDomainAdmin } from '@/role'
import Status from '@/components/widgets/Status'
import TooltipButton from '@/components/widgets/TooltipButton'
import TooltipLabel from '@/components/widgets/TooltipLabel'
@ -344,21 +345,29 @@ export default {
})
},
fetchTemplateData () {
api('listTemplates', {
templatefilter: 'all',
const params = {
listall: 'true',
domainid: this.resource.domainid,
account: this.resource.account
}).then(json => {
}
if (isAdmin()) {
params.templatefilter = 'all'
} else {
params.templatefilter = 'executable'
}
api('listTemplates', params).then(json => {
this.templatesList = json.listtemplatesresponse?.template || []
})
},
fetchServiceOfferingData () {
api('listServiceOfferings', {
const params = {
listall: 'true',
isrecursive: 'true',
issystem: 'false'
}).then(json => {
}
if (isAdminOrDomainAdmin()) {
params.isrecursive = 'true'
}
api('listServiceOfferings', params).then(json => {
this.serviceOfferingsList = json.listserviceofferingsresponse?.serviceoffering || []
this.serviceOfferingsList = this.serviceOfferingsList.filter(offering => !offering.iscustomized)
})

View File

@ -1652,7 +1652,7 @@ export default {
if (this.templateId) {
apiName = 'listTemplates'
params.listall = true
params.templatefilter = 'all'
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.templateId
} else if (this.networkId) {
params.listall = true

View File

@ -1619,11 +1619,11 @@ export default {
if (this.templateId) {
apiName = 'listTemplates'
params.listall = true
params.templatefilter = 'all'
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.templateId
} else if (this.isoId) {
params.listall = true
params.isofilter = 'all'
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.isoId
apiName = 'listIsos'
} else if (this.networkId) {