diff --git a/ui/app/controllers/vault/cluster/access/mfa/methods/method/index.js b/ui/app/controllers/vault/cluster/access/mfa/methods/method/index.js index 99c762c4d4..cce625543f 100644 --- a/ui/app/controllers/vault/cluster/access/mfa/methods/method/index.js +++ b/ui/app/controllers/vault/cluster/access/mfa/methods/method/index.js @@ -13,7 +13,7 @@ export default class MfaMethodController extends Controller { async deleteMethod() { try { await this.model.method.destroyRecord(); - this.flashMessages.success('MFA method deleted successfully deleted.'); + this.flashMessages.success('MFA method deleted successfully.'); this.router.transitionTo('vault.cluster.access.mfa.methods'); } catch (error) { this.flashMessages.danger(`There was an error deleting this MFA method.`); diff --git a/ui/app/models/mfa-method.js b/ui/app/models/mfa-method.js index 7c4729d22f..1ca25b47fd 100644 --- a/ui/app/models/mfa-method.js +++ b/ui/app/models/mfa-method.js @@ -121,7 +121,8 @@ export default class MfaMethod extends Model { @attr({ label: 'Period', editType: 'ttl', - subText: 'How long each generated TOTP is valid.', + helperTextEnabled: 'How long each generated TOTP is valid.', + hideToggle: true, }) period; @attr('number', { diff --git a/ui/lib/core/addon/components/form-field.hbs b/ui/lib/core/addon/components/form-field.hbs index 7835e1c663..8adc5e8e92 100644 --- a/ui/lib/core/addon/components/form-field.hbs +++ b/ui/lib/core/addon/components/form-field.hbs @@ -113,6 +113,7 @@ @description={{@attr.helpText}} @initialValue={{initialValue}} @initialEnabled={{if (eq initialValue "0s") false initialValue}} + @hideToggle={{@attr.options.hideToggle}} /> {{/let}} diff --git a/ui/lib/core/addon/components/ttl-picker2.js b/ui/lib/core/addon/components/ttl-picker2.js index 17c8fa86e3..e8e8e277a0 100644 --- a/ui/lib/core/addon/components/ttl-picker2.js +++ b/ui/lib/core/addon/components/ttl-picker2.js @@ -19,6 +19,7 @@ * @param initialValue=null {String} - This is the value set initially (particularly from a string like '30h') * @param initialEnabled=null {Boolean} - Set this value if you want the toggle on when component is mounted * @param changeOnInit=false {Boolean} - set this value if you'd like the passed onChange function to be called on component initialization + * @param hideToggle=false {Boolean} - set this value if you'd like to hide the toggle and just leverage the input field */ import { computed } from '@ember/object'; @@ -53,6 +54,7 @@ export default TtlForm.extend({ unit: 's', initialValue: null, changeOnInit: false, + hideToggle: false, init() { this._super(...arguments); @@ -140,8 +142,9 @@ export default TtlForm.extend({ 'helperTextEnabled', 'helperTextSet', 'helperTextUnset', + 'hideToggle', function () { - return this.enableTTL ? this.helperTextEnabled : this.helperTextDisabled; + return this.enableTTL || this.hideToggle ? this.helperTextEnabled : this.helperTextDisabled; } ), diff --git a/ui/lib/core/addon/templates/components/ttl-picker2.hbs b/ui/lib/core/addon/templates/components/ttl-picker2.hbs index 27f89e977a..deb7391422 100644 --- a/ui/lib/core/addon/templates/components/ttl-picker2.hbs +++ b/ui/lib/core/addon/templates/components/ttl-picker2.hbs @@ -1,13 +1,6 @@ - - {{this.label}}
-
+{{#if this.hideToggle}} + {{this.label}}
+
{{this.helperText}} {{#if this.description}} @@ -22,9 +15,35 @@ {{/if}}
- -{{#if this.enableTTL}} -
+{{else}} + + {{this.label}}
+
+ {{this.helperText}} + {{#if this.description}} + + + + + +
+ {{this.description}} +
+
+
+ {{/if}} +
+
+{{/if}} +{{#if (or this.enableTTL this.hideToggle)}} +