You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/06/20 09:03:44 UTC
[cloudstack-primate] branch master updated: components: Fix show
details in settings tab (#433)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new 275cd4d components: Fix show details in settings tab (#433)
275cd4d is described below
commit 275cd4d4f5e3a798d79807bde61330ea9008cfa2
Author: davidjumani <dj...@gmail.com>
AuthorDate: Sat Jun 20 09:03:35 2020 +0000
components: Fix show details in settings tab (#433)
Fixes #393
---
src/components/view/DetailSettings.vue | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/components/view/DetailSettings.vue b/src/components/view/DetailSettings.vue
index bb8e736..e97ca6c 100644
--- a/src/components/view/DetailSettings.vue
+++ b/src/components/view/DetailSettings.vue
@@ -136,17 +136,17 @@ export default {
)
},
updateResource (resource) {
+ this.details = []
if (!resource) {
return
}
this.resource = resource
this.resourceType = this.$route.meta.resourceType
- if (!resource.details) {
- return
+ if (resource.details) {
+ this.details = Object.keys(this.resource.details).map(k => {
+ return { name: k, value: this.resource.details[k], edit: false }
+ })
}
- this.details = Object.keys(this.resource.details).map(k => {
- return { name: k, value: this.resource.details[k], edit: false }
- })
api('listDetailOptions', { resourcetype: this.resourceType, resourceid: this.resource.id }).then(json => {
this.detailOptions = json.listdetailoptionsresponse.detailoptions.details
})
@@ -185,15 +185,19 @@ export default {
}
const params = { id: this.resource.id }
- this.details.forEach(function (item, index) {
- params['details[0].' + item.name] = item.value
- })
+ if (this.details.length === 0) {
+ params.cleanupdetails = true
+ } else {
+ this.details.forEach(function (item, index) {
+ params['details[0].' + item.name] = item.value
+ })
+ }
this.loading = true
api(apiName, params).then(json => {
var details = {}
- if (this.resourceType === 'UserVm') {
+ if (this.resourceType === 'UserVm' && json.updatevirtualmachineresponse.virtualmachine.details) {
details = json.updatevirtualmachineresponse.virtualmachine.details
- } else if (this.resourceType === 'Template') {
+ } else if (this.resourceType === 'Template' && json.updatetemplateresponse.template.details) {
details = json.updatetemplateresponse.template.details
}
this.details = Object.keys(details).map(k => {