diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index 790daf1a42..ec3a8d5f0b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -1436,7 +1436,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI title = insertVariable(title, prop + ':entityLabel', params[prop].entityLabel); } } - this.dialog.open(this.embedDashboardDialogComponent, { + dashboard.dialogRef = this.dialog.open(this.embedDashboardDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], viewContainerRef: this.widgetContentContainer, diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index 0bcfa8fb01..9c176dc8bb 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -394,6 +394,13 @@ export class WidgetContext { this.widgetActions = undefined; } + closeDialog(resultData: any = null) { + const dialogRef = this.$scope.dialogRef || this.stateController.dashboardCtrl.dashboardCtx.getDashboard().dialogRef; + if (dialogRef) { + dialogRef.close(resultData); + } + } + pageLink(pageSize: number, page: number = 0, textSearch: string = null, sortOrder: SortOrder = null): PageLink { return new PageLink(pageSize, page, textSearch, sortOrder); } diff --git a/ui-ngx/src/app/shared/models/dashboard.models.ts b/ui-ngx/src/app/shared/models/dashboard.models.ts index 12e1c83ada..cf777633a2 100644 --- a/ui-ngx/src/app/shared/models/dashboard.models.ts +++ b/ui-ngx/src/app/shared/models/dashboard.models.ts @@ -22,6 +22,7 @@ import { Widget } from './widget.models'; import { Timewindow } from '@shared/models/time/time.models'; import { EntityAliases } from './alias.models'; import { Filters } from '@shared/models/query/query.models'; +import { MatDialogRef } from '@angular/material/dialog'; export interface DashboardInfo extends BaseData, ExportableEntity { tenantId?: TenantId; @@ -112,6 +113,7 @@ export interface DashboardConfiguration { export interface Dashboard extends DashboardInfo { configuration?: DashboardConfiguration; + dialogRef?: MatDialogRef; } export interface HomeDashboard extends Dashboard {