ui: Remove authorization and disabled partials/blocks (#8829)

* Add disabled and unauthorized views into AppView without a block

* Remove disabled/unauthorized block usage

* Remove unauthorized and diabled partials

* Passthrough allowLogin attribute
This commit is contained in:
John Cowen 2020-10-06 14:34:32 +01:00 committed by GitHub
parent 6c78cc6eea
commit 356ddd1976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 78 deletions

View File

@ -82,7 +82,31 @@
</header>
<div>
{{#if (not enabled) }}
<YieldSlot @name="disabled">{{yield}}</YieldSlot>
<EmptyState>
<BlockSlot @name="header">
<h2>Welcome to ACLs</h2>
</BlockSlot>
<BlockSlot @name="body">
<p>
ACLs are not enabled in this Consul cluster. We strongly encourage the use of ACLs in production environments for the best security practices.
</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
<a href="{{env 'CONSUL_DOCS_URL'}}/acl/index.html" rel="noopener noreferrer" target="_blank">Read the documentation</a>
</li>
<li class="learn-link">
<a href="{{env 'CONSUL_DOCS_LEARN_URL'}}/consul/security-networking/production-acls" rel="noopener noreferrer" target="_blank">Follow the guide</a>
</li>
</BlockSlot>
</EmptyState>
{{else if (not authorized)}}
<ErrorState
@error={{hash
status='403'
}}
@allowLogin={{true}}
/>
{{else}}
<YieldSlot @name="content">{{yield}}</YieldSlot>
{{/if}}

View File

@ -1,5 +1,8 @@
{{#if (not-eq error.status "403")}}
<EmptyState class={{concat "status-" error.status}}>
<EmptyState
class={{concat "status-" error.status}}
@allowLogin={{@allowLogin}}
>
<BlockSlot @name="header">
<h2>{{or error.message "Consul returned an error"}}</h2>
</BlockSlot>
@ -23,7 +26,10 @@
</BlockSlot>
</EmptyState>
{{else}}
<EmptyState class="status-403">
<EmptyState
class="status-403"
@allowLogin={{@allowLogin}}
>
<BlockSlot @name="header">
<h2 data-test-status={{error.status}}>You are not authorized</h2>
</BlockSlot>

View File

@ -1,21 +0,0 @@
<EmptyState class="status-403" @allowLogin={{true}}>
<BlockSlot @name="header">
<h2>You are not authorized</h2>
</BlockSlot>
<BlockSlot @name="subheader">
<h3>Error 403</h3>
</BlockSlot>
<BlockSlot @name="body">
<p>
You must be granted permissions to view this data. Login or ask your administrator if you think you should have access.
</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
<a href="{{env 'CONSUL_DOCS_URL'}}/acl/index.html" rel="noopener noreferrer" target="_blank">Read the documentation</a>
</li>
<li class="learn-link">
<a href="{{env 'CONSUL_DOCS_LEARN_URL'}}/consul/security-networking/production-acls" rel="noopener noreferrer" target="_blank">Follow the guide</a>
</li>
</BlockSlot>
</EmptyState>

View File

@ -1,18 +0,0 @@
<EmptyState>
<BlockSlot @name="header">
<h2>Welcome to ACLs</h2>
</BlockSlot>
<BlockSlot @name="body">
<p>
ACLs are not enabled in this Consul cluster. We strongly encourage the use of ACLs in production environments for the best security practices.
</p>
</BlockSlot>
<BlockSlot @name="actions">
<li class="docs-link">
<a href="{{env 'CONSUL_DOCS_URL'}}/acl/index.html" rel="noopener noreferrer" target="_blank">Read the documentation</a>
</li>
<li class="learn-link">
<a href="{{env 'CONSUL_DOCS_LEARN_URL'}}/consul/security-networking/production-acls" rel="noopener noreferrer" target="_blank">Follow the guide</a>
</li>
</BlockSlot>
</EmptyState>

View File

@ -14,12 +14,6 @@
<BlockSlot @name="notification" as |status type item error|>
{{partial 'dc/acls/policies/notifications'}}
</BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="breadcrumbs">
<ol>
<li><a data-test-back href={{href-to 'dc.acls.policies'}}>All Policies</a></li>

View File

@ -25,12 +25,6 @@
{{partial 'dc/acls/nav'}}
{{/if}}
</BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.acls.policies.create'}}" class="type-create">Create</a>
</BlockSlot>

View File

@ -14,12 +14,6 @@
<BlockSlot @name="notification" as |status type item error|>
{{partial 'dc/acls/roles/notifications'}}
</BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="breadcrumbs">
<ol>
<li><a data-test-back href={{href-to 'dc.acls.roles'}}>All Roles</a></li>

View File

@ -22,12 +22,6 @@
{{partial 'dc/acls/nav'}}
{{/if}}
</BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.acls.roles.create'}}" class="type-create">Create</a>
</BlockSlot>

View File

@ -14,12 +14,6 @@
<BlockSlot @name="notification" as |status type item error|>
{{partial 'dc/acls/tokens/notifications'}}
</BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="breadcrumbs">
<ol>
<li><a data-test-back href={{href-to 'dc.acls.tokens'}}>All Tokens</a></li>

View File

@ -25,12 +25,6 @@
{{partial 'dc/acls/nav'}}
{{/if}}
</BlockSlot>
<BlockSlot @name="disabled">
{{partial 'dc/acls/disabled'}}
</BlockSlot>
<BlockSlot @name="authorization">
{{partial 'dc/acls/authorization'}}
</BlockSlot>
<BlockSlot @name="actions">
<a data-test-create href="{{href-to 'dc.acls.tokens.create'}}" class="type-create">Create</a>
</BlockSlot>