2018-09-25 16:28:26 +00:00
|
|
|
import { resolve } from 'rsvp';
|
|
|
|
import Route from '@ember/routing/route';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
const SUPPORTED_DYNAMIC_BACKENDS = ['ssh', 'aws', 'pki'];
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Route.extend({
|
2018-04-03 14:16:57 +00:00
|
|
|
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) {
|
2018-09-25 16:28:26 +00:00
|
|
|
let role = params.secret;
|
|
|
|
let backendModel = this.backendModel();
|
|
|
|
let backendPath = backendModel.get('id');
|
|
|
|
let backendType = backendModel.get('type');
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
if (!SUPPORTED_DYNAMIC_BACKENDS.includes(backendModel.get('type'))) {
|
2018-09-25 16:28:26 +00:00
|
|
|
return this.transitionTo('vault.cluster.secrets.backend.list-root', backendPath);
|
2018-04-03 14:16:57 +00:00
|
|
|
}
|
2018-09-25 16:28:26 +00:00
|
|
|
return resolve({
|
|
|
|
backendPath,
|
|
|
|
backendType,
|
|
|
|
roleName: role,
|
2018-04-25 03:22:18 +00:00
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
resetController(controller) {
|
|
|
|
controller.reset();
|
|
|
|
},
|
|
|
|
});
|