mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 03:58:01 +00:00
PKI: Fix small routing issues with SecretListHeader (#17526)
* fix routing issues with SecretListHeader * clean up
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import { action } from '@ember/object';
|
import { action } from '@ember/object';
|
||||||
import { next } from '@ember/runloop';
|
import { next } from '@ember/runloop';
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
|
|
||||||
export default class PkiRolesIssuerController extends Controller {
|
export default class PkiRolesIssuerController extends Controller {
|
||||||
|
get mountPoint() {
|
||||||
|
return getOwner(this).mountPoint;
|
||||||
|
}
|
||||||
// To prevent production build bug of passing D.actions to on "click": https://github.com/hashicorp/vault/pull/16983
|
// To prevent production build bug of passing D.actions to on "click": https://github.com/hashicorp/vault/pull/16983
|
||||||
@action onLinkClick(D) {
|
@action onLinkClick(D) {
|
||||||
next(() => D.actions.close());
|
next(() => D.actions.close());
|
||||||
|
|||||||
8
ui/lib/pki/addon/controllers/keys/index.js
Normal file
8
ui/lib/pki/addon/controllers/keys/index.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { getOwner } from '@ember/application';
|
||||||
|
|
||||||
|
export default class PkiRolesIssuerController extends Controller {
|
||||||
|
get mountPoint() {
|
||||||
|
return getOwner(this).mountPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import Route from '@ember/routing/route';
|
|
||||||
|
|
||||||
export default class PkiCertificatesRoute extends Route {}
|
|
||||||
@@ -4,13 +4,22 @@ import { inject as service } from '@ember/service';
|
|||||||
export default class PkiCertificatesIndexRoute extends Route {
|
export default class PkiCertificatesIndexRoute extends Route {
|
||||||
@service store;
|
@service store;
|
||||||
@service secretMountPath;
|
@service secretMountPath;
|
||||||
|
@service pathHelp;
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store
|
return this.store
|
||||||
.query('pki/pki-certificate-engine', { backend: this.secretMountPath.currentPath })
|
.query('pki/pki-certificate-engine', { backend: this.secretMountPath.currentPath })
|
||||||
|
.then((certificateModel) => {
|
||||||
|
return { certificateModel, parentModel: this.modelFor('certificates') };
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.httpStatus === 404) {
|
if (err.httpStatus === 404) {
|
||||||
return [];
|
return { parentModel: this.modelFor('certificates') };
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default class ConfigurationDetailsRoute extends Route {}
|
export default class PkiConfigurationDetailsRoute extends Route {}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default class ConfigurationEditRoute extends Route {}
|
export default class PkiConfigurationEditRoute extends Route {}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default class ConfigurationIndexRoute extends Route {}
|
export default class PkiConfigurationIndexRoute extends Route {}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default class ConfigurationTidyRoute extends Route {}
|
export default class PkiConfigurationTidyRoute extends Route {}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import Route from '@ember/routing/route';
|
|
||||||
|
|
||||||
export default class PkiIssuersRoute extends Route {}
|
|
||||||
@@ -6,15 +6,23 @@ export default class PkiIssuersIndexRoute extends Route {
|
|||||||
@service secretMountPath;
|
@service secretMountPath;
|
||||||
@service pathHelp;
|
@service pathHelp;
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
// the pathHelp service is needed for adding openAPI to the model
|
// the pathHelp service is needed for adding openAPI to the model
|
||||||
this.pathHelp.getNewModel('pki/pki-issuer-engine', 'pki');
|
this.pathHelp.getNewModel('pki/pki-issuer-engine', 'pki');
|
||||||
|
|
||||||
return this.store
|
return this.store
|
||||||
.query('pki/pki-issuer-engine', { backend: this.secretMountPath.currentPath })
|
.query('pki/pki-issuer-engine', { backend: this.secretMountPath.currentPath })
|
||||||
|
.then((issuersModel) => {
|
||||||
|
return { issuersModel, parentModel: this.modelFor('issuers') };
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.httpStatus === 404) {
|
if (err.httpStatus === 404) {
|
||||||
return [];
|
return { parentModel: this.modelFor('issuers') };
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import Route from '@ember/routing/route';
|
|
||||||
|
|
||||||
export default class PkiKeysRoute extends Route {}
|
|
||||||
@@ -4,13 +4,22 @@ import { inject as service } from '@ember/service';
|
|||||||
export default class PkiKeysIndexRoute extends Route {
|
export default class PkiKeysIndexRoute extends Route {
|
||||||
@service store;
|
@service store;
|
||||||
@service secretMountPath;
|
@service secretMountPath;
|
||||||
|
@service pathHelp;
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store
|
return this.store
|
||||||
.query('pki/pki-key-engine', { backend: this.secretMountPath.currentPath })
|
.query('pki/pki-key-engine', { backend: this.secretMountPath.currentPath })
|
||||||
|
.then((keyModel) => {
|
||||||
|
return { keyModel, parentModel: this.modelFor('keys') };
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.httpStatus === 404) {
|
if (err.httpStatus === 404) {
|
||||||
return [];
|
return { parentModel: this.modelFor('keys') };
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
export default class RolesIndexRoute extends Route {
|
export default class PkiRolesIndexRoute extends Route {
|
||||||
@service store;
|
@service store;
|
||||||
@service secretMountPath;
|
@service secretMountPath;
|
||||||
@service pathHelp;
|
@service pathHelp;
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<SecretListHeader
|
|
||||||
@model={{this.model}}
|
|
||||||
@backendCrumb={{hash
|
|
||||||
label=this.model.id
|
|
||||||
text=this.model.id
|
|
||||||
path="vault.cluster.secrets.backend.list-root"
|
|
||||||
model=this.model.id
|
|
||||||
}}
|
|
||||||
@isEngine={{true}}
|
|
||||||
/>
|
|
||||||
{{outlet}}
|
|
||||||
@@ -1,12 +1,23 @@
|
|||||||
|
<SecretListHeader
|
||||||
|
@model={{this.model.parentModel}}
|
||||||
|
@backendCrumb={{hash
|
||||||
|
label=this.model.parentModel.id
|
||||||
|
text=this.model.parentModel.id
|
||||||
|
path="vault.cluster.secrets.backend.list-root"
|
||||||
|
model=this.model.parentModel.id
|
||||||
|
}}
|
||||||
|
@isEngine={{true}}
|
||||||
|
/>
|
||||||
|
{{outlet}}
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
{{#if (gt this.model.length 0)}}
|
{{#if this.model.certificateModel.length}}
|
||||||
<ToolbarFilters>
|
<ToolbarFilters>
|
||||||
{{! ARG TODO glimmerize the NavigateInput and refactor so you can use it in an engine }}
|
{{! ARG TODO glimmerize the NavigateInput and refactor so you can use it in an engine }}
|
||||||
</ToolbarFilters>
|
</ToolbarFilters>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
{{#if (gt this.model.length 0)}}
|
{{#if this.model.certificateModel.length}}
|
||||||
{{#each this.model as |pkiCertificate|}}
|
{{#each this.model.certificateModel as |pkiCertificate|}}
|
||||||
<LinkedBlock
|
<LinkedBlock
|
||||||
class="list-item-row"
|
class="list-item-row"
|
||||||
@params={{array "certificates.certificate.details" pkiCertificate.id}}
|
@params={{array "certificates.certificate.details" pkiCertificate.id}}
|
||||||
@@ -44,8 +55,8 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn't yet been configured with a certificate issuer.">
|
<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.index" @model={{this.model.certificateModel}}>
|
||||||
ARG TODO waiting from design for language.
|
{{! ARG TODO if configuration of engine not setup then direct toward setting that up otherwise replace with new design language }}
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<SecretListHeader
|
|
||||||
@model={{this.model}}
|
|
||||||
@backendCrumb={{hash
|
|
||||||
label=this.model.id
|
|
||||||
text=this.model.id
|
|
||||||
path="vault.cluster.secrets.backend.list-root"
|
|
||||||
model=this.model.id
|
|
||||||
}}
|
|
||||||
@isEngine={{true}}
|
|
||||||
/>
|
|
||||||
{{outlet}}
|
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
|
<SecretListHeader
|
||||||
|
@model={{this.model.parentModel}}
|
||||||
|
@backendCrumb={{hash
|
||||||
|
label=this.model.parentModel.id
|
||||||
|
text=this.model.parentModel.id
|
||||||
|
path="vault.cluster.secrets.backend.list-root"
|
||||||
|
model=this.model.parentModel.id
|
||||||
|
}}
|
||||||
|
@isEngine={{true}}
|
||||||
|
/>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<ToolbarActions>
|
<ToolbarActions>
|
||||||
<ToolbarLink @params={{array "configuration.create.import-ca"}}>
|
<ToolbarLink @params={{array "configuration.create.import-ca"}}>
|
||||||
@@ -27,8 +37,8 @@
|
|||||||
</BasicDropdown>
|
</BasicDropdown>
|
||||||
</ToolbarActions>
|
</ToolbarActions>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
{{#if (gt this.model.length 0)}}
|
{{#if this.model.issuersModel.length}}
|
||||||
{{#each this.model as |pkiIssuer|}}
|
{{#each this.model.issuersModel as |pkiIssuer|}}
|
||||||
<LinkedBlock class="list-item-row" @params={{array "roles.role.details" pkiIssuer.id}} @linkPrefix={{this.mountPoint}}>
|
<LinkedBlock class="list-item-row" @params={{array "roles.role.details" pkiIssuer.id}} @linkPrefix={{this.mountPoint}}>
|
||||||
<div class="level is-mobile">
|
<div class="level is-mobile">
|
||||||
<div class="level-left">
|
<div class="level-left">
|
||||||
@@ -72,7 +82,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn’t yet been configured with a certificate issuer.">
|
<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.index" @model={{this.model.issuersModel}}>
|
||||||
Configure PKI
|
Configure PKI
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<SecretListHeader
|
|
||||||
@model={{this.model}}
|
|
||||||
@backendCrumb={{hash
|
|
||||||
label=this.model.id
|
|
||||||
text=this.model.id
|
|
||||||
path="vault.cluster.secrets.backend.list-root"
|
|
||||||
model=this.model.id
|
|
||||||
}}
|
|
||||||
@isEngine={{true}}
|
|
||||||
/>
|
|
||||||
{{outlet}}
|
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
|
<SecretListHeader
|
||||||
|
@model={{this.model.parentModel}}
|
||||||
|
@backendCrumb={{hash
|
||||||
|
label=this.model.parentModel.id
|
||||||
|
text=this.model.parentModel.id
|
||||||
|
path="vault.cluster.secrets.backend.list-root"
|
||||||
|
model=this.model.parentModel.id
|
||||||
|
}}
|
||||||
|
@isEngine={{true}}
|
||||||
|
/>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<ToolbarActions>
|
<ToolbarActions>
|
||||||
<ToolbarLink @params={{array "keys.import"}} @type="download">
|
<ToolbarLink @params={{array "keys.import"}} @type="download">
|
||||||
@@ -11,8 +21,8 @@
|
|||||||
<p class="has-padding">Below is information about the private keys used by the issuers to sign certificates. While
|
<p class="has-padding">Below is information about the private keys used by the issuers to sign certificates. While
|
||||||
certificates represent a public assertion of an identity, private keys represent the private part of that identity, a
|
certificates represent a public assertion of an identity, private keys represent the private part of that identity, a
|
||||||
secret used to prove who they are and who they trust.</p>
|
secret used to prove who they are and who they trust.</p>
|
||||||
{{#if (gt this.model.length 0)}}
|
{{#if this.model.keyModel.length}}
|
||||||
{{#each this.model as |pkiKey|}}
|
{{#each this.model.keyModel as |pkiKey|}}
|
||||||
<LinkedBlock class="list-item-row" @params={{array "roles.role.details" pkiKey.id}} @linkPrefix={{this.mountPoint}}>
|
<LinkedBlock class="list-item-row" @params={{array "roles.role.details" pkiKey.id}} @linkPrefix={{this.mountPoint}}>
|
||||||
<div class="level is-mobile">
|
<div class="level is-mobile">
|
||||||
<div class="level-left">
|
<div class="level-left">
|
||||||
@@ -53,7 +63,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn’t yet been configured with a certificate issuer.">
|
<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.index" @model={{this.model.keyModel}}>
|
||||||
ARG TODO waiting for language from design
|
ARG TODO waiting for language from design
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
</ToolbarActions>
|
</ToolbarActions>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|
||||||
{{! ARG TODO: add conditional for empty state }}
|
|
||||||
<EmptyState @title="PKI not configured" @message="This PKI mount hasn’t yet been configured with a certificate issuer.">
|
<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.index" @model={{this.model}}>
|
||||||
Configure PKI
|
Configure PKI
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</ToolbarActions>
|
</ToolbarActions>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|
||||||
{{#if (gt this.model.roleModel.length 0)}}
|
{{#if this.model.roleModel.length}}
|
||||||
{{#each this.model.roleModel as |pkiRole|}}
|
{{#each this.model.roleModel as |pkiRole|}}
|
||||||
<LinkedBlock class="list-item-row" @params={{array "roles.role.details" pkiRole.id}} @linkPrefix={{this.mountPoint}}>
|
<LinkedBlock class="list-item-row" @params={{array "roles.role.details" pkiRole.id}} @linkPrefix={{this.mountPoint}}>
|
||||||
<div class="level is-mobile">
|
<div class="level is-mobile">
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export { default } from 'pki/components/pki-key-usage';
|
|
||||||
Reference in New Issue
Block a user