Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update alerts to Hds::Alert component #16412

Merged
merged 4 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/16412.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Update alerts to Hds::Alert component
```
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@
</Notice>
{{/if}}
{{else if (eq @type 'kv')}}
<Notice
@type="warning"
data-test-session-warning
as |notice|>
<notice.Body>
<p>
<strong>Warning.</strong> This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see <a href="{{env 'CONSUL_DOCS_URL'}}/internals/sessions.html" target="_blank" rel="noopener noreferrer">our documentation</a> for more information.
</p>
</notice.Body>
</Notice>
<Hds::Alert @type='inline' @color='warning' class='mb-3' data-test-session-warning as |A|>
<A.Title>Warning</A.Title>
<A.Description>This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session.</A.Description>
<A.Link::Standalone @text='Learn more'
@href="{{env 'CONSUL_DOCS_URL'}}/internals/sessions.html"
@icon='docs-link'
@iconPosition='trailing' />
</Hds::Alert>
{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@

<fsm.State @matches={{array "idle" "error"}}>
<fsm.State @matches={{"error"}}>
<Notice @type="error" role="alert" as |notice|>
<notice.Body>
<p>
<strong>Error</strong><br />
{{fsm.state.context.error.message}}
</p>
</notice.Body>
</Notice>
<Hds::Alert @type='critical' class='mb-3 mt-2' as |A|>
<A.Title>Error</A.Title>
<A.Description>{{fsm.state.context.error.message}}</A.Description>
</Hds::Alert>
</fsm.State>
{{yield
(hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@
as |writer|
>
<BlockSlot @name="error" as |after error|>
<Notice @type="error" role="alert" as |notice|>
<notice.Body>
<p>
<strong>Error</strong><br />
{{error.message}}
</p>
</notice.Body>
</Notice>
<Hds::Alert @type='critical' class='mb-3 mt-2' as |A|>
<A.Title>Error</A.Title>
<A.Description>{{error.message}}</A.Description>
</Hds::Alert>
</BlockSlot>
<BlockSlot @name="content">
{{#let (unique-id) as |id|}}
Expand Down
76 changes: 44 additions & 32 deletions ui/packages/consul-ui/app/components/auth-form/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,52 @@
{{/if}}
<State @matches='error'>
{{#if this.error.status}}
<Notice @type='error' role='alert' as |notice|>
<notice.Body>
<p>
{{#if this.value.Name}}
{{#if (eq this.error.status '403')}}
<strong>Consul login failed</strong><br />
We received a token from your OIDC provider but could not log in to Consul
with it.
{{else if (eq this.error.status '401')}}
<strong>Could not log in to provider</strong><br />
The OIDC provider has rejected this access token. Please have an
administrator check your auth method configuration.
{{else if (eq this.error.status '499')}}
<strong>SSO log in window closed</strong><br />
The OIDC provider window was closed. Please try again.
{{else}}
<strong>Error</strong><br />
{{this.error.detail}}
{{/if}}
<Hds::Alert @type='inline' @color='critical' class='mb-1 mt-2' as |A|>
<A.Title>
{{#if this.value.Name}}
{{#if (eq this.error.status '403')}}
Consul login failed
{{else if (eq this.error.status '401')}}
Could not log in to provider
{{else if (eq this.error.status '499')}}
SSO log in window closed
{{else}}
{{#if (eq this.error.status '403')}}
<strong>Invalid token</strong><br />
The token entered does not exist. Please enter a valid token to log in.
{{else if (eq this.error.status '404')}}
<strong>No providers</strong><br />
No SSO providers are configured for that Partition.
{{else}}
<strong>Error</strong><br />
{{this.error.detail}}
{{/if}}
Error
{{/if}}
</p>
</notice.Body>
</Notice>
{{else}}
{{#if (eq this.error.status '403')}}
Invalid token
{{else if (eq this.error.status '404')}}
No providers
{{else}}
Error
{{/if}}
{{/if}}
</A.Title>
<A.Description>
{{#if this.value.Name}}
{{#if (eq this.error.status '403')}}
We received a token from your OIDC provider but could not log in to Consul
with it.
{{else if (eq this.error.status '401')}}
The OIDC provider has rejected this access token. Please have an
administrator check your auth method configuration.
{{else if (eq this.error.status '499')}}
The OIDC provider window was closed. Please try again.
{{else}}
{{this.error.detail}}
{{/if}}
{{else}}
{{#if (eq this.error.status '403')}}
The token entered does not exist. Please enter a valid token to log in.
{{else if (eq this.error.status '404')}}
No SSO providers are configured for that Partition.
{{else}}
{{this.error.detail}}
{{/if}}
{{/if}}
</A.Description>
</Hds::Alert>
{{/if}}
</State>
<TabState @matches='token'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,10 @@ as |item readonly|}}

{{#if api.isCreate}}
{{#if (and (can 'use partitions') (not (can 'choose partitions' dc=@dc)))}}
<Notice
@type="info"
as |notice|>
<notice.Header>
<h3>
Cross-partition communication not supported
</h3>
</notice.Header>
<notice.Body>
<p>
Cross-partition communication is not supported outside of the primary datacenter. You will only be able to select namespaces for source and destination services.
</p>
</notice.Body>
</Notice>
<Hds::Alert @type='inline' class='mb-3 mt-2' as |A|>
<A.Title>Cross-partition communication not supported</A.Title>
<A.Description>Cross-partition communication is not supported outside of the primary datacenter. You will only be able to select namespaces for source and destination services.</A.Description>
</Hds::Alert>
{{/if}}
{{#if this.isManagedByCRDs}}
<Consul::Intention::Notice::CustomResource @type="warning" />
Expand Down Expand Up @@ -213,29 +203,14 @@ as |item readonly|}}
{{else}}

{{#if item.IsManagedByCRD}}
<Notice
class="crd"
@type="warning"
as |notice|>
<notice.Header>
<h3>
Intention Custom Resource
</h3>
</notice.Header>
<notice.Body>
<p>
This Intention is view only because it is managed through an Intention Custom Resource in your Kubernetes cluster.
</p>
</notice.Body>
<notice.Footer>
<Hds::Link::Standalone
@text='Learn more about CRDs'
@href="{{env 'CONSUL_DOCS_URL'}}/k8s/crds"
@icon='docs-link'
@iconPosition='trailing'
/>
</notice.Footer>
</Notice>
<Hds::Alert @type="inline" class='mb-3 mt-2' as |A|>
<A.Title>Intention Custom Resource</A.Title>
<A.Description>This Intention is view only because it is managed through an Intention Custom Resource in your Kubernetes cluster.</A.Description>
<A.Link::Standalone @text='Learn more about CRDs'
@href="{{env 'CONSUL_DOCS_URL'}}/k8s/crds"
@icon='docs-link'
@iconPosition='trailing' />
</Hds::Alert>
{{/if}}

<Consul::Intention::View
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
<Notice
class="consul-intention-notice-custom-resource crd"
...attributes
@type={{or @type "info"}}
as |notice|>
<notice.Header>
<h3>
Intention Custom Resource
</h3>
</notice.Header>
<notice.Body>
<p>
Some of your intentions are being managed through an Intention Custom Resource in your Kubernetes cluster. Those managed intentions will be view only in the UI. Any intentions created in the UI will work but will not be synced to the Custom Resource Definition (CRD) datastore.
</p>
</notice.Body>
<notice.Footer>
<p>
<Hds::Link::Standalone
@href="{{env 'CONSUL_DOCS_URL'}}/k8s/crds"
@text='Learn more about CRDs'
@icon="docs-link"
@iconPosition="trailing"
@size="small"
/>
</p>
</notice.Footer>
</Notice>
<Hds::Alert @type='inline' @color={{or @type "neutral"}} class='mb-2 mt-2' as |A|>
<A.Title>Intention Custom Resource</A.Title>
<A.Description>Some of your intentions are being managed through an Intention Custom Resource in your Kubernetes cluster. Those managed intentions will be view only in the UI. Any intentions created in the UI will work but will not be synced to the Custom Resource Definition (CRD) datastore.</A.Description>
<A.Link::Standalone @href="{{env 'CONSUL_DOCS_URL'}}/k8s/crds"
@text='Learn more about CRDs'
@icon="docs-link"
@iconPosition="trailing"
@size="small" />
</Hds::Alert>
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<Notice
@type="info"
as |notice|>
<notice.Body>
<p>
{{t "components.consul.intention.notice.permissions.body"}}
</p>
</notice.Body>
<notice.Footer>
<p>
<Hds::Link::Standalone
@text={{t "components.consul.intention.notice.permissions.footer"}}
@href="{{env 'CONSUL_DOCS_URL'}}/connect/intentions"
@icon="docs-link"
@iconPosition="trailing"
@size="small"
/>
</p>
</notice.Footer>
</Notice>

<Hds::Alert @type="inline" class="mb-3 mt-2" as |A|>
<A.Description>{{t "components.consul.intention.notice.permissions.body"}}</A.Description>
<A.Link::Standalone
@text={{t "components.consul.intention.notice.permissions.footer"}}
@href="{{env 'CONSUL_DOCS_URL'}}/connect/intentions"
@icon="docs-link"
@iconPosition="trailing"
@size="small"
/>
</Hds::Alert>
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
{{#if isVisible}}
<Notice data-test-node-agentless-notice @type='info' class='agentless-node-notice' as |notice|>
<notice.Header>
<h3>
{{t 'routes.dc.nodes.index.agentless.notice.header'}}
</h3>
<Hds::Alert @type="inline" class='mb-3 mt-2' class='agentless-node-notice' data-test-node-agentless-notice as |A|>
<A.Title>
<span>{{t 'routes.dc.nodes.index.agentless.notice.header'}}</span>
<Hds::Button
@color='secondary'
@text='Dismiss notice'
{{on 'click' this.dismissAgentlessNotice}}
@icon='x'
@size='small'
@isIconOnly={{true}}
/>
</notice.Header>
<notice.Body>
<p>
{{t 'routes.dc.nodes.index.agentless.notice.body'}}
</p>
</notice.Body>
<notice.Footer>
<Hds::Button
@color='tertiary'
@href='{{env "CONSUL_DOCS_DEVELOPER_URL"}}/connect/dataplane'
@text={{t 'routes.dc.nodes.index.agentless.notice.footer'}}
@icon='docs-link'
/>
</notice.Footer>
</Notice>
</A.Title>
<A.Description>{{t 'routes.dc.nodes.index.agentless.notice.body'}}</A.Description>
<A.Link::Standalone @href='{{env "CONSUL_DOCS_DEVELOPER_URL"}}/connect/dataplane'
@text={{t 'routes.dc.nodes.index.agentless.notice.footer'}}
@icon='docs-link'
@iconPosition='trailing' />
</Hds::Alert>
{{/if}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.agentless-node-notice header {
.agentless-node-notice .hds-alert__title {
display: flex;
justify-content: space-between;
}
21 changes: 8 additions & 13 deletions ui/packages/consul-ui/app/templates/dc/acls/policies/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,14 @@ as |dc partition nspace id item create|}}
</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>
<Hds::Alert @type="inline" @icon="star-fill" class="mb-3 mt-2" as |A|>
<A.Title>Management</A.Title>
<A.Description>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.</A.Description>
<A.Link::Standalone @text='Learn more'
@href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#builtin-policies"
@icon='docs-link'
@iconPosition='trailing' />
</Hds::Alert>
<div class="definition-table">
<dl>
<dt>Name</dt>
Expand Down
20 changes: 8 additions & 12 deletions ui/packages/consul-ui/app/templates/dc/acls/tokens/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,14 @@ as |dc partition nspace item create|}}
</BlockSlot>
<BlockSlot @name="content">
{{#if (token/is-legacy item)}}
<Notice
@type="info"
as |notice|>
<notice.Header>
<h2>Update</h2>
</notice.Header>
<notice.Body>
<p>
We have upgraded our ACL system by allowing you to create reusable policies which you can then apply to tokens. Don't worry, even though this token was written in the old style, it is still valid. However, we do recommend upgrading your old tokens to the new style. Learn how in our <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl-migrate-tokens.html" target="_blank" rel="noopener noreferrer">documentation</a>.
</p>
</notice.Body>
</Notice>
<Hds::Alert @type='inline' class='mb-6' as |A|>
<A.Title>Update</A.Title>
<A.Description>We have upgraded our ACL system by allowing you to create reusable policies which you can then apply to tokens. Don't worry, even though this token was written in the old style, it is still valid. However, we do recommend upgrading your old tokens to the new style.</A.Description>
<A.Link::Standalone @text='Learn more'
@href="{{env 'CONSUL_DOCS_URL'}}/guides/acl-migrate-tokens.html"
@icon='docs-link'
@iconPosition='trailing' />
</Hds::Alert>
{{/if}}
{{#if (not create) }}
<div class="definition-table">
Expand Down
Loading