Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ui/src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
config.params.projectid = project.id
}
}
if (config.params.ignoreproject !== undefined) {
config.params.ignoreproject = null
}
}
return config
}, err)
Expand Down
28 changes: 18 additions & 10 deletions ui/src/views/compute/AssignInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(() => {
Expand All @@ -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(() => {
Expand All @@ -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(() => {
Expand All @@ -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 () {
Expand Down