feat(theme-shared): add hideCloseIcon property to http error config token

pull/2172/head
mehmet-erim 5 years ago
parent 9552ee0221
commit 8365934032

@ -1,5 +1,5 @@
<div #container id="abp-error" class="error">
<button id="abp-close-button" type="button" class="close mr-2" (click)="destroy()">
<button *ngIf="!hideCloseIcon" id="abp-close-button" type="button" class="close mr-2" (click)="destroy()">
<span aria-hidden="true">&times;</span>
</button>

@ -36,6 +36,8 @@ export class ErrorComponent implements AfterViewInit, OnDestroy {
destroy$: Subject<void>;
hideCloseIcon = false;
@ViewChild('container', { static: false })
containerRef: ElementRef<HTMLDivElement>;

@ -19,7 +19,6 @@ import { ErrorComponent } from '../components/error/error.component';
import { HttpErrorConfig, ErrorScreenErrorCodes } from '../models/common';
import { Toaster } from '../models/toaster';
import { ConfirmationService } from '../services/confirmation.service';
import { HTTP_ERROR_CONFIG } from '../tokens/error-pages.token';
export const DEFAULT_ERROR_MESSAGES = {
defaultError: {
@ -56,7 +55,7 @@ export class ErrorHandler {
private cfRes: ComponentFactoryResolver,
private rendererFactory: RendererFactory2,
private injector: Injector,
@Inject(HTTP_ERROR_CONFIG) private httpErrorConfig: HttpErrorConfig,
@Inject('HTTP_ERROR_CONFIG') private httpErrorConfig: HttpErrorConfig,
) {
this.actions.pipe(ofActionSuccessful(RestOccurError, RouterError, RouterDataResolved)).subscribe(res => {
if (res instanceof RestOccurError) {
@ -209,7 +208,8 @@ export class ErrorHandler {
this.componentRef.instance[key] = instance[key];
}
}
console.warn(this.httpErrorConfig.errorScreen);
this.componentRef.instance.hideCloseIcon = this.httpErrorConfig.errorScreen.hideCloseIcon;
if (this.canCreateCustomError(instance.status as ErrorScreenErrorCodes)) {
this.componentRef.instance.cfRes = this.cfRes;
this.componentRef.instance.appRef = this.appRef;

@ -14,5 +14,6 @@ export interface HttpErrorConfig {
| [ErrorScreenErrorCodes, ErrorScreenErrorCodes]
| [ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes]
| [ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes];
hideCloseIcon?: boolean;
};
}

@ -19,7 +19,7 @@ import { TableSortDirective } from './directives/table-sort.directive';
import { ErrorHandler } from './handlers/error.handler';
import { chartJsLoaded$ } from './utils/widget-utils';
import { RootParams } from './models/common';
import { HTTP_ERROR_CONFIG, httpErrorConfigFactory } from './tokens/error-pages.token';
import { HTTP_ERROR_CONFIG, httpErrorConfigFactory } from './tokens/http-error.token';
export function appendScript(injector: Injector) {
const fn = () => {

Loading…
Cancel
Save