-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Add 'filtered by' to Upstreams and UpstreamInstance listings (#9632)
* Add filtered by to Upstreams and Linked Services * Filterby for upstream instances * More specific headers for definition tables * Add empty healthcheck filter predicate and related computed props * More i18n
- Loading branch information
Showing
12 changed files
with
307 additions
and
182 deletions.
There are no files selected for viewing
135 changes: 84 additions & 51 deletions
135
ui/packages/consul-ui/app/components/consul/upstream-instance/search-bar/index.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,96 @@ | ||
<form | ||
class="consul-upstream-instance-search-bar filter-bar" | ||
<SearchBar | ||
class="consul-upstream-instance-search-bar" | ||
...attributes | ||
@filter={{@filter}} | ||
> | ||
<div class="search"> | ||
<FreetextFilter | ||
@onsearch={{action @onsearch}} | ||
@value={{@search}} | ||
@placeholder="Search" | ||
> | ||
<PopoverSelect | ||
class="type-search-properties" | ||
<:status as |search|> | ||
|
||
{{#let | ||
|
||
(t (concat "components.consul.upstream-instance.search-bar." search.status.key ".name") | ||
default=(array | ||
(concat "common.search." search.status.key) | ||
(concat "common.consul." search.status.key) | ||
) | ||
) | ||
|
||
(t (concat "components.consul.upstream-instance.search-bar." search.status.value ".name") | ||
default=(array | ||
(concat "common.search." search.status.value) | ||
(concat "common.consul." search.status.value) | ||
(concat "common.brand." search.status.value) | ||
) | ||
) | ||
|
||
as |key value|}} | ||
<search.RemoveFilter | ||
aria-label={{t "common.ui.remove" item=(concat key " " value)}} | ||
> | ||
<dl> | ||
<dt>{{key}}</dt> | ||
<dd>{{value}}</dd> | ||
</dl> | ||
</search.RemoveFilter> | ||
{{/let}} | ||
|
||
</:status> | ||
<:search as |search|> | ||
<search.Search | ||
@onsearch={{action @onsearch}} | ||
@value={{@search}} | ||
@placeholder={{t "common.search.search"}} | ||
> | ||
<search.Select | ||
class="type-search-properties" | ||
@position="right" | ||
@onchange={{action @filter.searchproperty.change}} | ||
@multiple={{true}} | ||
@required={{true}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
{{t "common.search.searchproperty"}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
{{#each @filter.searchproperty.default as |prop|}} | ||
<Option @value={{prop}} @selected={{contains prop @filter.searchproperty.value}}> | ||
{{t (concat "common.consul." (lowercase prop))}} | ||
</Option> | ||
{{/each}} | ||
{{/let}} | ||
</BlockSlot> | ||
</search.Select> | ||
</search.Search> | ||
</:search> | ||
<:sort as |search|> | ||
<search.Select | ||
class="type-sort" | ||
data-test-sort-control | ||
@position="right" | ||
@onchange={{action @onfilter.searchproperty}} | ||
@multiple={{true}} | ||
@onchange={{action @sort.change}} | ||
@multiple={{false}} | ||
@required={{true}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
Search across | ||
{{#let (from-entries (array | ||
(array "DestinationName:asc" (t "common.sort.alpha.asc")) | ||
(array "DestinationName:desc" (t "common.sort.alpha.desc")) | ||
)) | ||
as |selectable| | ||
}} | ||
{{get selectable @sort.value}} | ||
{{/let}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
{{#each @searchproperties as |prop|}} | ||
<Option @value={{prop}} @selected={{contains prop @filter.searchproperties}}>{{prop}}</Option> | ||
{{/each}} | ||
<Option @value="DestinationName:asc" @selected={{eq "DestinationName:asc" @sort.value}}>{{t "common.sort.alpha.asc"}}</Option> | ||
<Option @value="DestinationName:desc" @selected={{eq "DestinationName:desc" @sort.value}}>{{t "common.sort.alpha.desc"}}</Option> | ||
{{/let}} | ||
</BlockSlot> | ||
</PopoverSelect> | ||
</FreetextFilter> | ||
</div> | ||
<div class="sort"> | ||
{{#let (or @sort 'DestinationName:asc') as |sort|}} | ||
<PopoverSelect | ||
class="type-sort" | ||
data-test-sort-control | ||
@position="right" | ||
@onchange={{action @onsort}} | ||
@multiple={{false}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
{{#let (from-entries (array | ||
(array "DestinationName:asc" "A to Z") | ||
(array "DestinationName:desc" "Z to A") | ||
)) | ||
as |selectable|}} | ||
{{get selectable sort}} | ||
{{/let}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
<Optgroup @label="Service Name"> | ||
<Option @value="DestinationName:asc" @selected={{eq "DestinationName:asc" sort}}>A to Z</Option> | ||
<Option @value="DestinationName:desc" @selected={{eq "DestinationName:desc" sort}}>Z to A</Option> | ||
</Optgroup> | ||
{{/let}} | ||
</BlockSlot> | ||
</PopoverSelect> | ||
{{/let}} | ||
</div> | ||
</form> | ||
</search.Select> | ||
</:sort> | ||
</SearchBar> |
188 changes: 114 additions & 74 deletions
188
ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,126 @@ | ||
<form | ||
class="consul-upstream-search-bar filter-bar" | ||
<SearchBar | ||
class="consul-upstream-search-bar" | ||
...attributes | ||
@filter={{@filter}} | ||
> | ||
<div class="search"> | ||
<FreetextFilter | ||
@onsearch={{action @onsearch}} | ||
@value={{@search}} | ||
@placeholder="Search" | ||
> | ||
<PopoverSelect | ||
class="type-search-properties" | ||
@position="right" | ||
@onchange={{action @onfilter.searchproperty}} | ||
<:status as |search|> | ||
|
||
{{#let | ||
|
||
(t (concat "components.consul.upstream.search-bar." search.status.key ".name") | ||
default=(array | ||
(concat "common.search." search.status.key) | ||
(concat "common.consul." search.status.key) | ||
) | ||
) | ||
|
||
(t (concat "components.consul.upstream.search-bar." search.status.value ".name") | ||
default=(array | ||
(concat "common.search." search.status.value) | ||
(concat "common.consul." search.status.value) | ||
(concat "common.brand." search.status.value) | ||
) | ||
) | ||
|
||
as |key value|}} | ||
<search.RemoveFilter | ||
aria-label={{t "common.ui.remove" item=(concat key " " value)}} | ||
> | ||
<dl> | ||
<dt>{{key}}</dt> | ||
<dd>{{value}}</dd> | ||
</dl> | ||
</search.RemoveFilter> | ||
{{/let}} | ||
|
||
</:status> | ||
<:search as |search|> | ||
<search.Search | ||
@onsearch={{action @onsearch}} | ||
@value={{@search}} | ||
@placeholder={{t "common.search.search"}} | ||
> | ||
<search.Select | ||
class="type-search-properties" | ||
@position="right" | ||
@onchange={{action @filter.searchproperty.change}} | ||
@multiple={{true}} | ||
@required={{true}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
{{t "common.search.searchproperty"}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
{{#each @filter.searchproperty.default as |prop|}} | ||
<Option @value={{prop}} @selected={{contains prop @filter.searchproperty.value}}> | ||
{{t (concat "common.consul." (lowercase prop))}} | ||
</Option> | ||
{{/each}} | ||
{{/let}} | ||
</BlockSlot> | ||
</search.Select> | ||
</search.Search> | ||
</:search> | ||
<:filter as |search|> | ||
<search.Select | ||
@position="left" | ||
@onchange={{action @filter.instance.change}} | ||
@multiple={{true}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
Search across | ||
{{t "components.consul.upstream.search-bar.instance.name"}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
<Option @value="Name" @selected={{contains 'Name' @filter.searchproperties}}>Name</Option> | ||
<Option @value="Tags" @selected={{contains 'Tags' @filter.searchproperties}}>Tags</Option> | ||
{{#each (array "registered" "not-registered") as |item|}} | ||
<Option @value={{item}} @selected={{contains item @filter.instance.value}}> | ||
{{t (concat "common.consul." item)}} | ||
</Option> | ||
{{/each}} | ||
{{/let}} | ||
</BlockSlot> | ||
</PopoverSelect> | ||
</FreetextFilter> | ||
</div> | ||
<div class="filters"> | ||
<PopoverSelect | ||
@position="left" | ||
@onchange={{action @onfilter.instance}} | ||
@multiple={{true}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
Type | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
<Option @value="registered" @selected={{contains 'registered' @filter.instances}}>Registered</Option> | ||
<Option @value="not-registered" @selected={{contains 'not-registered' @filter.instances}}>Not Registered</Option> | ||
{{/let}} | ||
</BlockSlot> | ||
</PopoverSelect> | ||
</div> | ||
<div class="sort"> | ||
<PopoverSelect | ||
class="type-sort" | ||
data-test-sort-control | ||
@position="right" | ||
@onchange={{action @onsort}} | ||
@multiple={{false}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
{{#let (from-entries (array | ||
(array "Name:asc" "A to Z") | ||
(array "Name:desc" "Z to A") | ||
(array "Status:asc" "Unhealthy to Healthy") | ||
(array "Status:desc" "Healthy to Unhealthy") | ||
)) | ||
as |selectable| | ||
}} | ||
{{get selectable @sort}} | ||
{{/let}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
<Optgroup @label="Health Status"> | ||
<Option @value="Status:asc" @selected={{eq "Status:asc" @sort}}>Unhealthy to Healthy</Option> | ||
<Option @value="Status:desc" @selected={{eq "Status:desc" @sort}}>Healthy to Unhealthy</Option> | ||
</Optgroup> | ||
<Optgroup @label="Service Name"> | ||
<Option @value="Name:asc" @selected={{eq "Name:asc" @sort}}>A to Z</Option> | ||
<Option @value="Name:desc" @selected={{eq "Name:desc" @sort}}>Z to A</Option> | ||
</Optgroup> | ||
{{/let}} | ||
</BlockSlot> | ||
</PopoverSelect> | ||
</div> | ||
</form> | ||
</search.Select> | ||
</:filter> | ||
<:sort as |search|> | ||
<search.Select | ||
class="type-sort" | ||
data-test-sort-control | ||
@position="right" | ||
@onchange={{action @sort.change}} | ||
@multiple={{false}} | ||
@required={{true}} | ||
as |components|> | ||
<BlockSlot @name="selected"> | ||
<span> | ||
{{#let (from-entries (array | ||
(array "Name:asc" (t "common.sort.alpha.asc")) | ||
(array "Name:desc" (t "common.sort.alpha.desc")) | ||
(array "Status:asc" (t "common.sort.status.asc")) | ||
(array "Status:desc" (t "common.sort.status.desc")) | ||
)) | ||
as |selectable| | ||
}} | ||
{{get selectable @sort.value}} | ||
{{/let}} | ||
</span> | ||
</BlockSlot> | ||
<BlockSlot @name="options"> | ||
{{#let components.Optgroup components.Option as |Optgroup Option|}} | ||
<Optgroup @label={{t "common.consul.status"}}> | ||
<Option @value="Status:asc" @selected={{eq "Status:asc" @sort.value}}>{{t "common.sort.status.asc"}}</Option> | ||
<Option @value="Status:desc" @selected={{eq "Status:desc" @sort.value}}>{{t "common.sort.status.desc"}}</Option> | ||
</Optgroup> | ||
<Optgroup @label={{t "common.consul.service-name"}}> | ||
<Option @value="Name:asc" @selected={{eq "Name:asc" @sort.value}}>{{t "common.sort.alpha.asc"}}</Option> | ||
<Option @value="Name:desc" @selected={{eq "Name:desc" @sort.value}}>{{t "common.sort.alpha.desc"}}</Option> | ||
</Optgroup> | ||
{{/let}} | ||
</BlockSlot> | ||
</search.Select> | ||
</:sort> | ||
</SearchBar> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.