@finos/legend-query-builder 4.1.2 → 4.1.3

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.
Files changed (98) hide show
  1. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  2. package/lib/components/QueryBuilderPropertyExpressionEditor.js +1 -1
  3. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  4. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderResultPanel.js +91 -24
  6. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  7. package/lib/components/execution-plan/AllocationExecutionNodeViewer.d.ts +23 -0
  8. package/lib/components/execution-plan/AllocationExecutionNodeViewer.d.ts.map +1 -0
  9. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js +32 -0
  10. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js.map +1 -0
  11. package/lib/components/execution-plan/ConstantExecutionNodeViewer.d.ts +23 -0
  12. package/lib/components/execution-plan/ConstantExecutionNodeViewer.d.ts.map +1 -0
  13. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js +35 -0
  14. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js.map +1 -0
  15. package/lib/components/execution-plan/DataTypeResultTypeViewer.d.ts +21 -0
  16. package/lib/components/execution-plan/DataTypeResultTypeViewer.d.ts.map +1 -0
  17. package/lib/components/execution-plan/DataTypeResultTypeViewer.js +31 -0
  18. package/lib/components/execution-plan/DataTypeResultTypeViewer.js.map +1 -0
  19. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts +10 -4
  20. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
  21. package/lib/components/execution-plan/ExecutionPlanViewer.js +74 -62
  22. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  23. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts +25 -0
  24. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts.map +1 -0
  25. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js +47 -0
  26. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -0
  27. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.d.ts +23 -0
  28. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.d.ts.map +1 -0
  29. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js +31 -0
  30. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js.map +1 -0
  31. package/lib/components/execution-plan/ResultTypeViewer.d.ts +21 -0
  32. package/lib/components/execution-plan/ResultTypeViewer.d.ts.map +1 -0
  33. package/lib/components/execution-plan/ResultTypeViewer.js +33 -0
  34. package/lib/components/execution-plan/ResultTypeViewer.js.map +1 -0
  35. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts +9 -1
  36. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts.map +1 -1
  37. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +12 -6
  38. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
  39. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts +23 -0
  40. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts.map +1 -0
  41. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js +38 -0
  42. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js.map +1 -0
  43. package/lib/components/execution-plan/TDSResultTypeViewer.d.ts +21 -0
  44. package/lib/components/execution-plan/TDSResultTypeViewer.d.ts.map +1 -0
  45. package/lib/components/execution-plan/TDSResultTypeViewer.js +25 -0
  46. package/lib/components/execution-plan/TDSResultTypeViewer.js.map +1 -0
  47. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  48. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -3
  49. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  50. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  51. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +24 -34
  52. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  53. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +44 -11
  55. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  56. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  57. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +4 -4
  58. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  59. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  60. package/lib/components/filter/QueryBuilderFilterPanel.js +20 -32
  61. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  62. package/lib/index.css +2 -2
  63. package/lib/index.css.map +1 -1
  64. package/lib/package.json +1 -1
  65. package/lib/stores/QueryBuilderResultState.d.ts +0 -3
  66. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  67. package/lib/stores/QueryBuilderResultState.js +2 -25
  68. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  69. package/lib/stores/execution-plan/ExecutionPlanState.d.ts +14 -1
  70. package/lib/stores/execution-plan/ExecutionPlanState.d.ts.map +1 -1
  71. package/lib/stores/execution-plan/ExecutionPlanState.js +86 -3
  72. package/lib/stores/execution-plan/ExecutionPlanState.js.map +1 -1
  73. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +3 -0
  74. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  75. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +11 -0
  76. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  77. package/package.json +5 -5
  78. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +1 -2
  79. package/src/components/QueryBuilderResultPanel.tsx +146 -30
  80. package/src/components/execution-plan/AllocationExecutionNodeViewer.tsx +77 -0
  81. package/src/components/execution-plan/ConstantExecutionNodeViewer.tsx +82 -0
  82. package/src/components/execution-plan/DataTypeResultTypeViewer.tsx +52 -0
  83. package/src/components/execution-plan/ExecutionPlanViewer.tsx +205 -195
  84. package/src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx +118 -0
  85. package/src/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.tsx +68 -0
  86. package/src/components/execution-plan/ResultTypeViewer.tsx +37 -0
  87. package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +50 -19
  88. package/src/components/execution-plan/SequenceExecutionNodeViewer.tsx +95 -0
  89. package/src/components/execution-plan/TDSResultTypeViewer.tsx +59 -0
  90. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -8
  91. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +32 -61
  92. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +77 -14
  93. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +6 -8
  94. package/src/components/filter/QueryBuilderFilterPanel.tsx +45 -73
  95. package/src/stores/QueryBuilderResultState.ts +1 -42
  96. package/src/stores/execution-plan/ExecutionPlanState.ts +142 -4
  97. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +16 -0
  98. package/tsconfig.json +8 -0
@@ -14,15 +14,20 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { observable, action, makeObservable } from 'mobx';
17
+ import { observable, action, makeObservable, computed } from 'mobx';
18
18
  import {
19
19
  type RawExecutionPlan,
20
20
  type GraphManagerState,
21
21
  ExecutionPlan,
22
22
  ExecutionNode,
23
23
  } from '@finos/legend-graph';
24
- import type { TreeNodeData } from '@finos/legend-art';
24
+ import type { TreeNodeData, TreeData } from '@finos/legend-art';
25
25
  import type { GenericLegendApplicationStore } from '@finos/legend-application';
26
+ import {
27
+ addUniqueEntry,
28
+ filterByType,
29
+ guaranteeNonNullable,
30
+ } from '@finos/legend-shared';
26
31
 
27
32
  export class ExecutionPlanViewTreeNodeData implements TreeNodeData {
28
33
  id: string;
@@ -33,10 +38,22 @@ export class ExecutionPlanViewTreeNodeData implements TreeNodeData {
33
38
  executionPlan!: ExecutionPlan;
34
39
 
35
40
  constructor(id: string, label: string, executionPlan: ExecutionPlan) {
41
+ makeObservable(this, {
42
+ isSelected: observable,
43
+ isOpen: observable,
44
+ setIsSelected: action,
45
+ setIsOpen: action,
46
+ });
36
47
  this.id = id;
37
48
  this.label = label;
38
49
  this.executionPlan = executionPlan;
39
50
  }
51
+ setIsSelected(val: boolean): void {
52
+ this.isSelected = val;
53
+ }
54
+ setIsOpen(val: boolean): void {
55
+ this.isOpen = val;
56
+ }
40
57
  }
41
58
 
42
59
  export class ExecutionNodeTreeNodeData implements TreeNodeData {
@@ -48,12 +65,85 @@ export class ExecutionNodeTreeNodeData implements TreeNodeData {
48
65
  executionNode: ExecutionNode;
49
66
 
50
67
  constructor(id: string, label: string, executionNode: ExecutionNode) {
68
+ makeObservable(this, {
69
+ isSelected: observable,
70
+ isOpen: observable,
71
+ setIsSelected: action,
72
+ setIsOpen: action,
73
+ });
51
74
  this.id = id;
52
75
  this.label = label;
53
76
  this.executionNode = executionNode;
54
77
  }
78
+
79
+ setIsSelected(val: boolean): void {
80
+ this.isSelected = val;
81
+ }
82
+ setIsOpen(val: boolean): void {
83
+ this.isOpen = val;
84
+ }
55
85
  }
56
86
 
87
+ export const generateExecutionNodeTreeNodeData = (
88
+ executionNode: ExecutionNode,
89
+ label: string,
90
+ parentNode:
91
+ | ExecutionNodeTreeNodeData
92
+ | ExecutionPlanViewTreeNodeData
93
+ | undefined,
94
+ ): ExecutionNodeTreeNodeData => {
95
+ const executionNodeTreeNode = new ExecutionNodeTreeNodeData(
96
+ executionNode._UUID,
97
+ label,
98
+ executionNode,
99
+ );
100
+
101
+ const childrenIds: string[] = [];
102
+
103
+ executionNode.executionNodes
104
+ .slice()
105
+ .filter(filterByType(ExecutionNode))
106
+ .forEach((childExecutionNode) => {
107
+ addUniqueEntry(childrenIds, childExecutionNode._UUID);
108
+ });
109
+
110
+ executionNodeTreeNode.childrenIds = childrenIds;
111
+
112
+ return executionNodeTreeNode;
113
+ };
114
+
115
+ export const generateExecutionPlanTreeNodeData = (
116
+ executionPlan: ExecutionPlan,
117
+ ): ExecutionPlanViewTreeNodeData => {
118
+ const executionPlanNode = new ExecutionPlanViewTreeNodeData(
119
+ `Execution Plan`,
120
+ `Execution Plan`,
121
+ executionPlan,
122
+ );
123
+
124
+ const childrenIds: string[] = [];
125
+
126
+ const rootNodeId = executionPlan.rootExecutionNode._UUID;
127
+ addUniqueEntry(childrenIds, rootNodeId);
128
+ executionPlanNode.childrenIds = childrenIds;
129
+ return executionPlanNode;
130
+ };
131
+
132
+ export const getExecutionPlanTreeData = (
133
+ executionPlan: ExecutionPlan,
134
+ ): TreeData<ExecutionPlanViewTreeNodeData | ExecutionNodeTreeNodeData> => {
135
+ const rootIds: string[] = [];
136
+ const nodes = new Map<
137
+ string,
138
+ ExecutionPlanViewTreeNodeData | ExecutionNodeTreeNodeData
139
+ >();
140
+ const executionPlanTreeNode =
141
+ generateExecutionPlanTreeNodeData(executionPlan);
142
+ addUniqueEntry(rootIds, executionPlanTreeNode.id);
143
+ nodes.set(executionPlanTreeNode.id, executionPlanTreeNode);
144
+ return { rootIds, nodes };
145
+ };
146
+
57
147
  export enum EXECUTION_PLAN_VIEW_MODE {
58
148
  FORM = 'Form',
59
149
  JSON = 'JSON',
@@ -69,6 +159,9 @@ export class ExecutionPlanState {
69
159
  | ExecutionPlanViewTreeNodeData
70
160
  | undefined = undefined;
71
161
  viewMode: EXECUTION_PLAN_VIEW_MODE = EXECUTION_PLAN_VIEW_MODE.FORM;
162
+ treeData?:
163
+ | TreeData<ExecutionPlanViewTreeNodeData | ExecutionNodeTreeNodeData>
164
+ | undefined;
72
165
  rawPlan?: RawExecutionPlan | undefined;
73
166
  plan?: ExecutionPlan | undefined;
74
167
  debugText?: string | undefined;
@@ -84,6 +177,7 @@ export class ExecutionPlanState {
84
177
  rawPlan: observable,
85
178
  plan: observable,
86
179
  debugText: observable,
180
+ treeData: observable,
87
181
  setExecutionPlanDisplayData: action,
88
182
  setExecutionPlanDisplayDataJson: action,
89
183
  transformMetadataToProtocolJson: action,
@@ -92,6 +186,11 @@ export class ExecutionPlanState {
92
186
  setPlan: action,
93
187
  setViewMode: action,
94
188
  setDebugText: action,
189
+ setTreeNode: action,
190
+ setTreeData: action,
191
+ refreshTreeData: action,
192
+ nonNullableTreeData: computed,
193
+ initialize: action,
95
194
  });
96
195
  this.applicationStore = applicationStore;
97
196
  this.graphManagerState = graphManagerState;
@@ -101,6 +200,36 @@ export class ExecutionPlanState {
101
200
  this.viewMode = val;
102
201
  }
103
202
 
203
+ setTreeNode(
204
+ id: string,
205
+ node: ExecutionPlanViewTreeNodeData | ExecutionNodeTreeNodeData,
206
+ ): void {
207
+ this.treeData?.nodes.set(id, node);
208
+ }
209
+
210
+ setTreeData(
211
+ val:
212
+ | TreeData<ExecutionPlanViewTreeNodeData | ExecutionNodeTreeNodeData>
213
+ | undefined,
214
+ ): void {
215
+ this.treeData = val;
216
+ }
217
+
218
+ refreshTreeData(): void {
219
+ if (this.treeData) {
220
+ this.setTreeData({ ...this.treeData });
221
+ }
222
+ }
223
+
224
+ get nonNullableTreeData(): TreeData<
225
+ ExecutionPlanViewTreeNodeData | ExecutionNodeTreeNodeData
226
+ > {
227
+ return guaranteeNonNullable(
228
+ this.treeData,
229
+ 'Execution plan viewer tree data has not been initialized',
230
+ );
231
+ }
232
+
104
233
  setRawPlan = (val: RawExecutionPlan | undefined): void => {
105
234
  this.rawPlan = val;
106
235
  };
@@ -109,6 +238,15 @@ export class ExecutionPlanState {
109
238
  this.plan = val;
110
239
  };
111
240
 
241
+ initialize = (val: ExecutionPlan | undefined): void => {
242
+ this.setPlan(val);
243
+ if (val !== undefined) {
244
+ this.setTreeData(getExecutionPlanTreeData(val));
245
+ } else {
246
+ this.setTreeData(undefined);
247
+ }
248
+ };
249
+
112
250
  setDebugText(val: string | undefined): void {
113
251
  this.debugText = val;
114
252
  }
@@ -117,10 +255,10 @@ export class ExecutionPlanState {
117
255
  node: ExecutionNodeTreeNodeData | ExecutionPlanViewTreeNodeData | undefined,
118
256
  ): void {
119
257
  if (this.selectedNode) {
120
- this.selectedNode.isSelected = false;
258
+ this.selectedNode.setIsSelected(false);
121
259
  }
122
260
  if (node) {
123
- node.isSelected = true;
261
+ node.setIsSelected(true);
124
262
  }
125
263
  this.selectedNode = node;
126
264
  }
@@ -121,6 +121,8 @@ export class QueryBuilderTDSState
121
121
  isConvertDerivationProjectionObjects = false;
122
122
  showPostFilterPanel: boolean;
123
123
  showWindowFuncPanel = false;
124
+ draggedColumnIndex: number | undefined;
125
+ hoveredColumnIndex: number | undefined;
124
126
 
125
127
  postFilterOperators: QueryBuilderPostFilterOperator[] =
126
128
  getQueryBuilderCorePostFilterOperators();
@@ -142,11 +144,14 @@ export class QueryBuilderTDSState
142
144
  isConvertDerivationProjectionObjects: observable,
143
145
  showPostFilterPanel: observable,
144
146
  showWindowFuncPanel: observable,
147
+ draggedColumnIndex: observable,
148
+ hoveredColumnIndex: observable,
145
149
  TEMPORARY__showPostFetchStructurePanel: computed,
146
150
  derivations: computed,
147
151
  hasParserError: computed,
148
152
  addColumn: action,
149
153
  moveColumn: action,
154
+ setRearrangeColumnsIndex: action,
150
155
  replaceColumn: action,
151
156
  initialize: action,
152
157
  setShowPostFilterPanel: action,
@@ -154,6 +159,9 @@ export class QueryBuilderTDSState
154
159
  convertDerivationProjectionObjects: flow,
155
160
  });
156
161
 
162
+ this.draggedColumnIndex = undefined;
163
+ this.hoveredColumnIndex = undefined;
164
+
157
165
  this.resultSetModifierState = new QueryResultSetModifierState(this);
158
166
  this.postFilterState = new QueryBuilderPostFilterState(
159
167
  this,
@@ -174,6 +182,14 @@ export class QueryBuilderTDSState
174
182
  ) ?? false;
175
183
  }
176
184
 
185
+ setRearrangeColumnsIndex(
186
+ draggedColumnIndex: number | undefined,
187
+ hoveredColumnIndex: number | undefined,
188
+ ): void {
189
+ this.draggedColumnIndex = draggedColumnIndex;
190
+ this.hoveredColumnIndex = hoveredColumnIndex;
191
+ }
192
+
177
193
  get type(): string {
178
194
  return FETCH_STRUCTURE_IMPLEMENTATION.TABULAR_DATA_STRUCTURE;
179
195
  }
package/tsconfig.json CHANGED
@@ -222,8 +222,16 @@
222
222
  "./src/components/ServiceQuerySetupUtils.tsx",
223
223
  "./src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx",
224
224
  "./src/components/data-access/DataAccessOverview.tsx",
225
+ "./src/components/execution-plan/AllocationExecutionNodeViewer.tsx",
226
+ "./src/components/execution-plan/ConstantExecutionNodeViewer.tsx",
227
+ "./src/components/execution-plan/DataTypeResultTypeViewer.tsx",
225
228
  "./src/components/execution-plan/ExecutionPlanViewer.tsx",
229
+ "./src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx",
230
+ "./src/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.tsx",
231
+ "./src/components/execution-plan/ResultTypeViewer.tsx",
226
232
  "./src/components/execution-plan/SQLExecutionNodeViewer.tsx",
233
+ "./src/components/execution-plan/SequenceExecutionNodeViewer.tsx",
234
+ "./src/components/execution-plan/TDSResultTypeViewer.tsx",
227
235
  "./src/components/explorer/QueryBuilderExplorerPanel.tsx",
228
236
  "./src/components/explorer/QueryBuilderFunctionsExplorerPanel.tsx",
229
237
  "./src/components/explorer/QueryBuilderMilestoningEditor.tsx",