From d5188469c6048b2a9ef3eb4d8e536750668ba8f4 Mon Sep 17 00:00:00 2001 From: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> Date: Mon, 17 Apr 2023 10:58:30 -0500 Subject: [PATCH] UI: PKI routes extend base Route (#20179) --- ui/lib/pki/addon/routes/application.js | 16 +++++++++++--- ui/lib/pki/addon/routes/certificates/index.js | 4 ++-- .../pki/addon/routes/configuration/create.js | 6 ----- .../pki/addon/routes/configuration/index.js | 3 --- .../routes/issuers/generate-intermediate.js | 15 ++++++++++--- ui/lib/pki/addon/routes/issuers/import.js | 12 +++++++--- ui/lib/pki/addon/routes/issuers/index.js | 8 +------ ui/lib/pki/addon/routes/issuers/issuer.js | 9 +++++--- .../addon/routes/issuers/issuer/cross-sign.js | 22 ++++++++++++++----- .../addon/routes/issuers/issuer/details.js | 16 +++++++++++--- .../pki/addon/routes/issuers/issuer/edit.js | 6 ----- .../routes/issuers/issuer/rotate-root.js | 4 ++-- .../pki/addon/routes/issuers/issuer/sign.js | 6 ----- ui/lib/pki/addon/routes/keys/create.js | 12 +++++++--- ui/lib/pki/addon/routes/keys/import.js | 12 +++++++--- ui/lib/pki/addon/routes/keys/index.js | 10 ++------- ui/lib/pki/addon/routes/keys/key.js | 8 +++++-- ui/lib/pki/addon/routes/keys/key/details.js | 17 +++++++++++--- ui/lib/pki/addon/routes/keys/key/edit.js | 18 ++++++++++++--- ui/lib/pki/addon/routes/overview.js | 9 ++++---- ui/lib/pki/addon/routes/roles/index.js | 4 ++-- .../pki/addon/routes/roles/role/generate.js | 7 ------ ui/lib/pki/addon/routes/roles/role/sign.js | 7 ------ .../addon/templates/certificates/index.hbs | 2 +- ui/lib/pki/addon/templates/issuers/index.hbs | 2 +- ui/lib/pki/addon/templates/keys/index.hbs | 2 +- ui/lib/pki/addon/templates/overview.hbs | 2 +- ui/lib/pki/addon/templates/roles/index.hbs | 2 +- 28 files changed, 142 insertions(+), 99 deletions(-) diff --git a/ui/lib/pki/addon/routes/application.js b/ui/lib/pki/addon/routes/application.js index 2e2896aac80c..d0d7d5e768f6 100644 --- a/ui/lib/pki/addon/routes/application.js +++ b/ui/lib/pki/addon/routes/application.js @@ -5,14 +5,24 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; +import { hash } from 'rsvp'; export default class PkiRoute extends Route { @service pathHelp; @service secretMountPath; beforeModel() { - // Must call this promise before the model hook otherwise the model doesn't hydrate from OpenAPI correctly. - // only needs to be called once to add the openAPI attributes to the model prototype - return this.pathHelp.getNewModel('pki/role', this.secretMountPath.currentPath); + // We call pathHelp for all the models in this engine that use OpenAPI before any model hooks + // so that the model attributes hydrate correctly. These only need to be called once to add + // the openAPI attributes to the model prototype + const mountPath = this.secretMountPath.currentPath; + return hash({ + role: this.pathHelp.getNewModel('pki/role', mountPath), + urls: this.pathHelp.getNewModel('pki/urls', mountPath), + key: this.pathHelp.getNewModel('pki/key', mountPath), + signCsr: this.pathHelp.getNewModel('pki/sign-intermediate', mountPath), + certGenerate: this.pathHelp.getNewModel('pki/certificate/generate', mountPath), + certSign: this.pathHelp.getNewModel('pki/certificate/sign', mountPath), + }); } } diff --git a/ui/lib/pki/addon/routes/certificates/index.js b/ui/lib/pki/addon/routes/certificates/index.js index 769059782f07..2b88c90f0e72 100644 --- a/ui/lib/pki/addon/routes/certificates/index.js +++ b/ui/lib/pki/addon/routes/certificates/index.js @@ -38,7 +38,7 @@ export default class PkiCertificatesIndexRoute extends Route { super.setupController(controller, resolvedModel); const certificates = resolvedModel.certificates; - if (certificates?.length) controller.message = getCliMessage('certificates'); - else controller.message = getCliMessage(); + if (certificates?.length) controller.notConfiguredMessage = getCliMessage('certificates'); + else controller.notConfiguredMessage = getCliMessage(); } } diff --git a/ui/lib/pki/addon/routes/configuration/create.js b/ui/lib/pki/addon/routes/configuration/create.js index f78a5b4bb285..9832aea39097 100644 --- a/ui/lib/pki/addon/routes/configuration/create.js +++ b/ui/lib/pki/addon/routes/configuration/create.js @@ -12,12 +12,6 @@ import { hash } from 'rsvp'; export default class PkiConfigurationCreateRoute extends Route { @service secretMountPath; @service store; - @service pathHelp; - - beforeModel() { - // pki/urls uses openApi to hydrate model - return this.pathHelp.getNewModel('pki/urls', this.secretMountPath.currentPath); - } model() { return hash({ diff --git a/ui/lib/pki/addon/routes/configuration/index.js b/ui/lib/pki/addon/routes/configuration/index.js index dcf3bf3b58da..7002c871a390 100644 --- a/ui/lib/pki/addon/routes/configuration/index.js +++ b/ui/lib/pki/addon/routes/configuration/index.js @@ -7,7 +7,6 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { withConfig } from 'pki/decorators/check-config'; import { hash } from 'rsvp'; -import { PKI_DEFAULT_EMPTY_STATE_MSG } from 'pki/routes/overview'; @withConfig() export default class ConfigurationIndexRoute extends Route { @@ -53,7 +52,5 @@ export default class ConfigurationIndexRoute extends Route { setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - - controller.message = PKI_DEFAULT_EMPTY_STATE_MSG; } } diff --git a/ui/lib/pki/addon/routes/issuers/generate-intermediate.js b/ui/lib/pki/addon/routes/issuers/generate-intermediate.js index 6a5d4bc9b428..4e4b31507b09 100644 --- a/ui/lib/pki/addon/routes/issuers/generate-intermediate.js +++ b/ui/lib/pki/addon/routes/issuers/generate-intermediate.js @@ -3,17 +3,26 @@ * SPDX-License-Identifier: MPL-2.0 */ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; import { withConfirmLeave } from 'core/decorators/confirm-leave'; -import PkiIssuersIndexRoute from '.'; @withConfirmLeave() -export default class PkiIssuersGenerateIntermediateRoute extends PkiIssuersIndexRoute { +export default class PkiIssuersGenerateIntermediateRoute extends Route { + @service store; + @service secretMountPath; + model() { return this.store.createRecord('pki/action', { actionType: 'generate-csr' }); } setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: 'generate CSR' }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'issuers', route: 'issuers.index' }, + { label: 'generate CSR' }, + ]; } } diff --git a/ui/lib/pki/addon/routes/issuers/import.js b/ui/lib/pki/addon/routes/issuers/import.js index d0eddde8e7b7..c6312960e077 100644 --- a/ui/lib/pki/addon/routes/issuers/import.js +++ b/ui/lib/pki/addon/routes/issuers/import.js @@ -3,13 +3,14 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiIssuersIndexRoute from '.'; +import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { withConfirmLeave } from 'core/decorators/confirm-leave'; @withConfirmLeave() -export default class PkiIssuersImportRoute extends PkiIssuersIndexRoute { +export default class PkiIssuersImportRoute extends Route { @service store; + @service secretMountPath; model() { return this.store.createRecord('pki/action'); @@ -17,6 +18,11 @@ export default class PkiIssuersImportRoute extends PkiIssuersIndexRoute { setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: 'import' }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'issuers', route: 'issuers.index' }, + { label: 'import' }, + ]; } } diff --git a/ui/lib/pki/addon/routes/issuers/index.js b/ui/lib/pki/addon/routes/issuers/index.js index 9f5a8c323dc0..2365228da7c1 100644 --- a/ui/lib/pki/addon/routes/issuers/index.js +++ b/ui/lib/pki/addon/routes/issuers/index.js @@ -10,12 +10,6 @@ import { PKI_DEFAULT_EMPTY_STATE_MSG } from 'pki/routes/overview'; export default class PkiIssuersListRoute extends Route { @service store; @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/issuer', this.secretMountPath.currentPath); - } model() { return this.store @@ -39,6 +33,6 @@ export default class PkiIssuersListRoute extends Route { { label: this.secretMountPath.currentPath, route: 'overview' }, { label: 'issuers', route: 'issuers.index' }, ]; - controller.message = PKI_DEFAULT_EMPTY_STATE_MSG; + controller.notConfiguredMessage = PKI_DEFAULT_EMPTY_STATE_MSG; } } diff --git a/ui/lib/pki/addon/routes/issuers/issuer.js b/ui/lib/pki/addon/routes/issuers/issuer.js index 3d27356bb8b6..b347dab1e7cc 100644 --- a/ui/lib/pki/addon/routes/issuers/issuer.js +++ b/ui/lib/pki/addon/routes/issuers/issuer.js @@ -3,10 +3,13 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiIssuersListRoute from '.'; +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class PkiIssuerIndexRoute extends Route { + @service store; + @service secretMountPath; -// Single issuer index route extends issuers list route -export default class PkiIssuerIndexRoute extends PkiIssuersListRoute { model() { const { issuer_ref } = this.paramsFor('issuers/issuer'); return this.store.queryRecord('pki/issuer', { diff --git a/ui/lib/pki/addon/routes/issuers/issuer/cross-sign.js b/ui/lib/pki/addon/routes/issuers/issuer/cross-sign.js index 09a9536e165b..f3cb81a56973 100644 --- a/ui/lib/pki/addon/routes/issuers/issuer/cross-sign.js +++ b/ui/lib/pki/addon/routes/issuers/issuer/cross-sign.js @@ -3,16 +3,28 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiIssuerRoute from '../issuer'; +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; import { withConfirmLeave } from 'core/decorators/confirm-leave'; @withConfirmLeave() -export default class PkiIssuerCrossSignRoute extends PkiIssuerRoute { +export default class PkiIssuerCrossSignRoute extends Route { + @service store; + @service secretMountPath; + + model() { + return this.modelFor('issuers.issuer'); + } + setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push( + + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'issuers', route: 'issuers.index' }, { label: resolvedModel.id, route: 'issuers.issuer.details' }, - { label: 'cross-sign' } - ); + { label: 'cross-sign' }, + ]; } } diff --git a/ui/lib/pki/addon/routes/issuers/issuer/details.js b/ui/lib/pki/addon/routes/issuers/issuer/details.js index a6d25ac9b4f3..fdbc988502cf 100644 --- a/ui/lib/pki/addon/routes/issuers/issuer/details.js +++ b/ui/lib/pki/addon/routes/issuers/issuer/details.js @@ -3,10 +3,15 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiIssuerRoute from '../issuer'; +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; import { verifyCertificates } from 'vault/utils/parse-pki-cert'; import { hash } from 'rsvp'; -export default class PkiIssuerDetailsRoute extends PkiIssuerRoute { + +export default class PkiIssuerDetailsRoute extends Route { + @service store; + @service secretMountPath; + model() { const issuer = this.modelFor('issuers.issuer'); return hash({ @@ -19,7 +24,12 @@ export default class PkiIssuerDetailsRoute extends PkiIssuerRoute { setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: resolvedModel.issuer.id }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'issuers', route: 'issuers.index' }, + { label: resolvedModel.issuer.id }, + ]; } /** diff --git a/ui/lib/pki/addon/routes/issuers/issuer/edit.js b/ui/lib/pki/addon/routes/issuers/issuer/edit.js index 7885244093f5..0c2b6a0c0cea 100644 --- a/ui/lib/pki/addon/routes/issuers/issuer/edit.js +++ b/ui/lib/pki/addon/routes/issuers/issuer/edit.js @@ -11,12 +11,6 @@ import { withConfirmLeave } from 'core/decorators/confirm-leave'; export default class PkiIssuerEditRoute extends Route { @service store; @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/issuer', this.secretMountPath.currentPath); - } model() { const { issuer_ref } = this.paramsFor('issuers/issuer'); diff --git a/ui/lib/pki/addon/routes/issuers/issuer/rotate-root.js b/ui/lib/pki/addon/routes/issuers/issuer/rotate-root.js index cd07617f7b51..2d3dfbed38f1 100644 --- a/ui/lib/pki/addon/routes/issuers/issuer/rotate-root.js +++ b/ui/lib/pki/addon/routes/issuers/issuer/rotate-root.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiIssuerRoute from '../issuer'; +import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { hash } from 'rsvp'; import { parseCertificate } from 'vault/utils/parse-pki-cert'; @@ -11,7 +11,7 @@ import camelizeKeys from 'vault/utils/camelize-object-keys'; import { withConfirmLeave } from 'core/decorators/confirm-leave'; @withConfirmLeave('model.newRootModel') -export default class PkiIssuerRotateRootRoute extends PkiIssuerRoute { +export default class PkiIssuerRotateRootRoute extends Route { @service secretMountPath; @service store; diff --git a/ui/lib/pki/addon/routes/issuers/issuer/sign.js b/ui/lib/pki/addon/routes/issuers/issuer/sign.js index 2d0d2f955119..00e76255c174 100644 --- a/ui/lib/pki/addon/routes/issuers/issuer/sign.js +++ b/ui/lib/pki/addon/routes/issuers/issuer/sign.js @@ -11,12 +11,6 @@ import { withConfirmLeave } from 'core/decorators/confirm-leave'; export default class PkiIssuerSignRoute extends Route { @service store; @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/sign-intermediate', this.secretMountPath.currentPath); - } model() { const { issuer_ref } = this.paramsFor('issuers/issuer'); diff --git a/ui/lib/pki/addon/routes/keys/create.js b/ui/lib/pki/addon/routes/keys/create.js index a1a29d0a5414..044f9c26b0d6 100644 --- a/ui/lib/pki/addon/routes/keys/create.js +++ b/ui/lib/pki/addon/routes/keys/create.js @@ -3,12 +3,13 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiKeysIndexRoute from '.'; +import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { withConfirmLeave } from 'core/decorators/confirm-leave'; @withConfirmLeave() -export default class PkiKeysCreateRoute extends PkiKeysIndexRoute { +export default class PkiKeysCreateRoute extends Route { + @service secretMountPath; @service store; model() { @@ -17,6 +18,11 @@ export default class PkiKeysCreateRoute extends PkiKeysIndexRoute { setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: 'generate' }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'keys', route: 'keys.index' }, + { label: 'generate' }, + ]; } } diff --git a/ui/lib/pki/addon/routes/keys/import.js b/ui/lib/pki/addon/routes/keys/import.js index e1cc252ac42e..ce95a5af31ca 100644 --- a/ui/lib/pki/addon/routes/keys/import.js +++ b/ui/lib/pki/addon/routes/keys/import.js @@ -3,12 +3,13 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiKeysIndexRoute from '.'; +import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { withConfirmLeave } from 'core/decorators/confirm-leave'; @withConfirmLeave() -export default class PkiKeysImportRoute extends PkiKeysIndexRoute { +export default class PkiKeysImportRoute extends Route { + @service secretMountPath; @service store; model() { @@ -17,6 +18,11 @@ export default class PkiKeysImportRoute extends PkiKeysIndexRoute { setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: 'import' }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'keys', route: 'keys.index' }, + { label: 'import' }, + ]; } } diff --git a/ui/lib/pki/addon/routes/keys/index.js b/ui/lib/pki/addon/routes/keys/index.js index 31b0f6e1e2ef..1c00969b0d53 100644 --- a/ui/lib/pki/addon/routes/keys/index.js +++ b/ui/lib/pki/addon/routes/keys/index.js @@ -11,14 +11,8 @@ import { PKI_DEFAULT_EMPTY_STATE_MSG } from 'pki/routes/overview'; @withConfig() export default class PkiKeysIndexRoute extends Route { - @service store; @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/key', this.secretMountPath.currentPath); - } + @service store; model() { return hash({ @@ -41,6 +35,6 @@ export default class PkiKeysIndexRoute extends Route { { label: this.secretMountPath.currentPath, route: 'overview' }, { label: 'keys', route: 'keys.index' }, ]; - controller.message = PKI_DEFAULT_EMPTY_STATE_MSG; + controller.notConfiguredMessage = PKI_DEFAULT_EMPTY_STATE_MSG; } } diff --git a/ui/lib/pki/addon/routes/keys/key.js b/ui/lib/pki/addon/routes/keys/key.js index 598907def36a..73136a0439b5 100644 --- a/ui/lib/pki/addon/routes/keys/key.js +++ b/ui/lib/pki/addon/routes/keys/key.js @@ -3,9 +3,13 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiKeysIndexRoute from './index'; +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class PkiKeyRoute extends Route { + @service secretMountPath; + @service store; -export default class PkiKeyRoute extends PkiKeysIndexRoute { model() { const { key_id } = this.paramsFor('keys/key'); return this.store.queryRecord('pki/key', { diff --git a/ui/lib/pki/addon/routes/keys/key/details.js b/ui/lib/pki/addon/routes/keys/key/details.js index dbc68f22cfda..42c1fc31b4bc 100644 --- a/ui/lib/pki/addon/routes/keys/key/details.js +++ b/ui/lib/pki/addon/routes/keys/key/details.js @@ -3,11 +3,22 @@ * SPDX-License-Identifier: MPL-2.0 */ -import PkiKeyRoute from '../key'; +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; -export default class PkiKeyDetailsRoute extends PkiKeyRoute { +export default class PkiKeyDetailsRoute extends Route { + @service secretMountPath; + + model() { + return this.modelFor('keys.key'); + } setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: resolvedModel.id }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'keys', route: 'keys.index' }, + { label: resolvedModel.id }, + ]; } } diff --git a/ui/lib/pki/addon/routes/keys/key/edit.js b/ui/lib/pki/addon/routes/keys/key/edit.js index f1d3c9ff4e71..8c29d48b59f8 100644 --- a/ui/lib/pki/addon/routes/keys/key/edit.js +++ b/ui/lib/pki/addon/routes/keys/key/edit.js @@ -4,12 +4,24 @@ */ import { withConfirmLeave } from 'core/decorators/confirm-leave'; -import PkiKeyRoute from '../key'; +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; @withConfirmLeave() -export default class PkiKeyEditRoute extends PkiKeyRoute { +export default class PkiKeyEditRoute extends Route { + @service secretMountPath; + + model() { + return this.modelFor('keys.key'); + } + setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); - controller.breadcrumbs.push({ label: resolvedModel.id, route: 'keys.key.details' }, { label: 'edit' }); + controller.breadcrumbs = [ + { label: 'secrets', route: 'secrets', linkExternal: true }, + { label: this.secretMountPath.currentPath, route: 'overview' }, + { label: 'keys', route: 'keys.index' }, + { label: resolvedModel.id }, + ]; } } diff --git a/ui/lib/pki/addon/routes/overview.js b/ui/lib/pki/addon/routes/overview.js index b86d2e2918f3..63ede09b88c9 100644 --- a/ui/lib/pki/addon/routes/overview.js +++ b/ui/lib/pki/addon/routes/overview.js @@ -62,10 +62,11 @@ export default class PkiOverviewRoute extends Route { const roles = resolvedModel.roles; const certificates = resolvedModel.certificates; - controller.message = getCliMessage(); + controller.notConfiguredMessage = getCliMessage(); - if (roles?.length) controller.message = getCliMessage('roles'); - if (certificates?.length) controller.message = getCliMessage('certificates'); - if (roles?.length && certificates?.length) controller.message = getCliMessage('roles and certificates'); + if (roles?.length) controller.notConfiguredMessage = getCliMessage('roles'); + if (certificates?.length) controller.notConfiguredMessage = getCliMessage('certificates'); + if (roles?.length && certificates?.length) + controller.notConfiguredMessage = getCliMessage('roles and certificates'); } } diff --git a/ui/lib/pki/addon/routes/roles/index.js b/ui/lib/pki/addon/routes/roles/index.js index 70646d376fee..25c6dddfeb24 100644 --- a/ui/lib/pki/addon/routes/roles/index.js +++ b/ui/lib/pki/addon/routes/roles/index.js @@ -37,7 +37,7 @@ export default class PkiRolesIndexRoute extends Route { super.setupController(controller, resolvedModel); const roles = resolvedModel.roles; - if (roles?.length) controller.message = getCliMessage('roles'); - else controller.message = getCliMessage(); + if (roles?.length) controller.notConfiguredMessage = getCliMessage('roles'); + else controller.notConfiguredMessage = getCliMessage(); } } diff --git a/ui/lib/pki/addon/routes/roles/role/generate.js b/ui/lib/pki/addon/routes/roles/role/generate.js index 5a71d99585ce..047933037c23 100644 --- a/ui/lib/pki/addon/routes/roles/role/generate.js +++ b/ui/lib/pki/addon/routes/roles/role/generate.js @@ -11,13 +11,6 @@ withConfirmLeave(); export default class PkiRoleGenerateRoute extends Route { @service store; @service secretMountPath; - @service pathHelp; - - beforeModel() { - // Must call this promise before the model hook otherwise - // the model doesn't hydrate from OpenAPI correctly. - return this.pathHelp.getNewModel('pki/certificate/generate', this.secretMountPath.currentPath); - } async model() { const { role } = this.paramsFor('roles/role'); diff --git a/ui/lib/pki/addon/routes/roles/role/sign.js b/ui/lib/pki/addon/routes/roles/role/sign.js index bea1a55b9a1f..e37f60edc5df 100644 --- a/ui/lib/pki/addon/routes/roles/role/sign.js +++ b/ui/lib/pki/addon/routes/roles/role/sign.js @@ -11,13 +11,6 @@ withConfirmLeave(); export default class PkiRoleSignRoute extends Route { @service store; @service secretMountPath; - @service pathHelp; - - beforeModel() { - // Must call this promise before the model hook otherwise - // the model doesn't hydrate from OpenAPI correctly. - return this.pathHelp.getNewModel('pki/certificate/sign', this.secretMountPath.currentPath); - } model() { const { role } = this.paramsFor('roles/role'); diff --git a/ui/lib/pki/addon/templates/certificates/index.hbs b/ui/lib/pki/addon/templates/certificates/index.hbs index ba26a62e190b..e7e76fb6680c 100644 --- a/ui/lib/pki/addon/templates/certificates/index.hbs +++ b/ui/lib/pki/addon/templates/certificates/index.hbs @@ -68,7 +68,7 @@ {{/if}} {{else}} - + Configure PKI diff --git a/ui/lib/pki/addon/templates/issuers/index.hbs b/ui/lib/pki/addon/templates/issuers/index.hbs index 1a762c4c531a..45d16a21326f 100644 --- a/ui/lib/pki/addon/templates/issuers/index.hbs +++ b/ui/lib/pki/addon/templates/issuers/index.hbs @@ -93,7 +93,7 @@ {{/each}} {{else}} - + Configure PKI diff --git a/ui/lib/pki/addon/templates/keys/index.hbs b/ui/lib/pki/addon/templates/keys/index.hbs index a0c14fba93dc..eddf92d86891 100644 --- a/ui/lib/pki/addon/templates/keys/index.hbs +++ b/ui/lib/pki/addon/templates/keys/index.hbs @@ -19,7 +19,7 @@ /> {{else}} - + Configure PKI diff --git a/ui/lib/pki/addon/templates/overview.hbs b/ui/lib/pki/addon/templates/overview.hbs index 66215ca9d23b..f47fee3c4f73 100644 --- a/ui/lib/pki/addon/templates/overview.hbs +++ b/ui/lib/pki/addon/templates/overview.hbs @@ -21,7 +21,7 @@ {{#if this.model.hasConfig}} {{else}} - + Configure PKI diff --git a/ui/lib/pki/addon/templates/roles/index.hbs b/ui/lib/pki/addon/templates/roles/index.hbs index 0972ecf69f07..89ad0fcb7e88 100644 --- a/ui/lib/pki/addon/templates/roles/index.hbs +++ b/ui/lib/pki/addon/templates/roles/index.hbs @@ -67,7 +67,7 @@ {{/if}} {{else}} - + Configure PKI