open-vault/ui/app/routes/vault/cluster/secrets/backend.js

33 lines
1,021 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import Ember from 'ember';
const { inject } = Ember;
export default Ember.Route.extend({
flashMessages: inject.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 target = transition.targetName;
let path = model && model.get('path');
let type = model && model.get('type');
if (type === 'kv' && model.get('options.version') === 2) {
2018-04-03 14:16:57 +00:00
this.get('flashMessages').stickyInfo(
`"${path}" is a newer version of the KV backend. The Vault UI does not currently support the additional versioning features. All actions taken through the UI in this engine will operate on the most recent version of a secret.`
2018-04-03 14:16:57 +00:00
);
}
if (target === this.routeName) {
return this.replaceWith('vault.cluster.secrets.backend.list-root', path);
2018-04-03 14:16:57 +00:00
}
},
});