@finos/legend-query-builder 4.1.2 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) 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/QueryBuilderTextEditor.d.ts.map +1 -1
  8. package/lib/components/QueryBuilderTextEditor.js +3 -1
  9. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  10. package/lib/components/execution-plan/AllocationExecutionNodeViewer.d.ts +23 -0
  11. package/lib/components/execution-plan/AllocationExecutionNodeViewer.d.ts.map +1 -0
  12. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js +32 -0
  13. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js.map +1 -0
  14. package/lib/components/execution-plan/ConstantExecutionNodeViewer.d.ts +23 -0
  15. package/lib/components/execution-plan/ConstantExecutionNodeViewer.d.ts.map +1 -0
  16. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js +35 -0
  17. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js.map +1 -0
  18. package/lib/components/execution-plan/DataTypeResultTypeViewer.d.ts +21 -0
  19. package/lib/components/execution-plan/DataTypeResultTypeViewer.d.ts.map +1 -0
  20. package/lib/components/execution-plan/DataTypeResultTypeViewer.js +31 -0
  21. package/lib/components/execution-plan/DataTypeResultTypeViewer.js.map +1 -0
  22. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts +10 -4
  23. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
  24. package/lib/components/execution-plan/ExecutionPlanViewer.js +74 -62
  25. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  26. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts +25 -0
  27. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts.map +1 -0
  28. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js +47 -0
  29. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -0
  30. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.d.ts +23 -0
  31. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.d.ts.map +1 -0
  32. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js +31 -0
  33. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js.map +1 -0
  34. package/lib/components/execution-plan/ResultTypeViewer.d.ts +21 -0
  35. package/lib/components/execution-plan/ResultTypeViewer.d.ts.map +1 -0
  36. package/lib/components/execution-plan/ResultTypeViewer.js +33 -0
  37. package/lib/components/execution-plan/ResultTypeViewer.js.map +1 -0
  38. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts +9 -1
  39. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts.map +1 -1
  40. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +12 -6
  41. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
  42. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts +23 -0
  43. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts.map +1 -0
  44. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js +38 -0
  45. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js.map +1 -0
  46. package/lib/components/execution-plan/TDSResultTypeViewer.d.ts +21 -0
  47. package/lib/components/execution-plan/TDSResultTypeViewer.d.ts.map +1 -0
  48. package/lib/components/execution-plan/TDSResultTypeViewer.js +25 -0
  49. package/lib/components/execution-plan/TDSResultTypeViewer.js.map +1 -0
  50. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  51. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -3
  52. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  53. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +25 -34
  55. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  56. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  57. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +68 -22
  58. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  59. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  60. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +4 -4
  61. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  62. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  63. package/lib/components/filter/QueryBuilderFilterPanel.js +21 -32
  64. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  65. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  66. package/lib/components/shared/LambdaEditor.js +10 -3
  67. package/lib/components/shared/LambdaEditor.js.map +1 -1
  68. package/lib/index.css +2 -2
  69. package/lib/index.css.map +1 -1
  70. package/lib/package.json +4 -4
  71. package/lib/stores/QueryBuilderResultState.d.ts +0 -3
  72. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  73. package/lib/stores/QueryBuilderResultState.js +2 -25
  74. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  75. package/lib/stores/QueryBuilderTextEditorState.d.ts +3 -1
  76. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  77. package/lib/stores/QueryBuilderTextEditorState.js +2 -2
  78. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  79. package/lib/stores/QueryLoaderState.d.ts +2 -0
  80. package/lib/stores/QueryLoaderState.d.ts.map +1 -1
  81. package/lib/stores/QueryLoaderState.js +7 -3
  82. package/lib/stores/QueryLoaderState.js.map +1 -1
  83. package/lib/stores/execution-plan/ExecutionPlanState.d.ts +14 -1
  84. package/lib/stores/execution-plan/ExecutionPlanState.d.ts.map +1 -1
  85. package/lib/stores/execution-plan/ExecutionPlanState.js +86 -3
  86. package/lib/stores/execution-plan/ExecutionPlanState.js.map +1 -1
  87. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  88. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +3 -1
  89. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  90. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +4 -1
  91. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  92. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +5 -3
  93. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  94. package/lib/stores/shared/LambdaEditorState.d.ts +7 -2
  95. package/lib/stores/shared/LambdaEditorState.d.ts.map +1 -1
  96. package/lib/stores/shared/LambdaEditorState.js +7 -2
  97. package/lib/stores/shared/LambdaEditorState.js.map +1 -1
  98. package/package.json +12 -12
  99. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +1 -2
  100. package/src/components/QueryBuilderResultPanel.tsx +146 -30
  101. package/src/components/QueryBuilderTextEditor.tsx +3 -1
  102. package/src/components/execution-plan/AllocationExecutionNodeViewer.tsx +77 -0
  103. package/src/components/execution-plan/ConstantExecutionNodeViewer.tsx +82 -0
  104. package/src/components/execution-plan/DataTypeResultTypeViewer.tsx +52 -0
  105. package/src/components/execution-plan/ExecutionPlanViewer.tsx +205 -195
  106. package/src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx +118 -0
  107. package/src/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.tsx +68 -0
  108. package/src/components/execution-plan/ResultTypeViewer.tsx +37 -0
  109. package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +50 -19
  110. package/src/components/execution-plan/SequenceExecutionNodeViewer.tsx +95 -0
  111. package/src/components/execution-plan/TDSResultTypeViewer.tsx +59 -0
  112. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -8
  113. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +37 -62
  114. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +161 -45
  115. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +6 -8
  116. package/src/components/filter/QueryBuilderFilterPanel.tsx +49 -73
  117. package/src/components/shared/LambdaEditor.tsx +10 -3
  118. package/src/stores/QueryBuilderResultState.ts +1 -42
  119. package/src/stores/QueryBuilderTextEditorState.ts +4 -2
  120. package/src/stores/QueryLoaderState.ts +11 -1
  121. package/src/stores/execution-plan/ExecutionPlanState.ts +142 -4
  122. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +3 -1
  123. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +8 -3
  124. package/src/stores/shared/LambdaEditorState.ts +12 -5
  125. package/tsconfig.json +8 -0
@@ -68,7 +68,7 @@ import {
68
68
  prettyDuration,
69
69
  filterByType,
70
70
  } from '@finos/legend-shared';
71
- import { forwardRef, useState } from 'react';
71
+ import { forwardRef, useRef, useState } from 'react';
72
72
  import {
73
73
  QueryBuilderDerivationProjectionColumnState,
74
74
  QueryBuilderProjectionColumnState,
@@ -132,6 +132,7 @@ const QueryBuilderGridResultContextMenu = observer(
132
132
  }
133
133
  >(function QueryBuilderResultContextMenu(props, ref) {
134
134
  const { data, tdsState } = props;
135
+
135
136
  const applicationStore = useApplicationStore();
136
137
  const postFilterEqualOperator = new QueryBuilderPostFilterOperator_Equal();
137
138
  const postFilterInOperator = new QueryBuilderPostFilterOperator_In();
@@ -404,14 +405,31 @@ const QueryBuilderGridResultContextMenu = observer(
404
405
  ),
405
406
  );
406
407
 
408
+ const findRowFromRowIndex = (
409
+ rowIndex: number,
410
+ ): (string | number | boolean | null)[] => {
411
+ if (
412
+ !tdsState.queryBuilderState.resultState.executionResult ||
413
+ !(
414
+ tdsState.queryBuilderState.resultState.executionResult instanceof
415
+ TDSExecutionResult
416
+ )
417
+ ) {
418
+ return [''];
419
+ }
420
+ return (
421
+ tdsState.queryBuilderState.resultState.executionResult.result.rows[
422
+ rowIndex
423
+ ]?.values ?? ['']
424
+ );
425
+ };
426
+
407
427
  const handleCopyRowValue = applicationStore.guardUnhandledError(() =>
408
428
  applicationStore.clipboardService.copyTextToClipboard(
409
- tdsState.queryBuilderState.resultState
410
- .findRowFromRowIndex(
411
- tdsState.queryBuilderState.resultState.selectedCells[0]?.coordinates
412
- .rowIndex ?? 0,
413
- )
414
- .toString(),
429
+ findRowFromRowIndex(
430
+ tdsState.queryBuilderState.resultState.selectedCells[0]?.coordinates
431
+ .rowIndex ?? 0,
432
+ ).toString(),
415
433
  ),
416
434
  );
417
435
 
@@ -480,6 +498,45 @@ const QueryResultCellRenderer = observer(
480
498
  result.coordinates.rowIndex === currentCellCoordinates.rowIndex,
481
499
  );
482
500
 
501
+ const findColumnFromCoordinates = (
502
+ colIndex: number,
503
+ ): string | number | boolean | null | undefined => {
504
+ if (
505
+ !resultState.executionResult ||
506
+ !(resultState.executionResult instanceof TDSExecutionResult)
507
+ ) {
508
+ return undefined;
509
+ }
510
+ return resultState.executionResult.result.columns[colIndex];
511
+ };
512
+
513
+ const findResultValueFromCoordinates = (
514
+ resultCoordinate: [number, number],
515
+ ): string | number | boolean | null | undefined => {
516
+ const rowIndex = resultCoordinate[0];
517
+ const colIndex = resultCoordinate[1];
518
+
519
+ if (
520
+ !resultState.executionResult ||
521
+ !(resultState.executionResult instanceof TDSExecutionResult)
522
+ ) {
523
+ return undefined;
524
+ }
525
+
526
+ return resultState.executionResult.result.rows[rowIndex]?.values[
527
+ colIndex
528
+ ];
529
+ };
530
+
531
+ const isCoordinatesSelected = (
532
+ resultCoordinate: QueryBuilderTDSResultCellCoordinate,
533
+ ): boolean =>
534
+ resultState.selectedCells.some(
535
+ (cell) =>
536
+ cell.coordinates.rowIndex === resultCoordinate.rowIndex &&
537
+ cell.coordinates.colIndex === resultCoordinate.colIndex,
538
+ );
539
+
483
540
  const mouseDown: React.MouseEventHandler = (event) => {
484
541
  event.preventDefault();
485
542
 
@@ -488,7 +545,7 @@ const QueryResultCellRenderer = observer(
488
545
  columnName,
489
546
  params.rowIndex,
490
547
  );
491
- const actualValue = resultState.findResultValueFromCoordinates([
548
+ const actualValue = findResultValueFromCoordinates([
492
549
  coordinates.rowIndex,
493
550
  coordinates.colIndex,
494
551
  ]);
@@ -507,20 +564,13 @@ const QueryResultCellRenderer = observer(
507
564
  columnName,
508
565
  params.rowIndex,
509
566
  );
510
- const actualValue = resultState.findResultValueFromCoordinates([
567
+ const actualValue = findResultValueFromCoordinates([
511
568
  coordinates.rowIndex,
512
569
  coordinates.colIndex,
513
570
  ]);
514
571
 
515
572
  const rowNode = params.api.getRowNode(params.rowIndex.toString());
516
573
 
517
- if (rowNode) {
518
- params.api.refreshCells({
519
- force: true,
520
- columns: [columnName],
521
- rowNodes: [rowNode],
522
- });
523
- }
524
574
  resultState.setSelectedCells([
525
575
  {
526
576
  value: actualValue,
@@ -528,6 +578,48 @@ const QueryResultCellRenderer = observer(
528
578
  coordinates: coordinates,
529
579
  },
530
580
  ]);
581
+
582
+ if (rowNode) {
583
+ params.api.refreshCells({
584
+ force: true,
585
+ columns: [columnName],
586
+ rowNodes: [rowNode],
587
+ });
588
+ }
589
+
590
+ resultState.setMouseOverCell(resultState.selectedCells[0] ?? null);
591
+ }
592
+
593
+ if (event.button === 2) {
594
+ const coordinates = findCoordinatesFromResultValue(
595
+ columnName,
596
+ params.rowIndex,
597
+ );
598
+ const isInSelected = isCoordinatesSelected(coordinates);
599
+ if (!isInSelected) {
600
+ const actualValue = findResultValueFromCoordinates([
601
+ coordinates.rowIndex,
602
+ coordinates.colIndex,
603
+ ]);
604
+
605
+ resultState.setSelectedCells([
606
+ {
607
+ value: actualValue,
608
+ columnName: columnName,
609
+ coordinates: coordinates,
610
+ },
611
+ ]);
612
+ const rowNode = params.api.getRowNode(params.rowIndex.toString());
613
+
614
+ if (rowNode) {
615
+ params.api.refreshCells({
616
+ force: true,
617
+ columns: [columnName],
618
+ rowNodes: [rowNode],
619
+ });
620
+ }
621
+ resultState.setMouseOverCell(resultState.selectedCells[0] ?? null);
622
+ }
531
623
  }
532
624
  };
533
625
  const mouseUp: React.MouseEventHandler = (event) => {
@@ -559,14 +651,11 @@ const QueryResultCellRenderer = observer(
559
651
 
560
652
  for (let x = minRow; x <= maxRow; x++) {
561
653
  for (let y = minCol; y <= maxCol; y++) {
562
- const actualValue = resultState.findResultValueFromCoordinates([
563
- x,
564
- y,
565
- ]);
654
+ const actualValue = findResultValueFromCoordinates([x, y]);
566
655
 
567
656
  const valueAndColumnId = {
568
657
  value: actualValue,
569
- columnName: resultState.findColumnFromCoordinates(y),
658
+ columnName: findColumnFromCoordinates(y),
570
659
  coordinates: {
571
660
  rowIndex: x,
572
661
  colIndex: y,
@@ -828,13 +917,6 @@ export const QueryBuilderResultPanel = observer(
828
917
  flowResult(resultState.generatePlan(true)),
829
918
  );
830
919
 
831
- const changeLimit: React.ChangeEventHandler<HTMLInputElement> = (event) => {
832
- const val = event.target.value;
833
- queryBuilderState.resultState.setPreviewLimit(
834
- val === '' ? 0 : parseInt(val, 10),
835
- );
836
- };
837
-
838
920
  const allowSettingPreviewLimit = queryBuilderState.isQuerySupported;
839
921
 
840
922
  const copyExpression = (value: string): void => {
@@ -877,6 +959,37 @@ export const QueryBuilderResultPanel = observer(
877
959
  const resultDescription = executionResult
878
960
  ? getResultSetDescription(executionResult)
879
961
  : undefined;
962
+
963
+ const [previewLimitValue, setPreviewLimitValue] = useState(
964
+ resultState.previewLimit,
965
+ );
966
+
967
+ const changePreviewLimit: React.ChangeEventHandler<HTMLInputElement> = (
968
+ event,
969
+ ) => {
970
+ setPreviewLimitValue(parseInt(event.target.value, 10));
971
+ };
972
+
973
+ const inputRef = useRef<HTMLInputElement>(null);
974
+
975
+ const getPreviewLimit = (): void => {
976
+ if (isNaN(previewLimitValue) || previewLimitValue === 0) {
977
+ setPreviewLimitValue(1);
978
+ queryBuilderState.resultState.setPreviewLimit(1);
979
+ } else {
980
+ queryBuilderState.resultState.setPreviewLimit(previewLimitValue);
981
+ }
982
+ };
983
+
984
+ const onKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {
985
+ if (event.code === 'Enter') {
986
+ getPreviewLimit();
987
+ inputRef.current?.focus();
988
+ } else if (event.code === 'Escape') {
989
+ inputRef.current?.select();
990
+ }
991
+ };
992
+
880
993
  return (
881
994
  <div
882
995
  data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_RESULT_PANEL}
@@ -956,11 +1069,14 @@ export const QueryBuilderResultPanel = observer(
956
1069
  preview limit
957
1070
  </div>
958
1071
  <input
1072
+ ref={inputRef}
959
1073
  className="input--dark query-builder__result__limit__input"
960
1074
  spellCheck={false}
961
1075
  type="number"
962
- value={resultState.previewLimit}
963
- onChange={changeLimit}
1076
+ value={previewLimitValue}
1077
+ onChange={changePreviewLimit}
1078
+ onBlur={getPreviewLimit}
1079
+ onKeyDown={onKeyDown}
964
1080
  disabled={!isQueryValid}
965
1081
  />
966
1082
  </div>
@@ -54,7 +54,9 @@ export const QueryBuilderTextEditor = observer(
54
54
  const mode = queryTextEditorState.mode;
55
55
  useEffect(() => {
56
56
  flowResult(
57
- queryTextEditorState.convertLambdaObjectToGrammarString(true),
57
+ queryTextEditorState.convertLambdaObjectToGrammarString({
58
+ pretty: true,
59
+ }),
58
60
  ).catch(applicationStore.alertUnhandledError);
59
61
  }, [applicationStore, queryTextEditorState]);
60
62
 
@@ -0,0 +1,77 @@
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 type { ExecutionPlanState } from '../../stores/execution-plan/ExecutionPlanState.js';
19
+ import { PanelListItem, PanelDivider, PanelContent } from '@finos/legend-art';
20
+ import {
21
+ ConstantExecutionNode,
22
+ type AllocationExecutionNode,
23
+ } from '@finos/legend-graph';
24
+ import { ResultTypeViewer } from './ResultTypeViewer.js';
25
+ import { ConstantExecutionNodeViewer } from './ConstantExecutionNodeViewer.js';
26
+
27
+ export const AllocationExecutionNodeViewer: React.FC<{
28
+ node: AllocationExecutionNode;
29
+ executionPlanState: ExecutionPlanState;
30
+ }> = observer((props) => {
31
+ const { node, executionPlanState } = props;
32
+ const varName = node.varName;
33
+ const resultType = node.resultType;
34
+ const realizeInMemory = node.realizeInMemory.toString();
35
+ const applicationStore = executionPlanState.applicationStore;
36
+
37
+ return (
38
+ <PanelContent
39
+ darkMode={
40
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
41
+ }
42
+ >
43
+ <div className="query-builder__allocation__container">
44
+ <div>
45
+ <PanelListItem className="query-builder__allocation__container__item__label">
46
+ Allocation Node Details
47
+ </PanelListItem>
48
+ <PanelDivider />
49
+ <div className="query-builder__allocation__container__item">
50
+ <div className="query-builder__allocation__container__info">
51
+ varName
52
+ </div>
53
+ <div className="query-builder__allocation__container__info__var-name">
54
+ {`: ${varName}`}
55
+ </div>
56
+ <br />
57
+ <div className="query-builder__allocation__container__info">
58
+ realizeInMemory {`: ${realizeInMemory}`}
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ <PanelDivider />
64
+ <ResultTypeViewer resultType={resultType} />
65
+ <PanelDivider />
66
+ {node.executionNodes.length > 0 &&
67
+ node.executionNodes[0] !== undefined &&
68
+ node.executionNodes[0] instanceof ConstantExecutionNode && (
69
+ <ConstantExecutionNodeViewer
70
+ cnode={node.executionNodes[0]}
71
+ executionPlanState={executionPlanState}
72
+ />
73
+ )}
74
+ <PanelDivider />
75
+ </PanelContent>
76
+ );
77
+ });
@@ -0,0 +1,82 @@
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 {
19
+ type ExecutionPlanState,
20
+ EXECUTION_PLAN_VIEW_MODE,
21
+ } from '../../stores/execution-plan/ExecutionPlanState.js';
22
+
23
+ import {
24
+ PanelListItem,
25
+ PanelDivider,
26
+ Button,
27
+ PanelContent,
28
+ } from '@finos/legend-art';
29
+ import type { ConstantExecutionNode } from '@finos/legend-graph';
30
+ import { ResultTypeViewer } from './ResultTypeViewer.js';
31
+ import { isPlainObject } from '@finos/legend-shared';
32
+
33
+ export const ConstantExecutionNodeViewer: React.FC<{
34
+ cnode: ConstantExecutionNode;
35
+ executionPlanState: ExecutionPlanState;
36
+ }> = observer((props) => {
37
+ const { cnode, executionPlanState } = props;
38
+ const resultType = cnode.resultType;
39
+ let value = '';
40
+ const applicationStore = executionPlanState.applicationStore;
41
+ try {
42
+ value = (isPlainObject(cnode.values) ? cnode.values.value : '') as string;
43
+ } catch {
44
+ // do nothing
45
+ }
46
+
47
+ return (
48
+ <PanelContent
49
+ darkMode={
50
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
51
+ }
52
+ >
53
+ {value !== '' && (
54
+ <div className="query-builder__constant__container">
55
+ <div>
56
+ <PanelListItem className="query-builder__constant__container__item__label">
57
+ Constant Execution Node Details
58
+ </PanelListItem>
59
+ <PanelDivider />
60
+ <pre>
61
+ <div className="query-builder__constant__container__item">
62
+ <div>value : {value}</div>
63
+ </div>
64
+ </pre>
65
+ </div>
66
+ </div>
67
+ )}
68
+ <PanelDivider />
69
+ <ResultTypeViewer resultType={resultType} />
70
+ <div className="query-builder__constant__container">
71
+ <Button
72
+ className="btn--dark execution-node-viewer__unsupported-view__to-text-mode__btn"
73
+ onClick={(): void =>
74
+ executionPlanState.setViewMode(EXECUTION_PLAN_VIEW_MODE.JSON)
75
+ }
76
+ text="View JSON"
77
+ />
78
+ </div>
79
+ <PanelDivider />
80
+ </PanelContent>
81
+ );
82
+ });
@@ -0,0 +1,52 @@
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 {
20
+ PackageableElementImplicitReference,
21
+ type DataTypeResultType,
22
+ } from '@finos/legend-graph';
23
+
24
+ export const DataTypeResultTypeViewer: React.FC<{
25
+ resultType: DataTypeResultType;
26
+ }> = observer((props) => {
27
+ const { resultType } = props;
28
+ let type = '';
29
+ if (resultType.type instanceof PackageableElementImplicitReference) {
30
+ type = resultType.type.input ?? '';
31
+ }
32
+
33
+ if (type === '') {
34
+ return <></>;
35
+ }
36
+
37
+ return (
38
+ <div className="query-builder__result__container">
39
+ <PanelListItem className="query-builder__result__container__item__data-type">
40
+ <>
41
+ <div className="query-builder__result__container__item__data-type__type">
42
+ Result type:
43
+ </div>
44
+ <div className="query-builder__result__container__item__data-type__value">
45
+ {type}
46
+ </div>
47
+ </>
48
+ </PanelListItem>
49
+ <PanelDivider />
50
+ </div>
51
+ );
52
+ });