From e9e162fbb03c30a05e9cc151e4e0821ad0c47c50 Mon Sep 17 00:00:00 2001 From: Vault Automation Date: Fri, 22 Aug 2025 17:14:51 -0600 Subject: [PATCH] UI: Create Lease Duration card component + style updates (#8815) (#8870) * updating components to use hds flex, removing custom css * creating layout, updating fields to use select instead of dropdown * conditional render, remove commented code * adding external link * update handlers and style * updating general settings layout so TTL doesnt stretch other cards * typo Co-authored-by: Dan Rivera --- .../secret-engine/card/lease-duration.hbs | 68 +++++++++++++++++++ .../secret-engine/card/lease-duration.ts | 65 ++++++++++++++++++ .../secret-engine/card/metadata.hbs | 8 +-- .../components/secret-engine/card/security.ts | 2 +- .../components/secret-engine/card/version.hbs | 29 ++++---- .../secret-engine/page/general-settings.hbs | 16 +++-- .../helper-classes/flexbox-and-grid.scss | 8 --- 7 files changed, 162 insertions(+), 34 deletions(-) create mode 100644 ui/app/components/secret-engine/card/lease-duration.hbs create mode 100644 ui/app/components/secret-engine/card/lease-duration.ts diff --git a/ui/app/components/secret-engine/card/lease-duration.hbs b/ui/app/components/secret-engine/card/lease-duration.hbs new file mode 100644 index 0000000000..7fa7004e6f --- /dev/null +++ b/ui/app/components/secret-engine/card/lease-duration.hbs @@ -0,0 +1,68 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +}} + + + + + Lease Duration + Lease, measured by the “time-to-live” value, defines how long any secret issued + by this engine remains valid. + {{! TODO: Verify what link this is supposed to be }} + + + + + + + Time-to-live (TTL) + Standard expiry deadline. + + + + + + + {{#if this.enableTTL}} + + + + + + + + + + + + {{/if}} + + Maximum Time-to-live (TTL) + Maximum possible extension for expiry. + + + + + + + {{#if this.enableMaxTTL}} + + + + + + + + + + + + {{/if}} + + \ No newline at end of file diff --git a/ui/app/components/secret-engine/card/lease-duration.ts b/ui/app/components/secret-engine/card/lease-duration.ts new file mode 100644 index 0000000000..b32283e188 --- /dev/null +++ b/ui/app/components/secret-engine/card/lease-duration.ts @@ -0,0 +1,65 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +import { action } from '@ember/object'; +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { HTMLElementEvent } from 'vault/forms'; +import SecretsEngineResource from 'vault/resources/secrets/engine'; +interface Args { + model: SecretsEngineResource; +} + +export default class LeaseDuration extends Component { + // TODO: When wiring up to parent, address variable names and usage, update onchange functions etc - reference ttl-picker.js + @tracked enableTTL = false; + @tracked enableMaxTTL = false; + @tracked time = ''; + @tracked maxTime = ''; + @tracked unit = 's'; + @tracked maxUnit = 's'; + + constructor(owner: unknown, args: Args) { + super(owner, args); + } + + @action + setTTLType(event: HTMLElementEvent) { + if (event.target.value === 'Custom') { + this.enableTTL = true; + } else { + this.enableTTL = false; + } + } + + @action + setMaxTTLType(event: HTMLElementEvent) { + if (event.target.value === 'Custom') { + this.enableMaxTTL = true; + } else { + this.enableMaxTTL = false; + } + } + + @action + setTtlTime(event: HTMLElementEvent) { + this.time = event.target.value; + } + + @action + setMaxTtlTime(event: HTMLElementEvent) { + this.maxTime = event.target.value; + } + + @action + setUnit(event: HTMLElementEvent) { + this.unit = event.target.value; + } + + @action + setMaxUnit(event: HTMLElementEvent) { + this.maxUnit = event.target.value; + } +} diff --git a/ui/app/components/secret-engine/card/metadata.hbs b/ui/app/components/secret-engine/card/metadata.hbs index 0f15fee26e..a8e83144a7 100644 --- a/ui/app/components/secret-engine/card/metadata.hbs +++ b/ui/app/components/secret-engine/card/metadata.hbs @@ -10,7 +10,7 @@ Path The mount path where this secrets engine is accessible. -
+ -
+
@@ -28,7 +28,7 @@ Accessor Internal identifier used by Vault to reference this engine. -
+ -
+
diff --git a/ui/app/components/secret-engine/card/security.ts b/ui/app/components/secret-engine/card/security.ts index fc9a8fb572..0fd9b85887 100644 --- a/ui/app/components/secret-engine/card/security.ts +++ b/ui/app/components/secret-engine/card/security.ts @@ -10,7 +10,7 @@ interface Args { model: SecretsEngineResource; } -export default class SecurityCard extends Component { +export default class Security extends Component { constructor(owner: unknown, args: Args) { super(owner, args); } diff --git a/ui/app/components/secret-engine/card/version.hbs b/ui/app/components/secret-engine/card/version.hbs index e4b8fa71cb..03b8300c68 100644 --- a/ui/app/components/secret-engine/card/version.hbs +++ b/ui/app/components/secret-engine/card/version.hbs @@ -7,13 +7,13 @@ {{! TODO: Having this set up with flex for now, grid might be better? }}
-
+ Engine type Current version Latest 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 -
+
-
- Update version to: - - - {{! TODO: Update interactives with available versions from API }} - 12.32 - 12.4 - 12.42 - -
+ + + Update version to: + {{! TODO: Update options with available versions from API }} + + + + + + + \ 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 index bf9a51f558..82250630b8 100644 --- a/ui/app/components/secret-engine/page/general-settings.hbs +++ b/ui/app/components/secret-engine/page/general-settings.hbs @@ -19,14 +19,16 @@ Mount parameters that you can tune to fit required engine behavior. - - - {{! TODO: Lease duration component }} - + + + + + - - - + + + +
diff --git a/ui/app/styles/helper-classes/flexbox-and-grid.scss b/ui/app/styles/helper-classes/flexbox-and-grid.scss index 7294f5349b..e1eef8a758 100644 --- a/ui/app/styles/helper-classes/flexbox-and-grid.scss +++ b/ui/app/styles/helper-classes/flexbox-and-grid.scss @@ -29,14 +29,6 @@ row-gap: size_variables.$spacing-8; } - &.row-gap-12 { - row-gap: size_variables.$spacing-12; - } - - &.column-gap-8 { - column-gap: size_variables.$spacing-8; - } - &.column-gap-16 { column-gap: size_variables.$spacing-16; }