mirror of https://github.com/apache/cloudstack.git
components: Fix show details in settings tab (#433)
Fixes #393 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
71fbb6b84a
commit
775739d751
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue