You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2022/02/21 00:53:09 UTC
[cloudstack] branch main updated: UI: fix network list when assign vm to other accounts in project view (#6009)
This is an automated email from the ASF dual-hosted git repository.
nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new b8ce074 UI: fix network list when assign vm to other accounts in project view (#6009)
b8ce074 is described below
commit b8ce07475d5382465fb7087b86f633a6b39b630f
Author: Wei Zhou <we...@apache.org>
AuthorDate: Mon Feb 21 01:52:44 2022 +0100
UI: fix network list when assign vm to other accounts in project view (#6009)
* UI: fix network list when assign vm to other accounts in project view
* PR#5009: return [] if empty result
---
ui/src/utils/request.js | 5 ++++-
ui/src/views/compute/AssignInstance.vue | 28 ++++++++++++++++++----------
2 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js
index 00520f7..7e49541 100644
--- a/ui/src/utils/request.js
+++ b/ui/src/utils/request.js
@@ -134,13 +134,16 @@ service.interceptors.request.use(config => {
if (config && config.params) {
config.params.response = 'json'
const project = Vue.ls.get(CURRENT_PROJECT)
- if (!config.params.projectid && project && project.id) {
+ if (!config.params.projectid && !config.params.ignoreproject && project && project.id) {
if (config.params.command === 'listTags') {
config.params.projectid = '-1'
} else if (config.params.command !== 'assignVirtualMachine') {
config.params.projectid = project.id
}
}
+ if (config.params.ignoreproject !== undefined) {
+ config.params.ignoreproject = null
+ }
}
return config
}, err)
diff --git a/ui/src/views/compute/AssignInstance.vue b/ui/src/views/compute/AssignInstance.vue
index 9341064..762e712 100644
--- a/ui/src/views/compute/AssignInstance.vue
+++ b/ui/src/views/compute/AssignInstance.vue
@@ -187,7 +187,7 @@ export default {
showicon: true,
details: 'min'
}).then(response => {
- this.domains = response.listdomainsresponse.domain
+ this.domains = response.listdomainsresponse.domain || []
this.selectedDomain = this.domains[0].id
this.fetchAccounts()
this.fetchProjects()
@@ -206,7 +206,7 @@ export default {
state: 'Enabled',
isrecursive: false
}).then(response => {
- this.accounts = response.listaccountsresponse.account
+ this.accounts = response.listaccountsresponse.account || []
}).catch(error => {
this.$notifyError(error)
}).finally(() => {
@@ -223,7 +223,7 @@ export default {
details: 'min',
isrecursive: false
}).then(response => {
- this.projects = response.listprojectsresponse.project
+ this.projects = response.listprojectsresponse.project || []
}).catch(error => {
this.$notifyError(error)
}).finally(() => {
@@ -232,16 +232,20 @@ export default {
},
fetchNetworks () {
this.loading = true
- api('listNetworks', {
- response: 'json',
+ var params = {
domainId: this.selectedDomain,
listAll: true,
isrecursive: false,
- showicon: true,
- account: this.selectedAccount,
- projectid: this.selectedProject
- }).then(response => {
- this.networks = response.listnetworksresponse.network
+ showicon: true
+ }
+ if (this.selectedProject != null) {
+ params.projectid = this.selectedProject
+ } else {
+ params.account = this.selectedAccount
+ params.ignoreproject = true
+ }
+ api('listNetworks', params).then(response => {
+ this.networks = response.listnetworksresponse.network || []
}).catch(error => {
this.$notifyError(error)
}).finally(() => {
@@ -250,15 +254,19 @@ export default {
},
changeDomain () {
this.selectedAccount = null
+ this.selectedProject = null
+ this.selectedNetwork = null
this.fetchAccounts()
this.fetchProjects()
},
changeAccount () {
this.selectedProject = null
+ this.selectedNetwork = null
this.fetchNetworks()
},
changeProject () {
this.selectedAccount = null
+ this.selectedNetwork = null
this.fetchNetworks()
},
closeAction () {