Skip to content

Feat | add error selectors #1480

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

Merged
merged 5 commits into from
Mar 15, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Inject, InjectionToken, TemplateRef
import { IconType } from '@hypertrace/assets-library';
import { Observable } from 'rxjs';
import { switchMap, tap } from 'rxjs/operators';
import { NotificationMode } from '../../notification/notification.component';
import { LoadAsyncStateType } from '../load-async-state.type';
import { AsyncState, LoadAsyncConfig, LoadAsyncContext, LoaderType } from '../load-async.service';

Expand All @@ -21,6 +22,13 @@ export const ASYNC_WRAPPER_PARAMETERS$ = new InjectionToken<Observable<LoadAsync
</ng-container>
<ng-container *ngSwitchDefault>
<ht-message-display
aria-live="polite"
role="alert"
[attr.data-alert-type]="
state.type === '${LoadAsyncStateType.GenericError}'
? '${NotificationMode.Failure}'
: '${NotificationMode.Info}'
"
[icon]="this.icon"
[title]="this.title"
[description]="this.description"
Expand Down
9 changes: 8 additions & 1 deletion projects/components/src/not-found/not-found.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ImagesAssetPath } from '@hypertrace/assets-library';
import { NavigationService } from '@hypertrace/common';
import { ButtonRole, ButtonStyle } from '../button/button';
import { NotificationMode } from '../notification/notification.component';

@Component({
selector: 'ht-not-found',
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['./not-found.component.scss'],
template: `
<div class="not-found-container fill-container">
<div class="not-found-content">
<div
class="not-found-content"
role="alert"
aria-live="assertive"
[attr.data-alert-type]="'${NotificationMode.Failure}'"
>
<img class="not-found-image" src="${ImagesAssetPath.ErrorPage}" loading="lazy" alt="not found page" />
<div class="not-found-message-wrapper">
<div class="not-found-text-wrapper">
Expand All @@ -30,6 +36,7 @@ import { ButtonRole, ButtonStyle } from '../button/button';
})
export class NotFoundComponent {
public constructor(private readonly navService: NavigationService) {}

public goHome(): void {
this.navService.navigateToHome();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IconSize } from '../icon/icon-size';
styleUrls: ['./notification.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="notification-container">
<div class="notification-container" role="alert" aria-live="polite" [attr.data-alert-type]="this.data.mode">
<ht-icon
[ngClass]="this.data.mode"
class="status-icon"
Expand Down