Files
vault/ui/lib/core/addon/components/search-select-with-modal.hbs
Angel Garbarino 3abca46464 WIF sidebranch (#28148)
* manual cherry pick to deal with all the merge things

* changelog

* test fixes

* Update 28148.txt

* fix tests failures after main merge

* fix test failures after main merge

* Add Access Type and conditionally render WIF fields (#28149)

* initial work.

* remove access_type

* better no model logic well kind of

* rollback attrs

* remove defaults

* stopping point

* wip changing back to sidebranch

* hustling shuffling and serializing

* some of the component test coverage

* disable acces type if editing

* test coverage

* hide max retries that sneaky bugger

* cleanup

* cleanup

* Update root-config.js

* remove flash message check, locally passes great but on ci flaky

* clean up

* thank you chelsea

* test clean up per enterprise vs community

* address pr comments

* welp a miss add

* UI (sidebranch) WIF Issuer field (#28187)

* Add type declaration files for aws config models

* use updated task syntax for save method on configure-aws

* fix types on edit route

* fetch issuer on configure edit page if aws + enterprise

* track issuer within configure-aws component

* add placeholder support on form-field

* Add warning if issuer changed from previous value or could not be read

* cleanup

* preliminary tests

* dont use while loop so we can test the modal

* tests

* cleanup

* fix tests

* remove extra tracked value and duplicate changed attrs check

* modal footer

---------

Co-authored-by: Angel Garbarino <argarbarino@gmail.com>

* Display issuer on Configuration details (#28209)

* display issuer on configuration details

* workflow complete, now on to testing

* handle issuer things

* fix all the broken tests things

* add test coveragE:

* cleanup

* rename model/adapter

* Update configure-aws.ts

* Update aws-configuration-test.js

* 90 percent there for pr comments

* last one for tonight

* a few more because why not

* hasDirtyAttributes fixes

* revert back to previous noRead->queryIssuerError

---------

Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
2024-08-29 12:17:51 -06:00

107 lines
3.2 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}
<div
{{did-insert (perform this.fetchOptions)}}
id={{@id}}
class="field search-select {{if @displayInherit 'display-inherit'}}"
data-test-search-select-with-modal
...attributes
>
{{#if this.shouldUseFallback}}
{{component
@fallbackComponent
label=@label
subText=@subText
onChange=@onChange
inputValue=@inputValue
helpText=@helpText
placeholder=(or @fallbackComponentPlaceholder @placeholder)
id=@id
selectLimit=@selectLimit
}}
{{else}}
{{#if @label}}
<label for={{@id}} class={{or @labelClass "is-label"}} data-test-field-label>
{{@label}}
{{#if @helpText}}
<InfoTooltip>{{@helpText}}</InfoTooltip>
{{/if}}
</label>
{{/if}}
{{#if @subText}}
<p data-test-modal-subtext class="sub-text">{{@subText}}</p>
{{/if}}
{{#unless this.hidePowerSelect}}
<PowerSelect
@eventType="click"
@placeholder={{@placeholder}}
@searchEnabled={{true}}
@search={{this.searchAndSuggest}}
@options={{this.dropdownOptions}}
@onChange={{this.selectOrCreate}}
@placeholderComponent={{component "search-select-placeholder"}}
@verticalPosition="below"
as |option|
>
{{#if this.shouldRenderName}}
{{option.name}}
{{#unless option.__isSuggestion__}}
<small class="search-select-list-key" data-test-smaller-id="true">
{{option.id}}
</small>
{{/unless}}
{{else}}
{{option.id}}
{{/if}}
</PowerSelect>
{{/unless}}
<ul class="search-select-list">
{{#each this.selectedOptions as |selected index|}}
<li class="search-select-list-item" data-test-selected-option={{index}}>
{{#if this.shouldRenderName}}
{{selected.name}}
<small class="search-select-list-key" data-test-smaller-id={{index}}>
{{selected.id}}
</small>
{{else}}
<div>
{{selected.id}}
</div>
{{/if}}
<div class="control">
<Hds::Button
@icon="trash"
@text="delete selection"
@isIconOnly={{true}}
@color="tertiary"
data-test-selected-list-button="delete"
{{on "click" (fn this.discardSelection selected)}}
/>
</div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if this.showModal}}
<Hds::Modal id="search-select-modal" @onClose={{fn (mut this.showModal) false}} as |M|>
<M.Header data-test-modal-title>
Create new
{{singularize @id}}
</M.Header>
<M.Body>
{{#if @modalSubtext}}
<p class="has-bottom-margin-s" data-test-modal-subtext>
{{@modalSubtext}}
</p>
{{/if}}
{{! dynamically render template from modal-form/ folder}}
{{! form must receive an @onSave and @onCancel arg that executes the callback}}
{{component @modalFormTemplate nameInput=this.nameInput onSave=this.resetModal onCancel=this.resetModal}}
</M.Body>
</Hds::Modal>
{{/if}}
</div>