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

UI: HDS adoption update <AlertInline> component to use Hds::Alert #24299

Merged
merged 12 commits into from
Dec 1, 2023
3 changes: 3 additions & 0 deletions changelog/24299.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Update AlertInline component to use Helios Design System Alert component
```
3 changes: 1 addition & 2 deletions ui/app/components/auth-saml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
/>
</div>
<AlertInline
@sizeSmall={{true}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the class size-small no longer exists (functionality have been removed previously?), so remove this arg all together.

@paddingTop={{true}}
class="has-top-padding-s"
@type="info"
@message="Leave blank to sign in with the default role if one is configured."
/>
Expand Down
9 changes: 0 additions & 9 deletions ui/app/styles/components/doc-link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,3 @@
text-decoration: underline !important;
}
}

.doc-link-subtle {
color: inherit;
text-decoration: underline;
font-weight: inherit;
&:hover {
color: inherit;
}
}
3 changes: 1 addition & 2 deletions ui/app/templates/components/auth-form-options.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
/>
</div>
<AlertInline
@sizeSmall={{true}}
@paddingTop={{true}}
class="has-top-padding-s"
@type="info"
@message="If this backend was mounted using a non-default path, enter it here."
/>
Expand Down
3 changes: 1 addition & 2 deletions ui/app/templates/components/auth-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@
/>
{{#if (and this.delayAuthMessageReminder.isIdle this.showLoading)}}
<AlertInline
@paddingTop={{true}}
@sizeSmall={{true}}
class="has-top-padding-s"
@type="info"
@message="If login takes longer than usual, you may need to check your device for an MFA notification, or contact your administrator if login times out."
data-test-auth-message="push"
Expand Down
3 changes: 1 addition & 2 deletions ui/app/templates/components/auth-jwt.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
/>
</div>
<AlertInline
@sizeSmall={{true}}
@paddingTop={{true}}
class="has-top-padding-s"
@type="info"
@message="Leave blank to sign in with the default role if one is configured"
/>
Expand Down
27 changes: 17 additions & 10 deletions ui/app/templates/components/clients/attribution.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,24 @@
<Hds::Button @text="Cancel" @color="secondary" {{on "click" F.close}} />
</Hds::ButtonSet>
{{#if @upgradeExplanation}}
<div class="has-text-grey is-size-8 has-top-padding-m">
<AlertInline @type="warning">
Your data contains an upgrade.
<DocLink
@path="/vault/docs/concepts/client-count/faq#q-which-vault-version-reflects-the-most-accurate-client-counts"
<Hds::Alert class="has-top-padding-m" @type="compact" @color="warning" as |A|>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-11-30 at 12 59 39 PM

<A.Description>
<strong>Your data contains an upgrade.</strong>
{{@upgradeExplanation}}
Visit our
<Hds::Link::Inline
@icon="docs-link"
@iconPosition="trailing"
@isHrefExternal={{true}}
@href={{doc-link
"/vault/docs/concepts/client-count/faq#q-which-vault-version-reflects-the-most-accurate-client-counts"
}}
>
Learn more here.
</DocLink>
</AlertInline>
<p class="has-left-padding-l">{{@upgradeExplanation}}</p>
</div>
Client count FAQ
</Hds::Link::Inline>
for more information.
</A.Description>
</Hds::Alert>
{{/if}}
</M.Footer>
</Hds::Modal>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/date-dropdown.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
/>
</Hds::SegmentedGroup>
{{#if this.invalidDate}}
<AlertInline @type="danger" @message={{this.invalidDate}} @paddingTop={{true}} @mimicRefresh={{true}} />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decided to make @mimicRefresh part of the default functionality in this component, since moving forward Hds::Alert should just be used directly if the refresh functionality is not needed

<AlertInline @type="danger" @message={{this.invalidDate}} class="has-top-padding-s" />
{{/if}}
57 changes: 42 additions & 15 deletions ui/app/templates/components/keymgmt/distribute.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,20 @@
@disallowNewItems={{false}}
>
{{#if (and this.validMatchError.key (not this.isNewKey))}}
<AlertInline @paddingTop={{true}} @sizeSmall={{true}} @type="danger" data-test-keymgmt-error="key">
{{this.validMatchError.key}}
To check compatibility,
<DocLink class="doc-link-subtle" @path="/vault/docs/secrets/key-management#compatibility">refer to this table</DocLink>.
</AlertInline>
<Hds::Alert class="has-top-margin-s" @type="inline" @color="warning" data-test-keymgmt-error="key" as |A|>
<A.Description>
{{this.validMatchError.key}}
To check compatibility,
<Hds::Link::Inline
@icon="docs-link"
@iconPosition="trailing"
@isHrefExternal={{true}}
@href={{doc-link "/vault/docs/secrets/key-management#compatibility"}}
>
refer to this table
</Hds::Link::Inline>.
</A.Description>
</Hds::Alert>
{{/if}}
</SearchSelect>
</div>
Expand Down Expand Up @@ -62,11 +71,20 @@
</select>
</div>
{{#if this.validMatchError.key}}
<AlertInline @paddingTop={{true}} @sizeSmall={{true}} @type="danger" data-test-keymgmt-error="new-key">
{{this.validMatchError.key}}
To check compatibility,
<DocLink class="doc-link-subtle" @path="/vault/docs/secrets/key-management#compatibility">refer to this table</DocLink>.
</AlertInline>
<Hds::Alert class="has-top-margin-s" @type="inline" @color="warning" data-test-keymgmt-error="new-key" as |A|>
<A.Description>
{{this.validMatchError.key}}
To check compatibility,
<Hds::Link::Inline
@icon="docs-link"
@iconPosition="trailing"
@isHrefExternal={{true}}
@href={{doc-link "/vault/docs/secrets/key-management#compatibility"}}
>
refer to this table
</Hds::Link::Inline>.
</A.Description>
</Hds::Alert>
{{/if}}
</div>
</div>
Expand All @@ -89,11 +107,20 @@
data-test-keymgmt-dist-provider
>
{{#if this.validMatchError.provider}}
<AlertInline @paddingTop={{true}} @sizeSmall={{true}} @type="danger" data-test-keymgmt-error="provider">
{{this.validMatchError.provider}}
To check compatibility,
<DocLink class="doc-link-subtle" @path="/vault/docs/secrets/key-management#compatibility">refer to this table</DocLink>.
</AlertInline>
<Hds::Alert class="has-top-margin-s" @type="inline" @color="warning" data-test-keymgmt-error="provider" as |A|>
<A.Description>
{{this.validMatchError.provider}}
To check compatibility,
<Hds::Link::Inline
@icon="docs-link"
@iconPosition="trailing"
@isHrefExternal={{true}}
@href={{doc-link "/vault/docs/secrets/key-management#compatibility"}}
>
refer to this table
</Hds::Link::Inline>.
</A.Description>
</Hds::Alert>
{{/if}}
</SearchSelect>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/mfa/mfa-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</div>
{{#if this.newCodeDelay.isRunning}}
<div>
<AlertInline @type="danger" @sizeSmall={{true}} @message={{this.codeDelayMessage}} />
<AlertInline @type="danger" @message={{this.codeDelayMessage}} />
</div>
{{/if}}
<Hds::Button
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/mount-backend-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" @paddingTop={{true}} @message={{this.invalidFormAlert}} @mimicRefresh={{true}} />
<AlertInline @type="danger" class="has-top-padding-s" @message={{this.invalidFormAlert}} />
</div>
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/oidc/assignment-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
data-test-oidc-assignment-cancel
/>
{{#if this.modelValidations.targets.errors}}
<AlertInline @type="danger" @message={{join ", " this.modelValidations.targets.errors}} @paddingTop={{true}} />
<AlertInline @type="danger" @message={{join ", " this.modelValidations.targets.errors}} class="has-top-padding-s" />
{{/if}}
</div>
</form>
2 changes: 1 addition & 1 deletion ui/app/templates/components/oidc/client-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" @paddingTop={{true}} @message={{this.invalidFormAlert}} @mimicRefresh={{true}} />
<AlertInline @type="danger" class="has-top-padding-s" @message={{this.invalidFormAlert}} />
</div>
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/oidc/key-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" @paddingTop={{true}} @message={{this.invalidFormAlert}} @mimicRefresh={{true}} />
<AlertInline @type="danger" class="has-top-padding-s" @message={{this.invalidFormAlert}} />
</div>
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/oidc/provider-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" @paddingTop={{true}} @message={{this.invalidFormAlert}} @mimicRefresh={{true}} />
<AlertInline @type="danger" class="has-top-padding-s" @message={{this.invalidFormAlert}} />
</div>
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/oidc/scope-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline @type="danger" @paddingTop={{true}} @message={{this.invalidFormAlert}} @mimicRefresh={{true}} />
<AlertInline @type="danger" class="has-top-padding-s" @message={{this.invalidFormAlert}} />
</div>
{{/if}}
</form>
Expand Down
14 changes: 2 additions & 12 deletions ui/app/templates/components/secret-create-or-update.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
/>
</p>
{{#if (get this.validationMessages "path")}}
<AlertInline
@type="danger"
@message={{get this.validationMessages "path"}}
@paddingTop={{true}}
@isMarginless={{true}}
/>
<AlertInline @type="danger" @message={{capitalize (get this.validationMessages "path")}} class="has-top-padding-s" />
{{/if}}
{{#if @modelForData.isFolder}}
<p class="help has-text-danger">
Expand Down Expand Up @@ -104,12 +99,7 @@
</div>
</div>
{{#if this.validationMessages.key}}
<AlertInline
@type="danger"
@message={{this.validationMessages.key}}
@paddingTop={{true}}
@isMarginless={{true}}
/>
<AlertInline @type="danger" @message={{this.validationMessages.key}} class="has-top-padding-s" />
{{/if}}
{{/each}}
</div>
Expand Down
24 changes: 9 additions & 15 deletions ui/lib/core/addon/components/alert-inline.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@
SPDX-License-Identifier: BUSL-1.1
~}}

<div
<Hds::Alert
{{did-update this.refresh @message}}
class={{concat "is-flex-center" this.paddingTop this.isMarginless this.sizeSmall}}
@type="compact"
@color={{this.color}}
@icon={{if this.isRefreshing "loading"}}
data-test-inline-alert
...attributes
as |A|
>
{{#if this.isRefreshing}}
<Icon @name="loading" class="loading" />
{{else}}
<Icon @name={{this.alertType.glyph}} class={{this.alertType.glyphClass}} />
<p class={{this.textClass}} data-test-inline-error-message>
{{#if (has-block)}}
{{yield}}
{{else}}
{{@message}}
{{/if}}
</p>
{{/if}}
</div>
{{#unless this.isRefreshing}}
<A.Description data-test-inline-error-message>{{@message}}</A.Description>
{{/unless}}
</Hds::Alert>
Loading