@memberjunction/ng-dashboard-viewer 6.2.0-edge.5 → 6.2.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/lib/config-panels/artifact-config-panel.component.js +2 -2
- package/dist/lib/config-panels/component-config-panel.component.d.ts +51 -0
- package/dist/lib/config-panels/component-config-panel.component.d.ts.map +1 -0
- package/dist/lib/config-panels/component-config-panel.component.js +246 -0
- package/dist/lib/config-panels/component-config-panel.component.js.map +1 -0
- package/dist/lib/config-panels/index.d.ts +1 -0
- package/dist/lib/config-panels/index.d.ts.map +1 -1
- package/dist/lib/config-panels/index.js +1 -0
- package/dist/lib/config-panels/index.js.map +1 -1
- package/dist/lib/config-panels/query-config-panel.component.js +2 -2
- package/dist/lib/config-panels/view-config-panel.component.js +2 -2
- package/dist/lib/config-panels/weburl-config-panel.component.js +2 -2
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.d.ts +58 -1
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.d.ts.map +1 -1
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.js +186 -4
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.js.map +1 -1
- package/dist/lib/dashboard-viewer.module.d.ts +22 -17
- package/dist/lib/dashboard-viewer.module.d.ts.map +1 -1
- package/dist/lib/dashboard-viewer.module.js +29 -4
- package/dist/lib/dashboard-viewer.module.js.map +1 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.d.ts +35 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.d.ts.map +1 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.js +307 -34
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.js.map +1 -1
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.d.ts +79 -0
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.d.ts.map +1 -0
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.js +461 -0
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.js.map +1 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.d.ts +41 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.d.ts.map +1 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.js +248 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.js.map +1 -0
- package/dist/lib/models/dashboard-config-validator.d.ts +30 -0
- package/dist/lib/models/dashboard-config-validator.d.ts.map +1 -0
- package/dist/lib/models/dashboard-config-validator.js +107 -0
- package/dist/lib/models/dashboard-config-validator.js.map +1 -0
- package/dist/lib/models/dashboard-part-interfaces.d.ts +42 -0
- package/dist/lib/models/dashboard-part-interfaces.d.ts.map +1 -0
- package/dist/lib/models/dashboard-part-interfaces.js +180 -0
- package/dist/lib/models/dashboard-part-interfaces.js.map +1 -0
- package/dist/lib/models/dashboard-properties.d.ts +182 -0
- package/dist/lib/models/dashboard-properties.d.ts.map +1 -0
- package/dist/lib/models/dashboard-properties.js +263 -0
- package/dist/lib/models/dashboard-properties.js.map +1 -0
- package/dist/lib/models/dashboard-types.d.ts +8 -0
- package/dist/lib/models/dashboard-types.d.ts.map +1 -1
- package/dist/lib/models/dashboard-types.js.map +1 -1
- package/dist/lib/models/part-inputs-editor.d.ts +36 -0
- package/dist/lib/models/part-inputs-editor.d.ts.map +1 -0
- package/dist/lib/models/part-inputs-editor.js +53 -0
- package/dist/lib/models/part-inputs-editor.js.map +1 -0
- package/dist/lib/parts/artifact-part.component.d.ts.map +1 -1
- package/dist/lib/parts/artifact-part.component.js +5 -4
- package/dist/lib/parts/artifact-part.component.js.map +1 -1
- package/dist/lib/parts/base-dashboard-part.d.ts +50 -1
- package/dist/lib/parts/base-dashboard-part.d.ts.map +1 -1
- package/dist/lib/parts/base-dashboard-part.js +108 -1
- package/dist/lib/parts/base-dashboard-part.js.map +1 -1
- package/dist/lib/parts/component-part.component.d.ts +54 -0
- package/dist/lib/parts/component-part.component.d.ts.map +1 -0
- package/dist/lib/parts/component-part.component.js +221 -0
- package/dist/lib/parts/component-part.component.js.map +1 -0
- package/dist/lib/parts/index.d.ts +1 -0
- package/dist/lib/parts/index.d.ts.map +1 -1
- package/dist/lib/parts/index.js +1 -0
- package/dist/lib/parts/index.js.map +1 -1
- package/dist/lib/parts/query-part.component.d.ts +25 -1
- package/dist/lib/parts/query-part.component.d.ts.map +1 -1
- package/dist/lib/parts/query-part.component.js +93 -10
- package/dist/lib/parts/query-part.component.js.map +1 -1
- package/dist/lib/parts/view-part.component.d.ts +18 -1
- package/dist/lib/parts/view-part.component.d.ts.map +1 -1
- package/dist/lib/parts/view-part.component.js +74 -10
- package/dist/lib/parts/view-part.component.js.map +1 -1
- package/dist/lib/parts/weburl-part.component.d.ts +8 -0
- package/dist/lib/parts/weburl-part.component.d.ts.map +1 -1
- package/dist/lib/parts/weburl-part.component.js +29 -2
- package/dist/lib/parts/weburl-part.component.js.map +1 -1
- package/dist/public-api.d.ts +8 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +8 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +15 -13
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { EventEmitter, OnDestroy, ElementRef, ChangeDetectorRef, ApplicationRef, Injector, EnvironmentInjector } from '@angular/core';
|
|
2
|
+
import { PropertyValue } from '@memberjunction/core';
|
|
2
3
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
3
4
|
import { MJDashboardEntity, MJDashboardPartTypeEntity, MJDashboardCategoryEntity } from '@memberjunction/core-entities';
|
|
4
5
|
import { BreadcrumbNavigateEvent } from '../breadcrumb/dashboard-breadcrumb.component';
|
|
5
6
|
import { ResolvedLayoutConfig } from 'golden-layout';
|
|
6
7
|
import { DashboardConfig, DashboardPanel, PanelConfig, PanelInteractionEvent, DashboardConfigChangedEvent, DashboardNavRequestEvent } from '../models/dashboard-types';
|
|
7
8
|
import { type PanelPosition } from '../models/dashboard-layout-editor';
|
|
9
|
+
import { DashboardPartInterface, DashboardProperty, DashboardWire } from '../models/dashboard-properties';
|
|
8
10
|
import * as i0 from "@angular/core";
|
|
9
11
|
export type DashboardLayoutReadyState = 'pending-dashboard' | 'pending-parts' | 'waiting-for-size' | 'initializing' | 'ready' | 'error';
|
|
10
12
|
export interface DashboardLayoutLifecycleEvent {
|
|
@@ -90,6 +92,19 @@ export declare class DashboardViewerComponent extends BaseAngularComponent imple
|
|
|
90
92
|
get showEditButton(): DashboardViewerComponent['ShowEditButton'];
|
|
91
93
|
/** All categories for breadcrumb path resolution */
|
|
92
94
|
Categories: MJDashboardCategoryEntity[];
|
|
95
|
+
/**
|
|
96
|
+
* Values for the dashboard's properties, keyed by property name, set once by the host (for
|
|
97
|
+
* example a chapter space's chapter). Each part takes them through its own input mappings. A host
|
|
98
|
+
* value always wins over a wired event's value and over the property's default; null or undefined
|
|
99
|
+
* counts as not set. Unset (the default) on a dashboard without properties changes nothing.
|
|
100
|
+
*/
|
|
101
|
+
set Properties(value: Record<string, PropertyValue> | null);
|
|
102
|
+
get Properties(): Record<string, PropertyValue> | null;
|
|
103
|
+
private _hostProperties;
|
|
104
|
+
/** Works out the dashboard's property values: host, then wired events, then defaults. */
|
|
105
|
+
private propertyResolver;
|
|
106
|
+
/** Why the last save was refused (a broken mapping or wire), or null. */
|
|
107
|
+
LastSaveError: string | null;
|
|
93
108
|
/**
|
|
94
109
|
* Computed: Should the toolbar be visible?
|
|
95
110
|
* Auto-hides when showToolbar=false OR when all toolbar elements are disabled
|
|
@@ -317,6 +332,22 @@ export declare class DashboardViewerComponent extends BaseAngularComponent imple
|
|
|
317
332
|
* Get the current configuration
|
|
318
333
|
*/
|
|
319
334
|
getConfig(): DashboardConfig | null;
|
|
335
|
+
/** The dashboard's properties (empty when it has none). */
|
|
336
|
+
GetDashboardProperties(): DashboardProperty[];
|
|
337
|
+
/** The dashboard's wires (empty when it has none). */
|
|
338
|
+
GetWires(): DashboardWire[];
|
|
339
|
+
/**
|
|
340
|
+
* Replaces the dashboard's properties and wires (the designer's Properties panel and Wires list).
|
|
341
|
+
* An empty list removes its key, so a dashboard without them saves exactly as before. Rebuilds the
|
|
342
|
+
* parts so they take the new properties, marks the dashboard changed and emits a `settings` change.
|
|
343
|
+
* The save checks the mappings and wires against them.
|
|
344
|
+
*/
|
|
345
|
+
SetPropertiesAndWires(properties: DashboardProperty[], wires: DashboardWire[]): Promise<void>;
|
|
346
|
+
/**
|
|
347
|
+
* Loads what each part with mappings or wires declares, for the designer and the save check.
|
|
348
|
+
* A part whose interface can't load maps to null.
|
|
349
|
+
*/
|
|
350
|
+
LoadPartInterfaces(panels?: DashboardPanel[]): Promise<Map<string, DashboardPartInterface | null>>;
|
|
320
351
|
/**
|
|
321
352
|
* Get available part types
|
|
322
353
|
*/
|
|
@@ -427,6 +458,32 @@ export declare class DashboardViewerComponent extends BaseAngularComponent imple
|
|
|
427
458
|
private renderQueryPart;
|
|
428
459
|
private renderArtifactPart;
|
|
429
460
|
private renderPlaceholderPart;
|
|
461
|
+
private createPropertyResolver;
|
|
462
|
+
/** Token defaults are worked out in the browser, for the provider's user, in the browser's zone. */
|
|
463
|
+
private resolutionContext;
|
|
464
|
+
/** True when the part takes a property context: the dashboard has properties, or the part has mappings. */
|
|
465
|
+
private takesPropertyContext;
|
|
466
|
+
/** The properties and their values as one panel sees them (without its own events' values). */
|
|
467
|
+
private contextFor;
|
|
468
|
+
/** Hands a new part its property context and wired events. A dashboard without them sets neither. */
|
|
469
|
+
private bindPartToProperties;
|
|
470
|
+
/** Hands every part its current context. A part reloads only when the values it runs with changed. */
|
|
471
|
+
private pushPropertyContexts;
|
|
472
|
+
/**
|
|
473
|
+
* A part raised an event. A View or Query selection reaches the host as `record-select`. Each wire
|
|
474
|
+
* from the event sets its property (a cleared selection removes the value it set), and the parts get
|
|
475
|
+
* the new values; the part that raised it doesn't see its own value, so it isn't refreshed by it.
|
|
476
|
+
*/
|
|
477
|
+
private onPartEvent;
|
|
478
|
+
/** True when the dashboard has properties, wires or any part mapping: only then does a save check them. */
|
|
479
|
+
private hasBindings;
|
|
480
|
+
/**
|
|
481
|
+
* Checks the properties, mappings and wires before a save. Returns true, with LastSaveError and an
|
|
482
|
+
* `error` event saying why, when the save must be refused. A dashboard without them is not checked.
|
|
483
|
+
*/
|
|
484
|
+
private refuseBrokenBindings;
|
|
485
|
+
/** The problems a save refuses. Loads the interfaces of the parts with mappings or wires. */
|
|
486
|
+
private validateBindings;
|
|
430
487
|
private onConfigurePart;
|
|
431
488
|
private onRemovePart;
|
|
432
489
|
/**
|
|
@@ -441,6 +498,6 @@ export declare class DashboardViewerComponent extends BaseAngularComponent imple
|
|
|
441
498
|
private updatePanelEditModes;
|
|
442
499
|
private markDirty;
|
|
443
500
|
static ɵfac: i0.ɵɵFactoryDeclaration<DashboardViewerComponent, never>;
|
|
444
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DashboardViewerComponent, "mj-dashboard-viewer", never, { "Dashboard": { "alias": "Dashboard"; "required": false; }; "dashboard": { "alias": "dashboard"; "required": false; }; "DashboardId": { "alias": "DashboardId"; "required": false; }; "dashboardId": { "alias": "dashboardId"; "required": false; }; "IsEditing": { "alias": "IsEditing"; "required": false; }; "isEditing": { "alias": "isEditing"; "required": false; }; "CanEdit": { "alias": "CanEdit"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; "showToolbar": { "alias": "showToolbar"; "required": false; }; "AutoSave": { "alias": "AutoSave"; "required": false; }; "autoSave": { "alias": "autoSave"; "required": false; }; "ShowBreadcrumb": { "alias": "ShowBreadcrumb"; "required": false; }; "showBreadcrumb": { "alias": "showBreadcrumb"; "required": false; }; "ShowOpenInTabButton": { "alias": "ShowOpenInTabButton"; "required": false; }; "showOpenInTabButton": { "alias": "showOpenInTabButton"; "required": false; }; "ShowEditButton": { "alias": "ShowEditButton"; "required": false; }; "showEditButton": { "alias": "showEditButton"; "required": false; }; "Categories": { "alias": "Categories"; "required": false; }; }, { "configChanged": "configChanged"; "NavigationRequested": "NavigationRequested"; "navigationRequested": "navigationRequested"; "PanelInteraction": "PanelInteraction"; "panelInteraction": "panelInteraction"; "DashboardSaved": "DashboardSaved"; "dashboardSaved": "dashboardSaved"; "error": "error"; "EditModeChanged": "EditModeChanged"; "editModeChanged": "editModeChanged"; "BreadcrumbNavigate": "BreadcrumbNavigate"; "breadcrumbNavigate": "breadcrumbNavigate"; "OpenInTab": "OpenInTab"; "openInTab": "openInTab"; "LayoutLifecycle": "LayoutLifecycle"; "layoutLifecycle": "layoutLifecycle"; "LayoutReady": "LayoutReady"; "layoutReady": "layoutReady"; "LayoutDeferred": "LayoutDeferred"; "layoutDeferred": "layoutDeferred"; }, never, never, false, never>;
|
|
501
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DashboardViewerComponent, "mj-dashboard-viewer", never, { "Dashboard": { "alias": "Dashboard"; "required": false; }; "dashboard": { "alias": "dashboard"; "required": false; }; "DashboardId": { "alias": "DashboardId"; "required": false; }; "dashboardId": { "alias": "dashboardId"; "required": false; }; "IsEditing": { "alias": "IsEditing"; "required": false; }; "isEditing": { "alias": "isEditing"; "required": false; }; "CanEdit": { "alias": "CanEdit"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; "showToolbar": { "alias": "showToolbar"; "required": false; }; "AutoSave": { "alias": "AutoSave"; "required": false; }; "autoSave": { "alias": "autoSave"; "required": false; }; "ShowBreadcrumb": { "alias": "ShowBreadcrumb"; "required": false; }; "showBreadcrumb": { "alias": "showBreadcrumb"; "required": false; }; "ShowOpenInTabButton": { "alias": "ShowOpenInTabButton"; "required": false; }; "showOpenInTabButton": { "alias": "showOpenInTabButton"; "required": false; }; "ShowEditButton": { "alias": "ShowEditButton"; "required": false; }; "showEditButton": { "alias": "showEditButton"; "required": false; }; "Categories": { "alias": "Categories"; "required": false; }; "Properties": { "alias": "Properties"; "required": false; }; }, { "configChanged": "configChanged"; "NavigationRequested": "NavigationRequested"; "navigationRequested": "navigationRequested"; "PanelInteraction": "PanelInteraction"; "panelInteraction": "panelInteraction"; "DashboardSaved": "DashboardSaved"; "dashboardSaved": "dashboardSaved"; "error": "error"; "EditModeChanged": "EditModeChanged"; "editModeChanged": "editModeChanged"; "BreadcrumbNavigate": "BreadcrumbNavigate"; "breadcrumbNavigate": "breadcrumbNavigate"; "OpenInTab": "OpenInTab"; "openInTab": "openInTab"; "LayoutLifecycle": "LayoutLifecycle"; "layoutLifecycle": "layoutLifecycle"; "LayoutReady": "LayoutReady"; "layoutReady": "layoutReady"; "LayoutDeferred": "LayoutDeferred"; "layoutDeferred": "layoutDeferred"; }, never, never, false, never>;
|
|
445
502
|
}
|
|
446
503
|
//# sourceMappingURL=dashboard-viewer.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-viewer.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dashboard-viewer/dashboard-viewer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EACZ,SAAS,EAET,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,QAAQ,EAGR,mBAAmB,EAGtB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard-viewer.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dashboard-viewer/dashboard-viewer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EACZ,SAAS,EAET,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,QAAQ,EAGR,mBAAmB,EAGtB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAyD,aAAa,EAAW,MAAM,sBAAsB,CAAC;AAErH,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAmB,iBAAiB,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACzI,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CA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|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, Input, Output, EventEmitter, ViewChild, createComponent, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
3
|
import { takeUntil } from 'rxjs/operators';
|
|
4
|
+
import { GetLocalTimeZone } from '@memberjunction/core';
|
|
4
5
|
import { MJGlobal, UUIDsEqual, EscapeHTML } from '@memberjunction/global';
|
|
5
6
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
6
7
|
import { DashboardEngine } from '@memberjunction/core-entities';
|
|
@@ -8,6 +9,9 @@ import { CreateDefaultDashboardConfig, GeneratePanelId, ExtractPanelsFromLayout,
|
|
|
8
9
|
import { GoldenLayoutWrapperService } from '../services/golden-layout-wrapper.service';
|
|
9
10
|
import { InsertPanel, FindPanelPath, DescribePath } from '../models/dashboard-layout-editor';
|
|
10
11
|
import { BaseDashboardPart } from '../parts/base-dashboard-part';
|
|
12
|
+
import { DashboardPropertyResolver, GetInputMappings, NormalizeEventValue, RECORD_SELECTED_EVENT, ROW_SELECTED_EVENT, } from '../models/dashboard-properties';
|
|
13
|
+
import { ValidateDashboardBindings } from '../models/dashboard-config-validator';
|
|
14
|
+
import { LoadPartInterface } from '../models/dashboard-part-interfaces';
|
|
11
15
|
import * as i0 from "@angular/core";
|
|
12
16
|
import * as i1 from "@memberjunction/ng-shared-generic";
|
|
13
17
|
import * as i2 from "@memberjunction/ng-ui-components";
|
|
@@ -265,6 +269,25 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
265
269
|
}
|
|
266
270
|
/** All categories for breadcrumb path resolution */
|
|
267
271
|
Categories = [];
|
|
272
|
+
/**
|
|
273
|
+
* Values for the dashboard's properties, keyed by property name, set once by the host (for
|
|
274
|
+
* example a chapter space's chapter). Each part takes them through its own input mappings. A host
|
|
275
|
+
* value always wins over a wired event's value and over the property's default; null or undefined
|
|
276
|
+
* counts as not set. Unset (the default) on a dashboard without properties changes nothing.
|
|
277
|
+
*/
|
|
278
|
+
set Properties(value) {
|
|
279
|
+
this._hostProperties = value;
|
|
280
|
+
this.propertyResolver?.SetHostValues(value);
|
|
281
|
+
this.pushPropertyContexts();
|
|
282
|
+
}
|
|
283
|
+
get Properties() {
|
|
284
|
+
return this._hostProperties;
|
|
285
|
+
}
|
|
286
|
+
_hostProperties = null;
|
|
287
|
+
/** Works out the dashboard's property values: host, then wired events, then defaults. */
|
|
288
|
+
propertyResolver = null;
|
|
289
|
+
/** Why the last save was refused (a broken mapping or wire), or null. */
|
|
290
|
+
LastSaveError = null;
|
|
268
291
|
/**
|
|
269
292
|
* Computed: Should the toolbar be visible?
|
|
270
293
|
* Auto-hides when showToolbar=false OR when all toolbar elements are disabled
|
|
@@ -556,6 +579,9 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
556
579
|
this.config.layout = glConfig;
|
|
557
580
|
}
|
|
558
581
|
}
|
|
582
|
+
if (await this.refuseBrokenBindings()) {
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
559
585
|
// Save to UIConfigDetails
|
|
560
586
|
this._dashboard.UIConfigDetails = JSON.stringify(this.config);
|
|
561
587
|
const saved = await this._dashboard.Save();
|
|
@@ -668,6 +694,54 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
668
694
|
getConfig() {
|
|
669
695
|
return this.config;
|
|
670
696
|
}
|
|
697
|
+
/** The dashboard's properties (empty when it has none). */
|
|
698
|
+
GetDashboardProperties() {
|
|
699
|
+
return this.config?.Properties ?? [];
|
|
700
|
+
}
|
|
701
|
+
/** The dashboard's wires (empty when it has none). */
|
|
702
|
+
GetWires() {
|
|
703
|
+
return this.config?.Wires ?? [];
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Replaces the dashboard's properties and wires (the designer's Properties panel and Wires list).
|
|
707
|
+
* An empty list removes its key, so a dashboard without them saves exactly as before. Rebuilds the
|
|
708
|
+
* parts so they take the new properties, marks the dashboard changed and emits a `settings` change.
|
|
709
|
+
* The save checks the mappings and wires against them.
|
|
710
|
+
*/
|
|
711
|
+
async SetPropertiesAndWires(properties, wires) {
|
|
712
|
+
if (!this.config)
|
|
713
|
+
return;
|
|
714
|
+
const layout = this._glService?.getLayoutConfig();
|
|
715
|
+
if (layout)
|
|
716
|
+
this.config.layout = layout;
|
|
717
|
+
setOrRemoveList(this.config, 'Properties', properties);
|
|
718
|
+
setOrRemoveList(this.config, 'Wires', wires);
|
|
719
|
+
this.propertyResolver = this.createPropertyResolver();
|
|
720
|
+
try {
|
|
721
|
+
if (this._glService)
|
|
722
|
+
await this.initializeLayout();
|
|
723
|
+
}
|
|
724
|
+
finally {
|
|
725
|
+
this.markDirty();
|
|
726
|
+
}
|
|
727
|
+
this.configChanged.emit({ config: this.config, changeType: 'settings' });
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Loads what each part with mappings or wires declares, for the designer and the save check.
|
|
731
|
+
* A part whose interface can't load maps to null.
|
|
732
|
+
*/
|
|
733
|
+
async LoadPartInterfaces(panels = ExtractPanelsFromLayout(this.config?.layout ?? null)) {
|
|
734
|
+
const interfaces = new Map();
|
|
735
|
+
await Promise.all(panels.map(async (panel) => {
|
|
736
|
+
try {
|
|
737
|
+
interfaces.set(panel.id, await LoadPartInterface(panel.config, this.ProviderToUse));
|
|
738
|
+
}
|
|
739
|
+
catch {
|
|
740
|
+
interfaces.set(panel.id, null);
|
|
741
|
+
}
|
|
742
|
+
}));
|
|
743
|
+
return interfaces;
|
|
744
|
+
}
|
|
671
745
|
/**
|
|
672
746
|
* Get available part types
|
|
673
747
|
*/
|
|
@@ -848,6 +922,7 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
848
922
|
// Parse or create config
|
|
849
923
|
this.config = this.parseOrCreateConfig();
|
|
850
924
|
this._loadedConfigDetails = this._dashboard.UIConfigDetails ?? null;
|
|
925
|
+
this.propertyResolver = this.createPropertyResolver();
|
|
851
926
|
// Wait for part types to be loaded before initializing layout
|
|
852
927
|
// This ensures partTypes array is populated when createPanelComponent is called
|
|
853
928
|
if (this._partTypesLoaded) {
|
|
@@ -913,8 +988,9 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
913
988
|
// We're proceeding with a real init — cancel any pending deferred attempt.
|
|
914
989
|
this.cancelDeferredLayoutInit();
|
|
915
990
|
this.emitLayoutLifecycle('initializing');
|
|
916
|
-
// Destroy existing layout
|
|
991
|
+
// Destroy existing layout. The new parts start with no selection, so no event value stands.
|
|
917
992
|
this.destroyLayout();
|
|
993
|
+
this.propertyResolver?.ClearEventValues();
|
|
918
994
|
// Create new Golden Layout service
|
|
919
995
|
const glService = new GoldenLayoutWrapperService();
|
|
920
996
|
this._glService = glService;
|
|
@@ -1207,11 +1283,17 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
1207
1283
|
environmentInjector: this.environmentInjector,
|
|
1208
1284
|
elementInjector: this.injector
|
|
1209
1285
|
});
|
|
1210
|
-
// Set inputs on the component
|
|
1286
|
+
// Set inputs on the component. The property context goes first, so the part's first load uses it.
|
|
1211
1287
|
const instance = componentRef.instance;
|
|
1288
|
+
this.bindPartToProperties(instance, panel);
|
|
1212
1289
|
instance.Panel = panel;
|
|
1213
1290
|
instance.PartType = partType;
|
|
1214
1291
|
instance.IsEditing = this.IsEditing;
|
|
1292
|
+
// The part reads and runs data through the viewer's provider. Without one, the part keeps
|
|
1293
|
+
// its own default (the global provider), exactly as before.
|
|
1294
|
+
if (this.Provider) {
|
|
1295
|
+
instance.Provider = this.Provider;
|
|
1296
|
+
}
|
|
1215
1297
|
// Subscribe to events
|
|
1216
1298
|
instance.ConfigureRequested.subscribe(() => {
|
|
1217
1299
|
this.onConfigurePart(panel.id);
|
|
@@ -1222,6 +1304,9 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
1222
1304
|
instance.NavigationRequested.subscribe((event) => {
|
|
1223
1305
|
this.NavigationRequested.emit(event);
|
|
1224
1306
|
});
|
|
1307
|
+
instance.PartEvent.subscribe((event) => {
|
|
1308
|
+
this.onPartEvent(panel.id, event);
|
|
1309
|
+
});
|
|
1225
1310
|
// Attach component to DOM
|
|
1226
1311
|
container.appendChild(componentRef.location.nativeElement);
|
|
1227
1312
|
// Attach to Angular's change detection
|
|
@@ -1399,6 +1484,92 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
1399
1484
|
</div>
|
|
1400
1485
|
`;
|
|
1401
1486
|
}
|
|
1487
|
+
// ========================================
|
|
1488
|
+
// Private Methods - Properties, mappings and wires
|
|
1489
|
+
// ========================================
|
|
1490
|
+
createPropertyResolver() {
|
|
1491
|
+
const resolver = new DashboardPropertyResolver(this.config?.Properties ?? [], () => this.resolutionContext());
|
|
1492
|
+
resolver.SetHostValues(this._hostProperties);
|
|
1493
|
+
return resolver;
|
|
1494
|
+
}
|
|
1495
|
+
/** Token defaults are worked out in the browser, for the provider's user, in the browser's zone. */
|
|
1496
|
+
resolutionContext() {
|
|
1497
|
+
const user = this.ProviderToUse?.CurrentUser;
|
|
1498
|
+
return { User: user ? { ID: user.ID, Email: user.Email, Name: user.Name } : undefined, TimeZone: GetLocalTimeZone() };
|
|
1499
|
+
}
|
|
1500
|
+
/** True when the part takes a property context: the dashboard has properties, or the part has mappings. */
|
|
1501
|
+
takesPropertyContext(panel) {
|
|
1502
|
+
return !!panel && ((this.config?.Properties?.length ?? 0) > 0 || GetInputMappings(panel.config).length > 0);
|
|
1503
|
+
}
|
|
1504
|
+
/** The properties and their values as one panel sees them (without its own events' values). */
|
|
1505
|
+
contextFor(panelId) {
|
|
1506
|
+
return { Properties: this.config?.Properties ?? [], Values: this.propertyResolver?.ValuesFor(panelId) ?? {} };
|
|
1507
|
+
}
|
|
1508
|
+
/** Hands a new part its property context and wired events. A dashboard without them sets neither. */
|
|
1509
|
+
bindPartToProperties(instance, panel) {
|
|
1510
|
+
if (this.takesPropertyContext(panel)) {
|
|
1511
|
+
instance.PropertyContext = this.contextFor(panel.id);
|
|
1512
|
+
}
|
|
1513
|
+
const wired = [...new Set(this.GetWires().filter(w => w.Panel === panel.id).map(w => w.Event))];
|
|
1514
|
+
if (wired.length > 0) {
|
|
1515
|
+
instance.WiredEvents = wired;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
/** Hands every part its current context. A part reloads only when the values it runs with changed. */
|
|
1519
|
+
pushPropertyContexts() {
|
|
1520
|
+
this._panelComponents.forEach((entry, panelId) => {
|
|
1521
|
+
const instance = entry.componentRef?.instance;
|
|
1522
|
+
if (instance && this.takesPropertyContext(instance.Panel)) {
|
|
1523
|
+
instance.PropertyContext = this.contextFor(panelId);
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* A part raised an event. A View or Query selection reaches the host as `record-select`. Each wire
|
|
1529
|
+
* from the event sets its property (a cleared selection removes the value it set), and the parts get
|
|
1530
|
+
* the new values; the part that raised it doesn't see its own value, so it isn't refreshed by it.
|
|
1531
|
+
*/
|
|
1532
|
+
onPartEvent(panelId, event) {
|
|
1533
|
+
if (event.Values && (event.Event === RECORD_SELECTED_EVENT || event.Event === ROW_SELECTED_EVENT)) {
|
|
1534
|
+
this.PanelInteraction.emit({ panelId, interactionType: 'record-select', payload: { event: event.Event, values: event.Values } });
|
|
1535
|
+
}
|
|
1536
|
+
const wires = this.GetWires().filter(w => w.Panel === panelId && w.Event === event.Event);
|
|
1537
|
+
if (wires.length === 0 || !this.propertyResolver)
|
|
1538
|
+
return;
|
|
1539
|
+
for (const wire of wires) {
|
|
1540
|
+
const value = event.Values ? NormalizeEventValue(event.Values[wire.Value]) : null;
|
|
1541
|
+
this.propertyResolver.SetEventValue(wire.Property, value, panelId);
|
|
1542
|
+
}
|
|
1543
|
+
this.pushPropertyContexts();
|
|
1544
|
+
}
|
|
1545
|
+
/** True when the dashboard has properties, wires or any part mapping: only then does a save check them. */
|
|
1546
|
+
hasBindings() {
|
|
1547
|
+
const panels = ExtractPanelsFromLayout(this.config?.layout ?? null);
|
|
1548
|
+
return this.GetDashboardProperties().length > 0 || this.GetWires().length > 0
|
|
1549
|
+
|| panels.some(p => GetInputMappings(p.config).length > 0);
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* Checks the properties, mappings and wires before a save. Returns true, with LastSaveError and an
|
|
1553
|
+
* `error` event saying why, when the save must be refused. A dashboard without them is not checked.
|
|
1554
|
+
*/
|
|
1555
|
+
async refuseBrokenBindings() {
|
|
1556
|
+
const problems = await this.validateBindings();
|
|
1557
|
+
this.LastSaveError = problems.length > 0 ? problems.join(' ') : null;
|
|
1558
|
+
if (this.LastSaveError) {
|
|
1559
|
+
this.error.emit({ message: `The dashboard can't be saved: ${this.LastSaveError}` });
|
|
1560
|
+
}
|
|
1561
|
+
return this.LastSaveError !== null;
|
|
1562
|
+
}
|
|
1563
|
+
/** The problems a save refuses. Loads the interfaces of the parts with mappings or wires. */
|
|
1564
|
+
async validateBindings() {
|
|
1565
|
+
if (!this.config || !this.hasBindings())
|
|
1566
|
+
return [];
|
|
1567
|
+
const panels = ExtractPanelsFromLayout(this.config.layout);
|
|
1568
|
+
const wiredPanels = new Set(this.GetWires().map(w => w.Panel));
|
|
1569
|
+
const toLoad = panels.filter(p => GetInputMappings(p.config).length > 0 || wiredPanels.has(p.id));
|
|
1570
|
+
const interfaces = await this.LoadPartInterfaces(toLoad);
|
|
1571
|
+
return ValidateDashboardBindings({ Properties: this.GetDashboardProperties(), Wires: this.GetWires(), Panels: panels, Interfaces: interfaces });
|
|
1572
|
+
}
|
|
1402
1573
|
onConfigurePart(panelId) {
|
|
1403
1574
|
// Emit event for parent to handle configuration
|
|
1404
1575
|
this.PanelInteraction.emit({
|
|
@@ -1479,7 +1650,7 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
1479
1650
|
} if (rf & 2) {
|
|
1480
1651
|
let _t;
|
|
1481
1652
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.LayoutContainer = _t.first);
|
|
1482
|
-
} }, inputs: { Dashboard: "Dashboard", dashboard: "dashboard", DashboardId: "DashboardId", dashboardId: "dashboardId", IsEditing: "IsEditing", isEditing: "isEditing", CanEdit: "CanEdit", ShowToolbar: "ShowToolbar", showToolbar: "showToolbar", AutoSave: "AutoSave", autoSave: "autoSave", ShowBreadcrumb: "ShowBreadcrumb", showBreadcrumb: "showBreadcrumb", ShowOpenInTabButton: "ShowOpenInTabButton", showOpenInTabButton: "showOpenInTabButton", ShowEditButton: "ShowEditButton", showEditButton: "showEditButton", Categories: "Categories" }, outputs: { configChanged: "configChanged", NavigationRequested: "NavigationRequested", navigationRequested: "navigationRequested", PanelInteraction: "PanelInteraction", panelInteraction: "panelInteraction", DashboardSaved: "DashboardSaved", dashboardSaved: "dashboardSaved", error: "error", EditModeChanged: "EditModeChanged", editModeChanged: "editModeChanged", BreadcrumbNavigate: "BreadcrumbNavigate", breadcrumbNavigate: "breadcrumbNavigate", OpenInTab: "OpenInTab", openInTab: "openInTab", LayoutLifecycle: "LayoutLifecycle", layoutLifecycle: "layoutLifecycle", LayoutReady: "LayoutReady", layoutReady: "layoutReady", LayoutDeferred: "LayoutDeferred", layoutDeferred: "layoutDeferred" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 7, vars: 8, consts: [["layoutContainer", ""], [1, "dashboard-viewer"], ["Size", "large", "RootIcon", "fa-solid fa-gauge-high", "RootLabel", "Dashboards", 3, "Categories", "CurrentCategoryId", "CurrentDashboard", "ShowDashboardName", "AllowDragDrop"], [1, "dashboard-toolbar"], [1, "loading-overlay"], [1, "layout-container"], ["Icon", "fa-solid fa-table-columns", "Title", "No parts yet", "Message", "Add a view, query, artifact, or web page to get started.", "ActionIcon", "fa-solid fa-plus", 1, "dashboard-empty", 3, "ActionText"], ["Size", "large", "RootIcon", "fa-solid fa-gauge-high", "RootLabel", "Dashboards", 3, "Navigate", "Categories", "CurrentCategoryId", "CurrentDashboard", "ShowDashboardName", "AllowDragDrop"], [1, "toolbar-left"], [1, "dashboard-title"], [1, "toolbar-center"], [1, "unsaved-indicator"], [1, "toolbar-right"], ["title", "Open in a dashboard tab", 1, "toolbar-button"], [1, "toolbar-button"], [1, "toolbar-button", 3, "active"], [1, "toolbar-button", "primary"], [1, "fa-solid", "fa-chart-line"], [1, "fa-solid", "fa-circle"], ["title", "Open in a dashboard tab", 1, "toolbar-button", 3, "click"], [1, "fa-solid", "fa-up-right-from-square"], [1, "toolbar-button", 3, "click"], [1, "fa-solid", "fa-plus"], [1, "fa-solid", "fa-edit"], [1, "toolbar-button", "primary", 3, "click"], [1, "fa-solid", "fa-save"], ["text", "Loading dashboard..."], ["Icon", "fa-solid fa-table-columns", "Title", "No parts yet", "Message", "Add a view, query, artifact, or web page to get started.", "ActionIcon", "fa-solid fa-plus", 1, "dashboard-empty", 3, "Action", "ActionText"]], template: function DashboardViewerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1653
|
+
} }, inputs: { Dashboard: "Dashboard", dashboard: "dashboard", DashboardId: "DashboardId", dashboardId: "dashboardId", IsEditing: "IsEditing", isEditing: "isEditing", CanEdit: "CanEdit", ShowToolbar: "ShowToolbar", showToolbar: "showToolbar", AutoSave: "AutoSave", autoSave: "autoSave", ShowBreadcrumb: "ShowBreadcrumb", showBreadcrumb: "showBreadcrumb", ShowOpenInTabButton: "ShowOpenInTabButton", showOpenInTabButton: "showOpenInTabButton", ShowEditButton: "ShowEditButton", showEditButton: "showEditButton", Categories: "Categories", Properties: "Properties" }, outputs: { configChanged: "configChanged", NavigationRequested: "NavigationRequested", navigationRequested: "navigationRequested", PanelInteraction: "PanelInteraction", panelInteraction: "panelInteraction", DashboardSaved: "DashboardSaved", dashboardSaved: "dashboardSaved", error: "error", EditModeChanged: "EditModeChanged", editModeChanged: "editModeChanged", BreadcrumbNavigate: "BreadcrumbNavigate", breadcrumbNavigate: "breadcrumbNavigate", OpenInTab: "OpenInTab", openInTab: "openInTab", LayoutLifecycle: "LayoutLifecycle", layoutLifecycle: "layoutLifecycle", LayoutReady: "LayoutReady", layoutReady: "layoutReady", LayoutDeferred: "LayoutDeferred", layoutDeferred: "layoutDeferred" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 7, vars: 8, consts: [["layoutContainer", ""], [1, "dashboard-viewer"], ["Size", "large", "RootIcon", "fa-solid fa-gauge-high", "RootLabel", "Dashboards", 3, "Categories", "CurrentCategoryId", "CurrentDashboard", "ShowDashboardName", "AllowDragDrop"], [1, "dashboard-toolbar"], [1, "loading-overlay"], [1, "layout-container"], ["Icon", "fa-solid fa-table-columns", "Title", "No parts yet", "Message", "Add a view, query, artifact, or web page to get started.", "ActionIcon", "fa-solid fa-plus", 1, "dashboard-empty", 3, "ActionText"], ["Size", "large", "RootIcon", "fa-solid fa-gauge-high", "RootLabel", "Dashboards", 3, "Navigate", "Categories", "CurrentCategoryId", "CurrentDashboard", "ShowDashboardName", "AllowDragDrop"], [1, "toolbar-left"], [1, "dashboard-title"], [1, "toolbar-center"], [1, "unsaved-indicator"], [1, "toolbar-right"], ["title", "Open in a dashboard tab", 1, "toolbar-button"], [1, "toolbar-button"], [1, "toolbar-button", 3, "active"], [1, "toolbar-button", "primary"], [1, "fa-solid", "fa-chart-line"], [1, "fa-solid", "fa-circle"], ["title", "Open in a dashboard tab", 1, "toolbar-button", 3, "click"], [1, "fa-solid", "fa-up-right-from-square"], [1, "toolbar-button", 3, "click"], [1, "fa-solid", "fa-plus"], [1, "fa-solid", "fa-edit"], [1, "toolbar-button", "primary", 3, "click"], [1, "fa-solid", "fa-save"], ["text", "Loading dashboard..."], ["Icon", "fa-solid fa-table-columns", "Title", "No parts yet", "Message", "Add a view, query, artifact, or web page to get started.", "ActionIcon", "fa-solid fa-plus", 1, "dashboard-empty", 3, "Action", "ActionText"]], template: function DashboardViewerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1483
1654
|
i0.ɵɵelementStart(0, "div", 1);
|
|
1484
1655
|
i0.ɵɵconditionalCreate(1, DashboardViewerComponent_Conditional_1_Template, 1, 5, "mj-dashboard-breadcrumb", 2);
|
|
1485
1656
|
i0.ɵɵconditionalCreate(2, DashboardViewerComponent_Conditional_2_Template, 10, 6, "div", 3);
|
|
@@ -1538,6 +1709,8 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
1538
1709
|
type: Input
|
|
1539
1710
|
}], Categories: [{
|
|
1540
1711
|
type: Input
|
|
1712
|
+
}], Properties: [{
|
|
1713
|
+
type: Input
|
|
1541
1714
|
}], configChanged: [{
|
|
1542
1715
|
type: Output
|
|
1543
1716
|
}], NavigationRequested: [{
|
|
@@ -1582,5 +1755,14 @@ export class DashboardViewerComponent extends BaseAngularComponent {
|
|
|
1582
1755
|
type: ViewChild,
|
|
1583
1756
|
args: ['layoutContainer', { static: true }]
|
|
1584
1757
|
}] }); })();
|
|
1585
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DashboardViewerComponent, { className: "DashboardViewerComponent", filePath: "src/lib/dashboard-viewer/dashboard-viewer.component.ts", lineNumber:
|
|
1758
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DashboardViewerComponent, { className: "DashboardViewerComponent", filePath: "src/lib/dashboard-viewer/dashboard-viewer.component.ts", lineNumber: 90 }); })();
|
|
1759
|
+
/** Sets a list on the config, or removes its key when the list is empty, so an unused feature leaves no trace. */
|
|
1760
|
+
function setOrRemoveList(config, key, list) {
|
|
1761
|
+
if (list.length > 0) {
|
|
1762
|
+
config[key] = list;
|
|
1763
|
+
}
|
|
1764
|
+
else {
|
|
1765
|
+
delete config[key];
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1586
1768
|
//# sourceMappingURL=dashboard-viewer.component.js.map
|