UI: Update engine dropdowns (#26806)

* Update search-select component
- Add aria-label arg
- use label or humanized ID as fallback aria-label
- protect against non-array options arg

* remove overflow-x rule on toolbar-scroller so dropdowns can render in place

* add renderInPlace to dropdowns in pki engine

* Update replication package.json and add renderInPlace

* Add renderInPlace to search-select and basic-dropdown in engines (kubernetes, kv, ldap, sync)

* small cleanup
This commit is contained in:
Chelsea Shaw
2024-05-03 12:09:03 -05:00
committed by GitHub
parent efa3f93e5f
commit 2a99b3651f
17 changed files with 60 additions and 22 deletions

View File

@@ -41,7 +41,6 @@
display: flex; display: flex;
height: 3rem; height: 3rem;
justify-content: space-between; justify-content: space-between;
overflow-x: auto;
width: 100%; width: 100%;
@include from($mobile) { @include from($mobile) {

View File

@@ -4,7 +4,14 @@
~}} ~}}
{{! @onWrap is recommend to be a concurrency task! see <Page::Secret::Details> in KV addon for example }} {{! @onWrap is recommend to be a concurrency task! see <Page::Secret::Details> in KV addon for example }}
<BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" @onClose={{@onClose}} as |D|> <BasicDropdown
@class="popup-menu"
@horizontalPosition="auto-right"
@verticalPosition="below"
@onClose={{@onClose}}
@renderInPlace={{true}}
as |D|
>
<D.Trigger data-test-copy-menu-trigger class="toolbar-link {{if D.isOpen 'is-active'}}" @htmlTag="button"> <D.Trigger data-test-copy-menu-trigger class="toolbar-link {{if D.isOpen 'is-active'}}" @htmlTag="button">
Copy Copy
<Chevron @direction={{if D.isOpen "up" "down"}} @isButton={{true}} /> <Chevron @direction={{if D.isOpen "up" "down"}} @isButton={{true}} />

View File

@@ -46,6 +46,7 @@
@renderInPlace={{@renderInPlace}} @renderInPlace={{@renderInPlace}}
@verticalPosition="below" @verticalPosition="below"
@disabled={{@disabled}} @disabled={{@disabled}}
@ariaLabel={{or @ariaLabel @label (humanize @id)}}
as |option| as |option|
> >
{{#if this.shouldRenderName}} {{#if this.shouldRenderName}}

View File

@@ -49,6 +49,7 @@ import { addToArray } from 'vault/helpers/add-to-array';
* @param {string} id - The name of the form field * @param {string} id - The name of the form field
* @param {string} [label] - Label for this form field * @param {string} [label] - Label for this form field
* @param {string} [labelClass] - overwrite default label size (14px) from class="is-label" * @param {string} [labelClass] - overwrite default label size (14px) from class="is-label"
* @param {string} [ariaLabel] - fallback accessible label if label is not provided
* @param {string} [subText] - Text to be displayed below the label * @param {string} [subText] - Text to be displayed below the label
* @param {string} fallbackComponent - name of component to be rendered if the API call 403s * @param {string} fallbackComponent - name of component to be rendered if the API call 403s
* @param {string} [helpText] - Text to be displayed in the info tooltip for this form field * @param {string} [helpText] - Text to be displayed in the info tooltip for this form field
@@ -142,7 +143,7 @@ export default class SearchSelect extends Component {
} }
if (!this.args.models) { if (!this.args.models) {
if (this.args.options) { if (Array.isArray(this.args.options)) {
const { options } = this.args; const { options } = this.args;
// if options are nested, let parent handle formatting - see path-filter-config-list.js // if options are nested, let parent handle formatting - see path-filter-config-list.js
this.dropdownOptions = options.some((e) => Object.keys(e).includes('groupName')) this.dropdownOptions = options.some((e) => Object.keys(e).includes('groupName'))

View File

@@ -32,6 +32,7 @@
@selectLimit="1" @selectLimit="1"
@fallbackComponent="input-search" @fallbackComponent="input-search"
@onChange={{this.selectRole}} @onChange={{this.selectRole}}
@renderInPlace={{true}}
/> />
<Hds::Button <Hds::Button
@text="Generate" @text="Generate"

View File

@@ -3,7 +3,7 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
~}} ~}}
<BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" as |D|> <BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" @renderInPlace={{true}} as |D|>
<D.Trigger data-test-version-dropdown class="toolbar-link {{if D.isOpen ' is-active'}}"> <D.Trigger data-test-version-dropdown class="toolbar-link {{if D.isOpen ' is-active'}}">
Version Version
{{or @displayVersion "current"}} {{or @displayVersion "current"}}

View File

@@ -57,7 +57,9 @@
@selectLimit="1" @selectLimit="1"
@fallbackComponent="input-search" @fallbackComponent="input-search"
@onChange={{this.selectRole}} @onChange={{this.selectRole}}
@renderInPlace={{true}}
/> />
<div>
<Hds::Button <Hds::Button
@text="Get credentials" @text="Get credentials"
@color="secondary" @color="secondary"
@@ -67,6 +69,7 @@
data-test-generate-credential-button data-test-generate-credential-button
/> />
</div> </div>
</div>
</OverviewCard> </OverviewCard>
</div> </div>
</div> </div>

View File

@@ -35,15 +35,21 @@
Sign Intermediate Sign Intermediate
</ToolbarLink> </ToolbarLink>
{{/if}} {{/if}}
<BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" as |D|> <BasicDropdown
@class="popup-menu"
@horizontalPosition="auto-right"
@verticalPosition="below"
@renderInPlace={{true}}
as |D|
>
<D.Trigger <D.Trigger
data-test-popup-menu-trigger="true"
class={{concat "toolbar-link" (if D.isOpen " is-active")}} class={{concat "toolbar-link" (if D.isOpen " is-active")}}
@htmlTag="button" @htmlTag="button"
data-test-issuer-download data-test-issuer-download
data-test-popup-menu-trigger
> >
Download Download
<Chevron @direction="down" @isButton={{true}} /> <Chevron @direction={{if D.isOpen "up" "down"}} @isButton={{true}} />
</D.Trigger> </D.Trigger>
<D.Content @defaultClass="popup-menu-content"> <D.Content @defaultClass="popup-menu-content">
<nav class="box menu" aria-label="snapshots actions"> <nav class="box menu" aria-label="snapshots actions">

View File

@@ -8,7 +8,13 @@
<ToolbarLink @route="issuers.import" @model={{@backend}} data-test-generate-issuer="import"> <ToolbarLink @route="issuers.import" @model={{@backend}} data-test-generate-issuer="import">
Import Import
</ToolbarLink> </ToolbarLink>
<BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" as |D|> <BasicDropdown
@class="popup-menu"
@horizontalPosition="auto-right"
@verticalPosition="below"
@renderInPlace={{true}}
as |D|
>
<D.Trigger <D.Trigger
class={{concat "toolbar-link" (if D.isOpen " is-active")}} class={{concat "toolbar-link" (if D.isOpen " is-active")}}
@htmlTag="button" @htmlTag="button"

View File

@@ -33,7 +33,13 @@
> >
Sign Intermediate Sign Intermediate
</ToolbarLink> </ToolbarLink>
<BasicDropdown @class="popup-menu" @horizontalPosition="auto-right" @verticalPosition="below" as |D|> <BasicDropdown
@class="popup-menu"
@horizontalPosition="auto-right"
@verticalPosition="below"
@renderInPlace={{true}}
as |D|
>
<D.Trigger <D.Trigger
data-test-popup-menu-trigger data-test-popup-menu-trigger
class={{concat "toolbar-link" (if D.isOpen " is-active")}} class={{concat "toolbar-link" (if D.isOpen " is-active")}}

View File

@@ -39,6 +39,7 @@
@disallowNewItems={{true}} @disallowNewItems={{true}}
@onChange={{this.handleRolesInput}} @onChange={{this.handleRolesInput}}
@fallbackComponent="input-search" @fallbackComponent="input-search"
@renderInPlace={{true}}
data-test-issue-certificate-input data-test-issue-certificate-input
/> />
<Hds::Button <Hds::Button
@@ -64,6 +65,7 @@
@disallowNewItems={{true}} @disallowNewItems={{true}}
@onChange={{this.handleCertificateInput}} @onChange={{this.handleCertificateInput}}
@fallbackComponent="input-search" @fallbackComponent="input-search"
@renderInPlace={{true}}
data-test-view-certificate-input data-test-view-certificate-input
/> />
<Hds::Button <Hds::Button
@@ -89,7 +91,8 @@
@onChange={{this.handleIssuerSearch}} @onChange={{this.handleIssuerSearch}}
@fallbackComponent="input-search" @fallbackComponent="input-search"
@shouldRenderName={{true}} @shouldRenderName={{true}}
@nameKey={{"issuerName"}} @nameKey="issuerName"
@renderInPlace={{true}}
data-test-issue-issuer-input data-test-issue-issuer-input
/> />
<Hds::Button <Hds::Button

View File

@@ -13,8 +13,8 @@ import type PkiIssuerModel from 'vault/models/pki/issuer';
import type PkiRoleModel from 'vault/models/pki/role'; import type PkiRoleModel from 'vault/models/pki/role';
interface Args { interface Args {
issuers: PkiIssuerModel | number; issuers: PkiIssuerModel[] | number;
roles: PkiRoleModel | number; roles: PkiRoleModel[] | number;
engine: string; engine: string;
} }

View File

@@ -6,6 +6,7 @@
], ],
"dependencies": { "dependencies": {
"date-fns": "*", "date-fns": "*",
"ember-basic-dropdown": "*",
"ember-cli-babel": "*", "ember-cli-babel": "*",
"ember-cli-htmlbars": "*", "ember-cli-htmlbars": "*",
"ember-cli-typescript": "*", "ember-cli-typescript": "*",

View File

@@ -89,6 +89,7 @@
@label="Paths in this {{this.config.mode}}" @label="Paths in this {{this.config.mode}}"
@options={{this.autoCompleteOptions}} @options={{this.autoCompleteOptions}}
@search={{perform this.setAutoCompleteOptions}} @search={{perform this.setAutoCompleteOptions}}
@renderInPlace={{true}}
/> />
{{/if}} {{/if}}
{{#if (and (not this.config.mode) this.startedWithMode)}} {{#if (and (not this.config.mode) this.startedWithMode)}}

View File

@@ -5,10 +5,11 @@
"ember-engine" "ember-engine"
], ],
"dependencies": { "dependencies": {
"ember-auto-import": "*",
"ember-cli-htmlbars": "*", "ember-cli-htmlbars": "*",
"ember-cli-babel": "*", "ember-cli-babel": "*",
"@hashicorp/design-system-components": "*", "ember-concurrency": "*",
"ember-auto-import": "*" "@hashicorp/design-system-components": "*"
}, },
"ember-addon": { "ember-addon": {
"paths": [ "paths": [

View File

@@ -25,6 +25,7 @@
@placeholder="Filter by type" @placeholder="Filter by type"
@inputValue={{if this.typeFilterName (array this.typeFilterName)}} @inputValue={{if this.typeFilterName (array this.typeFilterName)}}
@onChange={{fn this.onFilterChange "type"}} @onChange={{fn this.onFilterChange "type"}}
@renderInPlace={{true}}
class="is-marginless" class="is-marginless"
data-test-filter="type" data-test-filter="type"
/> />

View File

@@ -53,6 +53,7 @@
@selectLimit={{1}} @selectLimit={{1}}
@disallowNewItems={{true}} @disallowNewItems={{true}}
@onChange={{this.setMount}} @onChange={{this.setMount}}
@renderInPlace={{true}}
data-test-sync-mount-select data-test-sync-mount-select
/> />
{{else}} {{else}}