@finos/legend-query-builder 4.3.9 → 4.5.0

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 (139) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +2 -2
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderResultPanel.js +8 -2
  6. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  7. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  8. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +1 -1
  9. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
  10. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js +1 -1
  11. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js.map +1 -1
  12. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts +7 -0
  13. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
  14. package/lib/components/execution-plan/ExecutionPlanViewer.js +109 -27
  15. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  16. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts.map +1 -1
  17. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -1
  18. package/lib/components/execution-plan/ImplementationViewer.d.ts +23 -0
  19. package/lib/components/execution-plan/ImplementationViewer.d.ts.map +1 -0
  20. package/lib/components/execution-plan/ImplementationViewer.js +35 -0
  21. package/lib/components/execution-plan/ImplementationViewer.js.map +1 -0
  22. package/lib/components/execution-plan/PartialClassResultViewer.d.ts +21 -0
  23. package/lib/components/execution-plan/PartialClassResultViewer.d.ts.map +1 -0
  24. package/lib/components/execution-plan/PartialClassResultViewer.js +24 -0
  25. package/lib/components/execution-plan/PartialClassResultViewer.js.map +1 -0
  26. package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.d.ts +23 -0
  27. package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.d.ts.map +1 -0
  28. package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js +43 -0
  29. package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -0
  30. package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts +23 -0
  31. package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts.map +1 -0
  32. package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js +47 -0
  33. package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -0
  34. package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts +23 -0
  35. package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts.map +1 -0
  36. package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js +43 -0
  37. package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -0
  38. package/lib/components/execution-plan/ResultTypeViewer.d.ts.map +1 -1
  39. package/lib/components/execution-plan/ResultTypeViewer.js +5 -1
  40. package/lib/components/execution-plan/ResultTypeViewer.js.map +1 -1
  41. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts +1 -1
  42. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts.map +1 -1
  43. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +16 -3
  44. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
  45. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts +6 -0
  46. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts.map +1 -1
  47. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js +34 -12
  48. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js.map +1 -1
  49. package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.d.ts +23 -0
  50. package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.d.ts.map +1 -0
  51. package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.js +57 -0
  52. package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.js.map +1 -0
  53. package/lib/components/execution-plan/TempTableStrategyViewer.d.ts +28 -0
  54. package/lib/components/execution-plan/TempTableStrategyViewer.d.ts.map +1 -0
  55. package/lib/components/execution-plan/TempTableStrategyViewer.js +42 -0
  56. package/lib/components/execution-plan/TempTableStrategyViewer.js.map +1 -0
  57. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +7 -1
  58. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  59. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +16 -10
  60. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
  61. package/lib/components/shared/CustomDatePicker.d.ts +2 -1
  62. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  63. package/lib/components/shared/CustomDatePicker.js +31 -19
  64. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  65. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
  66. package/lib/components/shared/QueryBuilderVariableSelector.js +1 -1
  67. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  68. package/lib/graph-manager/QueryBuilderConfig.d.ts +24 -0
  69. package/lib/graph-manager/QueryBuilderConfig.d.ts.map +1 -0
  70. package/lib/graph-manager/QueryBuilderConfig.js +27 -0
  71. package/lib/graph-manager/QueryBuilderConfig.js.map +1 -0
  72. package/lib/index.css +2 -2
  73. package/lib/index.css.map +1 -1
  74. package/lib/index.d.ts +1 -0
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/index.js +1 -0
  77. package/lib/index.js.map +1 -1
  78. package/lib/package.json +9 -9
  79. package/lib/stores/QueryBuilderState.d.ts +3 -1
  80. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  81. package/lib/stores/QueryBuilderState.js +4 -2
  82. package/lib/stores/QueryBuilderState.js.map +1 -1
  83. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.d.ts.map +1 -1
  84. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js +1 -1
  85. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js.map +1 -1
  86. package/lib/stores/execution-plan/ExecutionPlanState.d.ts +15 -1
  87. package/lib/stores/execution-plan/ExecutionPlanState.d.ts.map +1 -1
  88. package/lib/stores/execution-plan/ExecutionPlanState.js +50 -3
  89. package/lib/stores/execution-plan/ExecutionPlanState.js.map +1 -1
  90. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  91. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +16 -4
  92. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  93. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts +6 -4
  94. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
  95. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +43 -9
  96. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
  97. package/lib/stores/workflows/FunctionQueryBuilderState.d.ts +2 -1
  98. package/lib/stores/workflows/FunctionQueryBuilderState.d.ts.map +1 -1
  99. package/lib/stores/workflows/FunctionQueryBuilderState.js +2 -2
  100. package/lib/stores/workflows/FunctionQueryBuilderState.js.map +1 -1
  101. package/lib/stores/workflows/MappingQueryBuilderState.d.ts +2 -1
  102. package/lib/stores/workflows/MappingQueryBuilderState.d.ts.map +1 -1
  103. package/lib/stores/workflows/MappingQueryBuilderState.js +2 -2
  104. package/lib/stores/workflows/MappingQueryBuilderState.js.map +1 -1
  105. package/lib/stores/workflows/ServiceQueryBuilderState.d.ts +2 -1
  106. package/lib/stores/workflows/ServiceQueryBuilderState.d.ts.map +1 -1
  107. package/lib/stores/workflows/ServiceQueryBuilderState.js +2 -2
  108. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  109. package/package.json +17 -17
  110. package/src/components/QueryBuilder.tsx +16 -14
  111. package/src/components/QueryBuilderResultPanel.tsx +7 -2
  112. package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +1 -0
  113. package/src/components/execution-plan/AllocationExecutionNodeViewer.tsx +1 -1
  114. package/src/components/execution-plan/ExecutionPlanViewer.tsx +233 -57
  115. package/src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx +1 -0
  116. package/src/components/execution-plan/ImplementationViewer.tsx +76 -0
  117. package/src/components/execution-plan/PartialClassResultViewer.tsx +55 -0
  118. package/src/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.tsx +190 -0
  119. package/src/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.tsx +219 -0
  120. package/src/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.tsx +204 -0
  121. package/src/components/execution-plan/ResultTypeViewer.tsx +4 -0
  122. package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +66 -44
  123. package/src/components/execution-plan/SequenceExecutionNodeViewer.tsx +79 -15
  124. package/src/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.tsx +264 -0
  125. package/src/components/execution-plan/TempTableStrategyViewer.tsx +97 -0
  126. package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +23 -9
  127. package/src/components/shared/CustomDatePicker.tsx +65 -27
  128. package/src/components/shared/QueryBuilderVariableSelector.tsx +4 -1
  129. package/src/graph-manager/QueryBuilderConfig.ts +31 -0
  130. package/src/index.ts +1 -1
  131. package/src/stores/QueryBuilderState.ts +5 -0
  132. package/src/stores/__test-utils__/QueryBuilderStateTestUtils.ts +1 -0
  133. package/src/stores/execution-plan/ExecutionPlanState.ts +64 -1
  134. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +17 -7
  135. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +73 -9
  136. package/src/stores/workflows/FunctionQueryBuilderState.ts +3 -1
  137. package/src/stores/workflows/MappingQueryBuilderState.ts +3 -1
  138. package/src/stores/workflows/ServiceQueryBuilderState.ts +3 -1
  139. package/tsconfig.json +8 -0
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useEffect, useState } from 'react';
17
+ import { useEffect } from 'react';
18
18
  import {
19
19
  type TreeNodeContainerProps,
20
20
  Dialog,
@@ -49,6 +49,7 @@ import {
49
49
  EXECUTION_PLAN_VIEW_MODE,
50
50
  type ExecutionPlanState,
51
51
  generateExecutionNodeTreeNodeData,
52
+ PLAN_TABS,
52
53
  } from '../../stores/execution-plan/ExecutionPlanState.js';
53
54
  import { observer } from 'mobx-react-lite';
54
55
  import {
@@ -61,9 +62,19 @@ import {
61
62
  ConstantExecutionNode,
62
63
  SequenceExecutionNode,
63
64
  type RawExecutionPlan,
65
+ StoreMappingGlobalGraphFetchExecutionNode,
66
+ PureExpressionPlatformExecutionNode,
67
+ RelationalClassQueryTempTableGraphFetchExecutionNode,
68
+ RelationalRootQueryTempTableGraphFetchExecutionNode,
69
+ RelationalCrossRootQueryTempTableGraphFetchExecutionNode,
70
+ RelationalGraphFetchExecutionNode,
64
71
  JavaPlatformImplementation,
72
+ RootGraphFetchTree,
73
+ PropertyGraphFetchTree,
74
+ LocalGraphFetchExecutionNode,
65
75
  } from '@finos/legend-graph';
66
76
  import { SQLExecutionNodeViewer } from './SQLExecutionNodeViewer.js';
77
+ import { StoreMappingGlobalGraphFetchExecutionNodeViewer } from './StoreMappingGlobalGraphFetchExecutionNodeViewer.js';
67
78
  import { FunctionParametersValidationNodeViewer } from './FunctionParametersValidationNodeViewer.js';
68
79
  import { AllocationExecutionNodeViewer } from './AllocationExecutionNodeViewer.js';
69
80
  import { ConstantExecutionNodeViewer } from './ConstantExecutionNodeViewer.js';
@@ -74,8 +85,27 @@ import {
74
85
  CodeEditor,
75
86
  } from '@finos/legend-lego/code-editor';
76
87
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
88
+ import { RelationalRootQueryTempTableGraphFetchExecutionNodeViewer } from './RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js';
89
+ import { RelationalClassQueryTempTableGraphFetchExecutionNodeViewer } from './RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js';
90
+ import { RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer } from './RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js';
77
91
 
78
92
  const EXECUTION_PLAN = 'Execution Plan';
93
+
94
+ const generateExecutionNodePrefixLabel = (node: ExecutionNode): string => {
95
+ if (
96
+ node instanceof StoreMappingGlobalGraphFetchExecutionNode ||
97
+ node instanceof LocalGraphFetchExecutionNode
98
+ ) {
99
+ if (node.graphFetchTree instanceof RootGraphFetchTree) {
100
+ return node.graphFetchTree.class.value.name;
101
+ }
102
+ if (node.graphFetchTree instanceof PropertyGraphFetchTree) {
103
+ return node.graphFetchTree.property.value.name;
104
+ }
105
+ }
106
+ return '';
107
+ };
108
+
79
109
  /**
80
110
  * @modularize
81
111
  * See https://github.com/finos/legend-studio/issues/65
@@ -93,16 +123,27 @@ export const generateExecutionNodeLabel = (type: ExecutionNode): string => {
93
123
  return `Constant Execution Node`;
94
124
  } else if (type instanceof SequenceExecutionNode) {
95
125
  return `Sequence Execution Node`;
126
+ } else if (type instanceof StoreMappingGlobalGraphFetchExecutionNode) {
127
+ return `Store Mapping Global Graph Fetch Execution Node`;
128
+ } else if (
129
+ type instanceof RelationalRootQueryTempTableGraphFetchExecutionNode
130
+ ) {
131
+ return `Relational Root Query TempTable Graph Fetch Execution Node`;
132
+ } else if (
133
+ type instanceof RelationalCrossRootQueryTempTableGraphFetchExecutionNode
134
+ ) {
135
+ return `Relational Cross Root Query TempTable Graph Fetch Execution Node`;
136
+ } else if (
137
+ type instanceof RelationalClassQueryTempTableGraphFetchExecutionNode
138
+ ) {
139
+ return `Relational Class Query TempTable Graph Fetch Execution Node`;
140
+ } else if (type instanceof PureExpressionPlatformExecutionNode) {
141
+ return `Pure Expression Platform Execution Node`;
96
142
  } else {
97
143
  return 'Other';
98
144
  }
99
145
  };
100
146
 
101
- enum PLAN_TABS {
102
- GENERAL = 'GENERAL',
103
- GLOBAL_IMPLEMENTATION_SUPPORT = 'GLOBAL_IMPLEMENTATION_SUPPORT',
104
- }
105
-
106
147
  export const ExecutionPlanViewerPanelContent: React.FC<{
107
148
  executionPlanState: ExecutionPlanState;
108
149
  }> = observer((props) => {
@@ -112,10 +153,6 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
112
153
  executionPlanState.plan?.globalImplementationSupport;
113
154
  const templateFunctions =
114
155
  executionPlanState.plan?.processingTemplateFunctions ?? [];
115
- const [selectedTab, setSelectedTab] = useState<PLAN_TABS>(PLAN_TABS.GENERAL);
116
- const [selectedJavaClass, setSelectedJavaClass] = useState<
117
- string | undefined
118
- >(undefined);
119
156
 
120
157
  if (
121
158
  globalImplementationSupport &&
@@ -129,11 +166,11 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
129
166
  if (
130
167
  globalImplementationSupport.classes.length > 0 &&
131
168
  globalImplementationSupport.classes[0] &&
132
- selectedJavaClass === undefined
169
+ executionPlanState.globalImplementationSupportState.selectedJavaClass ===
170
+ undefined
133
171
  ) {
134
- setSelectedJavaClass(
135
- globalImplementationSupport.classes[0]?.package +
136
- globalImplementationSupport.classes[0]?.name,
172
+ executionPlanState.globalImplementationSupportState.setSelectedJavaClass(
173
+ `${globalImplementationSupport.classes[0]?.package}.${globalImplementationSupport.classes[0]?.name}`,
137
174
  );
138
175
  }
139
176
  }
@@ -146,12 +183,18 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
146
183
  {Object.values(PLAN_TABS).map((tab) => (
147
184
  <div
148
185
  key={tab}
149
- onClick={() => setSelectedTab(tab)}
186
+ onClick={() =>
187
+ executionPlanState.globalImplementationSupportState.setSelectedTab(
188
+ tab,
189
+ )
190
+ }
150
191
  className={clsx(
151
192
  'query-builder__execution-plan-form--editor__tab',
152
193
  {
153
194
  'query-builder__execution-plan-form--editor__tab--active':
154
- tab === selectedTab,
195
+ tab ===
196
+ executionPlanState.globalImplementationSupportState
197
+ .selectedTab,
155
198
  },
156
199
  )}
157
200
  >
@@ -160,11 +203,12 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
160
203
  ))}
161
204
  </div>
162
205
  </div>
163
- {selectedTab === PLAN_TABS.GLOBAL_IMPLEMENTATION_SUPPORT &&
206
+ {executionPlanState.globalImplementationSupportState.selectedTab ===
207
+ PLAN_TABS.GLOBAL_IMPLEMENTATION_SUPPORT &&
164
208
  globalImplementationSupport &&
165
209
  globalImplementationSupport instanceof JavaPlatformImplementation && (
166
210
  <ResizablePanelGroup orientation="vertical">
167
- <ResizablePanel minSize={30} size={250}>
211
+ <ResizablePanel minSize={30} size={400}>
168
212
  <PanelContent
169
213
  darkMode={
170
214
  !applicationStore.layoutService
@@ -180,7 +224,10 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
180
224
  'query-builder__java__container__item',
181
225
  {
182
226
  'query-builder__java__container__item--active':
183
- `${cl.package}${cl.name}` === selectedJavaClass,
227
+ `${cl.package}.${cl.name}` ===
228
+ executionPlanState
229
+ .globalImplementationSupportState
230
+ .selectedJavaClass,
184
231
  },
185
232
  )}
186
233
  key={cl.package + cl.name}
@@ -188,7 +235,9 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
188
235
  <button
189
236
  className="query-builder__java__container__item__btn"
190
237
  onClick={() =>
191
- setSelectedJavaClass(cl.package + cl.name)
238
+ executionPlanState.globalImplementationSupportState.setSelectedJavaClass(
239
+ `${cl.package}.${cl.name}`,
240
+ )
192
241
  }
193
242
  tabIndex={-1}
194
243
  title={`Go to ${cl.package}.${cl.name}`}
@@ -206,11 +255,15 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
206
255
  <ResizablePanelSplitterLine color="var(--color-dark-grey-200)" />
207
256
  </ResizablePanelSplitter>
208
257
  <ResizablePanel>
209
- {selectedJavaClass && (
258
+ {executionPlanState.globalImplementationSupportState
259
+ .selectedJavaClass && (
210
260
  <CodeEditor
211
261
  inputValue={globalImplementationSupport.classes.reduce(
212
262
  (value, cl) => {
213
- if (selectedJavaClass === `${cl.package}${cl.name}`) {
263
+ if (
264
+ executionPlanState.globalImplementationSupportState
265
+ .selectedJavaClass === `${cl.package}.${cl.name}`
266
+ ) {
214
267
  return cl.source;
215
268
  }
216
269
  return value;
@@ -225,37 +278,41 @@ export const ExecutionPlanViewerPanelContent: React.FC<{
225
278
  </ResizablePanel>
226
279
  </ResizablePanelGroup>
227
280
  )}
228
- {selectedTab === PLAN_TABS.GENERAL && (
229
- <>
230
- <div className="query-builder__template--function--editor__header">
231
- {`AuthDependent: ${executionPlanState.plan?.authDependent.toString()}`}
232
- </div>
233
- <div className="query-builder__template--function--editor__title">
234
- Template Functions
235
- </div>
236
- <div className="query-builder__template--function--editor__code">
237
- <CodeEditor
238
- inputValue={templateFunctions.reduce(
239
- (total, func) => (total += `${func}\n`),
240
- '',
241
- )}
242
- isReadOnly={true}
243
- language={CODE_EDITOR_LANGUAGE.XML}
244
- hideMinimap={true}
245
- hideActionBar={true}
246
- />
247
- </div>
248
- <div className="query-builder__template--function--editor__json">
249
- <Button
250
- className="btn--dark execution-node-viewer__unsupported-view__to-text-mode__btn"
251
- onClick={(): void =>
252
- executionPlanState.setViewMode(EXECUTION_PLAN_VIEW_MODE.JSON)
253
- }
254
- text="View JSON"
255
- />
256
- </div>
257
- </>
258
- )}
281
+ {executionPlanState.globalImplementationSupportState.selectedTab ===
282
+ PLAN_TABS.GENERAL &&
283
+ templateFunctions.length > 0 && (
284
+ <>
285
+ <div className="query-builder__template--function--editor__header">
286
+ {`AuthDependent: ${executionPlanState.plan?.authDependent.toString()}`}
287
+ </div>
288
+ <div className="query-builder__template--function--editor__title">
289
+ Template Functions
290
+ </div>
291
+ <div className="query-builder__template--function--editor__code">
292
+ <CodeEditor
293
+ inputValue={templateFunctions.reduce(
294
+ (total, func) => (total += `${func}\n`),
295
+ '',
296
+ )}
297
+ isReadOnly={true}
298
+ language={CODE_EDITOR_LANGUAGE.XML}
299
+ hideMinimap={true}
300
+ hideActionBar={true}
301
+ />
302
+ </div>
303
+ <div className="query-builder__template--function--editor__json">
304
+ <Button
305
+ className="btn--dark execution-node-viewer__unsupported-view__to-text-mode__btn"
306
+ onClick={(): void =>
307
+ executionPlanState.setViewMode(
308
+ EXECUTION_PLAN_VIEW_MODE.JSON,
309
+ )
310
+ }
311
+ text="View JSON"
312
+ />
313
+ </div>
314
+ </>
315
+ )}
259
316
  </div>
260
317
  </div>
261
318
  );
@@ -284,6 +341,23 @@ const ExecutionNodeElementTreeNodeContainer = observer(
284
341
  ) : (
285
342
  <div />
286
343
  );
344
+ let details = '';
345
+ let prefixLabel = '';
346
+ const STORE_MAPPING_LABEL = `Store Mapping Global Graph Fetch Execution Node`;
347
+ if (node instanceof ExecutionNodeTreeNodeData) {
348
+ if (node.parentNodeId === STORE_MAPPING_LABEL) {
349
+ if (
350
+ node.executionNode instanceof
351
+ StoreMappingGlobalGraphFetchExecutionNode
352
+ ) {
353
+ details = 'Cross';
354
+ } else if (node.executionNode instanceof LocalGraphFetchExecutionNode) {
355
+ details = 'Local';
356
+ }
357
+ }
358
+ prefixLabel = generateExecutionNodePrefixLabel(node.executionNode);
359
+ }
360
+
287
361
  return (
288
362
  <div
289
363
  className={clsx(
@@ -304,6 +378,20 @@ const ExecutionNodeElementTreeNodeContainer = observer(
304
378
  <div className="tree-view__node__icon">
305
379
  <div className="tree-view__node__expand-icon">{nodeExpandIcon}</div>
306
380
  </div>
381
+ {details !== '' && (
382
+ <div className="execution-plan-viewer__node__sub-type">
383
+ <div className="execution-plan-viewer__node__sub-type__label">
384
+ {details}
385
+ </div>
386
+ </div>
387
+ )}
388
+ {prefixLabel !== '' && (
389
+ <div className="execution-plan-viewer__node__type">
390
+ <div className="execution-plan-viewer__node__type__label">
391
+ {prefixLabel}
392
+ </div>
393
+ </div>
394
+ )}
307
395
  <button
308
396
  className="tree-view__node__label execution-plan-viewer__explorer-tree__node__label"
309
397
  tabIndex={-1}
@@ -350,6 +438,45 @@ export const ExecutionPlanTree = observer(
350
438
  );
351
439
  });
352
440
  }
441
+ if (
442
+ node.executionNode instanceof
443
+ StoreMappingGlobalGraphFetchExecutionNode
444
+ ) {
445
+ const localNode = node.executionNode.localGraphFetchExecutionNode;
446
+ const localNodeTreeData = generateExecutionNodeTreeNodeData(
447
+ localNode,
448
+ generateExecutionNodeLabel(localNode),
449
+ node,
450
+ );
451
+ executionPlanState.setTreeNode(
452
+ localNodeTreeData.id,
453
+ localNodeTreeData,
454
+ );
455
+ node.executionNode.children.forEach((childExecutionNode) => {
456
+ const executionNodeTreeNode = generateExecutionNodeTreeNodeData(
457
+ childExecutionNode,
458
+ generateExecutionNodeLabel(childExecutionNode),
459
+ node,
460
+ );
461
+ executionPlanState.setTreeNode(
462
+ executionNodeTreeNode.id,
463
+ executionNodeTreeNode,
464
+ );
465
+ });
466
+ }
467
+ if (node.executionNode instanceof RelationalGraphFetchExecutionNode) {
468
+ node.executionNode.children.forEach((childExecutionNode) => {
469
+ const executionNodeTreeNode = generateExecutionNodeTreeNodeData(
470
+ childExecutionNode,
471
+ generateExecutionNodeLabel(childExecutionNode),
472
+ node,
473
+ );
474
+ executionPlanState.setTreeNode(
475
+ executionNodeTreeNode.id,
476
+ executionNodeTreeNode,
477
+ );
478
+ });
479
+ }
353
480
  }
354
481
  }
355
482
 
@@ -397,12 +524,13 @@ export const ExecutionPlanTree = observer(
397
524
  },
398
525
  );
399
526
 
400
- const ExecutionNodeViewer = observer(
527
+ export const ExecutionNodeViewer = observer(
401
528
  (props: {
402
529
  executionNode: ExecutionNode;
403
530
  executionPlanState: ExecutionPlanState;
531
+ viewJson?: boolean | undefined;
404
532
  }) => {
405
- const { executionNode, executionPlanState } = props;
533
+ const { executionNode, executionPlanState, viewJson } = props;
406
534
  if (executionNode instanceof SQLExecutionNode) {
407
535
  return (
408
536
  <SQLExecutionNodeViewer
@@ -410,7 +538,7 @@ const ExecutionNodeViewer = observer(
410
538
  resultColumns={executionNode.resultColumns}
411
539
  resultType={executionNode.resultType}
412
540
  executionPlanState={executionPlanState}
413
- viewJson={true}
541
+ viewJson={viewJson}
414
542
  />
415
543
  );
416
544
  }
@@ -453,6 +581,48 @@ const ExecutionNodeViewer = observer(
453
581
  <SequenceExecutionNodeViewer
454
582
  node={executionNode}
455
583
  executionPlanState={executionPlanState}
584
+ viewJson={viewJson}
585
+ />
586
+ );
587
+ }
588
+ if (executionNode instanceof StoreMappingGlobalGraphFetchExecutionNode) {
589
+ return (
590
+ <StoreMappingGlobalGraphFetchExecutionNodeViewer
591
+ storeMappingNode={executionNode}
592
+ executionPlanState={executionPlanState}
593
+ />
594
+ );
595
+ }
596
+ if (
597
+ executionNode instanceof
598
+ RelationalCrossRootQueryTempTableGraphFetchExecutionNode
599
+ ) {
600
+ return (
601
+ <RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer
602
+ node={executionNode}
603
+ executionPlanState={executionPlanState}
604
+ />
605
+ );
606
+ }
607
+ if (
608
+ executionNode instanceof
609
+ RelationalRootQueryTempTableGraphFetchExecutionNode
610
+ ) {
611
+ return (
612
+ <RelationalRootQueryTempTableGraphFetchExecutionNodeViewer
613
+ node={executionNode}
614
+ executionPlanState={executionPlanState}
615
+ />
616
+ );
617
+ }
618
+ if (
619
+ executionNode instanceof
620
+ RelationalClassQueryTempTableGraphFetchExecutionNode
621
+ ) {
622
+ return (
623
+ <RelationalClassQueryTempTableGraphFetchExecutionNodeViewer
624
+ node={executionNode}
625
+ executionPlanState={executionPlanState}
456
626
  />
457
627
  );
458
628
  }
@@ -505,7 +675,6 @@ const ExecutionPlanViewPanel = observer(
505
675
  }
506
676
  }, [executionPlanState]);
507
677
  const nativeViewModes = Object.values(EXECUTION_PLAN_VIEW_MODE);
508
-
509
678
  return (
510
679
  <div className="execution-plan-viewer__panel">
511
680
  {executionPlanState.selectedNode !== undefined && (
@@ -568,6 +737,7 @@ const ExecutionPlanViewPanel = observer(
568
737
  <ExecutionNodeViewer
569
738
  executionNode={currentElement}
570
739
  executionPlanState={executionPlanState}
740
+ viewJson={true}
571
741
  />
572
742
  )}
573
743
  {currentElement instanceof ExecutionPlan && (
@@ -651,6 +821,12 @@ export const ExecutionPlanViewer = observer(
651
821
  executionPlanState.setExecutionPlanDisplayData('');
652
822
  executionPlanState.setSelectedNode(undefined);
653
823
  executionPlanState.setDebugText(undefined);
824
+ executionPlanState.globalImplementationSupportState.setSelectedTab(
825
+ PLAN_TABS.GENERAL,
826
+ );
827
+ executionPlanState.globalImplementationSupportState.setSelectedJavaClass(
828
+ undefined,
829
+ );
654
830
  };
655
831
  const rawPlan = executionPlanState.rawPlan;
656
832
  const isDarkMode =
@@ -64,6 +64,7 @@ export const FunctionParametersValidationNodeViewer: React.FC<{
64
64
  }
65
65
  return `[${multiplicity.lowerBound.toString()}..${multiplicity.upperBound.toString()}]`;
66
66
  };
67
+
67
68
  return (
68
69
  <PanelContent
69
70
  darkMode={
@@ -0,0 +1,76 @@
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 { PanelListItem } from '@finos/legend-art';
18
+ import {
19
+ type ExecutionNode,
20
+ ExecutionPlan,
21
+ JavaPlatformImplementation,
22
+ } from '@finos/legend-graph';
23
+ import { guaranteeType } from '@finos/legend-shared';
24
+ import { observer } from 'mobx-react-lite';
25
+ import {
26
+ type ExecutionPlanState,
27
+ PLAN_TABS,
28
+ } from '../../stores/execution-plan/ExecutionPlanState.js';
29
+
30
+ export const ImplementationViewer: React.FC<{
31
+ node: ExecutionNode;
32
+ executionPlanState: ExecutionPlanState;
33
+ }> = observer((props) => {
34
+ const { node, executionPlanState } = props;
35
+
36
+ const openJavaClass = (): void => {
37
+ executionPlanState.setSelectedNode(
38
+ executionPlanState.treeData?.nodes.get(`Execution Plan`),
39
+ );
40
+ executionPlanState.transformMetadataToProtocolJson(
41
+ guaranteeType(
42
+ executionPlanState.plan,
43
+ ExecutionPlan,
44
+ 'Execution plan is undefined',
45
+ ),
46
+ );
47
+ executionPlanState.globalImplementationSupportState.setSelectedTab(
48
+ PLAN_TABS.GLOBAL_IMPLEMENTATION_SUPPORT,
49
+ );
50
+ if (node.implementation instanceof JavaPlatformImplementation) {
51
+ executionPlanState.globalImplementationSupportState.setSelectedJavaClass(
52
+ node.implementation.executionClassFullName,
53
+ );
54
+ }
55
+ };
56
+
57
+ return (
58
+ <>
59
+ <PanelListItem className="query-builder__implementation__container__header">
60
+ Implementation
61
+ </PanelListItem>
62
+ {node.implementation instanceof JavaPlatformImplementation &&
63
+ node.implementation.executionClassFullName && (
64
+ <div className="query-builder__implementation__container__item">
65
+ <button
66
+ onClick={openJavaClass}
67
+ title={`Go to Java class: ${node.implementation.executionClassFullName}`}
68
+ className="query-builder__implementation__container__item__java-btn"
69
+ >
70
+ {node.implementation.executionClassFullName}
71
+ </button>
72
+ </div>
73
+ )}
74
+ </>
75
+ );
76
+ });
@@ -0,0 +1,55 @@
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 { observer } from 'mobx-react-lite';
18
+ import { PanelListItem, PanelDivider } from '@finos/legend-art';
19
+ import { type PartialClassResultType } from '@finos/legend-graph';
20
+
21
+ export const PartialClassResultTypeViewer: React.FC<{
22
+ resultType: PartialClassResultType;
23
+ }> = observer((props) => {
24
+ const { resultType } = props;
25
+
26
+ return (
27
+ <div className="query-builder__result__container">
28
+ <PanelListItem className="query-builder__result__container__item__partial-class">
29
+ Result type: PartialClass[{resultType.type.valueForSerialization ?? ''}]
30
+ </PanelListItem>
31
+ <PanelDivider />
32
+ {
33
+ <table className="table query-builder__result__container__table--partial-class">
34
+ <thead>
35
+ <tr>
36
+ <th className="table__cell--left">Property</th>
37
+ <th className="table__cell--left">Parameters</th>
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ {resultType.propertiesWithParameters.map((column) => (
42
+ <tr key={column.property}>
43
+ <td className="table__cell--left">{column.property}</td>
44
+ <td className="table__cell--left">
45
+ {column.parameters.toString()}
46
+ </td>
47
+ </tr>
48
+ ))}
49
+ </tbody>
50
+ </table>
51
+ }
52
+ <PanelDivider />
53
+ </div>
54
+ );
55
+ });