Skip to content

Commit fe3e914

Browse files
committed
UI: Make CKS public templates visible to non-admins on CKS cluster creation
1 parent e904b1b commit fe3e914

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

ui/src/views/compute/CreateKubernetesCluster.vue

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,16 +661,27 @@ export default {
661661
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
662662
},
663663
fetchCksTemplates () {
664-
const params = {
665-
templatefilter: this.isAdminOrDomainAdmin() ? 'all' : 'self',
666-
forcks: true
664+
var filters = []
665+
if (this.isAdminOrDomainAdmin()) {
666+
filters = ['all']
667+
} else {
668+
filters = ['self', 'featured', 'community']
667669
}
668-
this.templateLoading = true
669-
api('listTemplates', params).then(json => {
670-
this.templates = json?.listtemplatesresponse?.template || []
671-
}).finally(() => {
672-
this.templateLoading = false
673-
})
670+
var ckstemplates = []
671+
for (const filtername of filters) {
672+
const params = {
673+
templatefilter: filtername,
674+
forcks: true
675+
}
676+
this.templateLoading = true
677+
api('listTemplates', params).then(json => {
678+
var templates = json?.listtemplatesresponse?.template || []
679+
ckstemplates.push(...templates)
680+
}).finally(() => {
681+
this.templateLoading = false
682+
})
683+
}
684+
this.templates = ckstemplates
674685
},
675686
fetchNetworkData () {
676687
const params = {}

0 commit comments

Comments
 (0)