diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 8ff510865a60..0284bc7639f4 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -1532,6 +1532,7 @@ "label.ovmnetworklabel": "OVM traffic label", "label.ovs": "OVS", "label.owner.account": "Owner Account", +"label.owner.type": "Owner type", "label.owners": "Owners", "label.pa": "Palo Alto", "label.page": "page", diff --git a/ui/public/locales/pt_BR.json b/ui/public/locales/pt_BR.json index a3aec03bf26d..0666f7ba0f75 100644 --- a/ui/public/locales/pt_BR.json +++ b/ui/public/locales/pt_BR.json @@ -1155,6 +1155,7 @@ "label.ovmnetworklabel": "R\u00f3tulo de tr\u00e1fego OVM", "label.ovs": "OVS", "label.owner.account": "Dono da conta", +"label.owner.type": "Tipo de dono", "label.owners": "Donos", "label.pa": "Palo Alto", "label.page": "p\u00e1gina", diff --git a/ui/src/views/compute/AssignInstance.vue b/ui/src/views/compute/AssignInstance.vue index 9726dc215774..873d10f57704 100644 --- a/ui/src/views/compute/AssignInstance.vue +++ b/ui/src/views/compute/AssignInstance.vue @@ -29,86 +29,7 @@ -
-

{{ $t('label.accounttype') }}

- - {{ $t('label.account') }} - {{ $t('label.project') }} - -
- -
-

*{{ $t('label.domain') }}

- - - - - - {{ domain.path || domain.name || domain.description }} - - - -
- - - - +

{{ $t('label.network') }}

@@ -146,6 +67,7 @@ diff --git a/ui/src/views/network/CreateIsolatedNetworkForm.vue b/ui/src/views/network/CreateIsolatedNetworkForm.vue index 919821576e06..0c81a69057c1 100644 --- a/ui/src/views/network/CreateIsolatedNetworkForm.vue +++ b/ui/src/views/network/CreateIsolatedNetworkForm.vue @@ -66,44 +66,7 @@ - - - - - {{ opt.path || opt.name || opt.description }} - - - - - - - - {{ opt.name || opt.description }} - - - + - - - - - - - -
{ - const listDomains = json.listdomainsresponse.domain - count = json.listdomainsresponse.count - this.domains = this.domains.concat(listDomains) - }).finally(() => { - if (count <= this.domains.length) { - sema.loading = false - } else { - this.loadMore(apiToCall, page + 1, sema) + if (OwnerOptions.selectedAccountType === this.$t('label.account')) { + if (!OwnerOptions.selectedAccount) { + return } - this.form.domainid = 0 - this.handleDomainChange(this.domains[0]) - }) - }, - handleDomainChange (domain) { - this.selectedDomain = domain - this.accountVisible = domain.id !== '-1' + this.owner.account = OwnerOptions.selectedAccount + this.owner.domainid = OwnerOptions.selectedDomain + this.owner.projectid = null + } else if (OwnerOptions.selectedAccountType === this.$t('label.project')) { + if (!OwnerOptions.selectedProject) { + return + } + this.owner.account = null + this.owner.domainid = null + this.owner.projectid = OwnerOptions.selectedProject + } if (isAdminOrDomainAdmin()) { this.updateVPCCheckAndFetchNetworkOfferingData() - this.fetchAccounts() } }, - handleAccountChange (account) { - this.selectedAccount = account - }, updateVPCCheckAndFetchNetworkOfferingData () { if (this.vpc !== null) { // from VPC section this.fetchNetworkOfferingData(true) @@ -562,8 +481,8 @@ export default { guestiptype: 'Isolated', state: 'Enabled' } - if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins - params.domainid = this.selectedDomain.id + if (isAdminOrDomainAdmin() && this.owner.domainid !== '-1') { // domain is visible only for admins + params.domainid = this.owner.domainid } if (!isAdmin()) { // normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true params.specifyvlan = false @@ -613,31 +532,6 @@ export default { } }) }, - fetchAccounts () { - this.accountLoading = true - var params = {} - if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins - params.domainid = this.selectedDomain.id - } - this.accounts = [ - { - id: '-1', - name: ' ' - } - ] - this.selectedAccount = {} - api('listAccounts', params).then(json => { - const listAccounts = json.listaccountsresponse.account || [] - this.accounts = this.accounts.concat(listAccounts) - }).catch(error => { - this.$notifyError(error) - }).finally(() => { - this.accountLoading = false - if (this.arrayHasItems(this.accounts)) { - this.form.account = null - } - }) - }, handleSubmit () { if (this.actionLoading) return this.formRef.value.validate().then(() => { @@ -666,12 +560,15 @@ export default { if ('vpcid' in values) { params.vpcid = this.selectedVpc.id } - if ('domainid' in values && values.domainid > 0) { - params.domainid = this.selectedDomain.id - if (this.isValidTextValueForKey(values, 'account') && this.selectedAccount.id !== '-1') { - params.account = this.selectedAccount.name - } + + if (this.owner.account) { + params.account = this.owner.account + params.domainid = this.owner.domainid + } else if (this.owner.projectid) { + params.domainid = this.owner.domainid + params.projectid = this.owner.projectid } + api('createNetwork', params).then(json => { this.$notification.success({ message: 'Network', diff --git a/ui/src/views/network/CreateL2NetworkForm.vue b/ui/src/views/network/CreateL2NetworkForm.vue index 6bb87e178f31..41d2ec8c2f2e 100644 --- a/ui/src/views/network/CreateL2NetworkForm.vue +++ b/ui/src/views/network/CreateL2NetworkForm.vue @@ -73,48 +73,7 @@ - - - - - - - - {{ opt.path || opt.name || opt.description }} - - - - - - - - - {{ opt.name || opt.description }} - - - +