1414 <a-row >
1515 <a-col :span =" 16" >
1616 <a-button
17- v-for =" (action, index ) in actions"
18- :key =" index "
17+ v-for =" (action, actionIndex ) in actions"
18+ :key =" actionIndex "
1919 :icon =" action.icon"
20- :type =" action.icon == 'delete' ? 'danger' : (action.icon == 'plus' ? 'primary' : 'default')"
20+ :type =" action.icon === 'delete' ? 'danger' : (action.icon = == 'plus' ? 'primary' : 'default')"
2121 shape =" circle"
2222 style =" margin-right : 5px "
2323 @click =" execAction(action)"
4242 </a-row >
4343
4444 <a-drawer
45- :title =" action .label"
45+ :title =" currentAction .label"
4646 placement =" right"
4747 width =" 75%"
4848 :closable =" true"
4949 @close =" closeAction"
5050 :visible =" showAction"
5151 >
52- <a-spin :spinning =" action .loading" >
52+ <a-spin :spinning =" currentAction .loading" >
5353 <a-form
5454 :form =" form"
5555 @submit =" handleSubmit"
5656 layout =" vertical" >
5757 <a-form-item
58- v-for =" (field, index ) in action .params"
59- :key =" index "
58+ v-for =" (field, fieldIndex ) in currentAction .params"
59+ :key =" fieldIndex "
6060 :label =" field.name"
6161 :v-bind =" field.name" >
6262
7777 :placeholder =" field.description"
7878
7979 >
80- <a-select-option v-for =" (opt, index ) in field.opts" :key =" index " >
80+ <a-select-option v-for =" (opt, optIndex ) in field.opts" :key =" optIndex " >
8181 {{ opt.name }}
8282 </a-select-option >
8383 </a-select >
120120 Cancel
121121 </a-button >
122122 <a-button
123- :loading =" action .loading"
123+ :loading =" currentAction .loading"
124124 type =" primary"
125125 html-type =" submit" >
126126 Submit
@@ -200,7 +200,7 @@ export default {
200200 columns: [],
201201 items: [],
202202 selectedRowKeys: [],
203- action : {},
203+ currentAction : {},
204204 showAction: false ,
205205 actions: []
206206 }
@@ -251,7 +251,7 @@ export default {
251251 this .apiName = this .$route .meta .permission [0 ]
252252 }
253253 }
254- if (this .apiName && this .apiName !== ' ' && ! this .columnKeys || this .columnKeys .length == 0 ) {
254+ if (this .apiName && this .apiName !== ' ' && ! this .columnKeys || this .columnKeys .length === 0 ) {
255255 for (const field of store .getters .apis [this .apiName ][' response' ]) {
256256 this .columnKeys .push (field .name )
257257 }
@@ -290,12 +290,12 @@ export default {
290290 }
291291 }
292292 for (const key in json[responseName]) {
293- if (key == ' count' ) continue
293+ if (key === ' count' ) continue
294294 objectName = key
295295 break
296296 }
297297 this .items = json[responseName][objectName]
298- if (! this .items || this .items .length == 0 ) {
298+ if (! this .items || this .items .length === 0 ) {
299299 this .items = []
300300 }
301301 for (let idx = 0 ; idx < this .items .length ; idx++ ) {
@@ -306,7 +306,7 @@ export default {
306306 getResource (id ) {
307307 var res = {}
308308 for (const item of this .items ) {
309- if (item .id == id) {
309+ if (item .id === id) {
310310 res = item
311311 break
312312 }
@@ -317,34 +317,34 @@ export default {
317317 this .fetchData (value)
318318 },
319319 closeAction () {
320- this .action .loading = false
320+ this .currentAction .loading = false
321321 this .showAction = false
322- this .action = {}
322+ this .currentAction = {}
323323 },
324324 execAction (action ) {
325- this .action = action
326- this .action [' params' ] = store .getters .apis [action .api ][' params' ]
327- this .action [' params' ].sort (function (a , b ) {
325+ this .currentAction = action
326+ this .currentAction [' params' ] = store .getters .apis [this . currentAction .api ][' params' ]
327+ this .currentAction [' params' ].sort (function (a , b ) {
328328 if (a .name === ' name' && b .name !== ' name' ) { return - 1 }
329329 if (a .name !== ' name' && b .name === ' name' ) { return - 1 }
330330 if (a .name === ' id' ) { return - 1 }
331331 if (a .name < b .name ) { return - 1 }
332332 if (a .name > b .name ) { return 1 }
333333 return 0
334334 })
335- for (var param of this .action [' params' ]) {
335+ for (var param of this .currentAction [' params' ]) {
336336 if (param .type === ' uuid' || param .name === ' account' ) {
337337 this .listUuidOpts (param)
338338 }
339339 }
340340 this .showAction = true
341- this .action .loading = false
341+ this .currentAction .loading = false
342342 },
343343 listUuidOpts (param ) {
344344 var paramName = param .name
345345 const possibleName = ' list' + paramName .replace (' id' , ' ' ).toLowerCase () + ' s'
346- var possibleApi = undefined
347- if (paramName == ' id' ) {
346+ var possibleApi
347+ if (paramName === ' id' ) {
348348 possibleApi = this .apiName
349349 } else {
350350 for (const api in store .getters .apis ) {
@@ -360,15 +360,15 @@ export default {
360360 param .loading = true
361361 param .opts = []
362362 var params = { listall: true }
363- if (possibleApi == ' listTemplates' ) {
363+ if (possibleApi === ' listTemplates' ) {
364364 params[' templatefilter' ] = ' executable'
365365 }
366366 api (possibleApi, params).then (json => {
367367 param .loading = false
368368 for (const obj in json) {
369369 if (obj .includes (' response' )) {
370370 for (const res in json[obj]) {
371- if (res == ' count' ) {
371+ if (res === ' count' ) {
372372 continue
373373 }
374374 param .opts = json[obj][res]
@@ -379,6 +379,7 @@ export default {
379379 }
380380 }
381381 }).catch (function (error ) {
382+ console .log (error .stack )
382383 param .loading = false
383384 }).then (function () {
384385 })
@@ -387,11 +388,11 @@ export default {
387388 e .preventDefault ()
388389 this .form .validateFields ((err , values ) => {
389390 if (! err) {
390- this .action .loading = true
391+ this .currentAction .loading = true
391392 const params = {}
392393 for (const key in values) {
393394 const input = values[key]
394- for (const param of this .action [' params' ]) {
395+ for (const param of this .currentAction [' params' ]) {
395396 if (param .name === key) {
396397 if (input === undefined ) {
397398 if (param .type === ' boolean' ) {
@@ -409,7 +410,7 @@ export default {
409410 }
410411 }
411412
412- api (this .action .api , params).then (json => {
413+ api (this .currentAction .api , params).then (json => {
413414 console .log (json)
414415 this .closeAction ()
415416 }).catch (function (error ) {
0 commit comments