diff --git a/ui/app/components/secret-engine/card/metadata.hbs b/ui/app/components/secret-engine/card/metadata.hbs index 53f1c7e8fa..0f15fee26e 100644 --- a/ui/app/components/secret-engine/card/metadata.hbs +++ b/ui/app/components/secret-engine/card/metadata.hbs @@ -2,7 +2,7 @@ Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: BUSL-1.1 }} - + Metadata
@@ -12,14 +12,12 @@
@@ -32,23 +30,21 @@
- + Description - A short description of the secrets engine’s purpose. + A short description of the secrets engine's purpose. {{! TODO: Confirm with Design - Is there a length limit for descriptions? Design has it around 765 characters, but not sure theres a backend limit? }} diff --git a/ui/app/components/secret-engine/card/metadata.ts b/ui/app/components/secret-engine/card/metadata.ts deleted file mode 100644 index c32393ae98..0000000000 --- a/ui/app/components/secret-engine/card/metadata.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import Component from '@glimmer/component'; -import SecretsEngineResource from 'vault/resources/secrets/engine'; -interface Args { - model: SecretsEngineResource; -} - -export default class Metadata extends Component { - constructor(owner: unknown, args: Args) { - super(owner, args); - } - - updatePath() { - // This method can be used to update the path of the secrets engine. - } - - updateAccessor() { - // This method can be used to update the accessor of the secrets engine. - } -} diff --git a/ui/app/components/secret-engine/card/security.hbs b/ui/app/components/secret-engine/card/security.hbs index bb3e9c565d..d4f0d600d1 100644 --- a/ui/app/components/secret-engine/card/security.hbs +++ b/ui/app/components/secret-engine/card/security.hbs @@ -2,18 +2,17 @@ Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: BUSL-1.1 }} - + Security - {{! TODO: Toggle fields here are currently hardcoded, will be replaced with actual data from model once wired into parent component }} - + Local Secrets stay in one cluster and are not replicated. - + Seal wrap Wrap secrets with an additional encryption layer using a seal. diff --git a/ui/app/components/secret-engine/card/version.hbs b/ui/app/components/secret-engine/card/version.hbs index a0178e4dcf..e4b8fa71cb 100644 --- a/ui/app/components/secret-engine/card/version.hbs +++ b/ui/app/components/secret-engine/card/version.hbs @@ -2,7 +2,7 @@ Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: BUSL-1.1 }} - + Version {{! TODO: Having this set up with flex for now, grid might be better? }} @@ -14,9 +14,12 @@
- {{@model.type}} + {{@model.secretsEngine.type}} {{! TODO: Verify if we want to display the full version or chop down ie. v0.17.1 vs v0.17.1-0.230942309423094... }} - {{@model.running_plugin_version}} + {{@model.secretsEngine.running_plugin_version}} {{! TODO: leaving as is for now to match design, but we might be removing this if we cant get latest version from some source }} v.12.46
diff --git a/ui/app/components/secret-engine/card/version.ts b/ui/app/components/secret-engine/card/version.ts deleted file mode 100644 index f28e2d3707..0000000000 --- a/ui/app/components/secret-engine/card/version.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import Component from '@glimmer/component'; -import SecretsEngineResource from 'vault/resources/secrets/engine'; -interface Args { - model: SecretsEngineResource; -} - -export default class Version extends Component { - constructor(owner: unknown, args: Args) { - super(owner, args); - } -} diff --git a/ui/app/components/secret-engine/page-header.hbs b/ui/app/components/secret-engine/page-header.hbs new file mode 100644 index 0000000000..635e94293e --- /dev/null +++ b/ui/app/components/secret-engine/page-header.hbs @@ -0,0 +1,38 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +}} + +{{#let (engines-display-data @model.secretsEngine.type) as |engineData|}} + + {{@model.secretsEngine.id}} configuration + {{get engineData "displayName"}} + + + + + + + + + {{get engineData "typeDisplay"}} + + +
+
+ +
+
+{{/let}} \ No newline at end of file diff --git a/ui/app/components/secret-engine/page/general-settings.hbs b/ui/app/components/secret-engine/page/general-settings.hbs new file mode 100644 index 0000000000..bf9a51f558 --- /dev/null +++ b/ui/app/components/secret-engine/page/general-settings.hbs @@ -0,0 +1,65 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +}} + + + +{{#if this.saveGeneralSettings.isRunning}} + {{! TODO: Fix loading state styles }} + +
+ +
+ Saving configuration... +
+{{else}} +
+ + Mount parameters that you can tune to fit required engine behavior. + + + + + {{! TODO: Lease duration component }} + + + + + + + +
+ + + + +
+
+{{/if}} + +{{#if this.showUnsavedChangesModal}} + + + Unsaved changes + + +

You've made changes to the following + {{@model.secretsEngine.id}} + settings:

+ {{! TODO: display what fields were changed }} +
+ Would you like to apply them? +
+ + + {{! TODO: confirm with design where we want to transition to if Discard changes is clicked }} + + +
+{{/if}} \ No newline at end of file diff --git a/ui/app/components/secret-engine/page/general-settings.ts b/ui/app/components/secret-engine/page/general-settings.ts new file mode 100644 index 0000000000..6ba54ec5b6 --- /dev/null +++ b/ui/app/components/secret-engine/page/general-settings.ts @@ -0,0 +1,60 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Component from '@glimmer/component'; +import { task } from 'ember-concurrency'; +import { service } from '@ember/service'; +import { tracked } from '@glimmer/tracking'; + +import type Router from '@ember/routing/router'; +import type FlashMessageService from 'vault/services/flash-messages'; +import type ApiService from 'vault/services/api'; +import type SecretsEngineResource from 'vault/resources/secrets/engine'; + +/** + * @module GeneralSettingsComponent is used to configure the SSH secret engine. + * + * @example + * ```js + * + * ``` + * + * @param {string} secretsEngine - secrets engine resource + */ + +interface Args { + model: { + secretsEngine: SecretsEngineResource; + }; +} + +export default class GeneralSettingsComponent extends Component { + @service declare readonly router: Router; + @service declare readonly api: ApiService; + @service declare readonly flashMessages: FlashMessageService; + + @tracked errorMessage: string | null = null; + @tracked invalidFormAlert: string | null = null; + @tracked showUnsavedChangesModal = false; + + saveGeneralSettings = task(async (event) => { + event.preventDefault(); + + try { + const fd = new FormData(event.target as HTMLFormElement); + await this.api.sys.mountsTuneConfigurationParameters(this.args.model.secretsEngine.id, { + // TODO: add other params when other card components are made + description: fd.get('description') as string, + }); + this.flashMessages.success('Engine settings successfully updated.'); + } catch (e) { + // handle error state + const { message } = await this.api.parseError(e); + this.flashMessages.danger(`Try again or check your network connection. ${message}`); + } + }); +} diff --git a/ui/app/router.js b/ui/app/router.js index 4d11ca647c..b8b9bb64ab 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -183,6 +183,8 @@ Router.map(function () { this.mount('pki'); this.route('index', { path: '/' }); this.route('configuration', function () { + this.route('index', { path: '/' }); + this.route('general-settings'); // only CONFIGURABLE_SECRET_ENGINES can be configured and access the edit route this.route('edit'); }); diff --git a/ui/app/routes/vault/cluster/secrets/backend/configuration/general-settings.ts b/ui/app/routes/vault/cluster/secrets/backend/configuration/general-settings.ts new file mode 100644 index 0000000000..e140f73e24 --- /dev/null +++ b/ui/app/routes/vault/cluster/secrets/backend/configuration/general-settings.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import Route from '@ember/routing/route'; + +import type SecretsEngineResource from 'vault/resources/secrets/engine'; + +export default class SecretsBackendConfigurationGeneralSettingsRoute extends Route { + async model() { + const secretsEngine = this.modelFor('vault.cluster.secrets.backend') as SecretsEngineResource; + // TODO: get list of versions using the sys/plugins/catalog endpoint. + return { secretsEngine }; + } +} diff --git a/ui/app/routes/vault/cluster/secrets/backend/configuration/index.js b/ui/app/routes/vault/cluster/secrets/backend/configuration/index.js index a40b01ee09..dc2269fe10 100644 --- a/ui/app/routes/vault/cluster/secrets/backend/configuration/index.js +++ b/ui/app/routes/vault/cluster/secrets/backend/configuration/index.js @@ -4,9 +4,23 @@ */ import Route from '@ember/routing/route'; +import { service } from '@ember/service'; import engineDisplayData from 'vault/helpers/engines-display-data'; export default class SecretsBackendConfigurationIndexRoute extends Route { + @service router; + + beforeModel() { + const { + secretsEngine: { type }, + } = this.modelFor('vault.cluster.secrets.backend.configuration'); + const engine = engineDisplayData(type); + + if (!engine?.isOldEngine) { + return this.router.replaceWith('vault.cluster.secrets.backend.configuration.general-settings'); + } + } + setupController(controller, resolvedModel) { super.setupController(controller, resolvedModel); const engine = engineDisplayData(resolvedModel.secretsEngine.type); diff --git a/ui/app/templates/vault/cluster/secrets/backend/configuration/general-settings.hbs b/ui/app/templates/vault/cluster/secrets/backend/configuration/general-settings.hbs new file mode 100644 index 0000000000..98520d7641 --- /dev/null +++ b/ui/app/templates/vault/cluster/secrets/backend/configuration/general-settings.hbs @@ -0,0 +1,6 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +}} + + \ No newline at end of file diff --git a/ui/lib/core/addon/components/secret-list-header.hbs b/ui/lib/core/addon/components/secret-list-header.hbs index 27a54423be..52d95334bd 100644 --- a/ui/lib/core/addon/components/secret-list-header.hbs +++ b/ui/lib/core/addon/components/secret-list-header.hbs @@ -52,15 +52,17 @@ /> {{/each}} -
  • - - Configuration - -
  • + {{#if options.isOldEngine}} +
  • + + Configuration + +
  • + {{/if}}