diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.html index cb3adb0e17..52056ee18c 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.html +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.html @@ -4,32 +4,28 @@ class="error" [style.backgroundColor]="backgroundColor" > - + @if (!hideCloseIcon) { + + } -
-
-
-

{{ statusText }} {{ title | abpLocalization }}

-
- {{ details | abpLocalization }} -
-
- - {{ { key: '::Menu:Home', defaultValue: 'Home' } | abpLocalization }} - + @if (!customComponent) { +
+
+
+

{{ statusText }} {{ title | abpLocalization }}

+
+ {{ details | abpLocalization }} +
+
-
+ }
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts index 7761751e8c..71566ff76c 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts @@ -17,6 +17,7 @@ import { fromEvent, Subject } from 'rxjs'; import { debounceTime, filter } from 'rxjs/operators'; import { LocalizationParam, SubscriptionService } from '@abp/ng.core'; import { ErrorScreenErrorCodes } from '../../models'; +import { Router } from '@angular/router'; @Component({ selector: 'abp-http-error-wrapper', @@ -27,6 +28,8 @@ import { ErrorScreenErrorCodes } from '../../models'; export class HttpErrorWrapperComponent implements OnInit, AfterViewInit, OnDestroy { protected readonly document = inject(DOCUMENT); protected readonly window = this.document.defaultView; + protected readonly router = inject(Router); + protected readonly subscription = inject(SubscriptionService); appRef!: ApplicationRef; @@ -57,11 +60,10 @@ export class HttpErrorWrapperComponent implements OnInit, AfterViewInit, OnDestr return this.status ? `[${this.status}]` : ''; } - constructor(private subscription: SubscriptionService) {} - ngOnInit(): void { this.backgroundColor = - this.window.getComputedStyle(this.document.body)?.getPropertyValue('background-color') || '#fff'; + this.window.getComputedStyle(this.document.body)?.getPropertyValue('background-color') || + '#fff'; } ngAfterViewInit(): void { @@ -87,6 +89,11 @@ export class HttpErrorWrapperComponent implements OnInit, AfterViewInit, OnDestr this.subscription.addOne(keyup$, () => this.destroy()); } + goHome() { + this.router.navigate(['/']); + this.destroy(); + } + ngOnDestroy(): void { this.destroy(); } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/constants/default-errors.ts b/npm/ng-packs/packages/theme-shared/src/lib/constants/default-errors.ts index 46a0605b95..6a2797e037 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/constants/default-errors.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/constants/default-errors.ts @@ -51,3 +51,17 @@ export const CUSTOM_HTTP_ERROR_HANDLER_PRIORITY = Object.freeze({ high: 9, veryHigh: 99, }); + +export const HTTP_ERROR_STATUS = { + '401': 'AbpUi::401Message', + '403': 'AbpUi::403Message', + '404': 'AbpUi::404Message', + '500': 'AbpUi::500Message', +}; + +export const HTTP_ERROR_DETAIL = { + '401': 'AbpUi::DefaultErrorMessage401Detail', + '403': 'AbpUi::DefaultErrorMessage403Detail', + '404': 'AbpUi::DefaultErrorMessage404Detail', + '500': 'AbpUi::DefaultErrorMessage', +}; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/constants/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/constants/index.ts new file mode 100644 index 0000000000..d08eba52b8 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/constants/index.ts @@ -0,0 +1,4 @@ +export * from './validation'; +export * from './default-errors'; +export * from './styles'; +export * from './scripts'; diff --git a/npm/ng-packs/packages/theme-shared/src/public-api.ts b/npm/ng-packs/packages/theme-shared/src/public-api.ts index 659e59e490..d5f78417ef 100644 --- a/npm/ng-packs/packages/theme-shared/src/public-api.ts +++ b/npm/ng-packs/packages/theme-shared/src/public-api.ts @@ -2,7 +2,7 @@ * Public API Surface of theme-shared */ -export * from './lib/adapters' +export * from './lib/adapters'; export * from './lib/animations'; export * from './lib/components'; export * from './lib/constants/validation'; @@ -16,3 +16,4 @@ export * from './lib/services'; export * from './lib/theme-shared.module'; export * from './lib/tokens'; export * from './lib/utils'; +export * from './lib/constants';