Format auth method search bar template

This commit is contained in:
wenincode 2022-10-25 11:55:09 -06:00
parent 59936ae661
commit 64904d35da
1 changed files with 159 additions and 130 deletions

View File

@ -1,148 +1,177 @@
<SearchBar <SearchBar class='consul-auth-method-search-bar' ...attributes @filter={{@filter}}>
class="consul-auth-method-search-bar" <:status as |search|>
...attributes
@filter={{@filter}}
>
<:status as |search|>
{{#let {{#let
(t
(t (concat "components.consul.auth-method.search-bar." search.status.key ".name") (concat 'components.consul.auth-method.search-bar.' search.status.key '.name')
default=(array default=(array
(concat "common.search." search.status.key) (concat 'common.search.' search.status.key) (concat 'common.consul.' search.status.key)
(concat "common.consul." search.status.key) )
) )
) (t
(concat
(t (concat "components.consul.auth-method.search-bar." search.status.key ".options." search.status.value) 'components.consul.auth-method.search-bar.'
default=(array search.status.key
(concat "common.search." search.status.value) '.options.'
(concat "common.consul." search.status.value) search.status.value
(concat "common.brand." search.status.value) )
default=(array
(concat 'common.search.' search.status.value)
(concat 'common.consul.' search.status.value)
(concat 'common.brand.' search.status.value)
)
) )
) as |key value|
}}
as |key value|}} <search.RemoveFilter aria-label={{t 'common.ui.remove' item=(concat key ' ' value)}}>
<search.RemoveFilter
aria-label={{t "common.ui.remove" item=(concat key " " value)}}
>
<dl> <dl>
<dt>{{key}}</dt> <dt>{{key}}</dt>
<dd>{{value}}</dd> <dd>{{value}}</dd>
</dl> </dl>
</search.RemoveFilter> </search.RemoveFilter>
{{/let}} {{/let}}
</:status> </:status>
<:search as |search|> <:search as |search|>
<search.Search <search.Search
@onsearch={{action @onsearch}} @onsearch={{action @onsearch}}
@value={{@search}} @value={{@search}}
@placeholder={{t "common.search.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|
> >
<search.Select <BlockSlot @name='selected'>
class="type-search-properties" <span>
@position="right" {{t 'common.search.searchproperty'}}
@onchange={{action @filter.searchproperty.change}} </span>
@multiple={{true}} </BlockSlot>
@required={{true}} <BlockSlot @name='options'>
as |components|> {{#let components.Optgroup components.Option as |Optgroup Option|}}
<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|}} {{#each @filter.searchproperty.default as |prop|}}
<Option @value={{prop}} @selected={{includes prop @filter.searchproperty.value}}> <Option @value={{prop}} @selected={{includes prop @filter.searchproperty.value}}>
{{t (concat "common.consul." (lowercase prop))}} {{t (concat 'common.consul.' (lowercase prop))}}
</Option> </Option>
{{/each}} {{/each}}
{{/let}} {{/let}}
</BlockSlot>
</search.Select>
</search.Search>
</:search>
<:filter as |search|>
<search.Select
class="type-kind"
@position="left"
@onchange={{action @filter.kind.change}}
@multiple={{true}}
as |components|>
<BlockSlot @name="selected">
<span>
{{t "components.consul.auth-method.search-bar.kind.name"}}
</span>
</BlockSlot> </BlockSlot>
<BlockSlot @name="options"> </search.Select>
</search.Search>
</:search>
<:filter as |search|>
<search.Select
class='type-kind'
@position='left'
@onchange={{action @filter.kind.change}}
@multiple={{true}}
as |components|
>
<BlockSlot @name='selected'>
<span>
{{t 'components.consul.auth-method.search-bar.kind.name'}}
</span>
</BlockSlot>
<BlockSlot @name='options'>
{{#let components.Optgroup components.Option as |Optgroup Option|}} {{#let components.Optgroup components.Option as |Optgroup Option|}}
<Option class="kubernetes" @value="kubernetes" @selected={{includes 'kubernetes' @filter.kind.value}}>Kubernetes</Option> <Option
<Option class="jwt" @value="jwt" @selected={{includes 'jwt' @filter.kind.value}}>JWT</Option> class='kubernetes'
{{#if (env 'CONSUL_SSO_ENABLED')}} @value='kubernetes'
<Option class="oidc" @value="oidc" @selected={{includes 'oidc' @filter.kind.value}}>OIDC</Option> @selected={{includes 'kubernetes' @filter.kind.value}}
{{/if}} >Kubernetes</Option>
<Option
class='jwt'
@value='jwt'
@selected={{includes 'jwt' @filter.kind.value}}
>JWT</Option>
{{#if (env 'CONSUL_SSO_ENABLED')}}
<Option
class='oidc'
@value='oidc'
@selected={{includes 'oidc' @filter.kind.value}}
>OIDC</Option>
{{/if}}
{{/let}} {{/let}}
</BlockSlot> </BlockSlot>
</search.Select> </search.Select>
<search.Select <search.Select
class="type-locality" class='type-locality'
@position="left" @position='left'
@onchange={{action @filter.source.change}} @onchange={{action @filter.source.change}}
@multiple={{true}} @multiple={{true}}
as |components|> as |components|
<BlockSlot @name="selected"> >
<span> <BlockSlot @name='selected'>
{{t "components.consul.auth-method.search-bar.locality.name"}} <span>
</span> {{t 'components.consul.auth-method.search-bar.locality.name'}}
</BlockSlot> </span>
<BlockSlot @name="options"> </BlockSlot>
{{#let components.Optgroup components.Option as |Optgroup Option|}} <BlockSlot @name='options'>
{{#each (array "local" "global") as |option|}} {{#let components.Optgroup components.Option as |Optgroup Option|}}
<Option class="{{option}}" @value={{option}} @selected={{includes option @filter.types}}> {{#each (array 'local' 'global') as |option|}}
{{t (concat "components.consul.auth-method.search-bar.locality.options." option)}} <Option
</Option> class='{{option}}'
{{/each}} @value={{option}}
{{/let}} @selected={{includes option @filter.types}}
</BlockSlot> >
</search.Select> {{t (concat 'components.consul.auth-method.search-bar.locality.options.' option)}}
</:filter> </Option>
<:sort as |search|> {{/each}}
<search.Select {{/let}}
class="type-sort" </BlockSlot>
data-test-sort-control </search.Select>
@position="right" </:filter>
@onchange={{action @sort.change}} <:sort as |search|>
@multiple={{false}} <search.Select
@required={{true}} class='type-sort'
as |components|> data-test-sort-control
<BlockSlot @name="selected"> @position='right'
<span> @onchange={{action @sort.change}}
{{#let (from-entries (array @multiple={{false}}
(array "MethodName:asc" (t "common.sort.alpha.asc")) @required={{true}}
(array "MethodName:desc" (t "common.sort.alpha.desc")) as |components|
(array "TokenTTL:desc" (t "common.sort.duration.asc")) >
(array "TokenTTL:asc" (t "common.sort.duration.desc")) <BlockSlot @name='selected'>
)) <span>
as |selectable| {{#let
}} (from-entries
{{get selectable @sort.value}} (array
{{/let}} (array 'MethodName:asc' (t 'common.sort.alpha.asc'))
</span> (array 'MethodName:desc' (t 'common.sort.alpha.desc'))
</BlockSlot> (array 'TokenTTL:desc' (t 'common.sort.duration.asc'))
<BlockSlot @name="options"> (array 'TokenTTL:asc' (t 'common.sort.duration.desc'))
{{#let components.Optgroup components.Option as |Optgroup Option|}} )
<Optgroup @label={{t "common.ui.name"}}> )
<Option @value="MethodName:asc" @selected={{eq "MethodName:asc" @sort.value}}>{{t "common.sort.alpha.asc"}}</Option> as |selectable|
<Option @value="MethodName:desc" @selected={{eq "MethodName:desc" @sort.value}}>{{t "common.sort.alpha.desc"}}</Option> }}
</Optgroup> {{get selectable @sort.value}}
<Optgroup @label={{t "common.ui.maxttl"}}> {{/let}}
<Option @value="TokenTTL:desc" @selected={{eq "TokenTTL:desc" @sort.value}}>{{t "common.sort.duration.asc"}}</Option> </span>
<Option @value="TokenTTL:asc" @selected={{eq "TokenTTL:asc" @sort.value}}>{{t "common.sort.duration.desc"}}</Option> </BlockSlot>
</Optgroup> <BlockSlot @name='options'>
{{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}}
</BlockSlot> <Optgroup @label={{t 'common.ui.name'}}>
</search.Select> <Option @value='MethodName:asc' @selected={{eq 'MethodName:asc' @sort.value}}>{{t
</:sort> 'common.sort.alpha.asc'
}}</Option>
<Option @value='MethodName:desc' @selected={{eq 'MethodName:desc' @sort.value}}>{{t
'common.sort.alpha.desc'
}}</Option>
</Optgroup>
<Optgroup @label={{t 'common.ui.maxttl'}}>
<Option @value='TokenTTL:desc' @selected={{eq 'TokenTTL:desc' @sort.value}}>{{t
'common.sort.duration.asc'
}}</Option>
<Option @value='TokenTTL:asc' @selected={{eq 'TokenTTL:asc' @sort.value}}>{{t
'common.sort.duration.desc'
}}</Option>
</Optgroup>
{{/let}}
</BlockSlot>
</search.Select>
</:sort>
</SearchBar> </SearchBar>