mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
UI secret navigation improvements (#5976)
* don't pass id when using createRecord * add find nearest ancestor mixin * re-throw the error if we've deleted something and encounter a 404 * use the with-nav-to-nearest-ancestor mixin * add some comments * add acceptance test to verify new behavior * yield final transition in ec task
This commit is contained in:
@@ -5,6 +5,7 @@ import { computed, set } from '@ember/object';
|
||||
import { alias, or } from '@ember/object/computed';
|
||||
import { task, waitForEvent } from 'ember-concurrency';
|
||||
import FocusOnInsertMixin from 'vault/mixins/focus-on-insert';
|
||||
import WithNavToNearestAncestor from 'vault/mixins/with-nav-to-nearest-ancestor';
|
||||
import keys from 'vault/lib/keycodes';
|
||||
import KVObject from 'vault/lib/kv-object';
|
||||
import { maybeQueryRecord } from 'vault/macros/maybe-query-record';
|
||||
@@ -13,7 +14,7 @@ const LIST_ROUTE = 'vault.cluster.secrets.backend.list';
|
||||
const LIST_ROOT_ROUTE = 'vault.cluster.secrets.backend.list-root';
|
||||
const SHOW_ROUTE = 'vault.cluster.secrets.backend.show';
|
||||
|
||||
export default Component.extend(FocusOnInsertMixin, {
|
||||
export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, {
|
||||
wizard: service(),
|
||||
router: service(),
|
||||
store: service(),
|
||||
@@ -163,7 +164,7 @@ export default Component.extend(FocusOnInsertMixin, {
|
||||
}),
|
||||
|
||||
transitionToRoute() {
|
||||
this.router.transitionTo(...arguments);
|
||||
return this.router.transitionTo(...arguments);
|
||||
},
|
||||
|
||||
onEscape(e) {
|
||||
@@ -304,8 +305,9 @@ export default Component.extend(FocusOnInsertMixin, {
|
||||
},
|
||||
|
||||
deleteKey() {
|
||||
let { id } = this.model;
|
||||
this.model.destroyRecord().then(() => {
|
||||
this.transitionToRoute(LIST_ROOT_ROUTE);
|
||||
this.navToNearestAncestor.perform(id);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user