open-vault/ui/app/routes/vault/cluster/secrets/backend.js
2018-10-18 14:54:34 -05:00

25 lines
623 B
JavaScript

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
export default Route.extend({
flashMessages: service(),
model(params) {
let { backend } = params;
return this.store
.query('secret-engine', {
path: backend,
})
.then(model => {
if (model) {
return model.get('firstObject');
}
});
},
afterModel(model, transition) {
let path = model && model.get('path');
if (transition.targetName === this.routeName) {
return this.replaceWith('vault.cluster.secrets.backend.list-root', path);
}
},
});