UI: Make CKS public templates visible to non-admins on CKS cluster creation

This commit is contained in:
nvazquez 2025-03-18 13:16:09 -03:00
parent e904b1b60c
commit fe3e914a85
No known key found for this signature in database
GPG Key ID: 656E1BCC8CB54F84
1 changed files with 20 additions and 9 deletions

View File

@ -661,16 +661,27 @@ export default {
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
},
fetchCksTemplates () {
const params = {
templatefilter: this.isAdminOrDomainAdmin() ? 'all' : 'self',
forcks: true
var filters = []
if (this.isAdminOrDomainAdmin()) {
filters = ['all']
} else {
filters = ['self', 'featured', 'community']
}
this.templateLoading = true
api('listTemplates', params).then(json => {
this.templates = json?.listtemplatesresponse?.template || []
}).finally(() => {
this.templateLoading = false
})
var ckstemplates = []
for (const filtername of filters) {
const params = {
templatefilter: filtername,
forcks: true
}
this.templateLoading = true
api('listTemplates', params).then(json => {
var templates = json?.listtemplatesresponse?.template || []
ckstemplates.push(...templates)
}).finally(() => {
this.templateLoading = false
})
}
this.templates = ckstemplates
},
fetchNetworkData () {
const params = {}