* feat: 🎸 filter sessions by target ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * docs: ✏️ add missing comment ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * refactor: 💡 make action reusable ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * refactor: 💡 remove unnecessary block ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * refactor: 💡 fix tests, add hds app state ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * perf: ⚡️ set limit of targets rendered in dropdown ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * fix: 🐛 change from displayName to name ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 * Update addons/core/addon/components/dropdown/index.hbs Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * refactor: 💡 remove # from if statement and remove .slice ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12066 --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
57 lines
1.4 KiB
Handlebars
57 lines
1.4 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: MPL-2.0
|
|
}}
|
|
|
|
<Hds::Dropdown
|
|
@height='314px'
|
|
@onClose={{this.close}}
|
|
@listPosition={{@listPosition}}
|
|
as |DD|
|
|
>
|
|
<DD.ToggleButton
|
|
@color='secondary'
|
|
@text={{@name}}
|
|
@count={{@checkedItems.length}}
|
|
/>
|
|
{{#if @isSearchable}}
|
|
<DD.Header @hasDivider={{true}}>
|
|
<Hds::Form::TextInput::Base
|
|
@type='search'
|
|
@value={{this.searchTerm}}
|
|
placeholder={{t 'actions.narrow-results'}}
|
|
aria-label={{t 'actions.narrow-results'}}
|
|
{{on 'input' this.filterItems}}
|
|
data-test-dropdown-search
|
|
/>
|
|
</DD.Header>
|
|
{{/if}}
|
|
{{#unless this.itemOptions}}
|
|
<DD.Description @text={{t 'titles.no-results'}} />
|
|
{{/unless}}
|
|
|
|
{{#if (has-block)}}
|
|
{{yield DD this.selectItem this.itemOptions}}
|
|
{{else}}
|
|
{{#each this.itemOptions as |itemOption|}}
|
|
<DD.Checkbox
|
|
@value={{itemOption.id}}
|
|
data-test-checkbox={{itemOption.id}}
|
|
checked={{includes itemOption.id @checkedItems}}
|
|
{{on 'change' this.selectItem}}
|
|
>
|
|
{{if itemOption.name itemOption.name itemOption.id}}
|
|
</DD.Checkbox>
|
|
{{/each}}
|
|
{{/if}}
|
|
|
|
<DD.Footer @hasDivider={{true}}>
|
|
<Hds::Button
|
|
@text='Apply'
|
|
@isFullWidth={{true}}
|
|
@size='small'
|
|
{{on 'click' (fn this.applyFilter DD.close)}}
|
|
data-test-dropdown-apply-button
|
|
/>
|
|
</DD.Footer>
|
|
</Hds::Dropdown> |