Defensive check (#578)

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
davidjumani 2020-08-13 14:18:03 +05:30 committed by Rohit Yadav
parent 7faed91d53
commit 3ced416660

View File

@ -748,11 +748,10 @@ export default {
if (res === 'count') { if (res === 'count') {
continue continue
} }
const filter = this.currentAction.mapping[param.name].filter param.opts = json[obj][res]
if (filter) { if (this.currentAction.mapping[param.name] && this.currentAction.mapping[param.name].filter) {
const filter = this.currentAction.mapping[param.name].filter
param.opts = json[obj][res].filter(filter) param.opts = json[obj][res].filter(filter)
} else {
param.opts = json[obj][res]
} }
if (['listTemplates', 'listIsos'].includes(possibleApi)) { if (['listTemplates', 'listIsos'].includes(possibleApi)) {
param.opts = [...new Map(param.opts.map(x => [x.id, x])).values()] param.opts = [...new Map(param.opts.map(x => [x.id, x])).values()]
@ -764,7 +763,7 @@ export default {
} }
this.$forceUpdate() this.$forceUpdate()
}).catch(function (error) { }).catch(function (error) {
console.log(error.stack) console.log(error)
param.loading = false param.loading = false
}).then(function () { }).then(function () {
}) })