Style Alert Banners

This commit is contained in:
Joshua Ogle 2018-10-31 16:08:25 -06:00
parent 237fa63908
commit 23e004299e
28 changed files with 238 additions and 170 deletions

View File

@ -17,6 +17,4 @@ export default Component.extend({
alertType: computed('type', function() {
return messageTypes([this.get('type')]);
}),
messageClass: 'message-body',
});

View File

@ -1,3 +1,4 @@
.login-form {
box-shadow: $box-shadow, $box-shadow-high;
overflow: auto;
}

View File

@ -1,10 +0,0 @@
.message-in-page {
margin-bottom: 1rem;
position: relative;
.close-button {
position: absolute;
right: 1rem;
top: $size-10;
}
}

View File

@ -19,9 +19,7 @@
.splash-page-container {
margin: $size-2 0;
}
.splash-page-header {
padding: $size-6 $size-5;
}
.splash-page-sub-header {
margin: 0 $size-5 $size-6;
}
}

View File

@ -11,9 +11,7 @@
.token-expire-warning .content p {
padding-right: $size-6;
}
.token-expire-warning .message-in-page {
margin: 0;
}
.token-expire-warning .message {
margin: 0;
width: 100%;
}

View File

@ -1,5 +1,3 @@
.unseal-warning.message,
.unseal-warning .message-body {
border-radius: 0;
margin-bottom: 0;
}
.unseal-warning.message {
margin: -1px -1px 0;
}

View File

@ -63,7 +63,6 @@
@import "./components/loader";
@import "./components/login-form";
@import "./components/masked-input";
@import "./components/message-in-page";
@import "./components/namespace-picker";
@import "./components/namespace-reminder";
@import "./components/page-header";

View File

@ -1,38 +1,72 @@
.message {
&.is-list {
margin: $size-10 0;
margin-bottom: $spacing-s;
padding: $spacing-m $spacing-m $spacing-m $spacing-s;
position: relative;
.close-button {
position: absolute;
right: 1rem;
top: $size-10;
}
&.is-warning {
.message-body {
color: $yellow-darkest;
padding: 0.75rem 1.25rem;
.message-icon {
margin-right: $spacing-xs;
}
.message-title {
font-size: 16px;
font-weight: $font-weight-bold;
}
.message-body {
border: 0;
margin-top: $spacing-xxs;
}
p {
font-size: $size-8;
border: 0;
padding: 0;
}
.message-actions {
margin-top: $spacing-xs;
a,
a:not(.button):not(.file-delete-button):not(.tag) {
color: $blue;
font-weight: $font-weight-semibold;
text-decoration: none;
}
> * + * {
margin-left: $spacing-xs;
}
}
&.is-highlight {
background: $yellow-lightest;
.message-body {
border: none;
box-shadow: 0 0 0 1px $yellow;
color: $yellow-darkest;
background: $yellow-010;
border: 1px solid $yellow-100;
.message-icon {
color: $yellow-500;
}
.has-text-highlight,
.close-button {
color: $yellow;
}
.title,
code {
background: none;
color: inherit;
}
.content .button {
border-color: $yellow;
color: $yellow-darkest;
.message-title {
color: $orange-700;
}
}
.content {
margin-bottom: 0;
&.is-danger {
background: $red-010;
border: 1px solid $red-050;
.message-icon {
color: $red-500;
}
.message-title {
color: $red-700;
}
}
}

View File

@ -1,8 +1,10 @@
.notification {
padding: 1rem 2.5rem 1rem 1.5rem;
padding: $spacing-m $spacing-m $spacing-m $spacing-s;
.title {
font-weight: $weight-bold;
}
&.has-border {
border: 1px solid currentColor;
border-left-width: 10px;

View File

@ -1,6 +1,7 @@
// Colors that will eventually be in Structure package
// Vault Gray
$vault-gray-010: #FDFDFE;
$vault-gray-050: #F7FAFC;
$vault-gray-100: #EBEEF5;
$vault-gray-200: #D3DBE6;
@ -15,6 +16,7 @@ $vault-gray: $vault-gray-500;
$vault-gray-dark: $vault-gray-700;
// UI Gray
$ui-gray-010: #FBFBFC;
$ui-gray-050: #F7F8FA;
$ui-gray-100: #EBEEF2;
$ui-gray-200: #DCE0E6;
@ -30,6 +32,7 @@ $grey-dark: $ui-gray-700;
$grey-darkest: $ui-gray-900;
// Blue
$blue-010: #FBFCFF;
$blue-050: #F0F5FF;
$blue-100: #BFD4FF;
$blue-300: #5B92FF;
@ -43,6 +46,7 @@ $blue-dark: $blue-700;
$blue-darkest: $blue-900;
// Red
$red-010: #FDFAFB;
$red-050: #F9ECEE;
$red-100: #EFC7CC;
$red-300: #DB7D88;
@ -56,6 +60,7 @@ $red-dark: $red-700;
$red-darkest: $red-900;
// Green
$green-010: #FAFDFA;
$green-050: #ECF7ED;
$green-100: #C6E9C9;
$green-300: #7ACC81;
@ -69,6 +74,7 @@ $green-dark: $green-700;
$green-darkest: $green-900;
// Orange
$orange-010: #FFFCFA;
$orange-050: #FEF4EC;
$orange-100: #FDE0C8;
$orange-300: #FBB77F;
@ -82,6 +88,7 @@ $orange-dark: $orange-700;
$orange-darkest: $orange-900;
// Yellow
$yellow-010: #FFFDF6;
$yellow-050: #FFFBED;
$yellow-100: #FDEEBA;
$yellow-300: #FBD95E;

View File

@ -0,0 +1,31 @@
<div data-test-flash-message=true>
<div class="columns is-mobile is-variable is-1">
<div class="column is-narrow message-icon">
{{i-con
glyph=alertType.glyph
class=alertType.glyphClass
size=22
excludeIconClass=true
}}
</div>
{{#if yieldWithoutColumn}}
{{yield}}
{{else}}
<div class="column">
<div class="message-title">
{{or title alertType.text}}
</div>
{{#if message}}
<p class="message-body">
{{message}}
</p>
{{/if}}
{{#if hasBlock}}
<p class="message-actions">
{{yield}}
</p>
{{/if}}
</div>
{{/if}}
</div>
</div>

View File

@ -32,9 +32,11 @@
<form {{action "saveCA" on="submit"}} data-test-generate-root-cert="true">
<NamespaceReminder @mode="save" @noun="PKI change" />
{{#if model.uploadPemBundle}}
{{#message-in-page type="warning" data-test-warning=true}}
<em>If you have already set a certificate and key, they will be overridden with the successful saving of a new <code>PEM bundle</code>.</em>
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="If you have already set a certificate and key, they will be overridden with the successful saving of a new PEM bundle."
data-test-warning
/>
{{/if}}
{{partial "partials/form-field-groups-loop"}}
<div class="field is-grouped is-grouped-split box is-fullwidth is-bottomless">
@ -67,9 +69,11 @@
{{/if}}
{{else if signIntermediate}}
{{#if (or model.certificate)}}
{{#message-in-page data-test-warning type="warning"}}
If using this for an Intermediate CA in Vault, copy the certificate below and write it to the PKI mount being used as an intermediate using the `Set signed Intermediate` endpoint.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="If using this for an Intermediate CA in Vault, copy the certificate below and write it to the PKI mount being used as an intermediate using the `Set signed Intermediate` endpoint."
data-test-warning
/>
{{#each model.attrs as |attr|}}
{{info-table-row data-test-table-row label=(capitalize (or attr.options.label (humanize (dasherize attr.name)))) value=(get model attr.name)}}
{{/each}}

View File

@ -34,9 +34,11 @@
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
{{message-error model=model}}
{{#unless model.isError}}
{{#message-in-page type="warning" data-test-warning=true}}
You will not be able to access this information later, so please copy the information below.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="You will not be able to access this information later, so please copy the information below."
data-test-warning
/>
{{/unless}}
{{#each model.attrs as |attr|}}
{{#if (eq attr.type "object")}}

View File

@ -3,9 +3,10 @@
<NamespaceReminder @mode={{mode}} @noun={{lowercase (humanize model.identityType)}} />
{{message-error model=model}}
{{#if (eq mode "merge")}}
{{#message-in-page type="warning"}}
Metadata on merged entities is not preserved, you will need to recreate it on the entity you merge to.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="Metadata on merged entities is not preserved, you will need to recreate it on the entity you merge to."
/>
{{/if}}
{{#each model.fields as |attr|}}
{{form-field data-test-field attr=attr model=model}}

View File

@ -1,38 +1,38 @@
{{#if model.disabled}}
<div class="box is-shadowless is-marginless">
{{#message-in-page type="warning" yieldWithoutColumn=true messageClass="message-body is-marginless" data-test-disabled-warning=true}}
<div class="column">
<strong>Attention</strong> This {{model.identityType}} is disabled. All associated tokens cannot be used, but are not revoked.
</div>
<div class="box is-shadowless is-marginless is-fullwidth">
{{#if model.disabled}}
<AlertBanner
@type="warning"
@title="Attention"
@message="This {{model.identityType}} is disabled. All associated tokens cannot be used, but are not revoked."
yieldWithoutColumn
data-test-disabled-warning>
{{#if model.canEdit}}
<div class="column is-flex-v-centered is-narrow">
<button type="button" class="button is-orange box" {{action "enable" model}} data-test-enable=true>
Enable
</button>
</div>
{{#link-to 'vault.cluster.access.identity.show' invokeAction=(action 'enable' model) data-test-enable=true}}
Enable
{{/link-to}}
{{/if}}
{{/message-in-page}}
</div>
{{/if}}
{{info-table-row label="Name" value=model.name data-test-identity-item-name=true}}
{{info-table-row label="Type" value=model.type }}
{{info-table-row label="ID" value=model.id }}
{{#info-table-row label="Merged Ids" value=model.mergedEntityIds }}
<div>
{{#each model.mergedEntityIds as |id|}}
<div>
<code class="has-text-black">{{id}}</code>
</div>
{{/each}}
</div>
{{/info-table-row}}
{{#info-table-row label="Created" value=model.creationTime}}
<time datetime={{model.creationTime}} title={{model.creationTime}}>
{{moment-format model.creationTime 'MMM DD, YYYY [at] h:mm a'}}
</time>
{{/info-table-row}}
{{#info-table-row label="Last Updated" value=model.lastUpdateTime}}
<time datetime={{model.lastUpdateTime}} title={{model.lastUpdateTime}}>
{{moment-format model.lastUpdateTime 'MMM DD, YYYY [at] h:mm a'}}
</time>
{{/info-table-row}}
</AlertBanner>
{{/if}}
{{info-table-row label="Name" value=model.name data-test-identity-item-name=true}}
{{info-table-row label="Type" value=model.type }}
{{info-table-row label="ID" value=model.id }}
{{#info-table-row label="Merged Ids" value=model.mergedEntityIds }}
<div>
{{#each model.mergedEntityIds as |id|}}
<div>
<code class="has-text-black">{{id}}</code>
</div>
{{/each}}
</div>
{{/info-table-row}}
{{#info-table-row label="Created" value=model.creationTime}}
<time datetime={{model.creationTime}} title={{model.creationTime}}>
{{moment-format model.creationTime 'MMM DD, YYYY [at] h:mm a'}}
</time>
{{/info-table-row}}
{{#info-table-row label="Last Updated" value=model.lastUpdateTime}}
<time datetime={{model.lastUpdateTime}} title={{model.lastUpdateTime}}>
{{moment-format model.lastUpdateTime 'MMM DD, YYYY [at] h:mm a'}}
</time>
{{/info-table-row}}
</div>

View File

@ -51,7 +51,10 @@
</div>
{{/each}}
{{#if kvHasDuplicateKeys}}
{{#message-in-page type="warning" class="is-marginless" data-test-duplicate-error-warnings=true}}
More than one key shares the same name. Please be sure to have unique key names or some data may be lost when saving.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="More than one key shares the same name. Please be sure to have unique key names or some data may be lost when saving."
@class="is-marginless"
data-test-duplicate-error-warnings
/>
{{/if}}

View File

@ -5,10 +5,14 @@
</PageHeader>
<MessageError @model={{model}} />
{{#if isTemporary}}
<section class="box is-sideless">
<MessageInPage data-test-cluster-status @type="warning" @class="license-warning" data-test-warning-text>
Your temporary license expires {{moment-from-now expirationTime}} and your vault will seal. Please enter a valid license below.
</MessageInPage>
<section class="box is-sideless is-fullwidth">
<AlertBanner
@type="warning"
@message="Your temporary license expires {{moment-from-now expirationTime}} and your vault will seal. Please enter a valid license below."
@class="license-warning"
data-test-cluster-status
data-test-warning-text
/>
<span class="title is-5" data-test-temp-license>Temporary License</span>
<form {{action "saveModel" text on="submit"}}>
<div class="box is-shadowless is-fullwidth is-marginless">
@ -27,7 +31,7 @@
</form>
</section>
{{else}}
<section class="box is-sideless">
<section class="box is-sideless is-fullwidth">
<span class="title is-5">Details</span>
{{#if showForm}}
<form {{action "saveModel" text on="submit"}}>
@ -61,7 +65,7 @@
{{/if}}
</section>
{{/if}}
<section class="box is-sideless is-marginless is-shadowless">
<section class="box is-sideless is-marginless is-shadowless is-fullwidth">
<span class="title is-5">Features</span>
<div class="field box is-fullwidth is-shadowless is-paddingless is-marginless">
{{#each featuresInfo as |info|}}

View File

@ -1,7 +1,9 @@
{{#if displayErrors.length}}
{{#each displayErrors as |error|}}
{{#message-in-page type="danger" data-test-error=true}}
{{error}}
{{/message-in-page}}
<AlertBanner
@type="danger"
@message="{{error}}"
data-test-error
/>
{{/each}}
{{/if}}

View File

@ -1,22 +0,0 @@
<div class="{{messageClass}} message-in-page" data-test-flash-message=true>
<div class="columns is-mobile is-variable is-1">
<div class="column is-narrow">
{{i-con
glyph=alertType.glyph
class=alertType.glyphClass
size=22
excludeIconClass=true
}}
</div>
{{#if yieldWithoutColumn}}
{{yield}}
{{else}}
<div class="column">
<p>
<strong>{{alertType.text}}</strong>
{{yield}}
</p>
</div>
{{/if}}
</div>
</div>

View File

@ -149,15 +149,22 @@
</form>
{{else}}
<form {{action 'onSubmit' (hash key=key) on="submit"}} id="shamir">
<div class="box is-shadowless no-padding-bottom is-marginless">
{{message-error errors=errors}}
{{#if hasBlock}}
{{yield}}
{{else}}
<p>{{formText}}</p>
{{/if}}
</div>
<div class="box is-marginless is-shadowless">
{{#if errors}}
<div class="box is-shadowless is-marginless no-padding-top is-fullwidth">
{{message-error errors=errors}}
</div>
{{/if}}
{{#if hasBlock}}
<div class="box is-shadowless is-marginless no-padding-top is-fullwidth">
{{yield}}
</div>
{{/if}}
{{#if formText}}
<div class="box is-shadowless is-marginless no-padding-top is-fullwidth">
{{formText}}
</div>
{{/if}}
<div class="field">
<label for="key" class="is-label">
Master Key Portion

View File

@ -9,9 +9,10 @@
</label>
{{/if}}
{{#if warning}}
{{#message-in-page type="warning"}}
{{warning}}
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="{{warning}}"
/>
{{/if}}
{{#each inputList as |data index|}}
<div class="field is-grouped" data-test-string-list-row="{{index}}">

View File

@ -3,10 +3,11 @@
{{message-error model=model}}
<NamespaceReminder @mode={{mode}} @noun="AWS role" />
{{#if (gt model.credentialTypes.length 1)}}
{{#message-in-page type="warning"}}
This role has more than one <code>credential_type</code>, currently: <code>{{join ', ' model.credentialTypes}}</code>.
Multiple credential types is deprecated and you must choose one in order to save this role.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="This role has more than one <code>credential_type</code>, currently: <code>{{join ', ' model.credentialTypes}}</code>.
Multiple credential types is deprecated and you must choose one in order to save this role."
/>
{{/if}}
{{#each (if (eq mode 'edit') (drop 1 model.fields) model.fields) as |attr|}}
{{form-field data-test-field attr=attr model=model}}

View File

@ -1,9 +1,10 @@
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
{{#if (gt model.credentialTypes.length 1)}}
{{#message-in-page type="warning"}}
This role has more than one <code>credential_type</code>, currently: <code>{{join ', ' model.credentialTypes}}</code>.
When you next edit this role, you will have to choose a single credential type.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="This role has more than one credential_type, currently: {{join ', ' model.credentialTypes}}.
When you next edit this role, you will have to choose a single credential type."
/>
{{/if}}
{{#each model.fields as |attr|}}
{{#if (eq attr.name "policyDocument")}}

View File

@ -4,9 +4,11 @@
<NamespaceReminder @mode="edit" @noun="secret" />
{{#if (not-eq model.selectedVersion.version model.currentVersion)}}
<div class="form-section">
<MessageInPage @type="warning" @class="is-marginless">
You are creating a new version based on data from Version {{model.selectedVersion.version}}. The current version for <code>{{model.id}}</code> is Version {{model.currentVersion}}.
</MessageInPage>
<AlertBanner
@type="warning"
@class="is-marginless"
@message="You are creating a new version based on data from Version {{model.selectedVersion.version}}. The current version for {{model.id}} is Version {{model.currentVersion}}."
/>
</div>
{{/if}}
<SecretEditDisplay

View File

@ -14,7 +14,7 @@
</p.levelLeft>
</PageHeader>
<form {{ action "savePolicy" model on="submit"}}>
<form class="" {{ action "savePolicy" model on="submit"}}>
<div class="box is-bottomless is-fullwidth is-marginless">
{{message-error model=model}}
<NamespaceReminder @mode="create" @noun="policy" />

View File

@ -25,9 +25,13 @@
</ul>
</nav>
{{#if (eq action 'promote')}}
<MessageInPage data-test-cluster-status @type="warning" @class="unseal-warning">
<em>Caution</em>: Vault replication is not designed for active-active usage and enabling two performance primaries should never be done, as it can lead to data loss if they or their secondaries are ever reconnected.
</MessageInPage>
<AlertBanner
@type="warning"
@title="Caution"
@message="Vault replication is not designed for active-active usage and enabling two performance primaries should never be done, as it can lead to data loss if they or their secondaries are ever reconnected."
@class="unseal-warning"
data-test-cluster-status
/>
<ReplicationActions
@replicationMode="dr"
@selectedAction="promote"

View File

@ -32,9 +32,11 @@
{{#if model.signedKey}}
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
{{#message-in-page type="warning" data-test-warning=true}}
You will not be able to access this information later, so please copy the information below.
{{/message-in-page}}
<AlertBanner
@type="warning"
@message="You will not be able to access this information later, so please copy the information below."
data-test-warning
/>
{{#each model.attrs as |attr|}}
{{#if (eq attr.type "object")}}
{{info-table-row label=(capitalize (or attr.options.label (humanize (dasherize attr.name)))) value=(stringify (get model attr.name))}}

View File

@ -5,9 +5,13 @@
</h1>
</Page.header>
<Page.content>
<MessageInPage data-test-cluster-status @type="warning" @class="unseal-warning">
{{capitalize model.name}} is {{if model.unsealed 'unsealed' 'sealed'}}
</MessageInPage>
<AlertBanner
@type="warning"
@title="{{capitalize model.name}} is {{if model.unsealed 'unsealed' 'sealed'}}"
@message="You can unseal the vault by entering a portion of the master key. Once all portions are entered, the vault will be unsealed."
@class="unseal-warning"
data-test-cluster-status
/>
<ShamirFlow
@action="unseal"
@onUpdate={{action 'setUnsealState'}}
@ -17,10 +21,6 @@
@isComplete={{action 'isUnsealed'}}
@threshold={{model.sealThreshold}}
@progress={{model.sealProgress}}
>
<p class="has-text-grey-dark">
Unseal the vault by entering a portion of the master key. Once all portions are entered, the vault will be unsealed.
</p>
</ShamirFlow>
/>
</Page.content>
</SplashPage>