Format auth method search bar template

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