diff --git a/ui/app/components/alert-inline.js b/ui/app/components/alert-inline.js new file mode 100644 index 0000000000..99a90ae7fc --- /dev/null +++ b/ui/app/components/alert-inline.js @@ -0,0 +1,22 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +import { messageTypes } from 'vault/helpers/message-types'; + +export default Component.extend({ + type: null, + + classNames: ['message-inline'], + + textClass: computed('type', function() { + if (this.get('type') == 'danger') { + return messageTypes([this.get('type')]).glyphClass; + } + + return + }), + + alertType: computed('type', function() { + return messageTypes([this.get('type')]); + }), +}); diff --git a/ui/app/styles/components/message-in-page.scss b/ui/app/styles/components/message-in-page.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ui/app/styles/components/splash-page.scss b/ui/app/styles/components/splash-page.scss index 2ea99593d0..2b6c887bad 100644 --- a/ui/app/styles/components/splash-page.scss +++ b/ui/app/styles/components/splash-page.scss @@ -22,4 +22,4 @@ .splash-page-header { padding: $size-6 $size-5; -} \ No newline at end of file +} diff --git a/ui/app/styles/components/unseal-warning.scss b/ui/app/styles/components/unseal-warning.scss index 9d9c11f6da..8a65b54df8 100644 --- a/ui/app/styles/components/unseal-warning.scss +++ b/ui/app/styles/components/unseal-warning.scss @@ -1,3 +1,3 @@ .unseal-warning.message { margin: -1px -1px 0; -} \ No newline at end of file +} diff --git a/ui/app/styles/core/message.scss b/ui/app/styles/core/message.scss index fc8129b679..3ae4df4aa6 100644 --- a/ui/app/styles/core/message.scss +++ b/ui/app/styles/core/message.scss @@ -96,3 +96,18 @@ } } } + +.message-inline { + display: flex; + margin: -$spacing-xs 0 $spacing-l; + + .icon { + flex: 0; + margin: 0 $spacing-xxs 0 0; + min-width: fit-content; + } + + .p { + margin: 0; + } +} diff --git a/ui/app/templates/components/alert-inline.hbs b/ui/app/templates/components/alert-inline.hbs new file mode 100644 index 0000000000..ea2976495b --- /dev/null +++ b/ui/app/templates/components/alert-inline.hbs @@ -0,0 +1,8 @@ + +

+ {{message}} +

diff --git a/ui/app/templates/components/form-field.hbs b/ui/app/templates/components/form-field.hbs index d0ad5de172..147a3c10a1 100644 --- a/ui/app/templates/components/form-field.hbs +++ b/ui/app/templates/components/form-field.hbs @@ -125,9 +125,10 @@ /> {{#if attr.options.validationAttr}} {{#if (and (get model valuePath) (not (get model attr.options.validationAttr)))}} -

- {{attr.options.invalidMessage}} -

+ {{/if}} {{/if}} {{/if}} diff --git a/ui/app/templates/components/message-error.hbs b/ui/app/templates/components/message-error.hbs index 316dfe21aa..1b56db2a88 100644 --- a/ui/app/templates/components/message-error.hbs +++ b/ui/app/templates/components/message-error.hbs @@ -2,7 +2,7 @@ {{#each displayErrors as |error|}} {{/each}} diff --git a/ui/app/templates/components/string-list.hbs b/ui/app/templates/components/string-list.hbs index 6d3076c695..43a7a73b3d 100644 --- a/ui/app/templates/components/string-list.hbs +++ b/ui/app/templates/components/string-list.hbs @@ -11,7 +11,7 @@ {{#if warning}} {{/if}} {{#each inputList as |data index|}} diff --git a/ui/app/templates/partials/replication/demote.hbs b/ui/app/templates/partials/replication/demote.hbs index 5b3013dbf1..48f5175968 100644 --- a/ui/app/templates/partials/replication/demote.hbs +++ b/ui/app/templates/partials/replication/demote.hbs @@ -7,14 +7,18 @@ (not model.performance.replicationDisabled) ) }} -

- Caution: Demoting this DR primary cluster - would result in a DR secondary and in that mode Vault is read-only. This - cluster is also currently operating as a Performance - {{capitalize model.performance.modeForUrl}}, demoting it will leave your - replication setup without a performance primary cluster until a new - cluster is promoted. -

+ +
+ +
{{/if}}

Demote this {{replicationDisplayMode}} primary cluster to a {{replicationDisplayMode}} secondary. The resulting secondary cluster will not diff --git a/ui/app/templates/partials/replication/disable.hbs b/ui/app/templates/partials/replication/disable.hbs index 466d7fbf6e..091e6ede63 100644 --- a/ui/app/templates/partials/replication/disable.hbs +++ b/ui/app/templates/partials/replication/disable.hbs @@ -31,10 +31,10 @@ The cluster will no longer be able to connect to the primary. {{/if}}

-

- Caution: re-enabling this node as a primary or secondary will - change its cluster ID. -

+

In the secondary case this means a wipe of the underlying storage when connected to a primary, and in the primary case, diff --git a/ui/app/templates/partials/replication/enable.hbs b/ui/app/templates/partials/replication/enable.hbs index a474e37f3e..4c0d5dc9bc 100644 --- a/ui/app/templates/partials/replication/enable.hbs +++ b/ui/app/templates/partials/replication/enable.hbs @@ -141,9 +141,10 @@ {{#if (eq mode 'secondary')}} -

- Caution: this will immediately clear all data in this cluster! -

+ {{/if}} {{#if (eq mode 'primary')}} diff --git a/ui/app/templates/partials/replication/promote.hbs b/ui/app/templates/partials/replication/promote.hbs index 8f16b6f79e..59c94c4eef 100644 --- a/ui/app/templates/partials/replication/promote.hbs +++ b/ui/app/templates/partials/replication/promote.hbs @@ -45,10 +45,11 @@ Force promotion of this cluster -

- Caution: Forcing promotion could result in data loss if data isn't fully replicated. Force promotion - promotes the cluster even if certain safety checks fail. -

+ {{/if}} @@ -74,10 +75,11 @@

Promote the cluster to primary.

-

- Caution: Vault replication is not designed for active-active usage and enabling two primaries should never be done, as it can lead to data loss if they or their secondaries are ever reconnected. - If the cluster has a primary, be sure to demote it before promoting a secondary. -

+
-

- Caution: Forcing promotion could result in data loss if data isn't fully replicated. Force promotion - promotes the cluster even if certain safety checks fail. -

+
diff --git a/ui/app/templates/partials/role-aws/form.hbs b/ui/app/templates/partials/role-aws/form.hbs index 3d676c9ce5..bd4285ad82 100644 --- a/ui/app/templates/partials/role-aws/form.hbs +++ b/ui/app/templates/partials/role-aws/form.hbs @@ -5,8 +5,8 @@ {{#if (gt model.credentialTypes.length 1)}} {{/if}} {{#each (if (eq mode 'edit') (drop 1 model.fields) model.fields) as |attr|}} diff --git a/ui/app/templates/vault/cluster/access/leases/error.hbs b/ui/app/templates/vault/cluster/access/leases/error.hbs index a632e211e1..05c759f900 100644 --- a/ui/app/templates/vault/cluster/access/leases/error.hbs +++ b/ui/app/templates/vault/cluster/access/leases/error.hbs @@ -11,34 +11,28 @@ {{/unless}}
-
-
-
- {{#if (eq model.httpStatus 400)}} -

- {{i-con glyph='close'}} - {{model.keyId}} is not a valid lease ID -

- {{else if (eq model.httpStatus 404)}} -

- Unable to find lease for the id: {{model.keyId}}. Try going back to the - {{#link-to "vault.cluster.access.leases"}}lookup{{/link-to}} - and re-entering the id. -

- {{else if (eq model.httpStatus 403)}} -

- You don't have access to {{model.keyId}}. If you think you've reached this page in error, please contact your administrator. -

- {{else}} - {{#each model.errors as |error|}} -

- {{error}} -

- {{/each}} - {{/if}} -
-
-
+ {{#if (eq model.httpStatus 400)}} + + {{else if (eq model.httpStatus 404)}} +

+ Unable to find lease for the id: {{model.keyId}}. Try going back to the + {{#link-to "vault.cluster.access.leases"}}lookup{{/link-to}} + and re-entering the id. +

+ {{else if (eq model.httpStatus 403)}} +

+ You don't have access to {{model.keyId}}. If you think you've reached this page in error, please contact your administrator. +

+ {{else}} + {{#each model.errors as |error|}} +

+ {{error}} +

+ {{/each}} + {{/if}}
{{#link-to "vault.cluster.access.leases" class="button"}} diff --git a/ui/app/templates/vault/cluster/policies/create.hbs b/ui/app/templates/vault/cluster/policies/create.hbs index a369925ad0..0128aec878 100644 --- a/ui/app/templates/vault/cluster/policies/create.hbs +++ b/ui/app/templates/vault/cluster/policies/create.hbs @@ -14,7 +14,7 @@ -
+
{{message-error model=model}} diff --git a/ui/tests/integration/components/alert-inline-test.js b/ui/tests/integration/components/alert-inline-test.js new file mode 100644 index 0000000000..2e2971090a --- /dev/null +++ b/ui/tests/integration/components/alert-inline-test.js @@ -0,0 +1,17 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | alert-inline', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{alert-inline type="danger" message="test message"}}`); + + assert.equal(this.element.textContent.trim(), 'test message'); + }); +}); diff --git a/ui/tests/pages/components/message-in-page.js b/ui/tests/pages/components/alert-banner.js similarity index 100% rename from ui/tests/pages/components/message-in-page.js rename to ui/tests/pages/components/alert-banner.js diff --git a/ui/tests/pages/components/mount-backend-form.js b/ui/tests/pages/components/mount-backend-form.js index 05035335cd..43ea859ca2 100644 --- a/ui/tests/pages/components/mount-backend-form.js +++ b/ui/tests/pages/components/mount-backend-form.js @@ -1,6 +1,6 @@ import { clickable, collection, fillable, text, value } from 'ember-cli-page-object'; import fields from './form-field'; -import errorText from './message-in-page'; +import errorText from './alert-banner'; export default { ...fields,