@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.
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +2 -2
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +8 -2
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
- package/lib/components/execution-plan/AllocationExecutionNodeViewer.js +1 -1
- package/lib/components/execution-plan/AllocationExecutionNodeViewer.js.map +1 -1
- package/lib/components/execution-plan/ExecutionPlanViewer.d.ts +7 -0
- package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/ExecutionPlanViewer.js +109 -27
- package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
- package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -1
- package/lib/components/execution-plan/ImplementationViewer.d.ts +23 -0
- package/lib/components/execution-plan/ImplementationViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/ImplementationViewer.js +35 -0
- package/lib/components/execution-plan/ImplementationViewer.js.map +1 -0
- package/lib/components/execution-plan/PartialClassResultViewer.d.ts +21 -0
- package/lib/components/execution-plan/PartialClassResultViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/PartialClassResultViewer.js +24 -0
- package/lib/components/execution-plan/PartialClassResultViewer.js.map +1 -0
- package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.d.ts +23 -0
- package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js +43 -0
- package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -0
- package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts +23 -0
- package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js +47 -0
- package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -0
- package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts +23 -0
- package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js +43 -0
- package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -0
- package/lib/components/execution-plan/ResultTypeViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/ResultTypeViewer.js +5 -1
- package/lib/components/execution-plan/ResultTypeViewer.js.map +1 -1
- package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts +1 -1
- package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/SQLExecutionNodeViewer.js +16 -3
- package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
- package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts +6 -0
- package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/SequenceExecutionNodeViewer.js +34 -12
- package/lib/components/execution-plan/SequenceExecutionNodeViewer.js.map +1 -1
- package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.d.ts +23 -0
- package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.js +57 -0
- package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.js.map +1 -0
- package/lib/components/execution-plan/TempTableStrategyViewer.d.ts +28 -0
- package/lib/components/execution-plan/TempTableStrategyViewer.d.ts.map +1 -0
- package/lib/components/execution-plan/TempTableStrategyViewer.js +42 -0
- package/lib/components/execution-plan/TempTableStrategyViewer.js.map +1 -0
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +7 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +16 -10
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
- package/lib/components/shared/CustomDatePicker.d.ts +2 -1
- package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
- package/lib/components/shared/CustomDatePicker.js +31 -19
- package/lib/components/shared/CustomDatePicker.js.map +1 -1
- package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
- package/lib/components/shared/QueryBuilderVariableSelector.js +1 -1
- package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
- package/lib/graph-manager/QueryBuilderConfig.d.ts +24 -0
- package/lib/graph-manager/QueryBuilderConfig.d.ts.map +1 -0
- package/lib/graph-manager/QueryBuilderConfig.js +27 -0
- package/lib/graph-manager/QueryBuilderConfig.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +9 -9
- package/lib/stores/QueryBuilderState.d.ts +3 -1
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +4 -2
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.d.ts.map +1 -1
- package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js +1 -1
- package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js.map +1 -1
- package/lib/stores/execution-plan/ExecutionPlanState.d.ts +15 -1
- package/lib/stores/execution-plan/ExecutionPlanState.d.ts.map +1 -1
- package/lib/stores/execution-plan/ExecutionPlanState.js +50 -3
- package/lib/stores/execution-plan/ExecutionPlanState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +16 -4
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts +6 -4
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +43 -9
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
- package/lib/stores/workflows/FunctionQueryBuilderState.d.ts +2 -1
- package/lib/stores/workflows/FunctionQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/FunctionQueryBuilderState.js +2 -2
- package/lib/stores/workflows/FunctionQueryBuilderState.js.map +1 -1
- package/lib/stores/workflows/MappingQueryBuilderState.d.ts +2 -1
- package/lib/stores/workflows/MappingQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/MappingQueryBuilderState.js +2 -2
- package/lib/stores/workflows/MappingQueryBuilderState.js.map +1 -1
- package/lib/stores/workflows/ServiceQueryBuilderState.d.ts +2 -1
- package/lib/stores/workflows/ServiceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/workflows/ServiceQueryBuilderState.js +2 -2
- package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
- package/package.json +17 -17
- package/src/components/QueryBuilder.tsx +16 -14
- package/src/components/QueryBuilderResultPanel.tsx +7 -2
- package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +1 -0
- package/src/components/execution-plan/AllocationExecutionNodeViewer.tsx +1 -1
- package/src/components/execution-plan/ExecutionPlanViewer.tsx +233 -57
- package/src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx +1 -0
- package/src/components/execution-plan/ImplementationViewer.tsx +76 -0
- package/src/components/execution-plan/PartialClassResultViewer.tsx +55 -0
- package/src/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.tsx +190 -0
- package/src/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.tsx +219 -0
- package/src/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.tsx +204 -0
- package/src/components/execution-plan/ResultTypeViewer.tsx +4 -0
- package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +66 -44
- package/src/components/execution-plan/SequenceExecutionNodeViewer.tsx +79 -15
- package/src/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.tsx +264 -0
- package/src/components/execution-plan/TempTableStrategyViewer.tsx +97 -0
- package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +23 -9
- package/src/components/shared/CustomDatePicker.tsx +65 -27
- package/src/components/shared/QueryBuilderVariableSelector.tsx +4 -1
- package/src/graph-manager/QueryBuilderConfig.ts +31 -0
- package/src/index.ts +1 -1
- package/src/stores/QueryBuilderState.ts +5 -0
- package/src/stores/__test-utils__/QueryBuilderStateTestUtils.ts +1 -0
- package/src/stores/execution-plan/ExecutionPlanState.ts +64 -1
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +17 -7
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +73 -9
- package/src/stores/workflows/FunctionQueryBuilderState.ts +3 -1
- package/src/stores/workflows/MappingQueryBuilderState.ts +3 -1
- package/src/stores/workflows/ServiceQueryBuilderState.ts +3 -1
- package/tsconfig.json +8 -0
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
BufferIcon,
|
|
48
48
|
CustomSelectorInput,
|
|
49
49
|
FolderIcon,
|
|
50
|
+
PURE_UnknownElementTypeIcon,
|
|
50
51
|
} from '@finos/legend-art';
|
|
51
52
|
import { QUERY_BUILDER_TEST_ID } from '../../__lib__/QueryBuilderTesting.js';
|
|
52
53
|
import {
|
|
@@ -80,6 +81,8 @@ import {
|
|
|
80
81
|
Binding,
|
|
81
82
|
Package,
|
|
82
83
|
getDescendantsOfPackage,
|
|
84
|
+
PropertyGraphFetchTree,
|
|
85
|
+
RootGraphFetchTree,
|
|
83
86
|
} from '@finos/legend-graph';
|
|
84
87
|
import {
|
|
85
88
|
ActionAlertActionType,
|
|
@@ -115,20 +118,26 @@ const getBindingFormatter = (props: {
|
|
|
115
118
|
);
|
|
116
119
|
};
|
|
117
120
|
|
|
118
|
-
const QueryBuilderGraphFetchTreeNodeContainer: React.FC<
|
|
121
|
+
export const QueryBuilderGraphFetchTreeNodeContainer: React.FC<
|
|
119
122
|
TreeNodeContainerProps<
|
|
120
123
|
QueryBuilderGraphFetchTreeNodeData,
|
|
121
124
|
{
|
|
122
125
|
isReadOnly: boolean;
|
|
123
|
-
removeNode
|
|
126
|
+
removeNode?: (node: QueryBuilderGraphFetchTreeNodeData) => void;
|
|
124
127
|
}
|
|
125
128
|
>
|
|
126
129
|
> = (props) => {
|
|
127
130
|
const { node, level, stepPaddingInRem, onNodeSelect, innerProps } = props;
|
|
128
|
-
const { removeNode } = innerProps;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
const { isReadOnly, removeNode } = innerProps;
|
|
132
|
+
let property, type, subType;
|
|
133
|
+
if (node.tree instanceof PropertyGraphFetchTree) {
|
|
134
|
+
property = node.tree.property.value;
|
|
135
|
+
type = property.genericType.value.rawType;
|
|
136
|
+
subType = node.tree.subType?.value;
|
|
137
|
+
} else if (node.tree instanceof RootGraphFetchTree) {
|
|
138
|
+
type = node.tree.class.value;
|
|
139
|
+
}
|
|
140
|
+
|
|
132
141
|
const isExpandable = Boolean(node.childrenIds.length);
|
|
133
142
|
const nodeExpandIcon = isExpandable ? (
|
|
134
143
|
node.isOpen ? (
|
|
@@ -139,9 +148,13 @@ const QueryBuilderGraphFetchTreeNodeContainer: React.FC<
|
|
|
139
148
|
) : (
|
|
140
149
|
<div />
|
|
141
150
|
);
|
|
142
|
-
const nodeTypeIcon =
|
|
151
|
+
const nodeTypeIcon = type ? (
|
|
152
|
+
getClassPropertyIcon(type)
|
|
153
|
+
) : (
|
|
154
|
+
<PURE_UnknownElementTypeIcon />
|
|
155
|
+
);
|
|
143
156
|
const toggleExpandNode = (): void => onNodeSelect?.(node);
|
|
144
|
-
const deleteNode = (): void => removeNode(node);
|
|
157
|
+
const deleteNode = (): void => removeNode?.(node);
|
|
145
158
|
|
|
146
159
|
return (
|
|
147
160
|
<div
|
|
@@ -184,7 +197,7 @@ const QueryBuilderGraphFetchTreeNodeContainer: React.FC<
|
|
|
184
197
|
{
|
|
185
198
|
<div className="query-builder-graph-fetch-tree__node__type">
|
|
186
199
|
<div className="query-builder-graph-fetch-tree__node__type__label">
|
|
187
|
-
{type
|
|
200
|
+
{type?.name}
|
|
188
201
|
</div>
|
|
189
202
|
</div>
|
|
190
203
|
}
|
|
@@ -196,6 +209,7 @@ const QueryBuilderGraphFetchTreeNodeContainer: React.FC<
|
|
|
196
209
|
title="Remove"
|
|
197
210
|
tabIndex={-1}
|
|
198
211
|
onClick={deleteNode}
|
|
212
|
+
disabled={isReadOnly}
|
|
199
213
|
>
|
|
200
214
|
<TimesIcon />
|
|
201
215
|
</button>
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
PrimitiveType,
|
|
39
39
|
} from '@finos/legend-graph';
|
|
40
40
|
import {
|
|
41
|
+
assertErrorThrown,
|
|
41
42
|
guaranteeNonNullable,
|
|
42
43
|
parseNumber,
|
|
43
44
|
returnUndefOnError,
|
|
@@ -58,6 +59,13 @@ import {
|
|
|
58
59
|
QUERY_BUILDER_PURE_PATH,
|
|
59
60
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS,
|
|
60
61
|
} from '../../graph/QueryBuilderMetaModelConst.js';
|
|
62
|
+
import {
|
|
63
|
+
useApplicationStore,
|
|
64
|
+
type ApplicationStore,
|
|
65
|
+
type LegendApplicationConfig,
|
|
66
|
+
type LegendApplicationPlugin,
|
|
67
|
+
type LegendApplicationPluginManager,
|
|
68
|
+
} from '@finos/legend-application';
|
|
61
69
|
|
|
62
70
|
export enum CUSTOM_DATE_PICKER_OPTION {
|
|
63
71
|
ABSOLUTE_DATE = 'Absolute Date',
|
|
@@ -110,6 +118,7 @@ enum CUSTOM_DATE_OPTION_REFERENCE_MOMENT {
|
|
|
110
118
|
FIRST_DAY_OF_QUARTER = 'Start of Quarter',
|
|
111
119
|
FIRST_DAY_OF_MONTH = 'Start of Month',
|
|
112
120
|
FIRST_DAY_OF_WEEK = 'Start of Week',
|
|
121
|
+
PERVIOUS_DAY_OF_WEEK = 'Previous Day of Week',
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
/**
|
|
@@ -599,6 +608,8 @@ const buildCustomDateOptionReferenceMomentValue = (
|
|
|
599
608
|
return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH;
|
|
600
609
|
case QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK:
|
|
601
610
|
return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK;
|
|
611
|
+
case QUERY_BUILDER_SUPPORTED_FUNCTIONS.PREVIOUS_DAY_OF_WEEK:
|
|
612
|
+
return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.PERVIOUS_DAY_OF_WEEK;
|
|
602
613
|
default:
|
|
603
614
|
throw new UnsupportedOperationError(
|
|
604
615
|
`Can't build custom date option reference moment '${funcName}'`,
|
|
@@ -612,6 +623,10 @@ const buildCustomDateOptionReferenceMomentValue = (
|
|
|
612
623
|
*/
|
|
613
624
|
const buildCustomDateOption = (
|
|
614
625
|
valueSpecification: SimpleFunctionExpression | PrimitiveInstanceValue,
|
|
626
|
+
applicationStore: ApplicationStore<
|
|
627
|
+
LegendApplicationConfig,
|
|
628
|
+
LegendApplicationPluginManager<LegendApplicationPlugin>
|
|
629
|
+
>,
|
|
615
630
|
): CustomDateOption => {
|
|
616
631
|
if (
|
|
617
632
|
valueSpecification instanceof SimpleFunctionExpression &&
|
|
@@ -620,29 +635,36 @@ const buildCustomDateOption = (
|
|
|
620
635
|
QUERY_BUILDER_SUPPORTED_FUNCTIONS.ADJUST,
|
|
621
636
|
)
|
|
622
637
|
) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const matchedPreservedCustomAdjustDates = reservedCustomDateOptions.filter(
|
|
632
|
-
(t) =>
|
|
633
|
-
t.generateDisplayLabel() === customDateOption.generateDisplayLabel(),
|
|
634
|
-
);
|
|
635
|
-
if (matchedPreservedCustomAdjustDates.length > 0) {
|
|
636
|
-
customDateOption.label = guaranteeNonNullable(
|
|
637
|
-
matchedPreservedCustomAdjustDates[0]?.label,
|
|
638
|
-
);
|
|
639
|
-
customDateOption.value = guaranteeNonNullable(
|
|
640
|
-
matchedPreservedCustomAdjustDates[0]?.value,
|
|
638
|
+
try {
|
|
639
|
+
const customDateOption = new CustomDateOption(
|
|
640
|
+
'',
|
|
641
|
+
CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE,
|
|
642
|
+
buildCustomDateOptionDurationValue(valueSpecification),
|
|
643
|
+
buildCustomDateOptionUnitValue(valueSpecification),
|
|
644
|
+
buildCustomDateOptionDirectionValue(valueSpecification),
|
|
645
|
+
buildCustomDateOptionReferenceMomentValue(valueSpecification),
|
|
641
646
|
);
|
|
647
|
+
const matchedPreservedCustomAdjustDates =
|
|
648
|
+
reservedCustomDateOptions.filter(
|
|
649
|
+
(t) =>
|
|
650
|
+
t.generateDisplayLabel() ===
|
|
651
|
+
customDateOption.generateDisplayLabel(),
|
|
652
|
+
);
|
|
653
|
+
if (matchedPreservedCustomAdjustDates.length > 0) {
|
|
654
|
+
customDateOption.label = guaranteeNonNullable(
|
|
655
|
+
matchedPreservedCustomAdjustDates[0]?.label,
|
|
656
|
+
);
|
|
657
|
+
customDateOption.value = guaranteeNonNullable(
|
|
658
|
+
matchedPreservedCustomAdjustDates[0]?.value,
|
|
659
|
+
);
|
|
660
|
+
return customDateOption;
|
|
661
|
+
}
|
|
662
|
+
customDateOption.updateLabel();
|
|
642
663
|
return customDateOption;
|
|
664
|
+
} catch (error) {
|
|
665
|
+
assertErrorThrown(error);
|
|
666
|
+
applicationStore.notificationService.notifyError(error);
|
|
643
667
|
}
|
|
644
|
-
customDateOption.updateLabel();
|
|
645
|
-
return customDateOption;
|
|
646
668
|
}
|
|
647
669
|
return new CustomDateOption('', '', 0, undefined, undefined, undefined);
|
|
648
670
|
};
|
|
@@ -652,6 +674,10 @@ const buildCustomDateOption = (
|
|
|
652
674
|
*/
|
|
653
675
|
export const buildDatePickerOption = (
|
|
654
676
|
valueSpecification: SimpleFunctionExpression | PrimitiveInstanceValue,
|
|
677
|
+
applicationStore: ApplicationStore<
|
|
678
|
+
LegendApplicationConfig,
|
|
679
|
+
LegendApplicationPluginManager<LegendApplicationPlugin>
|
|
680
|
+
>,
|
|
655
681
|
): DatePickerOption => {
|
|
656
682
|
if (valueSpecification instanceof SimpleFunctionExpression) {
|
|
657
683
|
switch (getSupportedDateFunctionFullPath(valueSpecification.functionName)) {
|
|
@@ -694,7 +720,7 @@ export const buildDatePickerOption = (
|
|
|
694
720
|
.values[0]?.value.name as CUSTOM_DATE_DAY_OF_WEEK,
|
|
695
721
|
);
|
|
696
722
|
case QUERY_BUILDER_SUPPORTED_FUNCTIONS.ADJUST:
|
|
697
|
-
return buildCustomDateOption(valueSpecification);
|
|
723
|
+
return buildCustomDateOption(valueSpecification, applicationStore);
|
|
698
724
|
default:
|
|
699
725
|
return new DatePickerOption('', '');
|
|
700
726
|
}
|
|
@@ -1210,6 +1236,7 @@ export const CustomDatePicker: React.FC<{
|
|
|
1210
1236
|
observerContext,
|
|
1211
1237
|
typeCheckOption,
|
|
1212
1238
|
} = props;
|
|
1239
|
+
const applicationStore = useApplicationStore();
|
|
1213
1240
|
// For some cases where types need to be matched strictly.
|
|
1214
1241
|
// Some options need to be filtered out for DateTime.
|
|
1215
1242
|
const targetDateOptionsEnum = typeCheckOption.match
|
|
@@ -1219,7 +1246,7 @@ export const CustomDatePicker: React.FC<{
|
|
|
1219
1246
|
])
|
|
1220
1247
|
: Object.values(CUSTOM_DATE_PICKER_OPTION);
|
|
1221
1248
|
const [datePickerOption, setDatePickerOption] = useState(
|
|
1222
|
-
buildDatePickerOption(valueSpecification),
|
|
1249
|
+
buildDatePickerOption(valueSpecification, applicationStore),
|
|
1223
1250
|
);
|
|
1224
1251
|
|
|
1225
1252
|
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
|
@@ -1229,10 +1256,14 @@ export const CustomDatePicker: React.FC<{
|
|
|
1229
1256
|
setAnchorEl(event.currentTarget);
|
|
1230
1257
|
};
|
|
1231
1258
|
const handleEnter = (): void => {
|
|
1232
|
-
setDatePickerOption(
|
|
1259
|
+
setDatePickerOption(
|
|
1260
|
+
buildDatePickerOption(valueSpecification, applicationStore),
|
|
1261
|
+
);
|
|
1233
1262
|
};
|
|
1234
1263
|
const closeCustomDatePickerPopover = (): void => {
|
|
1235
|
-
setDatePickerOption(
|
|
1264
|
+
setDatePickerOption(
|
|
1265
|
+
buildDatePickerOption(valueSpecification, applicationStore),
|
|
1266
|
+
);
|
|
1236
1267
|
setAnchorEl(null);
|
|
1237
1268
|
};
|
|
1238
1269
|
const handleDatePickerOptionChange = (
|
|
@@ -1311,7 +1342,10 @@ export const CustomDatePicker: React.FC<{
|
|
|
1311
1342
|
<CustomDateInstanceValueEditor
|
|
1312
1343
|
graph={graph}
|
|
1313
1344
|
observerContext={observerContext}
|
|
1314
|
-
customDateOptionValue={buildCustomDateOption(
|
|
1345
|
+
customDateOptionValue={buildCustomDateOption(
|
|
1346
|
+
valueSpecification,
|
|
1347
|
+
applicationStore,
|
|
1348
|
+
)}
|
|
1315
1349
|
setValueSpecification={setValueSpecification}
|
|
1316
1350
|
setDatePickerOption={setDatePickerOption}
|
|
1317
1351
|
/>
|
|
@@ -1323,6 +1357,7 @@ export const CustomDatePicker: React.FC<{
|
|
|
1323
1357
|
observerContext={observerContext}
|
|
1324
1358
|
customDateAdjustOptionValue={buildDatePickerOption(
|
|
1325
1359
|
valueSpecification,
|
|
1360
|
+
applicationStore,
|
|
1326
1361
|
)}
|
|
1327
1362
|
setValueSpecification={setValueSpecification}
|
|
1328
1363
|
setDatePickerOption={setDatePickerOption}
|
|
@@ -1335,6 +1370,7 @@ export const CustomDatePicker: React.FC<{
|
|
|
1335
1370
|
observerContext={observerContext}
|
|
1336
1371
|
customDateAdjustOptionValue={buildDatePickerOption(
|
|
1337
1372
|
valueSpecification,
|
|
1373
|
+
applicationStore,
|
|
1338
1374
|
)}
|
|
1339
1375
|
setValueSpecification={setValueSpecification}
|
|
1340
1376
|
setDatePickerOption={setDatePickerOption}
|
|
@@ -1347,8 +1383,10 @@ export const CustomDatePicker: React.FC<{
|
|
|
1347
1383
|
|
|
1348
1384
|
// make sure the date picker label is updated when the value is reset or changed somehow
|
|
1349
1385
|
useEffect(() => {
|
|
1350
|
-
setDatePickerOption(
|
|
1351
|
-
|
|
1386
|
+
setDatePickerOption(
|
|
1387
|
+
buildDatePickerOption(valueSpecification, applicationStore),
|
|
1388
|
+
);
|
|
1389
|
+
}, [applicationStore, valueSpecification]);
|
|
1352
1390
|
|
|
1353
1391
|
return (
|
|
1354
1392
|
<>
|
|
@@ -55,7 +55,10 @@ export const VariableViewer = observer(
|
|
|
55
55
|
|
|
56
56
|
const getNameOfValue = (value: ValueSpecification): string | undefined => {
|
|
57
57
|
if (value instanceof SimpleFunctionExpression) {
|
|
58
|
-
const possibleDateLabel = buildDatePickerOption(
|
|
58
|
+
const possibleDateLabel = buildDatePickerOption(
|
|
59
|
+
value,
|
|
60
|
+
queryBuilderState.applicationStore,
|
|
61
|
+
).label;
|
|
59
62
|
if (possibleDateLabel) {
|
|
60
63
|
return possibleDateLabel;
|
|
61
64
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { SerializationFactory } from '@finos/legend-shared';
|
|
18
|
+
import { createModelSchema, optional, primitive } from 'serializr';
|
|
19
|
+
|
|
20
|
+
export class QueryBuilderConfig {
|
|
21
|
+
/**
|
|
22
|
+
* This flag is to disable query builder chat feature
|
|
23
|
+
*/
|
|
24
|
+
TEMPORARY__disableQueryBuilderChat = false;
|
|
25
|
+
|
|
26
|
+
static readonly serialization = new SerializationFactory(
|
|
27
|
+
createModelSchema(QueryBuilderConfig, {
|
|
28
|
+
TEMPORARY__disableQueryBuilderChat: optional(primitive()),
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ export * from './__lib__/QueryBuilderTelemetryHelper.js';
|
|
|
19
19
|
export * from './__lib__/QueryBuilderEvent.js';
|
|
20
20
|
|
|
21
21
|
export { QueryBuilder_GraphManagerPreset } from './graph-manager/QueryBuilder_GraphManagerPreset.js';
|
|
22
|
-
|
|
22
|
+
export { QueryBuilderConfig } from './graph-manager/QueryBuilderConfig.js';
|
|
23
23
|
export { QUERY_BUILDER_TEST_ID } from './__lib__/QueryBuilderTesting.js';
|
|
24
24
|
export {
|
|
25
25
|
type CheckEntitlementEditorRender,
|
|
@@ -99,6 +99,7 @@ import {
|
|
|
99
99
|
QueryBuilderExternalExecutionContextState,
|
|
100
100
|
type QueryBuilderExecutionContextState,
|
|
101
101
|
} from './QueryBuilderExecutionContextState.js';
|
|
102
|
+
import type { QueryBuilderConfig } from '../graph-manager/QueryBuilderConfig.js';
|
|
102
103
|
|
|
103
104
|
export abstract class QueryBuilderState implements CommandRegistrar {
|
|
104
105
|
readonly applicationStore: GenericLegendApplicationStore;
|
|
@@ -107,6 +108,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
107
108
|
readonly changeDetectionState: QueryBuilderChangeDetectionState;
|
|
108
109
|
readonly queryCompileState = ActionState.create();
|
|
109
110
|
readonly observerContext: ObserverContext;
|
|
111
|
+
readonly config: QueryBuilderConfig | undefined;
|
|
110
112
|
|
|
111
113
|
explorerState: QueryBuilderExplorerState;
|
|
112
114
|
functionsExplorerState: QueryFunctionsExplorerState;
|
|
@@ -140,6 +142,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
140
142
|
constructor(
|
|
141
143
|
applicationStore: GenericLegendApplicationStore,
|
|
142
144
|
graphManagerState: GraphManagerState,
|
|
145
|
+
config: QueryBuilderConfig | undefined,
|
|
143
146
|
) {
|
|
144
147
|
makeObservable(this, {
|
|
145
148
|
explorerState: observable,
|
|
@@ -207,6 +210,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
207
210
|
this.graphManagerState.pluginManager.getPureGraphManagerPlugins(),
|
|
208
211
|
);
|
|
209
212
|
this.changeDetectionState = new QueryBuilderChangeDetectionState(this);
|
|
213
|
+
this.config = config;
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
get isMappingReadOnly(): boolean {
|
|
@@ -669,6 +673,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
|
669
673
|
const basicState = new INTERNAL__BasicQueryBuilderState(
|
|
670
674
|
this.applicationStore,
|
|
671
675
|
this.graphManagerState,
|
|
676
|
+
undefined,
|
|
672
677
|
);
|
|
673
678
|
basicState.class = this.class;
|
|
674
679
|
basicState.executionContextState.mapping =
|
|
@@ -131,6 +131,7 @@ export const TEST__setUpQueryBuilderState = async (
|
|
|
131
131
|
const queryBuilderState = new INTERNAL__BasicQueryBuilderState(
|
|
132
132
|
applicationStore,
|
|
133
133
|
graphManagerState,
|
|
134
|
+
undefined,
|
|
134
135
|
);
|
|
135
136
|
if (rawLambda) {
|
|
136
137
|
queryBuilderState.initializeWithQuery(rawLambda);
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
type GraphManagerState,
|
|
21
21
|
ExecutionPlan,
|
|
22
22
|
ExecutionNode,
|
|
23
|
+
StoreMappingGlobalGraphFetchExecutionNode,
|
|
24
|
+
RelationalGraphFetchExecutionNode,
|
|
23
25
|
} from '@finos/legend-graph';
|
|
24
26
|
import type { TreeNodeData, TreeData } from '@finos/legend-art';
|
|
25
27
|
import type { GenericLegendApplicationStore } from '@finos/legend-application';
|
|
@@ -28,6 +30,7 @@ import {
|
|
|
28
30
|
filterByType,
|
|
29
31
|
guaranteeNonNullable,
|
|
30
32
|
} from '@finos/legend-shared';
|
|
33
|
+
import { generateExecutionNodeLabel } from '../../components/execution-plan/ExecutionPlanViewer.js';
|
|
31
34
|
|
|
32
35
|
export class ExecutionPlanViewTreeNodeData implements TreeNodeData {
|
|
33
36
|
id: string;
|
|
@@ -63,8 +66,14 @@ export class ExecutionNodeTreeNodeData implements TreeNodeData {
|
|
|
63
66
|
isOpen?: boolean;
|
|
64
67
|
childrenIds?: string[];
|
|
65
68
|
executionNode: ExecutionNode;
|
|
69
|
+
parentNodeId: string | undefined;
|
|
66
70
|
|
|
67
|
-
constructor(
|
|
71
|
+
constructor(
|
|
72
|
+
id: string,
|
|
73
|
+
label: string,
|
|
74
|
+
executionNode: ExecutionNode,
|
|
75
|
+
parentNodeId: string | undefined,
|
|
76
|
+
) {
|
|
68
77
|
makeObservable(this, {
|
|
69
78
|
isSelected: observable,
|
|
70
79
|
isOpen: observable,
|
|
@@ -74,6 +83,7 @@ export class ExecutionNodeTreeNodeData implements TreeNodeData {
|
|
|
74
83
|
this.id = id;
|
|
75
84
|
this.label = label;
|
|
76
85
|
this.executionNode = executionNode;
|
|
86
|
+
this.parentNodeId = parentNodeId;
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
setIsSelected(val: boolean): void {
|
|
@@ -96,6 +106,9 @@ export const generateExecutionNodeTreeNodeData = (
|
|
|
96
106
|
executionNode._UUID,
|
|
97
107
|
label,
|
|
98
108
|
executionNode,
|
|
109
|
+
parentNode instanceof ExecutionNodeTreeNodeData
|
|
110
|
+
? generateExecutionNodeLabel(parentNode.executionNode)
|
|
111
|
+
: undefined,
|
|
99
112
|
);
|
|
100
113
|
|
|
101
114
|
const childrenIds: string[] = [];
|
|
@@ -107,6 +120,27 @@ export const generateExecutionNodeTreeNodeData = (
|
|
|
107
120
|
addUniqueEntry(childrenIds, childExecutionNode._UUID);
|
|
108
121
|
});
|
|
109
122
|
|
|
123
|
+
if (executionNode instanceof StoreMappingGlobalGraphFetchExecutionNode) {
|
|
124
|
+
addUniqueEntry(
|
|
125
|
+
childrenIds,
|
|
126
|
+
executionNode.localGraphFetchExecutionNode._UUID,
|
|
127
|
+
);
|
|
128
|
+
executionNode.children
|
|
129
|
+
.slice()
|
|
130
|
+
.filter(filterByType(ExecutionNode))
|
|
131
|
+
.forEach((childExecutionNode) => {
|
|
132
|
+
addUniqueEntry(childrenIds, childExecutionNode._UUID);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (executionNode instanceof RelationalGraphFetchExecutionNode) {
|
|
137
|
+
executionNode.children
|
|
138
|
+
.slice()
|
|
139
|
+
.filter(filterByType(ExecutionNode))
|
|
140
|
+
.forEach((childExecutionNode) => {
|
|
141
|
+
addUniqueEntry(childrenIds, childExecutionNode._UUID);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
110
144
|
executionNodeTreeNode.childrenIds = childrenIds;
|
|
111
145
|
|
|
112
146
|
return executionNodeTreeNode;
|
|
@@ -149,6 +183,32 @@ export enum EXECUTION_PLAN_VIEW_MODE {
|
|
|
149
183
|
JSON = 'JSON',
|
|
150
184
|
}
|
|
151
185
|
|
|
186
|
+
export enum PLAN_TABS {
|
|
187
|
+
GENERAL = 'GENERAL',
|
|
188
|
+
GLOBAL_IMPLEMENTATION_SUPPORT = 'GLOBAL_IMPLEMENTATION_SUPPORT',
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
class GlobalImplementationSupportState {
|
|
192
|
+
selectedTab: PLAN_TABS = PLAN_TABS.GENERAL;
|
|
193
|
+
selectedJavaClass: string | undefined = undefined;
|
|
194
|
+
constructor() {
|
|
195
|
+
makeObservable(this, {
|
|
196
|
+
selectedTab: observable,
|
|
197
|
+
selectedJavaClass: observable,
|
|
198
|
+
setSelectedTab: action,
|
|
199
|
+
setSelectedJavaClass: action,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
setSelectedTab(tab: PLAN_TABS): void {
|
|
204
|
+
this.selectedTab = tab;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
setSelectedJavaClass(javaClass: string | undefined): void {
|
|
208
|
+
this.selectedJavaClass = javaClass;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
152
212
|
export class ExecutionPlanState {
|
|
153
213
|
applicationStore: GenericLegendApplicationStore;
|
|
154
214
|
graphManagerState: GraphManagerState;
|
|
@@ -165,6 +225,8 @@ export class ExecutionPlanState {
|
|
|
165
225
|
rawPlan?: RawExecutionPlan | undefined;
|
|
166
226
|
plan?: ExecutionPlan | undefined;
|
|
167
227
|
debugText?: string | undefined;
|
|
228
|
+
globalImplementationSupportState: GlobalImplementationSupportState =
|
|
229
|
+
new GlobalImplementationSupportState();
|
|
168
230
|
|
|
169
231
|
constructor(
|
|
170
232
|
applicationStore: GenericLegendApplicationStore,
|
|
@@ -191,6 +253,7 @@ export class ExecutionPlanState {
|
|
|
191
253
|
refreshTreeData: action,
|
|
192
254
|
nonNullableTreeData: computed,
|
|
193
255
|
initialize: action,
|
|
256
|
+
globalImplementationSupportState: observable,
|
|
194
257
|
});
|
|
195
258
|
this.applicationStore = applicationStore;
|
|
196
259
|
this.graphManagerState = graphManagerState;
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
RootGraphFetchTree,
|
|
26
26
|
getAllSuperclasses,
|
|
27
27
|
type Binding,
|
|
28
|
+
PropertyGraphFetchTree,
|
|
28
29
|
} from '@finos/legend-graph';
|
|
29
30
|
import {
|
|
30
31
|
type QueryBuilderGraphFetchTreeData,
|
|
@@ -323,12 +324,18 @@ export class QueryBuilderGraphFetchTreeState
|
|
|
323
324
|
? // since we traverse the nodes in order, parent node ID should already been computed
|
|
324
325
|
guaranteeNonNullable(explorerTreeNodeIDIndex.get(node.parentId))
|
|
325
326
|
: '';
|
|
327
|
+
let generateID = '';
|
|
328
|
+
if (node.tree instanceof RootGraphFetchTree) {
|
|
329
|
+
generateID = `root.${node.tree.class.valueForSerialization ?? ''}`;
|
|
330
|
+
} else if (node.tree instanceof PropertyGraphFetchTree) {
|
|
331
|
+
generateID = node.tree.property.value.name;
|
|
332
|
+
}
|
|
326
333
|
const propertyNodeID = generateExplorerTreePropertyNodeID(
|
|
327
334
|
parentNodeID,
|
|
328
|
-
|
|
335
|
+
generateID,
|
|
329
336
|
);
|
|
330
337
|
ids.push(propertyNodeID);
|
|
331
|
-
if (node.tree.subType) {
|
|
338
|
+
if (node.tree instanceof PropertyGraphFetchTree && node.tree.subType) {
|
|
332
339
|
nodeID = generateExplorerTreeSubtypeNodeID(
|
|
333
340
|
propertyNodeID,
|
|
334
341
|
node.tree.subType.value.path,
|
|
@@ -502,11 +509,14 @@ export class QueryBuilderGraphFetchTreeState
|
|
|
502
509
|
|
|
503
510
|
isVariableUsed(variable: VariableExpression): boolean {
|
|
504
511
|
return Boolean(
|
|
505
|
-
Array.from(this.treeData?.nodes.values() ?? []).find((node) =>
|
|
506
|
-
node.tree
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
512
|
+
Array.from(this.treeData?.nodes.values() ?? []).find((node) => {
|
|
513
|
+
if (node.tree instanceof PropertyGraphFetchTree) {
|
|
514
|
+
return node.tree.parameters.find((p) =>
|
|
515
|
+
isValueExpressionReferencedInValue(variable, p),
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
return undefined;
|
|
519
|
+
}),
|
|
510
520
|
);
|
|
511
521
|
}
|
|
512
522
|
|