feca115ef4
* setup for concept it works, but probably not the best solution * add comment and remove console and test var * use normalize path higher up to fix issu * add test for bug that fixing * forgot a couple of changes * changelog
30 lines
1,009 B
JavaScript
30 lines
1,009 B
JavaScript
import Route from '@ember/routing/route';
|
|
import utils from 'vault/lib/key-utils';
|
|
import UnloadModelRoute from 'vault/mixins/unload-model-route';
|
|
import { normalizePath } from 'vault/utils/path-encoding-helpers';
|
|
|
|
export default Route.extend(UnloadModelRoute, {
|
|
templateName: 'vault/cluster/secrets/backend/versions',
|
|
|
|
beforeModel() {
|
|
let backendModel = this.modelFor('vault.cluster.secrets.backend');
|
|
const { secret } = this.paramsFor(this.routeName);
|
|
const parentKey = utils.parentKeyForKey(secret);
|
|
if (backendModel.get('isV2KV')) {
|
|
return;
|
|
}
|
|
if (parentKey) {
|
|
return this.transitionTo('vault.cluster.secrets.backend.list', parentKey);
|
|
} else {
|
|
return this.transitionTo('vault.cluster.secrets.backend.list-root');
|
|
}
|
|
},
|
|
|
|
model(params) {
|
|
let { secret } = params;
|
|
const { backend } = this.paramsFor('vault.cluster.secrets.backend');
|
|
let id = normalizePath(secret);
|
|
return this.store.queryRecord('secret-v2', { id, backend });
|
|
},
|
|
});
|