diff --git a/ui/src/components/CloudMonkey/Resource.vue b/ui/src/components/CloudMonkey/Resource.vue index e1e2eb20fac..65fc523b4f8 100644 --- a/ui/src/components/CloudMonkey/Resource.vue +++ b/ui/src/components/CloudMonkey/Resource.vue @@ -14,10 +14,10 @@ - + @@ -77,7 +77,7 @@ :placeholder="field.description" > - + {{ opt.name }} @@ -120,7 +120,7 @@ Cancel Submit @@ -200,7 +200,7 @@ export default { columns: [], items: [], selectedRowKeys: [], - action: {}, + currentAction: {}, showAction: false, actions: [] } @@ -251,7 +251,7 @@ export default { this.apiName = this.$route.meta.permission[0] } } - if (this.apiName && this.apiName !== '' && !this.columnKeys || this.columnKeys.length == 0) { + if (this.apiName && this.apiName !== '' && !this.columnKeys || this.columnKeys.length === 0) { for (const field of store.getters.apis[this.apiName]['response']) { this.columnKeys.push(field.name) } @@ -290,12 +290,12 @@ export default { } } for (const key in json[responseName]) { - if (key == 'count') continue + if (key === 'count') continue objectName = key break } this.items = json[responseName][objectName] - if (!this.items || this.items.length == 0) { + if (!this.items || this.items.length === 0) { this.items = [] } for (let idx = 0; idx < this.items.length; idx++) { @@ -306,7 +306,7 @@ export default { getResource (id) { var res = {} for (const item of this.items) { - if (item.id == id) { + if (item.id === id) { res = item break } @@ -317,14 +317,14 @@ export default { this.fetchData(value) }, closeAction () { - this.action.loading = false + this.currentAction.loading = false this.showAction = false - this.action = {} + this.currentAction = {} }, execAction (action) { - this.action = action - this.action['params'] = store.getters.apis[action.api]['params'] - this.action['params'].sort(function (a, b) { + this.currentAction = action + this.currentAction['params'] = store.getters.apis[this.currentAction.api]['params'] + this.currentAction['params'].sort(function (a, b) { if (a.name === 'name' && b.name !== 'name') { return -1 } if (a.name !== 'name' && b.name === 'name') { return -1 } if (a.name === 'id') { return -1 } @@ -332,19 +332,19 @@ export default { if (a.name > b.name) { return 1 } return 0 }) - for (var param of this.action['params']) { + for (var param of this.currentAction['params']) { if (param.type === 'uuid' || param.name === 'account') { this.listUuidOpts(param) } } this.showAction = true - this.action.loading = false + this.currentAction.loading = false }, listUuidOpts (param) { var paramName = param.name const possibleName = 'list' + paramName.replace('id', '').toLowerCase() + 's' - var possibleApi = undefined - if (paramName == 'id') { + var possibleApi + if (paramName === 'id') { possibleApi = this.apiName } else { for (const api in store.getters.apis) { @@ -360,7 +360,7 @@ export default { param.loading = true param.opts = [] var params = { listall: true } - if (possibleApi == 'listTemplates') { + if (possibleApi === 'listTemplates') { params['templatefilter'] = 'executable' } api(possibleApi, params).then(json => { @@ -368,7 +368,7 @@ export default { for (const obj in json) { if (obj.includes('response')) { for (const res in json[obj]) { - if (res == 'count') { + if (res === 'count') { continue } param.opts = json[obj][res] @@ -379,6 +379,7 @@ export default { } } }).catch(function (error) { + console.log(error.stack) param.loading = false }).then(function () { }) @@ -387,11 +388,11 @@ export default { e.preventDefault() this.form.validateFields((err, values) => { if (!err) { - this.action.loading = true + this.currentAction.loading = true const params = {} for (const key in values) { const input = values[key] - for (const param of this.action['params']) { + for (const param of this.currentAction['params']) { if (param.name === key) { if (input === undefined) { if (param.type === 'boolean') { @@ -409,7 +410,7 @@ export default { } } - api(this.action.api, params).then(json => { + api(this.currentAction.api, params).then(json => { console.log(json) this.closeAction() }).catch(function (error) { diff --git a/ui/src/components/layouts/BasicLayout.vue b/ui/src/components/layouts/BasicLayout.vue index ce37ec3cc0b..a282222cf8a 100644 --- a/ui/src/components/layouts/BasicLayout.vue +++ b/ui/src/components/layouts/BasicLayout.vue @@ -28,7 +28,6 @@ export default {