Allow managed-runtime badge to be dynamic (#14853)

This commit is contained in:
Michael Klein 2022-10-05 11:48:03 +02:00 committed by GitHub
parent 78b437760b
commit 6fbe799178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,24 +1,20 @@
<li <li class='dcs' data-test-datacenter-menu>
class="dcs"
data-test-datacenter-menu
>
{{#if (gt @dcs.length 1)}} {{#if (gt @dcs.length 1)}}
<DisclosureMenu <DisclosureMenu
aria-label="Datacenter" aria-label='Datacenter'
@items={{sort-by 'Primary:desc' 'Local:desc' 'Name:asc' @dcs}} @items={{sort-by 'Primary:desc' 'Local:desc' 'Name:asc' @dcs}}
data-test-datacenter-disclosure-menu data-test-datacenter-disclosure-menu
as |disclosure|> as |disclosure|
<disclosure.Action
{{on 'click' disclosure.toggle}}
> >
<disclosure.Action {{on 'click' disclosure.toggle}}>
{{@dc.Name}} {{@dc.Name}}
</disclosure.Action> </disclosure.Action>
<disclosure.Menu as |panel|> <disclosure.Menu as |panel|>
<DataSource <DataSource
@src={{uri '/*/*/*/datacenters'}} @src={{uri '/*/*/*/datacenters'}}
@onchange={{action (mut @dcs) value="data"}} @onchange={{action (mut @dcs) value='data'}}
/> />
<p class="dcs-message"> <p class='dcs-message'>
Datacenters shown in this dropdown are available through WAN Federation. Datacenters shown in this dropdown are available through WAN Federation.
</p> </p>
<panel.Menu as |menu|> <panel.Menu as |menu|>
@ -29,18 +25,18 @@
<menu.Item <menu.Item
data-test-dc-item data-test-dc-item
aria-current={{if (eq @dc.Name item.Name) 'true'}} aria-current={{if (eq @dc.Name item.Name) 'true'}}
class={{class-map class={{class-map (array 'is-local' item.Local) (array 'is-primary' item.Primary)}}
(array 'is-local' item.Local)
(array 'is-primary' item.Primary)
}}
> >
<menu.Action <menu.Action
{{on 'click' disclosure.close}} {{on 'click' disclosure.close}}
@href={{href-to '.' params=(hash @href={{href-to
'.'
params=(hash
dc=item.Name dc=item.Name
partition=undefined partition=undefined
nspace=(if (gt @nspace.length 0) @nspace undefined) nspace=(if (gt @nspace.length 0) @nspace undefined)
)}} )
}}
> >
{{item.Name}} {{item.Name}}
{{#if item.Primary}} {{#if item.Primary}}
@ -56,12 +52,13 @@
</disclosure.Menu> </disclosure.Menu>
</DisclosureMenu> </DisclosureMenu>
{{else}} {{else}}
<div class="dc-name" data-test-datacenter-single> <div class='dc-name' data-test-datacenter-single>
{{@dcs.firstObject.Name}} {{@dcs.firstObject.Name}}
{{#if (env 'CONSUL_HCP_MANAGED_RUNTIME')}} {{#let (env 'CONSUL_HCP_MANAGED_RUNTIME') as |managedRuntime|}}
<span>Self-managed</span> {{#if managedRuntime}}
<span>{{capitalize managedRuntime}}</span>
{{/if}} {{/if}}
{{/let}}
</div> </div>
{{/if}} {{/if}}
</li> </li>