open-vault/ui/app/templates/components/mount-accessor-select.hbs
Angel Garbarino 6d668aa60a
Glimmerize and add component test for MountAccessorSelect (#15565)
* glimmerize and add documentation to component

* fix test

* add component test:

* clean up

* address pr comments

* fix?

* replace drop with task

* replace test selector
2022-05-24 12:02:15 -06:00

53 lines
1.7 KiB
Handlebars

<div ...attributes>
{{#if @label}}
<label for={{@name}} class="is-label">
{{@label}}
{{#if @helpText}}
<InfoTooltip>
<span data-test-help-text>{{@helpText}}</span>
</InfoTooltip>
{{/if}}
</label>
{{/if}}
{{#if this.authMethods.isRunning}}
<div>
<span class="loader is-inline-block"></span>
</div>
{{else if this.authMethods.last.value}}
<div class="control is-expanded">
<div class="select is-fullwidth">
<select name={{@name}} id={{@name}} {{on "change" this.change}} data-test-mount-accessor-select>
{{#if this.noDefault}}
<option value="">Select one</option>
{{/if}}
{{#each this.authMethods.last.value as |method|}}
{{! token type does not need to be authorized via MFA }}
{{#if this.filterToken}}
{{#if (not-eq method.id "token")}}
<option selected={{eq @value method.accessor}} value={{method.accessor}}>
{{method.path}}
({{if @showAccessor method.accessor method.type}})
</option>
{{/if}}
{{else}}
<option selected={{eq @value method.accessor}} value={{method.accessor}}>
{{method.path}}
({{if @showAccessor method.accessor method.type}})
</option>
{{/if}}
{{/each}}
</select>
</div>
</div>
{{else}}
<input
name={{@name}}
id={{@name}}
class="input"
value={{@value}}
placeholder="Mount accessor"
{{on "change" this.change}}
data-test-mount-accessor-default
/>
{{/if}}
</div>