John Cowen 3f131dcf34
ui: Notifications re-organization/re-style (#11577)
- Moves where they appear up to the <App /> component.
- Instead of a <Notification /> wrapping component to move whatever you use for a notification up to where they need to appear (via ember-cli-flash), we now use a {{notification}} modifier now we have modifiers.
- Global notifications/flashes are no longer special styles of their own. You just use the {{notification}} modifier to hoist whatever component/element you want up to the top of the page. This means we can re-use our existing <Notice /> component for all our global UI notifications (this is the user visible change here)
2021-11-24 18:14:07 +00:00

116 lines
3.1 KiB
Handlebars

<Route
@name={{routeName}}
as |route|>
<DataLoader @src={{
uri '/${partition}/${nspace}/${dc}/policy/${id}'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
id=(or route.params.id '')
)
}}
as |loader|>
<BlockSlot @name="error">
{{#if (eq loader.error.status '401')}}
<Consul::Acl::Disabled />
{{else}}
<AppError
@error={{loader.error}}
@login={{route.model.app.login.open}}
/>
{{/if}}
</BlockSlot>
<BlockSlot @name="loaded">
{{#let
route.params.dc
route.params.partition
route.params.nspace
(or route.params.id '')
loader.data
loader.data.isNew
as |dc partition nspace id item create|}}
<AppView
@login={{route.model.app.login.open}}
>
<BlockSlot @name="breadcrumbs">
<ol>
<li><a data-test-back href={{href-to 'dc.acls.policies'}}>All Policies</a></li>
</ol>
</BlockSlot>
<BlockSlot @name="header">
<h1>
{{#if create }}
<route.Title @title="New Policy" />
{{else}}
{{#if (can "write policy" item=item)}}
<route.Title @title="Edit Policy" />
{{else}}
<route.Title @title="View Policy" />
{{/if}}
{{/if}}
</h1>
</BlockSlot>
<BlockSlot @name="content">
{{#if (not create) }}
<div class="definition-table">
<dl>
<dt>Policy ID</dt>
<dd>
<CopyButton @value={{item.ID}} @name="Policy ID" @position="top-start" /> {{item.ID}}
</dd>
</dl>
</div>
{{/if}}
{{#if (eq (policy/typeof item) 'policy-management')}}
<Notice
class="policy-management"
@type="none"
as |notice|>
<notice.Header>
<h3>Management</h3>
</notice.Header>
<notice.Body>
<p>
This global-management token is built into Consul's policy system. You can apply this special policy to tokens for full access. This policy is not editable or removeable, but can be ignored by not applying it to any tokens. Learn more in our <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#builtin-policies" target="_blank" rel="noopener noreferrer">documentation</a>.
</p>
</notice.Body>
</Notice>
<div class="definition-table">
<dl>
<dt>Name</dt>
<dd>{{item.Name}}</dd>
<dt>Valid Datacenters</dt>
<dd>{{ join ', ' (policy/datacenters item)}}</dd>
<dt>Description</dt>
<dd>{{item.Description}}</dd>
</dl>
</div>
<DataSource
@src={{uri '/${partition}/${nspace}/${dc}/tokens/for-policy/${id}'
(hash
partition=partition
nspace=nspace
dc=dc
id=id
)
}}
as |loader|>
{{#if (gt loader.data.length 0)}}
<TokenList @caption="Applied to the following tokens:" @items={{loader.data}} />
{{/if}}
</DataSource>
{{else}}
{{ partial 'dc/acls/policies/form'}}
{{/if}}
</BlockSlot>
</AppView>
{{/let}}
</BlockSlot>
</DataLoader>
</Route>