File

src/ui/error-handler/smart-error-dialog.component.ts

Implements

OnInit AfterViewInit

Metadata

Index

Properties
Methods
HostListeners

HostListeners

document:focusin
Arguments : '$event'
document:focusin(ev: FocusEvent)

Prevents elements outside the dialog from being focused.

Parameters :
Name Optional
ev No
window:dblclick
Arguments : '$event'
window:dblclick(ev: MouseEvent)

Restores the dialog to its original size when double-clicked on the title bar.

Parameters :
Name Optional
ev No

Methods

Public close
close(closeAction: DialogAction)

Closes the error window

Parameters :
Name Type Optional
closeAction DialogAction No
Returns : void
onClick
onClick(ev: MouseEvent)
Decorators :
@HostListener('window:dblclick', ['$event'])

Restores the dialog to its original size when double-clicked on the title bar.

Parameters :
Name Type Optional
ev MouseEvent No
Returns : boolean
onFocus
onFocus(ev: FocusEvent)
Decorators :
@HostListener('document:focusin', ['$event'])

Prevents elements outside the dialog from being focused.

Parameters :
Name Type Optional
ev FocusEvent No
Returns : boolean
Public processStacktrace
processStacktrace(stack: any)

Processes the stacktrace and populates the stacktrace array.

Parameters :
Name Type Optional
stack any No
Returns : void
Public toggleErrorDetail
toggleErrorDetail()

Hides or shows the error details.

Returns : void
Public toggleErrorProperties
toggleErrorProperties()

Hides or shows the error properties.

Returns : void
Public toggleSessionInfo
toggleSessionInfo()

Hides or shows the session information.

Returns : void
Public toggleStackDetails
toggleStackDetails()

Hides or shows the details view.

Returns : void
Public toggleStackElement
toggleStackElement(element: StackElement)

Toggles the given StackElement's visibility.

Parameters :
Name Type Optional
element StackElement No
Returns : void
Public toggleStacktrace
toggleStacktrace()

Hides or shows the stacktrace.

Returns : void

Properties

buttonArea
Type : ElementRef
Decorators :
@ViewChild('buttonArea', {read: ElementRef, static: false})
buttons
Type : QueryList<ButtonDirective>
Decorators :
@ViewChildren(ButtonDirective)
causedBy
Type : string
contentArea
Type : ElementRef
Decorators :
@ViewChild('contentArea', {read: ElementRef, static: false})
contentHeight
Type : number
dialogActions
Type : DialogAction[]
dialogRef
Type : WindowRef
err
Type : any
errDetail
Type : any[]
Default value : []
errDetailVisible
Type : unknown
Default value : false
errMsg
Type : string
errMsgs
Type : string[]
Default value : []
errProperties
Type : any
errPropertiesVisible
Type : unknown
Default value : false
sessionInfo
Type : any[]
Default value : []
sessionInfoVisible
Type : unknown
Default value : false
stackDetailsVisible
Type : unknown
Default value : false
stacktrace
Type : StackElement[]
Default value : []
stacktraceVisible
Type : unknown
Default value : false
title
Type : string
titleTemplate
Type : TemplateRef<any>
Decorators :
@ViewChild('windowTitleBar', {read: TemplateRef, static: false})
windowTitlebarEl
Type : ElementRef
Decorators :
@ViewChild('windowTitlebar', {read: ElementRef, static: false})
<!--
**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -                  *
* www.consultingwerk.com and other contributors as listed                *
* below. All Rights Reserved.                                            *
*                                                                        *
*  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY        *
*   KIND, either express or implied.                                     *
*                                                                        *
*  Contributors:                                                         *
*                                                                        *
**************************************************************************

--------------------------------------------------------------------------
    File        : smart-error-dialog.component.html
    Purpose     : Template for Smart Error Dialog.
    Author(s)   : Radu Nicoara
    Created     : Jan 12, 2018
--------------------------------------------------------------------------
-->
<ng-template #windowTitleBar let-win>
	<div class="k-window-title ms-0">{{ title }}</div>
	<button kendoWindowCloseAction [window]="win"></button>
</ng-template>

<div class="d-flex flex-column h-100" #contentArea id="content-area">
	<div id="error-modal-wrap" style="flex: 1 1 auto">
		<div id="err-view" class="d-flex flex-row px-2">
			<!-- Left Column for Error Messages and Stack Traces -->
			<div class="error-content">
				<!-- Error Messages -->
				@if (stacktrace) {
				<div class="stacktrace">
					@for (stackElement of stacktrace; track stackElement; let i
					= $index) {
					<div class="stacktrace-item">
						@if (i === 0) {
						<div>
							@for (msg of stackElement.text; track msg) {
							<p>{{ msg }}</p>
							}
						</div>
						}
						<div class="d-flex flex-row action-links">
							@if (errDetail?.length > 0) {
							<a (click)="toggleErrorDetail()"
								>{{
									errDetailVisible ? 'Hide ' : 'Show '
								}}details</a
							>
							} @if (i === 0 && !!stackElement.stackText) {
							<a (click)="toggleStackElement(stackElement)"
								>{{
									stackElement.visible ? 'Hide ' : 'View '
								}}Stack-Trace</a
							>
							} @if (i === 0 && errProperties) {
							<a (click)="toggleErrorProperties()"
								>{{
									errPropertiesVisible ? 'Hide ' : 'View '
								}}properties</a
							>
							}
						</div>
						<!-- Error Details -->
						@if (errDetailVisible && i === 0) {
						<div>
							@for (detail of errDetail; track detail) {
							<p>{{ detail }}</p>
							}
						</div>
						}
						<!-- Stack Trace Content -->
						@if (stackElement.visible && stacktrace[i === 0 ? 0 :
						i-1].visible) {
						<div class="stacktrace-item-content">
							@if (i > 0) {
							<div>
								@for (msg of stackElement.text; track msg) {
								<p>{{ msg }}</p>
								}
							</div>
							} @if (stackElement.error) {
							<p>{{ stackElement.error }}</p>
							}
							<kendo-textarea
								[rows]="7"
								resizable="none"
								[readonly]="true"
								class="stacktrace-textarea"
								[ngModel]="stackElement.stackText || ''"
							></kendo-textarea>
							@if (stacktrace[i+1]) {
							<a
								style="cursor: pointer"
								(click)="toggleStackElement(stacktrace[i + 1])"
								>Caused by
								<span class="caret"></span>
							</a>
							}
						</div>
						}
					</div>
					}
				</div>
				}
			</div>

			<!-- Right Column for Properties Grid -->
			@if (errPropertiesVisible) {
			<div class="properties-column">
				<div class="properties-container">
					<kendo-grid
						[data]="errProperties"
						[style.height]="'100%'"
						[style.width]="'100%'"
						[style.maxWidth]="'100%'"
						[style.minHeight]="'100%'"
						[scrollable]="'scrollable'"
						[resizable]="true"
					>
						<kendo-grid-column field="Name"></kendo-grid-column>
						<kendo-grid-column field="Value"></kendo-grid-column>
					</kendo-grid>
				</div>
			</div>
			}
		</div>
	</div>

	<!-- Button Area -->
	<div id="window-actions-wrapper" #buttonArea>
		@for (button of dialogActions; track button) {
		<button kendoButton themeColor="primary" (click)="close(button)">
			{{ button.text }}
		</button>
		}
	</div>
</div>

./smart-error-dialog.component.css

/**********************************************************************
 * Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -              *
 * www.consultingwerk.com and other contributors as listed            *
 * below. All Rights Reserved.                                        *
 *                                                                    *
 *  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY    *
 *   KIND, either express or implied.                                 *
 *                                                                    *
 *  Contributors:                                                     *
 *                                                                    *
 **********************************************************************/
/*------------------------------------------------------------------------
    File        : smart-error-dialog.component.css
    Purpose     : Styles for Smart Error Dialog.
    Author(s)   : Radu Nicoara
    Created     : Feb 09, 2022
  ----------------------------------------------------------------------*/

#window-actions-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--kendo-color-app-surface, white);
    z-index: 1;
    flex: 0 0 auto;
    padding: var(--kendo-spacing-2, 0.5rem);
    border-top: 1px solid var(--kendo-color-border, #e0e0e0);
    display: flex;
    gap: var(--kendo-spacing-2, 0.5rem);
    box-sizing: border-box;
}

#content-area {
   overflow: auto;
}

#window-actions-wrapper button {
    flex: 1;
    margin: 0;
}

#error-modal-wrap {
    display: flex;
    flex-direction: column;
    max-height: calc(100% - var(--button-area-height, var(--kendo-spacing-17, 4.25rem)) + var(--kendo-spacing-26, 8rem));
    overflow: hidden;
    padding-bottom: 0;
    position: relative;
    width: max-content;
    max-width: 100%;
    width: 100%;
}

#err-view {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: var(--kendo-spacing-6, 1.5rem);
    flex: 1;
    min-height: 0;
    padding-bottom: var(--button-area-height, 2rem);
    overflow: hidden;
}

.error-content {
    flex: 1;
    min-width: 28.125rem; /* 450px equivalent */
    max-height: calc(100% - var(--button-area-height, var(--kendo-spacing-17, 4.25rem)) + var(--kendo-spacing-26, 8rem));
}

:host-context(.smart-error-dialog) #err-view:not(:has(.properties-column)) .error-content {
    max-width: none; /* Allow full width expansion */
}

.properties-column {
    flex: 2; /* Give more weight to the properties column */
    max-width: 43.75rem; /* 700px equivalent */
}

.properties-container {
    flex: 1;
    min-height: 0;
    padding-left: 0;
    height: 100%;
    min-height: 12.5rem; /* 200px equivalent */
}

.properties-container kendo-grid {
    height: 100%;
    max-height: 80vh;
}

/* Make sure the stacktrace area still scrolls */
.stacktrace-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.stacktrace {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
}
.error-detail-container {
    margin: var(--kendo-spacing-4, 1rem) 0;
    padding: var(--kendo-spacing-4, 1rem);
    background-color: var(--kendo-color-surface, #f5f5f5);
    border-radius: var(--kendo-border-radius-md, 0.375rem);
}

.stacktrace-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: fit-content;
    p {
        overflow-wrap: anywhere;
        white-space: pre-wrap;
    }
}

.stacktrace-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.stacktrace-item-content kendo-textarea {
    flex: 1;
    resize: none;
}

.stacktrace-textarea {
    margin: var(--kendo-spacing-1.25, 0.3125rem) 0; /* 5px equivalent */
    background-color: var(--kendo-color-base-subtle, #e9ecef) !important;
    flex: 1;
}

.action-links {
    display: flex;
    gap: var(--kendo-spacing-2, 0.5rem); /* 10px equivalent */
    margin: var(--kendo-spacing-2, 0.5rem) 0;
}

.action-links a {
    cursor: pointer;
}

::ng-deep .smart-error-dialog {
    z-index: 100000 !important;
}

::ng-deep #err-view kendo-textarea .k-input-inner {
    cursor: default !important;
    height: 100%;
}

/* Input prompt dialog styles */
.input-prompt-frame {
    min-width: 18.75rem; /* 300px equivalent */
    display: block;
}

::ng-deep .k-window-title {
    margin-left: var(--kendo-spacing-1.25, 0.3125rem) !important; /* 5px equivalent */
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""