@@ -21,6 +21,7 @@ export default class ApiKeysIndexController extends Controller {
2121 @service theme ;
2222 @service hostRouter ;
2323 @service universe ;
24+ @service abilities ;
2425
2526 /**
2627 * Queryable parameters for this controller's model
@@ -83,7 +84,7 @@ export default class ApiKeysIndexController extends Controller {
8384 *
8485 * @memberof ApiKeysIndexController
8586 */
86- @computed ( 'testMode' ) get isTestMode ( ) {
87+ @computed ( 'testMode' ) get isTestMode ( ) {
8788 return this . testMode === true ;
8889 }
8990
@@ -92,7 +93,7 @@ export default class ApiKeysIndexController extends Controller {
9293 *
9394 * @memberof ApiKeysIndexController
9495 */
95- @computed ( 'currentUser.options.testKey' ) get testKey ( ) {
96+ @computed ( 'currentUser.options.testKey' ) get testKey ( ) {
9697 return this . currentUser . getOption ( 'testKey' ) ;
9798 }
9899
@@ -208,7 +209,7 @@ export default class ApiKeysIndexController extends Controller {
208209 *
209210 * @void
210211 */
211- @task ( { restartable : true } ) * search ( { target : { value } } ) {
212+ @task ( { restartable : true } ) * search ( { target : { value } } ) {
212213 // if no query don't search
213214 if ( isBlank ( value ) ) {
214215 this . query = null ;
@@ -232,7 +233,7 @@ export default class ApiKeysIndexController extends Controller {
232233 *
233234 * @void
234235 */
235- @action toggleTestMode ( testMode = false ) {
236+ @action toggleTestMode ( testMode = false ) {
236237 this . currentUser . setOption ( 'sandbox' , testMode ) ;
237238 this . testMode = testMode ;
238239 this . theme . setEnvironment ( ) ;
@@ -247,7 +248,7 @@ export default class ApiKeysIndexController extends Controller {
247248 *
248249 * @void
249250 */
250- @action toggleTestKey ( { target : { value } } ) {
251+ @action toggleTestKey ( { target : { value } } ) {
251252 if ( isBlank ( value ) ) {
252253 this . currentUser . setOption ( 'testKey' , null ) ;
253254 return ;
@@ -261,7 +262,7 @@ export default class ApiKeysIndexController extends Controller {
261262 *
262263 * @void
263264 */
264- @action createApiKey ( ) {
265+ @action createApiKey ( ) {
265266 const formPermission = 'developers create api-key' ;
266267 const apiKey = this . store . createRecord ( 'api-credential' , {
267268 test_mode : this . testMode ,
@@ -276,7 +277,7 @@ export default class ApiKeysIndexController extends Controller {
276277 successMessage : this . intl . t ( 'developers.api-keys.index.new-api-key-message' ) ,
277278 formPermission,
278279 apiKey,
279- confirm : async modal => {
280+ confirm : async ( modal ) => {
280281 modal . startLoading ( ) ;
281282
282283 if ( this . abilities . cannot ( formPermission ) ) {
@@ -300,7 +301,7 @@ export default class ApiKeysIndexController extends Controller {
300301 *
301302 * @void
302303 */
303- @action editApiKey ( apiKey , options = { } ) {
304+ @action editApiKey ( apiKey , options = { } ) {
304305 const formPermission = 'developers update api-key' ;
305306 this . modalsManager . show ( 'modals/api-key-form' , {
306307 title : this . intl . t ( 'developers.api-keys.index.edit-api-key-title' ) ,
@@ -315,7 +316,7 @@ export default class ApiKeysIndexController extends Controller {
315316 setExpiration : ( { target } ) => {
316317 apiKey . expires_at = target . value || null ;
317318 } ,
318- confirm : async modal => {
319+ confirm : async ( modal ) => {
319320 modal . startLoading ( ) ;
320321
321322 if ( this . abilities . cannot ( formPermission ) ) {
@@ -340,7 +341,7 @@ export default class ApiKeysIndexController extends Controller {
340341 *
341342 * @void
342343 */
343- @action renameApiKey ( apiKey ) {
344+ @action renameApiKey ( apiKey ) {
344345 const formPermission = 'developers update api-key' ;
345346 const apiKeyName = getWithDefault ( apiKey , 'name' , this . intl . t ( 'developers.api-keys.index.untitled' ) ) ;
346347
@@ -350,7 +351,7 @@ export default class ApiKeysIndexController extends Controller {
350351 acceptButtonHelpText : this . abilities . cannot ( formPermission ) ? this . intl . t ( 'common.unauthorized' ) : null ,
351352 apiKey,
352353 formPermission,
353- confirm : async modal => {
354+ confirm : async ( modal ) => {
354355 modal . startLoading ( ) ;
355356
356357 try {
@@ -370,12 +371,12 @@ export default class ApiKeysIndexController extends Controller {
370371 *
371372 * @void
372373 */
373- @action deleteApiKey ( apiKey ) {
374+ @action deleteApiKey ( apiKey ) {
374375 const apiKeyName = getWithDefault ( apiKey , 'name' , this . intl . t ( 'developers.api-keys.index.untitled' ) ) ;
375376 this . modalsManager . confirm ( {
376377 title : this . intl . t ( 'developers.api-keys.index.delete-api-key-title' , { apiKeyName } ) ,
377378 body : this . intl . t ( 'developers.api-keys.index.delete-api-key-body' ) ,
378- confirm : async modal => {
379+ confirm : async ( modal ) => {
379380 modal . startLoading ( ) ;
380381
381382 try {
@@ -396,7 +397,7 @@ export default class ApiKeysIndexController extends Controller {
396397 * @param {Array } selected an array of selected models
397398 * @void
398399 */
399- @action bulkDeleteApiCredentials ( ) {
400+ @action bulkDeleteApiCredentials ( ) {
400401 const selected = this . table . selectedRows ;
401402
402403 this . crud . bulkDelete ( selected , {
@@ -412,7 +413,7 @@ export default class ApiKeysIndexController extends Controller {
412413 *
413414 * @void
414415 */
415- @action rollApiKey ( apiKey ) {
416+ @action rollApiKey ( apiKey ) {
416417 const formPermission = 'developers roll api-key' ;
417418 const apiKeyName = getWithDefault ( apiKey , 'name' , this . intl . t ( 'developers.api-keys.index.untitled' ) ) ;
418419
@@ -431,7 +432,7 @@ export default class ApiKeysIndexController extends Controller {
431432 password : null ,
432433 formPermission,
433434 apiKey,
434- confirm : async modal => {
435+ confirm : async ( modal ) => {
435436 modal . startLoading ( ) ;
436437
437438 try {
@@ -455,7 +456,7 @@ export default class ApiKeysIndexController extends Controller {
455456 *
456457 * @void
457458 */
458- @action viewRequestLogs ( apiKey ) {
459+ @action viewRequestLogs ( apiKey ) {
459460 return this . universe . transitionToEngineRoute ( '@fleetbase/dev-engine' , 'logs.index' , {
460461 queryParams : { key : apiKey . id } ,
461462 } ) ;
@@ -466,7 +467,7 @@ export default class ApiKeysIndexController extends Controller {
466467 *
467468 * @void
468469 */
469- @action exportApiKeys ( ) {
470+ @action exportApiKeys ( ) {
470471 this . modalsManager . show ( 'modals/export-form' , {
471472 title : this . intl . t ( 'developers.api-keys.index.export-api' ) ,
472473 acceptButtonText : this . intl . t ( 'developers.api-keys.index.export-api-accept-button-text' ) ,
@@ -475,7 +476,7 @@ export default class ApiKeysIndexController extends Controller {
475476 setFormat : ( { target } ) => {
476477 this . modalsManager . setOption ( 'format' , target . value || null ) ;
477478 } ,
478- confirm : async modal => {
479+ confirm : async ( modal ) => {
479480 modal . startLoading ( ) ;
480481
481482 const format = modal . getOption ( 'format' , 'xlsx' ) ;
@@ -493,7 +494,7 @@ export default class ApiKeysIndexController extends Controller {
493494 later (
494495 this ,
495496 ( ) => {
496- return model . done ( ) ;
497+ return modal . done ( ) ;
497498 } ,
498499 600
499500 ) ;
@@ -508,7 +509,7 @@ export default class ApiKeysIndexController extends Controller {
508509 /**
509510 * Reload data.
510511 */
511- @action reload ( ) {
512+ @action reload ( ) {
512513 return this . hostRouter . refresh ( ) ;
513514 }
514515}
0 commit comments