diff --git a/changelog/18114.txt b/changelog/18114.txt new file mode 100644 index 000000000000..3692b12c8a00 --- /dev/null +++ b/changelog/18114.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: update TTL picker for consistency +``` diff --git a/ui/app/components/configure-aws-secret.js b/ui/app/components/configure-aws-secret.js index b9d6e9b61bc0..9e1aee011ad9 100644 --- a/ui/app/components/configure-aws-secret.js +++ b/ui/app/components/configure-aws-secret.js @@ -6,9 +6,9 @@ import { action } from '@ember/object'; * * @example * ```js - * + + \ No newline at end of file diff --git a/ui/app/components/wrap-ttl.js b/ui/app/components/wrap-ttl.js index 19b5afb74aa0..8f40b688679a 100644 --- a/ui/app/components/wrap-ttl.js +++ b/ui/app/components/wrap-ttl.js @@ -1,49 +1,26 @@ import { assert } from '@ember/debug'; -import Component from '@ember/component'; -import { set, computed } from '@ember/object'; -import hbs from 'htmlbars-inline-precompile'; +import Component from '@glimmer/component'; +import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; -export default Component.extend({ - // passed from outside - onChange: null, - wrapResponse: true, +export default class WrapTtlComponent extends Component { + @tracked + wrapResponse = true; - ttl: '30m', + constructor() { + super(...arguments); + assert('`onChange` handler is a required attr in `' + this.toString() + '`.', this.args.onChange); + } - wrapTTL: computed('wrapResponse', 'ttl', function () { + get wrapTTL() { const { wrapResponse, ttl } = this; return wrapResponse ? ttl : null; - }), + } - didRender() { - this._super(...arguments); - this.onChange(this.wrapTTL); - }, - - init() { - this._super(...arguments); - assert('`onChange` handler is a required attr in `' + this.toString() + '`.', this.onChange); - }, - - layout: hbs` -
- {{ttl-picker2 - data-test-wrap-ttl-picker=true - label='Wrap response' - helperTextDisabled='Will not wrap response' - helperTextEnabled='Will wrap response with a lease of' - enableTTL=wrapResponse - initialValue=ttl - onChange=(action 'changedValue') - }} -
- `, - - actions: { - changedValue(ttlObj) { - set(this, 'wrapResponse', ttlObj.enabled); - set(this, 'ttl', `${ttlObj.seconds}s`); - this.onChange(this.wrapTTL); - }, - }, -}); + @action + changedValue(ttlObj) { + this.wrapResponse = ttlObj.enabled; + this.ttl = ttlObj.goSafeTimeString; + this.args.onChange(this.wrapTTL); + } +} diff --git a/ui/app/styles/app.scss b/ui/app/styles/app.scss index 476acbdfe3a7..765038eaa9ed 100644 --- a/ui/app/styles/app.scss +++ b/ui/app/styles/app.scss @@ -13,3 +13,13 @@ // Font comes from npm package: https://www.npmjs.com/package/text-security // We took the font we wanted and moved it into the ui/fonts folder @include font-face('text-security-square'); + +.sr-only { + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + overflow: hidden; + position: absolute; + white-space: nowrap; + width: 1px; +} diff --git a/ui/app/styles/components/ttl-picker2.scss b/ui/app/styles/components/ttl-picker.scss similarity index 100% rename from ui/app/styles/components/ttl-picker2.scss rename to ui/app/styles/components/ttl-picker.scss diff --git a/ui/app/styles/core.scss b/ui/app/styles/core.scss index 21f8a188b767..6773a664c698 100644 --- a/ui/app/styles/core.scss +++ b/ui/app/styles/core.scss @@ -113,7 +113,7 @@ @import './components/tool-tip'; @import './components/transform-edit.scss'; @import './components/transit-card'; -@import './components/ttl-picker2'; +@import './components/ttl-picker'; @import './components/unseal-warning'; @import './components/ui-wizard'; @import './components/vault-loading'; diff --git a/ui/app/templates/components/configure-aws-secret.hbs b/ui/app/templates/components/configure-aws-secret.hbs index 164f1dec3893..8c387497a077 100644 --- a/ui/app/templates/components/configure-aws-secret.hbs +++ b/ui/app/templates/components/configure-aws-secret.hbs @@ -30,8 +30,18 @@ If you do not supply lease settings, we will use the default values in AWS.

- - + +
{{else if (eq @attr.options.editType "ttl")}} - -
-
-

Renew Lease

- {{#let (or (get @model this.valuePath) @attr.options.setDefault) as |initialValue|}} - -