Skip to content

Commit b034b1e

Browse files
committed
Enhance affinity group selection validation for admin users
1 parent d119a99 commit b034b1e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

ui/src/views/compute/CreateKubernetesCluster.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,18 @@ export default {
921921
}
922922
if (this.isAdminOrDomainAdmin()) {
923923
const selectedGroupIds = [...this.controlAffinityGroups, ...this.workerAffinityGroups, ...this.etcdAffinityGroups]
924-
if (selectedGroupIds.length > 0) {
925-
const group = this.affinityGroups.find(affinityGroup => affinityGroup.id === selectedGroupIds[0])
926-
if (group) {
927-
params.domainid = group.domainid
928-
params.account = group.account
924+
const selectedGroups = selectedGroupIds.map(id => this.affinityGroups.find(affinityGroup => affinityGroup.id === id)).filter(Boolean)
925+
if (selectedGroups.length > 0) {
926+
const hasMixedAccounts = selectedGroups.some(ag => ag.account !== selectedGroups[0].account)
927+
if (hasMixedAccounts) {
928+
this.$notification.error({
929+
message: this.$t('message.error.affinity.groups.different.accounts')
930+
})
931+
this.loading = false
932+
return
929933
}
934+
params.domainid = selectedGroups[0].domainid
935+
params.account = selectedGroups[0].account
930936
}
931937
}
932938
if (values.hypervisor !== null) {

0 commit comments

Comments
 (0)