UI: Pki engine (redesign) routing changes (#17997)
* reroute pki config routes * issuers routes * refactor role routes * add issuer/generate- routes * update key routes * refactor cert routes; * template cleanup, update routes * update component names with pki- * update components in test files
This commit is contained in:
parent
5ec0d57313
commit
a4270c7701
|
@ -2,12 +2,12 @@ import Component from '@glimmer/component';
|
|||
import { action } from '@ember/object';
|
||||
|
||||
/**
|
||||
* @module KeyParameters
|
||||
* KeyParameters components are used to set the default and update the key_bits pki role api param whenever the key_type changes.
|
||||
* @module PkiKeyParameters
|
||||
* PkiKeyParameters components are used to set the default and update the key_bits pki role api param whenever the key_type changes.
|
||||
* key_bits is conditional on key_type and should be set as a default value whenever key_type changes.
|
||||
* @example
|
||||
* ```js
|
||||
* <KeyParameters @model={@model} @group={group}/>
|
||||
* <PkiKeyParameters @model={@model} @group={group}/>
|
||||
* ```
|
||||
* @param {class} model - The pki/role model.
|
||||
* @param {string} group - The name of the group created in the model. In this case, it's the "Key parameters" group.
|
||||
|
@ -20,7 +20,7 @@ const KEY_BITS_OPTIONS = {
|
|||
any: [0],
|
||||
};
|
||||
|
||||
export default class KeyParameters extends Component {
|
||||
export default class PkiKeyParameters extends Component {
|
||||
get keyBitOptions() {
|
||||
return KEY_BITS_OPTIONS[this.args.model.keyType];
|
||||
}
|
|
@ -47,9 +47,9 @@
|
|||
</FormField>
|
||||
{{/each}}
|
||||
{{else if (eq group "Key usage")}}
|
||||
<KeyUsage @model={{@model}} @group={{group}} />
|
||||
<PkiKeyUsage @model={{@model}} @group={{group}} />
|
||||
{{else if (eq group "Key parameters")}}
|
||||
<KeyParameters @model={{@model}} @group={{group}} />
|
||||
<PkiKeyParameters @model={{@model}} @group={{group}} />
|
||||
{{else}}
|
||||
{{! Groups hidden behind Toggles }}
|
||||
{{#let (camelize (concat "show" group)) as |prop|}}
|
|
@ -5,12 +5,12 @@ import { task } from 'ember-concurrency';
|
|||
import { tracked } from '@glimmer/tracking';
|
||||
|
||||
/**
|
||||
* @module RoleForm
|
||||
* RoleForm components are used to create and update PKI roles.
|
||||
* @module PkiRoleForm
|
||||
* PkiRoleForm components are used to create and update PKI roles.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* <RoleForm @model={{this.model}}/>
|
||||
* <PkiRoleForm @model={{this.model}}/>
|
||||
* ```
|
||||
* @callback onCancel
|
||||
* @callback onSave
|
||||
|
@ -19,7 +19,7 @@ import { tracked } from '@glimmer/tracking';
|
|||
* @param {onSave} onSave - Callback triggered on save success.
|
||||
*/
|
||||
|
||||
export default class RoleForm extends Component {
|
||||
export default class PkiRoleForm extends Component {
|
||||
@service store;
|
||||
@service flashMessages;
|
||||
|
|
@ -3,45 +3,44 @@ import buildRoutes from 'ember-engines/routes';
|
|||
export default buildRoutes(function () {
|
||||
this.route('overview');
|
||||
this.route('configuration', function () {
|
||||
this.route('index', { path: '/' });
|
||||
this.route('tidy');
|
||||
this.route('create', function () {
|
||||
this.route('index', { path: '/' });
|
||||
this.route('import-ca');
|
||||
this.route('generate-root');
|
||||
this.route('generate-csr');
|
||||
});
|
||||
this.route('create');
|
||||
this.route('edit');
|
||||
this.route('details');
|
||||
});
|
||||
this.route('roles', function () {
|
||||
this.route('index', { path: '/' });
|
||||
this.route('create');
|
||||
this.route('role', { path: '/:id' }, function () {
|
||||
this.route('role', { path: '/:role' }, function () {
|
||||
this.route('details');
|
||||
this.route('edit');
|
||||
this.route('generate');
|
||||
this.route('sign');
|
||||
});
|
||||
});
|
||||
this.route('issuers', function () {
|
||||
this.route('index', { path: '/' });
|
||||
this.route('issuer', { path: '/:id' }, function () {
|
||||
this.route('import');
|
||||
this.route('generate-root');
|
||||
this.route('generate-intermediate');
|
||||
this.route('issuer', { path: '/:issuer_ref' }, function () {
|
||||
this.route('details');
|
||||
this.route('edit');
|
||||
this.route('sign');
|
||||
this.route('cross-sign');
|
||||
});
|
||||
});
|
||||
this.route('certificates', function () {
|
||||
this.route('index', { path: '/' });
|
||||
this.route('create');
|
||||
this.route('certificate', { path: '/:id' }, function () {
|
||||
this.route('certificate', { path: '/:serial' }, function () {
|
||||
this.route('details');
|
||||
this.route('edit');
|
||||
});
|
||||
});
|
||||
this.route('keys', function () {
|
||||
this.route('index', { path: '/' });
|
||||
this.route('generate');
|
||||
this.route('create');
|
||||
this.route('import');
|
||||
this.route('key', { path: '/:id' }, function () {
|
||||
this.route('key', { path: '/:key_ref' }, function () {
|
||||
this.route('details');
|
||||
this.route('edit');
|
||||
});
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiCertificateDetailsRoute extends Route {}
|
|
@ -8,12 +8,12 @@ export default class PkiCertificatesIndexRoute extends Route {
|
|||
|
||||
beforeModel() {
|
||||
// Must call this promise before the model hook otherwise it doesn't add OpenApi to record.
|
||||
return this.pathHelp.getNewModel('pki/pki-certificate-engine', 'pki');
|
||||
return this.pathHelp.getNewModel('pki/certificate', 'pki');
|
||||
}
|
||||
|
||||
model() {
|
||||
return this.store
|
||||
.query('pki/pki-certificate-engine', { backend: this.secretMountPath.currentPath })
|
||||
.query('pki/certificate', { backend: this.secretMountPath.currentPath })
|
||||
.then((certificateModel) => {
|
||||
return { certificateModel, parentModel: this.modelFor('certificates') };
|
||||
})
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationCreateRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationCreateGenerateCsrRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationCreateGenerateRootRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationCreateImportCaRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ConfigurationCreateIndexRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationDetailsRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiConfigurationIndexRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuersGenerateIntermediateRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuersGenerateRootRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuersImportRoute extends Route {}
|
|
@ -8,15 +8,14 @@ export default class PkiIssuersIndexRoute extends Route {
|
|||
|
||||
beforeModel() {
|
||||
// Must call this promise before the model hook otherwise it doesn't add OpenApi to record.
|
||||
return this.pathHelp.getNewModel('pki/pki-issuer-engine', 'pki');
|
||||
return this.pathHelp.getNewModel('pki/issuer', 'pki');
|
||||
}
|
||||
|
||||
model() {
|
||||
// the pathHelp service is needed for adding openAPI to the model
|
||||
this.pathHelp.getNewModel('pki/pki-issuer-engine', 'pki');
|
||||
|
||||
this.pathHelp.getNewModel('pki/issuer', 'pki');
|
||||
return this.store
|
||||
.query('pki/pki-issuer-engine', { backend: this.secretMountPath.currentPath })
|
||||
.query('pki/issuer', { backend: this.secretMountPath.currentPath })
|
||||
.then((issuersModel) => {
|
||||
return { issuersModel, parentModel: this.modelFor('issuers') };
|
||||
})
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuerCrossSignRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuerDetailsRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuerEditRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiIssuerSignRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiKeysCreateRoute extends Route {}
|
|
@ -1,3 +0,0 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiKeysGenerateRoute extends Route {}
|
|
@ -8,12 +8,12 @@ export default class PkiKeysIndexRoute extends Route {
|
|||
|
||||
beforeModel() {
|
||||
// Must call this promise before the model hook otherwise it doesn't add OpenApi to record.
|
||||
return this.pathHelp.getNewModel('pki/pki-key-engine', 'pki');
|
||||
return this.pathHelp.getNewModel('pki/key', 'pki');
|
||||
}
|
||||
|
||||
model() {
|
||||
return this.store
|
||||
.query('pki/pki-key-engine', { backend: this.secretMountPath.currentPath })
|
||||
.query('pki/key', { backend: this.secretMountPath.currentPath })
|
||||
.then((keyModel) => {
|
||||
return { keyModel, parentModel: this.modelFor('keys') };
|
||||
})
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiKeysKeyDetailsRoute extends Route {}
|
||||
export default class PkiKeyDetailsRoute extends Route {}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiKeysKeyEditRoute extends Route {}
|
||||
export default class PkiKeyEditRoute extends Route {}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class RolesRoleDetailsRoute extends Route {}
|
||||
export default class PkiRoleDetailsRoute extends Route {}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class RolesRoleEditRoute extends Route {}
|
||||
export default class PkiRoleEditRoute extends Route {}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiRoleGenerateRoute extends Route {}
|
|
@ -0,0 +1,3 @@
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PkiRoleSignRoute extends Route {}
|
|
@ -0,0 +1 @@
|
|||
route: certificate.details
|
|
@ -55,7 +55,7 @@
|
|||
{{/each}}
|
||||
{{else}}
|
||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn't yet been configured with a certificate issuer.">
|
||||
<LinkTo @route="configuration.create.index" @model={{this.model.certificateModel}}>
|
||||
<LinkTo @route="configuration.create">
|
||||
{{! ARG TODO if configuration of engine not setup then direct toward setting that up otherwise replace with new design language }}
|
||||
</LinkTo>
|
||||
</EmptyState>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
route: pki.configuration.create
|
|
@ -1 +0,0 @@
|
|||
configuration.create.generate-csr
|
|
@ -1 +0,0 @@
|
|||
configuration.create.generate-root
|
|
@ -1 +0,0 @@
|
|||
configuration.create.import-ca
|
|
@ -1 +0,0 @@
|
|||
configuration.create.index
|
|
@ -1 +0,0 @@
|
|||
configuration.details
|
|
@ -0,0 +1 @@
|
|||
route: issuers.generate-intermediate
|
|
@ -0,0 +1 @@
|
|||
route: issuers.generate-root
|
|
@ -0,0 +1,2 @@
|
|||
{{! https://github.com/hashicorp/vault/blob/main/website/content/api-docs/secret/pki.mdx#import-ca-certificates-and-keys }}
|
||||
route: issuers.import POST /pki/issuers/import/bundle POST /pki/issuers/import/cert
|
|
@ -10,7 +10,7 @@
|
|||
/>
|
||||
<Toolbar>
|
||||
<ToolbarActions>
|
||||
<ToolbarLink @route="configuration.create.import-ca">
|
||||
<ToolbarLink @route="issuers.import">
|
||||
Import
|
||||
</ToolbarLink>
|
||||
<BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" as |D|>
|
||||
|
@ -22,12 +22,12 @@
|
|||
<nav class="box menu" aria-label="generate options">
|
||||
<ul class="menu-list">
|
||||
<li class="action">
|
||||
<LinkTo @route="configuration.create.generate-root" {{on "click" (fn this.onLinkClick D)}}>
|
||||
<LinkTo @route="issuers.generate-root" {{on "click" (fn this.onLinkClick D)}}>
|
||||
Root
|
||||
</LinkTo>
|
||||
</li>
|
||||
<li class="action">
|
||||
<LinkTo @route="configuration.create.generate-csr" {{on "click" (fn this.onLinkClick D)}}>
|
||||
<LinkTo @route="issuers.generate-intermediate" {{on "click" (fn this.onLinkClick D)}}>
|
||||
Intermediate CSR
|
||||
</LinkTo>
|
||||
</li>
|
||||
|
@ -82,7 +82,7 @@
|
|||
{{/each}}
|
||||
{{else}}
|
||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn’t yet been configured with a certificate issuer.">
|
||||
<LinkTo @route="configuration.create.index" @model={{this.model.issuersModel}}>
|
||||
<LinkTo @route="configuration.create">
|
||||
Configure PKI
|
||||
</LinkTo>
|
||||
</EmptyState>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
route: issuers.issuer.cross-sign
|
|
@ -0,0 +1 @@
|
|||
route: issuers.issuer.details
|
|
@ -0,0 +1 @@
|
|||
route: issuers.issuer.edit
|
|
@ -0,0 +1 @@
|
|||
route: issuers.issuer.sign
|
|
@ -13,7 +13,7 @@
|
|||
<ToolbarLink @route="keys.import" @type="download">
|
||||
Import
|
||||
</ToolbarLink>
|
||||
<ToolbarLink @route="keys.generate" @type="add">
|
||||
<ToolbarLink @route="keys.create" @type="add">
|
||||
Generate
|
||||
</ToolbarLink>
|
||||
</ToolbarActions>
|
||||
|
@ -63,7 +63,7 @@
|
|||
{{/each}}
|
||||
{{else}}
|
||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn’t yet been configured with a certificate issuer.">
|
||||
<LinkTo @route="configuration.create.index" @model={{this.model.keyModel}}>
|
||||
<LinkTo @route="configuration.create">
|
||||
ARG TODO waiting for language from design
|
||||
</LinkTo>
|
||||
</EmptyState>
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
/>
|
||||
<Toolbar>
|
||||
<ToolbarActions>
|
||||
<ToolbarLink @route="configuration.create.index">
|
||||
<ToolbarLink @route="configuration.create">
|
||||
Configure PKI
|
||||
</ToolbarLink>
|
||||
</ToolbarActions>
|
||||
</Toolbar>
|
||||
|
||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn’t yet been configured with a certificate issuer.">
|
||||
<LinkTo @route="configuration.create.index" @model={{this.model}}>
|
||||
<LinkTo @route="configuration.create" @model={{this.model}}>
|
||||
Configure PKI
|
||||
</LinkTo>
|
||||
</EmptyState>
|
|
@ -1,4 +1,4 @@
|
|||
<RoleForm
|
||||
<PkiRoleForm
|
||||
@model={{this.model}}
|
||||
@onCancel={{transition-to "vault.cluster.secrets.backend.pki.roles.index"}}
|
||||
@onSave={{transition-to "vault.cluster.secrets.backend.pki.roles.role.details" this.model.id}}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
route: roles.role.generate
|
|
@ -0,0 +1 @@
|
|||
route: roles.role.sign
|
|
@ -5,7 +5,7 @@ import { hbs } from 'ember-cli-htmlbars';
|
|||
import { setupEngine } from 'ember-engines/test-support';
|
||||
import { SELECTORS } from 'vault/tests/helpers/pki-engine';
|
||||
|
||||
module('Integration | Component | pki/key-parameters', function (hooks) {
|
||||
module('Integration | Component | pki-key-parameters', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
setupEngine(hooks, 'pki');
|
||||
|
||||
|
@ -20,7 +20,7 @@ module('Integration | Component | pki/key-parameters', function (hooks) {
|
|||
await render(
|
||||
hbs`
|
||||
<div class="has-top-margin-xxl">
|
||||
<KeyParameters
|
||||
<PkiKeyParameters
|
||||
@model={{this.model}}
|
||||
@group="Key parameters"
|
||||
/>
|
||||
|
@ -39,7 +39,7 @@ module('Integration | Component | pki/key-parameters', function (hooks) {
|
|||
await render(
|
||||
hbs`
|
||||
<div class="has-top-margin-xxl">
|
||||
<KeyParameters
|
||||
<PkiKeyParameters
|
||||
@model={{this.model}}
|
||||
@group="Key parameters"
|
||||
/>
|
|
@ -5,7 +5,7 @@ import { hbs } from 'ember-cli-htmlbars';
|
|||
import { setupEngine } from 'ember-engines/test-support';
|
||||
import { SELECTORS } from 'vault/tests/helpers/pki-engine';
|
||||
|
||||
module('Integration | Component | pki/key-usage', function (hooks) {
|
||||
module('Integration | Component | pki-key-usage', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
setupEngine(hooks, 'pki');
|
||||
|
||||
|
@ -20,7 +20,7 @@ module('Integration | Component | pki/key-usage', function (hooks) {
|
|||
await render(
|
||||
hbs`
|
||||
<div class="has-top-margin-xxl">
|
||||
<KeyUsage
|
||||
<PkiKeyUsage
|
||||
@model={{this.model}}
|
||||
@group="Key usage"
|
||||
/>
|
||||
|
@ -50,7 +50,7 @@ module('Integration | Component | pki/key-usage', function (hooks) {
|
|||
await render(
|
||||
hbs`
|
||||
<div class="has-top-margin-xxl">
|
||||
<KeyUsage
|
||||
<PkiKeyUsage
|
||||
@model={{this.model}}
|
||||
@group="Key usage"
|
||||
/>
|
|
@ -6,7 +6,7 @@ import { setupEngine } from 'ember-engines/test-support';
|
|||
import { SELECTORS } from 'vault/tests/helpers/pki-engine';
|
||||
import { setupMirage } from 'ember-cli-mirage/test-support';
|
||||
|
||||
module('Integration | Component | pki/role-form', function (hooks) {
|
||||
module('Integration | Component | pki-role-form', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupEngine(hooks, 'pki'); // https://github.com/ember-engines/ember-engines/pull/653
|
||||
|
@ -21,7 +21,7 @@ module('Integration | Component | pki/role-form', function (hooks) {
|
|||
assert.expect(13);
|
||||
await render(
|
||||
hbs`
|
||||
<RoleForm
|
||||
<PkiRoleForm
|
||||
@model={{this.model}}
|
||||
@onCancel={{this.onCancel}}
|
||||
@onSave={{this.onSave}}
|
||||
|
@ -72,7 +72,7 @@ module('Integration | Component | pki/role-form', function (hooks) {
|
|||
|
||||
await render(
|
||||
hbs`
|
||||
<RoleForm
|
||||
<PkiRoleForm
|
||||
@model={{this.model}}
|
||||
@onCancel={{this.onCancel}}
|
||||
@onSave={{this.onSave}}
|
Loading…
Reference in New Issue