@finos/legend-application-repl 0.0.30 → 0.0.32
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/lib/components/LegendREPLFrameworkProvider.js +1 -1
- package/lib/components/LegendREPLFrameworkProvider.js.map +1 -1
- package/lib/components/REPLStoreProvider.d.ts +1 -1
- package/lib/components/REPLStoreProvider.d.ts.map +1 -1
- package/lib/components/REPLStoreProvider.js +1 -1
- package/lib/components/REPLStoreProvider.js.map +1 -1
- package/lib/components/REPLWindow.d.ts +33 -0
- package/lib/components/REPLWindow.d.ts.map +1 -0
- package/lib/components/REPLWindow.js +117 -0
- package/lib/components/REPLWindow.js.map +1 -0
- package/lib/components/dataCube/DataCube.d.ts.map +1 -1
- package/lib/components/dataCube/DataCube.js +13 -9
- package/lib/components/dataCube/DataCube.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditor.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditor.js +13 -90
- package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js +3 -2
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js +237 -6
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts +5 -0
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js +130 -48
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js.map +1 -1
- package/lib/{stores/dataCube/DataCubeDefaultConfig.d.ts → components/dataCube/editor/DataCubeEditorDeveloperPanel.d.ts} +4 -2
- package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.d.ts.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.js +28 -0
- package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.js.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.js +3 -2
- package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.js +3 -2
- package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js +145 -5
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js +3 -2
- package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorShared.d.ts +47 -0
- package/lib/components/dataCube/editor/DataCubeEditorShared.d.ts.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorShared.js +188 -0
- package/lib/components/dataCube/editor/DataCubeEditorShared.js.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js +36 -3
- package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js +3 -2
- package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js.map +1 -1
- package/lib/components/dataCube/grid/DataCubeGrid.d.ts +3 -0
- package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -1
- package/lib/components/dataCube/grid/DataCubeGrid.js +190 -63
- package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -1
- package/lib/{stores/dataCube/DataCubeDefaultConfig.js → components/dataCube/grid/DataCubeGridShared.d.ts} +3 -2
- package/lib/components/dataCube/grid/DataCubeGridShared.d.ts.map +1 -0
- package/lib/components/dataCube/grid/DataCubeGridShared.js +25 -0
- package/lib/components/dataCube/grid/DataCubeGridShared.js.map +1 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts +23 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts.map +1 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js +413 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js.map +1 -0
- package/{src/stores/dataCube/DataCubeDefaultConfig.ts → lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts} +4 -2
- package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts.map +1 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js +83 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +14 -12
- package/lib/server/models/DataCubeQuery.d.ts +3 -5
- package/lib/server/models/DataCubeQuery.d.ts.map +1 -1
- package/lib/server/models/DataCubeQuery.js +0 -2
- package/lib/server/models/DataCubeQuery.js.map +1 -1
- package/lib/stores/{dataCube/REPLStore.d.ts → REPLStore.d.ts} +6 -4
- package/lib/stores/REPLStore.d.ts.map +1 -0
- package/lib/stores/{dataCube/REPLStore.js → REPLStore.js} +8 -5
- package/lib/stores/REPLStore.js.map +1 -0
- package/lib/stores/dataCube/{core/DataCubeEngine.d.ts → DataCubeInfrastructure.d.ts} +20 -4
- package/lib/stores/dataCube/DataCubeInfrastructure.d.ts.map +1 -0
- package/lib/stores/dataCube/{core/DataCubeEngine.js → DataCubeInfrastructure.js} +31 -3
- package/lib/stores/dataCube/DataCubeInfrastructure.js.map +1 -0
- package/lib/stores/dataCube/DataCubeState.d.ts +14 -5
- package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
- package/lib/stores/dataCube/DataCubeState.js +37 -9
- package/lib/stores/dataCube/DataCubeState.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts +93 -0
- package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts.map +1 -0
- package/lib/stores/dataCube/core/DataCubeConfiguration.js +167 -0
- package/lib/stores/dataCube/core/DataCubeConfiguration.js.map +1 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.d.ts +25 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.d.ts.map +1 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.js +45 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.js.map +1 -0
- package/lib/stores/dataCube/core/DataCubeCoreState.d.ts +1 -1
- package/lib/stores/dataCube/core/DataCubeCoreState.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeCoreState.js +4 -4
- package/lib/stores/dataCube/core/DataCubeCoreState.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +12 -12
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts +99 -4
- package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryEngine.js +149 -3
- package/lib/stores/dataCube/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +19 -5
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js +36 -6
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js +42 -23
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js +6 -2
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts +1 -3
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js +2 -3
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts +3 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js +4 -2
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts +36 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js +66 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts +3 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js +10 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts +8 -3
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js +20 -24
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts +27 -0
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js +30 -0
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts +13 -6
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js +64 -19
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts +8 -4
- package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorState.js +26 -17
- package/lib/stores/dataCube/editor/DataCubeEditorState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts +100 -0
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js +450 -0
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js.map +1 -0
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts +39 -2
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +63 -3
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js +0 -9
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts +4 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js +330 -38
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js +16 -28
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +16 -2
- package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridState.js +51 -21
- package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -1
- package/package.json +20 -18
- package/src/components/LegendREPLFrameworkProvider.tsx +1 -1
- package/src/components/REPLStoreProvider.tsx +1 -1
- package/src/components/REPLWindow.tsx +179 -0
- package/src/components/dataCube/DataCube.tsx +44 -23
- package/src/components/dataCube/editor/DataCubeEditor.tsx +80 -186
- package/src/components/dataCube/editor/DataCubeEditorCodePanel.tsx +4 -2
- package/src/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.tsx +1044 -13
- package/src/components/dataCube/editor/DataCubeEditorColumnsPanel.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorColumnsSelector.tsx +264 -51
- package/src/components/dataCube/editor/DataCubeEditorDeveloperPanel.tsx +43 -0
- package/src/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.tsx +4 -2
- package/src/components/dataCube/editor/DataCubeEditorFilterPanel.tsx +4 -2
- package/src/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.tsx +743 -13
- package/src/components/dataCube/editor/DataCubeEditorHPivotsPanel.tsx +4 -2
- package/src/components/dataCube/editor/DataCubeEditorShared.tsx +484 -0
- package/src/components/dataCube/editor/DataCubeEditorSortsPanel.tsx +103 -4
- package/src/components/dataCube/editor/DataCubeEditorVPivotsPanel.tsx +4 -2
- package/src/components/dataCube/grid/DataCubeGrid.tsx +314 -120
- package/src/components/dataCube/grid/DataCubeGridShared.tsx +45 -0
- package/src/components/dataCube/grid/menu/DataCubeGridMenu.tsx +441 -0
- package/src/components/dataCube/grid/menu/DataCubeGridSortsMenu.tsx +119 -0
- package/src/server/models/DataCubeQuery.ts +2 -6
- package/src/stores/{dataCube/REPLStore.ts → REPLStore.ts} +9 -6
- package/src/stores/dataCube/{core/DataCubeEngine.ts → DataCubeInfrastructure.ts} +40 -3
- package/src/stores/dataCube/DataCubeState.ts +44 -10
- package/src/stores/dataCube/core/DataCubeConfiguration.ts +220 -0
- package/src/stores/dataCube/core/DataCubeConfigurationBuilder.ts +60 -0
- package/src/stores/dataCube/core/DataCubeCoreState.ts +7 -4
- package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +18 -18
- package/src/stores/dataCube/core/DataCubeQueryEngine.ts +157 -4
- package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +43 -6
- package/src/stores/dataCube/core/DataCubeQuerySnapshotBuilder.ts +49 -29
- package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +9 -2
- package/src/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.ts +6 -5
- package/src/stores/dataCube/editor/DataCubeEditorCodePanelState.ts +5 -2
- package/src/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.ts +96 -0
- package/src/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.ts +12 -0
- package/src/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.ts +31 -28
- package/src/stores/dataCube/editor/DataCubeEditorHPivotPanelState.ts +43 -0
- package/src/stores/dataCube/editor/DataCubeEditorPanelState.ts +1 -1
- package/src/stores/dataCube/editor/DataCubeEditorSortsPanelState.ts +92 -25
- package/src/stores/dataCube/editor/DataCubeEditorState.ts +32 -18
- package/src/stores/dataCube/editor/DataCubeMutableConfiguration.ts +641 -0
- package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +88 -3
- package/src/stores/dataCube/grid/DataCubeGridQueryBuilder.ts +0 -10
- package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.tsx +494 -45
- package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.ts +16 -36
- package/src/stores/dataCube/grid/DataCubeGridState.ts +73 -20
- package/tsconfig.json +13 -3
- package/lib/stores/dataCube/DataCubeDefaultConfig.d.ts.map +0 -1
- package/lib/stores/dataCube/DataCubeDefaultConfig.js.map +0 -1
- package/lib/stores/dataCube/REPLStore.d.ts.map +0 -1
- package/lib/stores/dataCube/REPLStore.js.map +0 -1
- package/lib/stores/dataCube/core/DataCubeEngine.d.ts.map +0 -1
- package/lib/stores/dataCube/core/DataCubeEngine.js.map +0 -1
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { V1_Lambda, V1_ValueSpecification } from '@finos/legend-graph';
|
|
18
|
-
import type { DataCubeConfiguration } from '
|
|
18
|
+
import type { DataCubeConfiguration } from './DataCubeConfiguration.js';
|
|
19
19
|
import {
|
|
20
20
|
IllegalStateError,
|
|
21
21
|
guaranteeNonNullable,
|
|
22
|
+
hashObject,
|
|
23
|
+
pruneObject,
|
|
22
24
|
uuid,
|
|
23
25
|
type PlainObject,
|
|
24
26
|
type Writable,
|
|
@@ -54,7 +56,7 @@ export enum DataCubeQuerySnapshotFilterOperation {
|
|
|
54
56
|
ENDS_WITH = 'endsWith',
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
export enum
|
|
59
|
+
export enum DataCubeQuerySnapshotSortOperation {
|
|
58
60
|
ASCENDING = 'ascending',
|
|
59
61
|
DESCENDING = 'descending',
|
|
60
62
|
}
|
|
@@ -90,7 +92,7 @@ export type DataCubeQuerySnapshotExtendedColumn =
|
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
export type DataCubeQuerySnapshotSortColumn = DataCubeQuerySnapshotColumn & {
|
|
93
|
-
|
|
95
|
+
operation: DataCubeQuerySnapshotSortOperation;
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
export type DataCubeQuerySnapshotAggregateColumn =
|
|
@@ -113,7 +115,7 @@ export type DataCubeQuerySnapshotData = {
|
|
|
113
115
|
name: string;
|
|
114
116
|
runtime: string;
|
|
115
117
|
sourceQuery: PlainObject<V1_ValueSpecification>;
|
|
116
|
-
configuration: DataCubeConfiguration
|
|
118
|
+
configuration: PlainObject<DataCubeConfiguration>;
|
|
117
119
|
originalColumns: DataCubeQuerySnapshotColumn[];
|
|
118
120
|
leafExtendedColumns: DataCubeQuerySnapshotExtendedColumn[];
|
|
119
121
|
filter?: DataCubeQuerySnapshotFilter | undefined;
|
|
@@ -138,11 +140,14 @@ export class DataCubeQuerySnapshot {
|
|
|
138
140
|
timestamp = Date.now();
|
|
139
141
|
readonly data: DataCubeQuerySnapshotData;
|
|
140
142
|
|
|
143
|
+
private _finalized = false;
|
|
144
|
+
private _hashCode?: string | undefined;
|
|
145
|
+
|
|
141
146
|
private constructor(
|
|
142
147
|
name: string,
|
|
143
148
|
runtime: string,
|
|
144
149
|
sourceQuery: PlainObject<V1_ValueSpecification>,
|
|
145
|
-
configuration: DataCubeConfiguration
|
|
150
|
+
configuration: PlainObject<DataCubeConfiguration>,
|
|
146
151
|
) {
|
|
147
152
|
this.data = {
|
|
148
153
|
name,
|
|
@@ -165,7 +170,7 @@ export class DataCubeQuerySnapshot {
|
|
|
165
170
|
name: string,
|
|
166
171
|
runtime: string,
|
|
167
172
|
sourceQuery: PlainObject<V1_ValueSpecification>,
|
|
168
|
-
configuration: DataCubeConfiguration
|
|
173
|
+
configuration: PlainObject<DataCubeConfiguration>,
|
|
169
174
|
) {
|
|
170
175
|
return new DataCubeQuerySnapshot(name, runtime, sourceQuery, configuration);
|
|
171
176
|
}
|
|
@@ -204,6 +209,38 @@ export class DataCubeQuerySnapshot {
|
|
|
204
209
|
throw new IllegalStateError(`Unknown stage '${stage}'`);
|
|
205
210
|
}
|
|
206
211
|
}
|
|
212
|
+
|
|
213
|
+
isFinalized(): boolean {
|
|
214
|
+
return this._finalized;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
finalize(): DataCubeQuerySnapshot {
|
|
218
|
+
if (this._finalized) {
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
221
|
+
this._hashCode = this.computeHashCode();
|
|
222
|
+
this._finalized = true;
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
get hashCode(): string {
|
|
227
|
+
if (!this._finalized || !this._hashCode) {
|
|
228
|
+
throw new IllegalStateError('Snapshot is not finalized');
|
|
229
|
+
}
|
|
230
|
+
return this._hashCode;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* NOTE: if this becomes a performance bottleneck, we can consider
|
|
235
|
+
* more granular hashing strategy
|
|
236
|
+
*
|
|
237
|
+
* Here, we are just hashing the raw object, but we must ensure
|
|
238
|
+
* to properly prune the snapshot data object before hashing
|
|
239
|
+
* else there would be mismatch
|
|
240
|
+
*/
|
|
241
|
+
private computeHashCode(): string {
|
|
242
|
+
return hashObject(pruneObject(this.data));
|
|
243
|
+
}
|
|
207
244
|
}
|
|
208
245
|
|
|
209
246
|
export function _findCol<T extends DataCubeQuerySnapshotColumn>(
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
import type { DataCubeQuery } from '../../../server/models/DataCubeQuery.js';
|
|
37
37
|
import {
|
|
38
38
|
DataCubeQuerySnapshot,
|
|
39
|
-
|
|
39
|
+
DataCubeQuerySnapshotSortOperation,
|
|
40
40
|
type DataCubeQuerySnapshotColumn,
|
|
41
41
|
} from './DataCubeQuerySnapshot.js';
|
|
42
42
|
import {
|
|
@@ -50,6 +50,8 @@ import {
|
|
|
50
50
|
DataCubeFunction,
|
|
51
51
|
type DataCubeQueryFunctionMap,
|
|
52
52
|
} from './DataCubeQueryEngine.js';
|
|
53
|
+
import { DataCubeConfiguration } from './DataCubeConfiguration.js';
|
|
54
|
+
import { buildDefaultConfiguration } from './DataCubeConfigurationBuilder.js';
|
|
53
55
|
|
|
54
56
|
// --------------------------------- UTILITIES ---------------------------------
|
|
55
57
|
|
|
@@ -113,12 +115,12 @@ const _SUPPORTED_TOP_LEVEL_FUNCTIONS: {
|
|
|
113
115
|
func: string;
|
|
114
116
|
parameters: number;
|
|
115
117
|
}[] = [
|
|
116
|
-
{ func: DataCubeFunction.EXTEND, parameters: 1 },
|
|
117
118
|
{ func: DataCubeFunction.FILTER, parameters: 1 },
|
|
119
|
+
{ func: DataCubeFunction.EXTEND, parameters: 1 },
|
|
120
|
+
{ func: DataCubeFunction.SELECT, parameters: 1 },
|
|
118
121
|
{ func: DataCubeFunction.GROUP_BY, parameters: 3 },
|
|
119
122
|
{ func: DataCubeFunction.LIMIT, parameters: 1 },
|
|
120
123
|
{ func: DataCubeFunction.PIVOT, parameters: 3 },
|
|
121
|
-
{ func: DataCubeFunction.SELECT, parameters: 1 },
|
|
122
124
|
{ func: DataCubeFunction.SORT, parameters: 1 },
|
|
123
125
|
|
|
124
126
|
{ func: DataCubeFunction.CAST, parameters: 1 },
|
|
@@ -132,13 +134,13 @@ const _FUNCTION_SEQUENCE_COMPOSITION_PATTERN: {
|
|
|
132
134
|
repeat?: boolean | undefined;
|
|
133
135
|
required?: boolean | undefined;
|
|
134
136
|
}[] = [
|
|
135
|
-
{ func: DataCubeFunction.EXTEND },
|
|
136
137
|
{ func: DataCubeFunction.FILTER },
|
|
138
|
+
{ func: DataCubeFunction.EXTEND },
|
|
139
|
+
{ func: DataCubeFunction.SELECT },
|
|
137
140
|
{ func: DataCubeFunction.GROUP_BY },
|
|
138
141
|
{ func: DataCubeFunction.PIVOT },
|
|
139
142
|
{ func: DataCubeFunction.CAST },
|
|
140
143
|
{ func: DataCubeFunction.EXTEND },
|
|
141
|
-
{ func: DataCubeFunction.SELECT },
|
|
142
144
|
{ func: DataCubeFunction.SORT },
|
|
143
145
|
{ func: DataCubeFunction.LIMIT },
|
|
144
146
|
];
|
|
@@ -269,19 +271,19 @@ function extractFunctionMap(
|
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
273
|
|
|
274
|
+
const select = sequence.find((func) =>
|
|
275
|
+
matchFunctionName(func.function, DataCubeFunction.SELECT),
|
|
276
|
+
);
|
|
272
277
|
const filter = sequence.find((func) =>
|
|
273
278
|
matchFunctionName(func.function, DataCubeFunction.FILTER),
|
|
274
279
|
);
|
|
275
280
|
const groupBy = sequence.find((func) =>
|
|
276
281
|
matchFunctionName(func.function, DataCubeFunction.GROUP_BY),
|
|
277
282
|
);
|
|
278
|
-
const select = sequence.find((func) =>
|
|
279
|
-
matchFunctionName(func.function, DataCubeFunction.SELECT),
|
|
280
|
-
);
|
|
281
283
|
const pivot = sequence.find((func) =>
|
|
282
284
|
matchFunctionName(func.function, DataCubeFunction.PIVOT),
|
|
283
285
|
);
|
|
284
|
-
const
|
|
286
|
+
const pivotCast = sequence.find((func) =>
|
|
285
287
|
matchFunctionName(func.function, DataCubeFunction.CAST),
|
|
286
288
|
);
|
|
287
289
|
const sort = sequence.find((func) =>
|
|
@@ -292,12 +294,12 @@ function extractFunctionMap(
|
|
|
292
294
|
);
|
|
293
295
|
return {
|
|
294
296
|
leafExtend,
|
|
297
|
+
select,
|
|
295
298
|
filter,
|
|
296
299
|
groupBy,
|
|
297
300
|
pivot,
|
|
298
|
-
pivotCast
|
|
301
|
+
pivotCast,
|
|
299
302
|
groupExtend,
|
|
300
|
-
select,
|
|
301
303
|
sort,
|
|
302
304
|
limit,
|
|
303
305
|
};
|
|
@@ -326,7 +328,7 @@ export function validateAndBuildQuerySnapshot(
|
|
|
326
328
|
baseQuery.name,
|
|
327
329
|
baseQuery.source.runtime,
|
|
328
330
|
V1_serializeValueSpecification(sourceQuery, []),
|
|
329
|
-
|
|
331
|
+
{},
|
|
330
332
|
);
|
|
331
333
|
const data = snapshot.data;
|
|
332
334
|
const colsMap = new Map<string, DataCubeQuerySnapshotColumn>();
|
|
@@ -335,15 +337,27 @@ export function validateAndBuildQuerySnapshot(
|
|
|
335
337
|
|
|
336
338
|
// --------------------------------- SOURCE ---------------------------------
|
|
337
339
|
|
|
338
|
-
data.originalColumns = baseQuery.source.columns
|
|
340
|
+
data.originalColumns = baseQuery.source.columns.map((col) => ({
|
|
341
|
+
name: col.name,
|
|
342
|
+
type: col.type,
|
|
343
|
+
}));
|
|
339
344
|
data.originalColumns.map((col) => colsMap.set(col.name, col));
|
|
340
345
|
|
|
341
|
-
// ---------------------------------
|
|
346
|
+
// --------------------------------- FILTER ---------------------------------
|
|
342
347
|
// TODO: @akphi - implement this
|
|
343
348
|
|
|
344
|
-
// ---------------------------------
|
|
349
|
+
// --------------------------------- LEAF EXTEND ---------------------------------
|
|
345
350
|
// TODO: @akphi - implement this
|
|
346
351
|
|
|
352
|
+
// --------------------------------- SELECT ---------------------------------
|
|
353
|
+
|
|
354
|
+
if (funcMap.select) {
|
|
355
|
+
data.selectColumns = _colSpecArrayParam(funcMap.select, 0).colSpecs.map(
|
|
356
|
+
(colSpec) => ({
|
|
357
|
+
..._col(colSpec),
|
|
358
|
+
}),
|
|
359
|
+
);
|
|
360
|
+
}
|
|
347
361
|
// --------------------------------- GROUP BY ---------------------------------
|
|
348
362
|
// TODO: @akphi - implement this
|
|
349
363
|
|
|
@@ -367,25 +381,15 @@ export function validateAndBuildQuerySnapshot(
|
|
|
367
381
|
]);
|
|
368
382
|
return {
|
|
369
383
|
..._col(_colSpecParam(sortColFunc, 0)),
|
|
370
|
-
|
|
384
|
+
operation:
|
|
371
385
|
_name(sortColFunc.function) === DataCubeFunction.ASC
|
|
372
|
-
?
|
|
373
|
-
:
|
|
386
|
+
? DataCubeQuerySnapshotSortOperation.ASCENDING
|
|
387
|
+
: DataCubeQuerySnapshotSortOperation.DESCENDING,
|
|
374
388
|
};
|
|
375
389
|
},
|
|
376
390
|
);
|
|
377
391
|
}
|
|
378
392
|
|
|
379
|
-
// --------------------------------- SELECT ---------------------------------
|
|
380
|
-
|
|
381
|
-
if (funcMap.select) {
|
|
382
|
-
data.selectColumns = _colSpecArrayParam(funcMap.select, 0).colSpecs.map(
|
|
383
|
-
(colSpec) => ({
|
|
384
|
-
..._col(colSpec),
|
|
385
|
-
}),
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
393
|
// --------------------------------- LIMIT ---------------------------------
|
|
390
394
|
|
|
391
395
|
if (funcMap.limit) {
|
|
@@ -394,5 +398,21 @@ export function validateAndBuildQuerySnapshot(
|
|
|
394
398
|
data.limit = value.value;
|
|
395
399
|
}
|
|
396
400
|
|
|
397
|
-
|
|
401
|
+
// --------------------------------- CONFIGURATION ---------------------------------
|
|
402
|
+
// The data query takes precedence over the configuration, we do this for 2 reasons
|
|
403
|
+
// 1. The purpose of the configuration is to provide the layout and styling
|
|
404
|
+
// customization on top of the data query result grid. If conflicts happen between
|
|
405
|
+
// the configuration and the query, we will reconciliate by modifying the configuration
|
|
406
|
+
// 2. The configuration when missing, can be generated from default presets. This helps
|
|
407
|
+
// helps with use cases where the query might comes from a different source, such as
|
|
408
|
+
// Studio or Query, or another part of Engine.
|
|
409
|
+
|
|
410
|
+
const configuration = baseQuery.configuration
|
|
411
|
+
? DataCubeConfiguration.serialization.fromJson(baseQuery.configuration)
|
|
412
|
+
: buildDefaultConfiguration(baseQuery.source.columns);
|
|
413
|
+
// TODO: @akphi - implement this
|
|
414
|
+
data.configuration =
|
|
415
|
+
DataCubeConfiguration.serialization.toJson(configuration);
|
|
416
|
+
|
|
417
|
+
return snapshot.finalize();
|
|
398
418
|
}
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from '@finos/legend-shared';
|
|
27
27
|
import type { DataCubeQuery } from '../../../server/models/DataCubeQuery.js';
|
|
28
28
|
|
|
29
|
-
// TODO:
|
|
29
|
+
// TODO: set a stack depth when we implement undo/redo
|
|
30
30
|
// const DATA_CUBE_MAX_SNAPSHOT_COUNT = 100;
|
|
31
31
|
|
|
32
32
|
export class DataCubeQuerySnapshotManager {
|
|
@@ -77,6 +77,13 @@ export class DataCubeQuerySnapshotManager {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
broadcastSnapshot(snapshot: DataCubeQuerySnapshot): void {
|
|
80
|
+
if (!snapshot.isFinalized()) {
|
|
81
|
+
this.dataCube.application.logService.error(
|
|
82
|
+
LogEvent.create(APPLICATION_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED),
|
|
83
|
+
`Snapshot must be finalized before broadcasting`,
|
|
84
|
+
);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
80
87
|
this.snapshots.push(snapshot);
|
|
81
88
|
this.subscribers.forEach((subscriber) => {
|
|
82
89
|
const currentSnapshot = subscriber.getLatestSnapshot();
|
|
@@ -87,7 +94,7 @@ export class DataCubeQuerySnapshotManager {
|
|
|
87
94
|
LogEvent.create(
|
|
88
95
|
APPLICATION_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED,
|
|
89
96
|
),
|
|
90
|
-
`
|
|
97
|
+
`Error occured while subscribers receiving and applying new snapshot should be handled gracefully`,
|
|
91
98
|
error,
|
|
92
99
|
);
|
|
93
100
|
});
|
|
@@ -16,28 +16,29 @@
|
|
|
16
16
|
|
|
17
17
|
import type { LegendREPLApplicationStore } from '../../LegendREPLBaseStore.js';
|
|
18
18
|
import type { DataCubeState } from '../DataCubeState.js';
|
|
19
|
-
import type { DataCubeEngine } from './DataCubeEngine.js';
|
|
20
19
|
import type { DataCubeQuerySnapshot } from './DataCubeQuerySnapshot.js';
|
|
21
20
|
|
|
22
21
|
export abstract class DataCubeQuerySnapshotSubscriber {
|
|
23
22
|
readonly dataCube!: DataCubeState;
|
|
24
23
|
readonly application!: LegendREPLApplicationStore;
|
|
25
|
-
readonly engine!: DataCubeEngine;
|
|
26
24
|
|
|
27
25
|
private latestSnapshot: DataCubeQuerySnapshot | undefined;
|
|
28
26
|
|
|
29
27
|
constructor(dataCube: DataCubeState) {
|
|
30
28
|
this.dataCube = dataCube;
|
|
31
29
|
this.application = dataCube.application;
|
|
32
|
-
this.engine = dataCube.engine;
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
abstract applySnapshot(
|
|
32
|
+
abstract applySnapshot(
|
|
33
|
+
snapshot: DataCubeQuerySnapshot,
|
|
34
|
+
previousSnapshot: DataCubeQuerySnapshot | undefined,
|
|
35
|
+
): Promise<void>;
|
|
36
36
|
abstract initialize(): Promise<void>;
|
|
37
37
|
|
|
38
38
|
async receiveSnapshot(snapshot: DataCubeQuerySnapshot): Promise<void> {
|
|
39
|
+
const previousSnapshot = this.latestSnapshot;
|
|
39
40
|
this.latestSnapshot = snapshot;
|
|
40
|
-
await this.applySnapshot(snapshot);
|
|
41
|
+
await this.applySnapshot(snapshot, previousSnapshot);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
publishSnapshot(snapshot: DataCubeQuerySnapshot): void {
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
SourceInformation,
|
|
30
30
|
V1_ParserError,
|
|
31
31
|
} from '@finos/legend-graph';
|
|
32
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
32
33
|
|
|
33
34
|
class DataCubeQueryEditorState {
|
|
34
35
|
uuid = uuid();
|
|
@@ -79,11 +80,12 @@ class DataCubeQueryEditorState {
|
|
|
79
80
|
|
|
80
81
|
export class DataCubeEditorCodePanelState {
|
|
81
82
|
readonly dataCube!: DataCubeState;
|
|
83
|
+
readonly editor: DataCubeEditorState;
|
|
82
84
|
|
|
83
85
|
queryEditorState!: DataCubeQueryEditorState;
|
|
84
86
|
currentSubQuery?: string | undefined;
|
|
85
87
|
|
|
86
|
-
constructor(
|
|
88
|
+
constructor(editor: DataCubeEditorState) {
|
|
87
89
|
makeObservable(this, {
|
|
88
90
|
currentSubQuery: observable,
|
|
89
91
|
queryEditorState: observable,
|
|
@@ -91,7 +93,8 @@ export class DataCubeEditorCodePanelState {
|
|
|
91
93
|
parseQuery: flow,
|
|
92
94
|
});
|
|
93
95
|
|
|
94
|
-
this.
|
|
96
|
+
this.editor = editor;
|
|
97
|
+
this.dataCube = editor.dataCube;
|
|
95
98
|
this.queryEditorState = new DataCubeQueryEditorState('');
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { DataCubeState } from '../DataCubeState.js';
|
|
19
|
+
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
20
|
+
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
21
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
22
|
+
import { DataCubeMutableColumnConfiguration } from './DataCubeMutableConfiguration.js';
|
|
23
|
+
import { getNonNullableEntry, type PlainObject } from '@finos/legend-shared';
|
|
24
|
+
|
|
25
|
+
export class DataCubeEditorColumnPropertiesPanelState
|
|
26
|
+
implements DataCubeQueryEditorPanelState
|
|
27
|
+
{
|
|
28
|
+
readonly dataCube!: DataCubeState;
|
|
29
|
+
readonly editor!: DataCubeEditorState;
|
|
30
|
+
|
|
31
|
+
columns: DataCubeMutableColumnConfiguration[] = [];
|
|
32
|
+
selectedColumnName?: string | undefined;
|
|
33
|
+
showAdvancedSettings = false;
|
|
34
|
+
|
|
35
|
+
constructor(editor: DataCubeEditorState) {
|
|
36
|
+
makeObservable(this, {
|
|
37
|
+
columns: observable,
|
|
38
|
+
setColumns: action,
|
|
39
|
+
|
|
40
|
+
selectedColumnName: observable,
|
|
41
|
+
setSelectedColumnName: action,
|
|
42
|
+
selectedColumn: computed,
|
|
43
|
+
|
|
44
|
+
showAdvancedSettings: observable,
|
|
45
|
+
setShowAdvancedSettings: action,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
this.editor = editor;
|
|
49
|
+
this.dataCube = editor.dataCube;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getColumnConfiguration(
|
|
53
|
+
colName: string | undefined,
|
|
54
|
+
): DataCubeMutableColumnConfiguration | undefined {
|
|
55
|
+
return this.columns.find((col) => col.name === colName);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setColumns(val: DataCubeMutableColumnConfiguration[]): void {
|
|
59
|
+
this.columns = val;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setSelectedColumnName(val: string | undefined): void {
|
|
63
|
+
this.selectedColumnName = val;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get selectedColumn(): DataCubeMutableColumnConfiguration | undefined {
|
|
67
|
+
return this.columns.find(
|
|
68
|
+
(column) => column.name === this.selectedColumnName,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setShowAdvancedSettings(val: boolean): void {
|
|
73
|
+
this.showAdvancedSettings = val;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
applySnaphot(snapshot: DataCubeQuerySnapshot): void {
|
|
77
|
+
this.setColumns(
|
|
78
|
+
(snapshot.data.configuration as { columns: PlainObject[] }).columns.map(
|
|
79
|
+
(column) => DataCubeMutableColumnConfiguration.create(column),
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
if (!this.selectedColumn && this.columns.length) {
|
|
83
|
+
this.setSelectedColumnName(getNonNullableEntry(this.columns, 0).name);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
buildSnapshot(
|
|
88
|
+
newSnapshot: DataCubeQuerySnapshot,
|
|
89
|
+
baseSnapshot: DataCubeQuerySnapshot,
|
|
90
|
+
): void {
|
|
91
|
+
newSnapshot.data.configuration = {
|
|
92
|
+
...newSnapshot.data.configuration,
|
|
93
|
+
columns: this.columns.map((column) => column.serialize()),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -18,6 +18,9 @@ import { makeObservable, observable, action } from 'mobx';
|
|
|
18
18
|
|
|
19
19
|
export abstract class DataCubeEditorColumnsSelectorColumnState {
|
|
20
20
|
abstract get name(): string;
|
|
21
|
+
resetWhenMadeAvailable(): void {
|
|
22
|
+
// do nothing
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export class DataCubeEditorColumnsSelectorState<
|
|
@@ -45,6 +48,7 @@ export class DataCubeEditorColumnsSelectorState<
|
|
|
45
48
|
this.availableColumns = val
|
|
46
49
|
.slice()
|
|
47
50
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
51
|
+
this.availableColumns.forEach((column) => column.resetWhenMadeAvailable());
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
setSelectedColumns(val: T[]): void {
|
|
@@ -58,4 +62,12 @@ export class DataCubeEditorColumnsSelectorState<
|
|
|
58
62
|
setSelectedColumnsSearchText(val: string): void {
|
|
59
63
|
this.selectedColumnsSearchText = val;
|
|
60
64
|
}
|
|
65
|
+
|
|
66
|
+
getAvailableColumn(colName: string): T | undefined {
|
|
67
|
+
return this.availableColumns.find((col) => col.name === colName);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getSelectedColumn(colName: string): T | undefined {
|
|
71
|
+
return this.selectedColumns.find((col) => col.name === colName);
|
|
72
|
+
}
|
|
61
73
|
}
|
|
@@ -18,63 +18,66 @@ import { action, makeObservable, observable } from 'mobx';
|
|
|
18
18
|
import type { DataCubeState } from '../DataCubeState.js';
|
|
19
19
|
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
20
20
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
21
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
22
|
+
import { DataCubeMutableConfiguration } from './DataCubeMutableConfiguration.js';
|
|
21
23
|
|
|
22
24
|
export class DataCubeEditorGeneralPropertiesPanelState
|
|
23
25
|
implements DataCubeQueryEditorPanelState
|
|
24
26
|
{
|
|
25
27
|
readonly dataCube!: DataCubeState;
|
|
28
|
+
readonly editor!: DataCubeEditorState;
|
|
29
|
+
|
|
26
30
|
name = '';
|
|
27
31
|
limit = -1;
|
|
32
|
+
configuration = new DataCubeMutableConfiguration();
|
|
28
33
|
|
|
29
|
-
constructor(
|
|
30
|
-
this.dataCube = dataCube;
|
|
31
|
-
|
|
34
|
+
constructor(editor: DataCubeEditorState) {
|
|
32
35
|
makeObservable(this, {
|
|
33
36
|
name: observable,
|
|
34
37
|
setName: action,
|
|
35
38
|
|
|
36
39
|
limit: observable,
|
|
37
40
|
setLimit: action,
|
|
41
|
+
|
|
42
|
+
configuration: observable,
|
|
43
|
+
setConfiguration: action,
|
|
38
44
|
});
|
|
45
|
+
|
|
46
|
+
this.editor = editor;
|
|
47
|
+
this.dataCube = editor.dataCube;
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
setName(val: string): void {
|
|
42
51
|
this.name = val;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
setLimit(val: number
|
|
46
|
-
this.limit =
|
|
54
|
+
setLimit(val: number): void {
|
|
55
|
+
this.limit = val;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setConfiguration(val: DataCubeMutableConfiguration): void {
|
|
59
|
+
this.configuration = val;
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
applySnaphot(snapshot: DataCubeQuerySnapshot): void {
|
|
50
63
|
this.setName(snapshot.data.name);
|
|
51
|
-
this.setLimit(
|
|
64
|
+
this.setLimit(
|
|
65
|
+
snapshot.data.limit !== undefined && snapshot.data.limit > 0
|
|
66
|
+
? snapshot.data.limit
|
|
67
|
+
: -1,
|
|
68
|
+
);
|
|
69
|
+
this.setConfiguration(
|
|
70
|
+
DataCubeMutableConfiguration.create(snapshot.data.configuration),
|
|
71
|
+
);
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
buildSnapshot(
|
|
55
75
|
newSnapshot: DataCubeQuerySnapshot,
|
|
56
76
|
baseSnapshot: DataCubeQuerySnapshot,
|
|
57
|
-
):
|
|
58
|
-
const data =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// limit
|
|
66
|
-
if (data.limit === undefined) {
|
|
67
|
-
if (this.limit !== -1) {
|
|
68
|
-
data.limit = this.limit;
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
if (this.limit !== data.limit) {
|
|
73
|
-
data.limit = this.limit;
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return false;
|
|
77
|
+
): void {
|
|
78
|
+
const data = newSnapshot.data;
|
|
79
|
+
data.name = this.name;
|
|
80
|
+
data.limit = this.limit <= 0 ? undefined : this.limit;
|
|
81
|
+
data.configuration = this.configuration.serialize();
|
|
79
82
|
}
|
|
80
83
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { DataCubeState } from '../DataCubeState.js';
|
|
18
|
+
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
19
|
+
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
20
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
21
|
+
|
|
22
|
+
export class DataCubeEditorGeneralPropertiesPanelState
|
|
23
|
+
implements DataCubeQueryEditorPanelState
|
|
24
|
+
{
|
|
25
|
+
readonly dataCube!: DataCubeState;
|
|
26
|
+
readonly editor!: DataCubeEditorState;
|
|
27
|
+
|
|
28
|
+
constructor(editor: DataCubeEditorState) {
|
|
29
|
+
this.editor = editor;
|
|
30
|
+
this.dataCube = editor.dataCube;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
applySnaphot(snapshot: DataCubeQuerySnapshot): void {
|
|
34
|
+
// TODO
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
buildSnapshot(
|
|
38
|
+
newSnapshot: DataCubeQuerySnapshot,
|
|
39
|
+
baseSnapshot: DataCubeQuerySnapshot,
|
|
40
|
+
): void {
|
|
41
|
+
// TODO
|
|
42
|
+
}
|
|
43
|
+
}
|