Files
nomad/ui/app/controllers/variables/variable/index.js
Phil Renaud 2e433c8c4f Path Tree compaction refactor (#13415)
* Bones of a just-in-time compaction pathTree

* wooo got compaction going in sub-ms times

* PR cleanup

* Path compaction tests

* lint fix to equal instead of .ok()

* Name prop specifically being equality checked
2022-07-11 13:34:05 -04:00

36 lines
996 B
JavaScript

import Controller from '@ember/controller';
import { task } from 'ember-concurrency';
import messageForError from '../../../utils/message-from-adapter-error';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
export default class VariablesVariableIndexController extends Controller {
@service router;
@tracked
error = null;
@task(function* () {
try {
yield this.model.deleteRecord();
yield this.model.save();
if (this.model.parentFolderPath) {
this.router.transitionTo('variables.path', this.model.parentFolderPath);
} else {
this.router.transitionTo('variables');
}
// TODO: alert the user that the variable was successfully deleted
} catch (err) {
this.error = {
title: 'Could Not Delete Variable',
description: messageForError(err, 'delete secure variables'),
};
}
})
deleteVariableFile;
onDismissError() {
this.error = null;
}
}