Skip to content

Commit d3b4b2c

Browse files
committed
Add domain/account-aware resource filtering to CKS cluster creation form
1 parent 2029a49 commit d3b4b2c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

ui/src/views/compute/CreateKubernetesCluster.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ export default {
615615
},
616616
fetchData () {
617617
this.fetchZoneData()
618-
this.fetchKeyPairData()
618+
if (!this.isAdmin()) {
619+
this.fetchKeyPairData()
620+
}
619621
this.fetchCksTemplates()
620622
this.fetchCKSNetworkOfferingName()
621623
this.fetchCniConfigurations()
@@ -682,10 +684,10 @@ export default {
682684
handleZoneChange (zone) {
683685
this.selectedZone = zone
684686
this.fetchKubernetesVersionData()
685-
this.fetchNetworkData()
686687
this.fetchZoneHypervisors()
687688
this.fetchZoneASNumbers()
688689
if (!this.isAdmin()) {
690+
this.fetchNetworkData()
689691
this.fetchAffinityGroups()
690692
}
691693
},
@@ -771,6 +773,8 @@ export default {
771773
}
772774
this.owner.projectid = ownerOptions.selectedProject
773775
}
776+
this.fetchNetworkData()
777+
this.fetchKeyPairData()
774778
this.fetchAffinityGroups()
775779
},
776780
fetchCksTemplates () {
@@ -802,6 +806,12 @@ export default {
802806
if (!this.isObjectEmpty(this.selectedZone)) {
803807
params.zoneid = this.selectedZone.id
804808
}
809+
if (this.owner.account) {
810+
params.account = this.owner.account
811+
params.domainid = this.owner.domainid
812+
} else if (this.owner.projectid) {
813+
params.projectid = this.owner.projectid
814+
}
805815
this.networkLoading = true
806816
this.networks = []
807817
getAPI('listNetworks', params).then(json => {
@@ -820,7 +830,14 @@ export default {
820830
},
821831
fetchKeyPairData () {
822832
const params = {}
833+
if (this.owner.account) {
834+
params.account = this.owner.account
835+
params.domainid = this.owner.domainid
836+
} else if (this.owner.projectid) {
837+
params.projectid = this.owner.projectid
838+
}
823839
this.keyPairLoading = true
840+
this.keyPairs = [this.emptyEntry]
824841
getAPI('listSSHKeyPairs', params).then(json => {
825842
const listKeyPairs = json.listsshkeypairsresponse.sshkeypair
826843
if (this.arrayHasItems(listKeyPairs)) {

0 commit comments

Comments
 (0)