2018-04-03 14:16:57 +00:00
|
|
|
import Ember from 'ember';
|
|
|
|
import UnloadModel from 'vault/mixins/unload-model-route';
|
|
|
|
|
|
|
|
const SUPPORTED_DYNAMIC_BACKENDS = ['ssh', 'aws', 'pki'];
|
|
|
|
|
|
|
|
export default Ember.Route.extend(UnloadModel, {
|
|
|
|
templateName: 'vault/cluster/secrets/backend/credentials',
|
|
|
|
|
|
|
|
backendModel() {
|
2018-04-24 21:30:44 +00:00
|
|
|
return this.modelFor('vault.cluster.secrets.backend');
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
model(params) {
|
|
|
|
const role = params.secret;
|
|
|
|
const backendModel = this.backendModel();
|
|
|
|
const backend = backendModel.get('id');
|
|
|
|
|
|
|
|
if (!SUPPORTED_DYNAMIC_BACKENDS.includes(backendModel.get('type'))) {
|
|
|
|
return this.transitionTo('vault.cluster.secrets.backend.list-root', backend);
|
|
|
|
}
|
2018-04-25 03:22:18 +00:00
|
|
|
return Ember.RSVP.resolve({
|
|
|
|
backend,
|
|
|
|
id: role,
|
|
|
|
name: role,
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller) {
|
|
|
|
this._super(...arguments);
|
|
|
|
controller.set('backend', this.backendModel());
|
|
|
|
},
|
|
|
|
|
|
|
|
resetController(controller) {
|
|
|
|
controller.reset();
|
|
|
|
},
|
|
|
|
});
|