Format index template

This commit is contained in:
wenincode 2022-10-27 14:23:41 -06:00
parent 3ed964864b
commit 2c7fabe447
1 changed files with 144 additions and 188 deletions

View File

@ -1,88 +1,81 @@
<App <App class='hashicorp-consul' ...attributes>
class="hashicorp-consul"
...attributes
>
<:notifications as |app|> <:notifications as |app|>
{{#each flashMessages.queue as |flash|}} {{#each flashMessages.queue as |flash|}}
<app.Notification <app.Notification @delay={{sub flash.timeout flash.extendedTimeout}} @sticky={{flash.sticky}}>
@delay={{sub flash.timeout flash.extendedTimeout}} {{#if flash.dom}}
@sticky={{flash.sticky}} {{{flash.dom}}}
>
{{#if flash.dom}}
{{{flash.dom}}}
{{else}}
{{#let (lowercase flash.type) (lowercase flash.action) as |status type|}}
<Notice
role="alert"
class={{concat status ' notification-' type}}
data-notification
@type={{status}}
as |notice|>
<notice.Header>
<strong>
{{capitalize status}}!
</strong>
</notice.Header>
<notice.Body>
<p>
{{#if (eq type 'logout')}}
{{#if (eq status 'success') }}
You are now logged out.
{{else}}
There was an error logging out.
{{/if}}
{{else if (eq type 'authorize')}}
{{#if (eq status 'success') }}
You are now logged in.
{{else}}
There was an error, please check your SecretID/Token
{{/if}}
{{else}} {{else}}
{{#if (or (eq type 'use') (eq flash.model 'token'))}} {{#let (lowercase flash.type) (lowercase flash.action) as |status type|}}
<Consul::Token::Notifications <Notice
@type={{type}} role='alert'
@status={{status}} class={{concat status ' notification-' type}}
@item={{flash.item}} data-notification
@error={{flash.error}} @type={{status}}
/> as |notice|
{{else if (eq flash.model 'intention')}} >
<Consul::Intention::Notifications <notice.Header>
@type={{type}} <strong>
@status={{status}} {{capitalize status}}!
@item={{flash.item}} </strong>
@error={{flash.error}} </notice.Header>
/> <notice.Body>
{{else if (eq flash.model 'role')}} <p>
<Consul::Role::Notifications {{#if (eq type 'logout')}}
@type={{type}} {{#if (eq status 'success')}}
@status={{status}} You are now logged out.
@item={{flash.item}} {{else}}
@error={{flash.error}} There was an error logging out.
/> {{/if}}
{{else if (eq flash.model 'policy')}} {{else if (eq type 'authorize')}}
<Consul::Policy::Notifications {{#if (eq status 'success')}}
@type={{type}} You are now logged in.
@status={{status}} {{else}}
@item={{flash.item}} There was an error, please check your SecretID/Token
@error={{flash.error}} {{/if}}
/> {{else}}
{{/if}} {{#if (or (eq type 'use') (eq flash.model 'token'))}}
<Consul::Token::Notifications
@type={{type}}
@status={{status}}
@item={{flash.item}}
@error={{flash.error}}
/>
{{else if (eq flash.model 'intention')}}
<Consul::Intention::Notifications
@type={{type}}
@status={{status}}
@item={{flash.item}}
@error={{flash.error}}
/>
{{else if (eq flash.model 'role')}}
<Consul::Role::Notifications
@type={{type}}
@status={{status}}
@item={{flash.item}}
@error={{flash.error}}
/>
{{else if (eq flash.model 'policy')}}
<Consul::Policy::Notifications
@type={{type}}
@status={{status}}
@item={{flash.item}}
@error={{flash.error}}
/>
{{/if}}
{{/if}}
</p>
</notice.Body>
</Notice>
{{/let}}
{{/if}} {{/if}}
</p> </app.Notification>
</notice.Body> {{/each}}
</Notice>
{{/let}}
{{/if}}
</app.Notification>
{{/each}}
</:notifications> </:notifications>
<:home-nav> <:home-nav>
<a <a href={{href-to 'index' params=(hash peer=undefined)}}><Consul::Logo /></a>
href={{href-to 'index' params=(hash peer=undefined)}}
><Consul::Logo /></a>
</:home-nav> </:home-nav>
<:main-nav> <:main-nav>
@ -99,147 +92,110 @@
@partition={{@partition}} @partition={{@partition}}
@nspace={{@nspace}} @nspace={{@nspace}}
@partitions={{this.partitions}} @partitions={{this.partitions}}
@onchange={{action (mut this.partitions) value="data"}} @onchange={{action (mut this.partitions) value='data'}}
/> />
<Consul::Nspace::Selector <Consul::Nspace::Selector
@dc={{@dc}} @dc={{@dc}}
@partition={{@partition}} @partition={{@partition}}
@nspace={{@nspace}} @nspace={{@nspace}}
@nspaces={{this.nspaces}} @nspaces={{this.nspaces}}
@onchange={{action (mut this.nspaces) value="data"}} @onchange={{action (mut this.nspaces) value='data'}}
/> />
{{#if (can 'access overview')}} {{#if (can 'access overview')}}
<li <li
data-test-main-nav-overview data-test-main-nav-overview
class={{class-map class={{class-map (array 'is-active' (is-href 'dc.show' @dc.Name))}}
(array 'is-active' (is-href 'dc.show' @dc.Name))
}}
> >
<Action <Action @href={{href-to 'dc.show' @dc.Name params=(hash peer=undefined)}}>
@href={{href-to 'dc.show' @dc.Name params=(hash peer=undefined)}}
>
Overview Overview
</Action> </Action>
</li> </li>
{{/if}} {{/if}}
{{#if (can "read services")}} {{#if (can 'read services')}}
<li data-test-main-nav-services class={{if (is-href 'dc.services' @dc.Name) 'is-active'}}> <li data-test-main-nav-services class={{if (is-href 'dc.services' @dc.Name) 'is-active'}}>
<a href={{href-to 'dc.services' @dc.Name params=(hash peer=undefined)}}>Services</a> <a href={{href-to 'dc.services' @dc.Name params=(hash peer=undefined)}}>Services</a>
</li> </li>
{{/if}} {{/if}}
{{#if (can "read nodes")}} {{#if (can 'read nodes')}}
<li data-test-main-nav-nodes class={{if (is-href 'dc.nodes' @dc.Name) 'is-active'}}> <li data-test-main-nav-nodes class={{if (is-href 'dc.nodes' @dc.Name) 'is-active'}}>
<a href={{href-to 'dc.nodes' @dc.Name params=(hash peer=undefined)}}>Nodes</a> <a href={{href-to 'dc.nodes' @dc.Name params=(hash peer=undefined)}}>Nodes</a>
</li> </li>
{{/if}} {{/if}}
{{#if (can "read kv")}} {{#if (can 'read kv')}}
<li data-test-main-nav-kvs class={{if (is-href 'dc.kv' @dc.Name) 'is-active'}}> <li data-test-main-nav-kvs class={{if (is-href 'dc.kv' @dc.Name) 'is-active'}}>
<a href={{href-to 'dc.kv' @dc.Name params=(hash peer=undefined)}}>Key/Value</a> <a href={{href-to 'dc.kv' @dc.Name params=(hash peer=undefined)}}>Key/Value</a>
</li> </li>
{{/if}} {{/if}}
{{#if (can "read intentions")}} {{#if (can 'read intentions')}}
<li data-test-main-nav-intentions class={{if (is-href 'dc.intentions' @dc.Name) 'is-active'}}> <li
<a href={{href-to 'dc.intentions' @dc.Name params=(hash peer=undefined)}}>Intentions</a> data-test-main-nav-intentions
class={{if (is-href 'dc.intentions' @dc.Name) 'is-active'}}
>
<a href={{href-to 'dc.intentions' @dc.Name params=(hash peer=undefined)}}>Intentions</a>
</li> </li>
{{/if}} {{/if}}
<Consul::Acl::Selector <Consul::Acl::Selector @dc={{@dc}} @partition={{@partition}} @nspace={{@nspace}} />
@dc={{@dc}} <Consul::Peer::Selector @dc={{@dc}} @partition={{@partition}} @nspace={{@nspace}} />
@partition={{@partition}}
@nspace={{@nspace}}
/>
<Consul::Peer::Selector
@dc={{@dc}}
@partition={{@partition}}
@nspace={{@nspace}}
/>
</ul> </ul>
</:main-nav> </:main-nav>
<:complementary-nav> <:complementary-nav>
<ul> <ul>
<Debug::Navigation /> <Debug::Navigation />
<li <li data-test-main-nav-help>
data-test-main-nav-help <DisclosureMenu as |disclosure|>
> <disclosure.Action {{on 'click' disclosure.toggle}}>
<DisclosureMenu Help
as |disclosure|> </disclosure.Action>
<disclosure.Action <disclosure.Menu as |panel|>
{{on 'click' disclosure.toggle}} <panel.Menu as |menu|>
> <menu.Separator>
Help Consul v{{env 'CONSUL_VERSION'}}
</disclosure.Action> </menu.Separator>
<disclosure.Menu as |panel|> <menu.Item class='docs-link'>
<panel.Menu as |menu|> <menu.Action @href={{env 'CONSUL_DOCS_URL'}} @external={{true}}>
<menu.Separator> Documentation
Consul v{{env 'CONSUL_VERSION'}} </menu.Action>
</menu.Separator> </menu.Item>
<menu.Item <menu.Item class='learn-link'>
class="docs-link" <menu.Action
@href={{concat (env 'CONSUL_DOCS_LEARN_URL') '/consul'}}
@external={{true}}
> >
<menu.Action HashiCorp Learn
@href={{env 'CONSUL_DOCS_URL'}} </menu.Action>
@external={{true}} </menu.Item>
> <menu.Separator />
Documentation <menu.Item class='feedback-link'>
</menu.Action> <menu.Action @href={{env 'CONSUL_REPO_ISSUES_URL'}} @external={{true}}>
</menu.Item> Provide Feedback
<menu.Item </menu.Action>
class="learn-link" </menu.Item>
> </panel.Menu>
<menu.Action </disclosure.Menu>
@href={{concat (env 'CONSUL_DOCS_LEARN_URL') '/consul'}} </DisclosureMenu>
@external={{true}} </li>
> <li data-test-main-nav-settings class={{if (is-href 'settings') 'is-active'}}>
HashiCorp Learn <a href={{href-to 'settings' params=(hash nspace=undefined partition=undefined)}}>
</menu.Action> Settings
</menu.Item> </a>
<menu.Separator /> </li>
<menu.Item <Consul::Token::Selector
class="feedback-link" @dc={{@dc}}
> @partition={{@partition}}
<menu.Action @nspace={{@nspace}}
@href={{env 'CONSUL_REPO_ISSUES_URL'}} @onchange={{@onchange}}
@external={{true}} as |selector|
> >
Provide Feedback <Ref @target={{this}} @name='tokenSelector' @value={{selector}} />
</menu.Action> </Consul::Token::Selector>
</menu.Item>
</panel.Menu>
</disclosure.Menu>
</DisclosureMenu>
</li>
<li
data-test-main-nav-settings
class={{if (is-href 'settings') 'is-active'}}
>
<a
href={{href-to 'settings' params=(hash
nspace=undefined
partition=undefined
)}}
>
Settings
</a>
</li>
<Consul::Token::Selector
@dc={{@dc}}
@partition={{@partition}}
@nspace={{@nspace}}
@onchange={{@onchange}}
as |selector|>
<Ref
@target={{this}}
@name="tokenSelector"
@value={{selector}}
/>
</Consul::Token::Selector>
</ul> </ul>
</:complementary-nav> </:complementary-nav>
<:main> <:main>
{{yield (hash {{yield
login=(if this.tokenSelector this.tokenSelector (hash open=undefined close=undefined)) (hash login=(if this.tokenSelector this.tokenSelector (hash open=undefined close=undefined)))
)}} }}
</:main> </:main>
<:content-info> <:content-info>