@finos/legend-application-query 13.6.8 → 13.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/application/LegendQueryApplicationConfig.d.ts +1 -0
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +2 -0
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -2
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +157 -4
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +9 -2
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +2 -2
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +38 -10
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -3
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js +0 -1
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +13 -2
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +135 -30
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +2 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +8 -12
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +1 -0
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +1 -0
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +3 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +41 -24
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/package.json +8 -8
- package/src/application/LegendQueryApplicationConfig.ts +3 -0
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +281 -7
- package/src/components/QueryEditor.tsx +25 -1
- package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +62 -24
- package/src/stores/LegendQueryApplicationPlugin.tsx +6 -5
- package/src/stores/QueryEditorStore.ts +254 -53
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +17 -28
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +1 -0
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +73 -51
@@ -15,9 +15,9 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import {
|
18
|
+
type QuerySetupActionConfiguration,
|
18
19
|
LegendQueryApplicationPlugin,
|
19
20
|
QuerySetupActionTag,
|
20
|
-
type QuerySetupActionConfiguration,
|
21
21
|
} from '../stores/LegendQueryApplicationPlugin.js';
|
22
22
|
import packageJson from '../../package.json' with { type: 'json' };
|
23
23
|
import type { QuerySetupLandingPageStore } from '../stores/QuerySetupStore.js';
|
@@ -50,10 +50,10 @@ import {
|
|
50
50
|
LEGEND_QUERY_ROUTE_PATTERN,
|
51
51
|
} from '../__lib__/LegendQueryNavigation.js';
|
52
52
|
import {
|
53
|
-
ActionAlertActionType,
|
54
|
-
ActionAlertType,
|
55
53
|
type ApplicationPageEntry,
|
56
54
|
type LegendApplicationSetup,
|
55
|
+
ActionAlertActionType,
|
56
|
+
ActionAlertType,
|
57
57
|
} from '@finos/legend-application';
|
58
58
|
import { CloneQueryServiceSetup } from './CloneQueryServiceSetup.js';
|
59
59
|
import { QueryProductionizerSetup } from './QueryProductionizerSetup.js';
|
@@ -65,9 +65,11 @@ import {
|
|
65
65
|
generateDataSpaceQuerySetupRoute,
|
66
66
|
} from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
67
67
|
import {
|
68
|
-
|
68
|
+
type QueryBuilderState,
|
69
69
|
type QueryBuilderHeaderActionConfiguration,
|
70
70
|
type QueryBuilderMenuActionConfiguration,
|
71
|
+
type QueryBuilderPropagateExecutionContextChangeHelper,
|
72
|
+
QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
|
71
73
|
} from '@finos/legend-query-builder';
|
72
74
|
import {
|
73
75
|
ExistingQueryEditorStore,
|
@@ -75,18 +77,48 @@ import {
|
|
75
77
|
} from '../stores/QueryEditorStore.js';
|
76
78
|
import {
|
77
79
|
DataSpaceQueryBuilderState,
|
80
|
+
DataSpacesDepotRepository,
|
78
81
|
generateDataSpaceTemplateQueryPromotionRoute,
|
79
82
|
} from '@finos/legend-extension-dsl-data-space/application';
|
80
|
-
import {
|
83
|
+
import {
|
84
|
+
createGraphBuilderReport,
|
85
|
+
GRAPH_MANAGER_EVENT,
|
86
|
+
LegendSDLC,
|
87
|
+
PackageableElementPointerType,
|
88
|
+
resolvePackagePathAndElementName,
|
89
|
+
RuntimePointer,
|
90
|
+
V1_EngineRuntime,
|
91
|
+
V1_Mapping,
|
92
|
+
V1_PackageableElementPointer,
|
93
|
+
V1_PackageableRuntime,
|
94
|
+
V1_PureGraphManager,
|
95
|
+
} from '@finos/legend-graph';
|
81
96
|
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
82
|
-
import { StoreProjectData } from '@finos/legend-server-depot';
|
83
|
-
import {
|
97
|
+
import { resolveVersion, StoreProjectData } from '@finos/legend-server-depot';
|
98
|
+
import {
|
99
|
+
ActionState,
|
100
|
+
assertErrorThrown,
|
101
|
+
buildUrl,
|
102
|
+
getNullableFirstEntry,
|
103
|
+
guaranteeNonNullable,
|
104
|
+
guaranteeType,
|
105
|
+
LogEvent,
|
106
|
+
StopWatch,
|
107
|
+
uniq,
|
108
|
+
} from '@finos/legend-shared';
|
84
109
|
import { parseProjectIdentifier } from '@finos/legend-storage';
|
85
110
|
import { QueryEditorExistingQueryHeader } from './QueryEditor.js';
|
86
111
|
import { DataSpaceTemplateQueryCreatorStore } from '../stores/data-space/DataSpaceTemplateQueryCreatorStore.js';
|
87
112
|
import { createViewSDLCProjectHandler } from '../stores/data-space/DataSpaceQueryBuilderHelper.js';
|
88
113
|
import { DataSpaceQueryCreatorStore } from '../stores/data-space/DataSpaceQueryCreatorStore.js';
|
89
114
|
import { configureCodeEditorComponent } from '@finos/legend-lego/code-editor';
|
115
|
+
import {
|
116
|
+
resolveUsableDataSpaceClasses,
|
117
|
+
V1_DataSpace,
|
118
|
+
V1_DataSpaceExecutionContext,
|
119
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
120
|
+
import { flowResult } from 'mobx';
|
121
|
+
import { LEGEND_QUERY_APP_EVENT } from '../__lib__/LegendQueryEvent.js';
|
90
122
|
|
91
123
|
export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlugin {
|
92
124
|
static NAME = packageJson.extensions.applicationQueryPlugin;
|
@@ -725,4 +757,246 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
|
|
725
757
|
},
|
726
758
|
};
|
727
759
|
}
|
760
|
+
|
761
|
+
getExtraQueryBuilderPropagateExecutionContextChangeHelper?(): QueryBuilderPropagateExecutionContextChangeHelper[] {
|
762
|
+
return [
|
763
|
+
(
|
764
|
+
queryBuilderState: QueryBuilderState,
|
765
|
+
isGraphBuildingNotRequired?: boolean,
|
766
|
+
): (() => Promise<void>) | undefined => {
|
767
|
+
/**
|
768
|
+
* Propagation after changing the execution context:
|
769
|
+
* - The mapping will be updated to the mapping of the execution context
|
770
|
+
* - The runtime will be updated to the default runtime of the execution context
|
771
|
+
* - If no class is chosen, try to choose a compatible class
|
772
|
+
* - If the chosen class is compatible with the new selected execution context mapping, do nothing, otherwise, try to choose a compatible class
|
773
|
+
*/
|
774
|
+
const propagateExecutionContextChange = async (): Promise<void> => {
|
775
|
+
const dataSpaceQueryBuilderState = guaranteeType(
|
776
|
+
queryBuilderState,
|
777
|
+
DataSpaceQueryBuilderState,
|
778
|
+
);
|
779
|
+
const mapping =
|
780
|
+
dataSpaceQueryBuilderState.executionContext.mapping.value;
|
781
|
+
const mappingModelCoverageAnalysisResult =
|
782
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult?.mappingToMappingCoverageResult?.get(
|
783
|
+
mapping.path,
|
784
|
+
);
|
785
|
+
const editorStore = (
|
786
|
+
queryBuilderState.workflowState
|
787
|
+
.actionConfig as QueryBuilderActionConfig_QueryApplication
|
788
|
+
).editorStore;
|
789
|
+
if (
|
790
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult &&
|
791
|
+
mappingModelCoverageAnalysisResult
|
792
|
+
) {
|
793
|
+
if (
|
794
|
+
!isGraphBuildingNotRequired &&
|
795
|
+
dataSpaceQueryBuilderState.isLightGraphEnabled
|
796
|
+
) {
|
797
|
+
const supportBuildMinimalGraph =
|
798
|
+
editorStore.applicationStore.config.options
|
799
|
+
.TEMPORARY__enableMinimalGraph;
|
800
|
+
if (
|
801
|
+
editorStore.enableMinialGraphForDataSpaceLoadingPerformance &&
|
802
|
+
supportBuildMinimalGraph
|
803
|
+
) {
|
804
|
+
try {
|
805
|
+
const stopWatch = new StopWatch();
|
806
|
+
const graph =
|
807
|
+
dataSpaceQueryBuilderState.graphManagerState.createNewGraph();
|
808
|
+
const graph_buildReport = createGraphBuilderReport();
|
809
|
+
const graphManager = guaranteeType(
|
810
|
+
dataSpaceQueryBuilderState.graphManagerState.graphManager,
|
811
|
+
V1_PureGraphManager,
|
812
|
+
);
|
813
|
+
// Create dummy mappings and runtimes
|
814
|
+
// TODO?: these stubbed mappings and runtimes are not really useful that useful, so either we should
|
815
|
+
// simplify the model here or potentially refactor the backend analytics endpoint to return these as model
|
816
|
+
const mappingModels = uniq(
|
817
|
+
Array.from(
|
818
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
|
819
|
+
).map((context) => context.mapping),
|
820
|
+
).map((m) => {
|
821
|
+
const _mapping = new V1_Mapping();
|
822
|
+
const [packagePath, name] =
|
823
|
+
resolvePackagePathAndElementName(m.path);
|
824
|
+
_mapping.package = packagePath;
|
825
|
+
_mapping.name = name;
|
826
|
+
return graphManager.elementProtocolToEntity(_mapping);
|
827
|
+
});
|
828
|
+
const runtimeModels = uniq(
|
829
|
+
Array.from(
|
830
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
|
831
|
+
)
|
832
|
+
.map((context) => context.defaultRuntime)
|
833
|
+
.concat(
|
834
|
+
Array.from(
|
835
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
|
836
|
+
).flatMap((val) => val.compatibleRuntimes),
|
837
|
+
),
|
838
|
+
).map((r) => {
|
839
|
+
const runtime = new V1_PackageableRuntime();
|
840
|
+
const [packagePath, name] =
|
841
|
+
resolvePackagePathAndElementName(r.path);
|
842
|
+
runtime.package = packagePath;
|
843
|
+
runtime.name = name;
|
844
|
+
runtime.runtimeValue = new V1_EngineRuntime();
|
845
|
+
return graphManager.elementProtocolToEntity(runtime);
|
846
|
+
});
|
847
|
+
// The DataSpace entity is excluded from AnalyticsResult.Json to reduce the JSON size
|
848
|
+
// because all its information can be found in V1_DataSpaceAnalysisResult.
|
849
|
+
// Therefore, we are building a simple v1_DataSpace entity based on V1_DataSpaceAnalysisResult.
|
850
|
+
const dataspaceProtocol = new V1_DataSpace();
|
851
|
+
dataspaceProtocol.name =
|
852
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.name;
|
853
|
+
dataspaceProtocol.package =
|
854
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.package;
|
855
|
+
dataspaceProtocol.supportInfo =
|
856
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.supportInfo;
|
857
|
+
dataspaceProtocol.executionContexts = Array.from(
|
858
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult
|
859
|
+
.executionContextsIndex,
|
860
|
+
).map(([key, execContext]) => {
|
861
|
+
const contextProtocol = new V1_DataSpaceExecutionContext();
|
862
|
+
contextProtocol.name = execContext.name;
|
863
|
+
contextProtocol.title = execContext.title;
|
864
|
+
contextProtocol.description = execContext.description;
|
865
|
+
contextProtocol.mapping = new V1_PackageableElementPointer(
|
866
|
+
PackageableElementPointerType.MAPPING,
|
867
|
+
execContext.mapping.path,
|
868
|
+
);
|
869
|
+
contextProtocol.defaultRuntime =
|
870
|
+
new V1_PackageableElementPointer(
|
871
|
+
PackageableElementPointerType.RUNTIME,
|
872
|
+
execContext.defaultRuntime.path,
|
873
|
+
);
|
874
|
+
return contextProtocol;
|
875
|
+
});
|
876
|
+
dataspaceProtocol.defaultExecutionContext =
|
877
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.defaultExecutionContext.name;
|
878
|
+
dataspaceProtocol.title =
|
879
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.title;
|
880
|
+
dataspaceProtocol.description =
|
881
|
+
dataSpaceQueryBuilderState.dataSpaceAnalysisResult.description;
|
882
|
+
const dataspaceEntity =
|
883
|
+
graphManager.elementProtocolToEntity(dataspaceProtocol);
|
884
|
+
|
885
|
+
const graphEntities = guaranteeNonNullable(
|
886
|
+
mappingModelCoverageAnalysisResult.entities,
|
887
|
+
)
|
888
|
+
.concat(mappingModels)
|
889
|
+
.concat(runtimeModels)
|
890
|
+
.concat(dataspaceEntity)
|
891
|
+
// NOTE: if an element could be found in the graph already it means it comes from system
|
892
|
+
// so we could rid of it
|
893
|
+
.filter(
|
894
|
+
(el) =>
|
895
|
+
!graph.getNullableElement(el.path, false) &&
|
896
|
+
!el.path.startsWith('meta::'),
|
897
|
+
);
|
898
|
+
let option;
|
899
|
+
if (
|
900
|
+
dataSpaceQueryBuilderState.dataSpaceRepo instanceof
|
901
|
+
DataSpacesDepotRepository
|
902
|
+
) {
|
903
|
+
option = new LegendSDLC(
|
904
|
+
dataSpaceQueryBuilderState.dataSpaceRepo.project.groupId,
|
905
|
+
dataSpaceQueryBuilderState.dataSpaceRepo.project.artifactId,
|
906
|
+
resolveVersion(
|
907
|
+
dataSpaceQueryBuilderState.dataSpaceRepo.project
|
908
|
+
.versionId,
|
909
|
+
),
|
910
|
+
);
|
911
|
+
}
|
912
|
+
await dataSpaceQueryBuilderState.graphManagerState.graphManager.buildGraph(
|
913
|
+
graph,
|
914
|
+
graphEntities,
|
915
|
+
ActionState.create(),
|
916
|
+
option
|
917
|
+
? {
|
918
|
+
origin: option,
|
919
|
+
}
|
920
|
+
: {},
|
921
|
+
graph_buildReport,
|
922
|
+
);
|
923
|
+
dataSpaceQueryBuilderState.graphManagerState.graph = graph;
|
924
|
+
const dependency_buildReport = createGraphBuilderReport();
|
925
|
+
// report
|
926
|
+
stopWatch.record(
|
927
|
+
GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS,
|
928
|
+
);
|
929
|
+
const graphBuilderReportData = {
|
930
|
+
timings:
|
931
|
+
dataSpaceQueryBuilderState.applicationStore.timeService.finalizeTimingsRecord(
|
932
|
+
stopWatch,
|
933
|
+
),
|
934
|
+
dependencies: dependency_buildReport,
|
935
|
+
dependenciesCount:
|
936
|
+
dataSpaceQueryBuilderState.graphManagerState.graph
|
937
|
+
.dependencyManager.numberOfDependencies,
|
938
|
+
graph: graph_buildReport,
|
939
|
+
};
|
940
|
+
editorStore.logBuildGraphMetrics(graphBuilderReportData);
|
941
|
+
dataSpaceQueryBuilderState.applicationStore.logService.info(
|
942
|
+
LogEvent.create(
|
943
|
+
GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS,
|
944
|
+
),
|
945
|
+
graphBuilderReportData,
|
946
|
+
);
|
947
|
+
} catch (error) {
|
948
|
+
assertErrorThrown(error);
|
949
|
+
editorStore.applicationStore.logService.error(
|
950
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
951
|
+
error,
|
952
|
+
);
|
953
|
+
editorStore.graphManagerState.graph =
|
954
|
+
editorStore.graphManagerState.createNewGraph();
|
955
|
+
await flowResult(editorStore.buildFullGraph());
|
956
|
+
}
|
957
|
+
} else {
|
958
|
+
editorStore.graphManagerState.graph =
|
959
|
+
editorStore.graphManagerState.createNewGraph();
|
960
|
+
await flowResult(editorStore.buildFullGraph());
|
961
|
+
}
|
962
|
+
}
|
963
|
+
dataSpaceQueryBuilderState.explorerState.mappingModelCoverageAnalysisResult =
|
964
|
+
mappingModelCoverageAnalysisResult;
|
965
|
+
}
|
966
|
+
const compatibleClasses = resolveUsableDataSpaceClasses(
|
967
|
+
dataSpaceQueryBuilderState.dataSpace,
|
968
|
+
mapping,
|
969
|
+
dataSpaceQueryBuilderState.graphManagerState,
|
970
|
+
dataSpaceQueryBuilderState,
|
971
|
+
);
|
972
|
+
dataSpaceQueryBuilderState.changeMapping(mapping);
|
973
|
+
dataSpaceQueryBuilderState.changeRuntime(
|
974
|
+
new RuntimePointer(
|
975
|
+
dataSpaceQueryBuilderState.executionContext.defaultRuntime,
|
976
|
+
),
|
977
|
+
);
|
978
|
+
// if there is no chosen class or the chosen one is not compatible
|
979
|
+
// with the mapping then pick a compatible class if possible
|
980
|
+
if (
|
981
|
+
!dataSpaceQueryBuilderState.class ||
|
982
|
+
!compatibleClasses.includes(dataSpaceQueryBuilderState.class)
|
983
|
+
) {
|
984
|
+
const possibleNewClass = getNullableFirstEntry(compatibleClasses);
|
985
|
+
if (possibleNewClass) {
|
986
|
+
dataSpaceQueryBuilderState.changeClass(possibleNewClass);
|
987
|
+
}
|
988
|
+
}
|
989
|
+
dataSpaceQueryBuilderState.explorerState.refreshTreeData();
|
990
|
+
};
|
991
|
+
if (
|
992
|
+
queryBuilderState instanceof DataSpaceQueryBuilderState &&
|
993
|
+
queryBuilderState.workflowState.actionConfig instanceof
|
994
|
+
QueryBuilderActionConfig_QueryApplication
|
995
|
+
) {
|
996
|
+
return propagateExecutionContextChange;
|
997
|
+
}
|
998
|
+
return undefined;
|
999
|
+
},
|
1000
|
+
];
|
1001
|
+
}
|
728
1002
|
}
|
@@ -605,6 +605,12 @@ export const QueryEditor = observer(() => {
|
|
605
605
|
!engineConfig.useClientRequestPayloadCompression,
|
606
606
|
);
|
607
607
|
|
608
|
+
const toggleEnableMinialGraphForDataSpaceLoadingPerformance = (): void => {
|
609
|
+
editorStore.setEnableMinialGraphForDataSpaceLoadingPerformance(
|
610
|
+
!editorStore.enableMinialGraphForDataSpaceLoadingPerformance,
|
611
|
+
);
|
612
|
+
};
|
613
|
+
|
608
614
|
const TEMPORARY__toggleLightDarkMode = (): void => {
|
609
615
|
applicationStore.layoutService.setColorTheme(
|
610
616
|
applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
@@ -629,7 +635,11 @@ export const QueryEditor = observer(() => {
|
|
629
635
|
applicationStore.alertUnhandledError,
|
630
636
|
);
|
631
637
|
applicationStore.releaseNotesService.updateViewedVersion();
|
632
|
-
}, [
|
638
|
+
}, [
|
639
|
+
editorStore,
|
640
|
+
applicationStore,
|
641
|
+
editorStore.enableMinialGraphForDataSpaceLoadingPerformance,
|
642
|
+
]);
|
633
643
|
|
634
644
|
return (
|
635
645
|
<div className="query-editor">
|
@@ -676,6 +686,20 @@ export const QueryEditor = observer(() => {
|
|
676
686
|
Compress request payload
|
677
687
|
</MenuContentItemLabel>
|
678
688
|
</MenuContentItem>
|
689
|
+
<MenuContentItem
|
690
|
+
onClick={
|
691
|
+
toggleEnableMinialGraphForDataSpaceLoadingPerformance
|
692
|
+
}
|
693
|
+
>
|
694
|
+
<MenuContentItemIcon>
|
695
|
+
{editorStore.enableMinialGraphForDataSpaceLoadingPerformance ? (
|
696
|
+
<CheckIcon />
|
697
|
+
) : null}
|
698
|
+
</MenuContentItemIcon>
|
699
|
+
<MenuContentItemLabel>
|
700
|
+
Enable minimal graph
|
701
|
+
</MenuContentItemLabel>
|
702
|
+
</MenuContentItem>
|
679
703
|
</MenuContent>
|
680
704
|
}
|
681
705
|
>
|
@@ -25,12 +25,15 @@ import { createMock, createSpy } from '@finos/legend-shared/test';
|
|
25
25
|
import {
|
26
26
|
type GraphManagerState,
|
27
27
|
type RawMappingModelCoverageAnalysisResult,
|
28
|
+
type QueryInfo,
|
28
29
|
Query,
|
29
30
|
LightQuery,
|
30
31
|
RawLambda,
|
31
|
-
PackageableElementExplicitReference,
|
32
32
|
QueryExplicitExecutionContext,
|
33
33
|
QueryDataSpaceExecutionContext,
|
34
|
+
PackageableElementExplicitReference,
|
35
|
+
QueryDataSpaceExecutionContextInfo,
|
36
|
+
QueryExplicitExecutionContextInfo,
|
34
37
|
} from '@finos/legend-graph';
|
35
38
|
import { DepotServerClient } from '@finos/legend-server-depot';
|
36
39
|
import {
|
@@ -104,7 +107,7 @@ export const TEST__provideMockedQueryEditorStore = (customization?: {
|
|
104
107
|
|
105
108
|
export const TEST__setUpQueryEditor = async (
|
106
109
|
MOCK__editorStore: ExistingQueryEditorStore,
|
107
|
-
entities: Entity[],
|
110
|
+
entities: PlainObject<Entity>[],
|
108
111
|
lambda: RawLambda,
|
109
112
|
mappingPath: string,
|
110
113
|
runtimePath: string,
|
@@ -142,7 +145,7 @@ export const TEST__setUpQueryEditor = async (
|
|
142
145
|
await graphManagerState.initializeSystem();
|
143
146
|
await graphManagerState.graphManager.buildGraph(
|
144
147
|
graphManagerState.graph,
|
145
|
-
entities,
|
148
|
+
entities as unknown as Entity[],
|
146
149
|
graphManagerState.graphBuildState,
|
147
150
|
);
|
148
151
|
|
@@ -162,13 +165,36 @@ export const TEST__setUpQueryEditor = async (
|
|
162
165
|
);
|
163
166
|
query.executionContext = execContext;
|
164
167
|
query.content = 'some content';
|
168
|
+
|
169
|
+
const execContextInfo = new QueryExplicitExecutionContextInfo();
|
170
|
+
execContextInfo.mapping = mappingPath;
|
171
|
+
execContextInfo.runtime = runtimePath;
|
172
|
+
|
173
|
+
const queryInfo: QueryInfo = {
|
174
|
+
name: TEST_QUERY_NAME,
|
175
|
+
id: TEST_QUERY_ID,
|
176
|
+
versionId: '0.0.0',
|
177
|
+
groupId: 'test.group',
|
178
|
+
artifactId: 'test-artifact',
|
179
|
+
executionContext: execContextInfo,
|
180
|
+
content: 'some content',
|
181
|
+
isCurrentUserQuery: true,
|
182
|
+
};
|
183
|
+
|
165
184
|
createSpy(
|
166
185
|
MOCK__editorStore.depotServerClient,
|
167
186
|
'getProject',
|
168
187
|
).mockResolvedValue(projectData);
|
188
|
+
createSpy(
|
189
|
+
MOCK__editorStore.depotServerClient,
|
190
|
+
'getEntities',
|
191
|
+
).mockResolvedValue(entities);
|
169
192
|
createSpy(graphManagerState.graphManager, 'getLightQuery').mockResolvedValue(
|
170
193
|
lightQuery,
|
171
194
|
);
|
195
|
+
createSpy(graphManagerState.graphManager, 'getQueryInfo').mockResolvedValue(
|
196
|
+
queryInfo,
|
197
|
+
);
|
172
198
|
createSpy(
|
173
199
|
graphManagerState.graphManager,
|
174
200
|
'pureCodeToLambda',
|
@@ -222,16 +248,22 @@ export const TEST__setUpQueryEditor = async (
|
|
222
248
|
|
223
249
|
export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
224
250
|
MOCK__editorStore: ExistingQueryEditorStore,
|
225
|
-
|
251
|
+
V1_dataspaceAnalyticsResult: PlainObject<V1_DataSpaceAnalysisResult>,
|
226
252
|
dataSpacePath: string,
|
227
253
|
executionContext: string,
|
228
254
|
lambda: RawLambda,
|
229
255
|
mappingPath: string,
|
230
|
-
entities: Entity[],
|
256
|
+
entities: PlainObject<Entity>[],
|
257
|
+
buildWithMinimalGraph = false,
|
231
258
|
): Promise<{
|
232
259
|
renderResult: RenderResult;
|
233
260
|
queryBuilderState: QueryBuilderState;
|
234
261
|
}> => {
|
262
|
+
if (buildWithMinimalGraph) {
|
263
|
+
MOCK__editorStore.applicationStore.config.options.TEMPORARY__enableMinimalGraph =
|
264
|
+
true;
|
265
|
+
}
|
266
|
+
|
235
267
|
const projectData = {
|
236
268
|
id: 'test-id',
|
237
269
|
groupId: 'test.group',
|
@@ -259,11 +291,6 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
|
259
291
|
});
|
260
292
|
|
261
293
|
await graphManagerState.initializeSystem();
|
262
|
-
await graphManagerState.graphManager.buildGraph(
|
263
|
-
graphManagerState.graph,
|
264
|
-
entities,
|
265
|
-
graphManagerState.graphBuildState,
|
266
|
-
);
|
267
294
|
|
268
295
|
const query = new Query();
|
269
296
|
query.name = lightQuery.name;
|
@@ -278,6 +305,22 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
|
278
305
|
execContext.executionKey = executionContext;
|
279
306
|
query.executionContext = execContext;
|
280
307
|
query.content = 'some content';
|
308
|
+
|
309
|
+
const execContextInfo = new QueryDataSpaceExecutionContextInfo();
|
310
|
+
execContextInfo.dataSpacePath = dataSpacePath;
|
311
|
+
execContextInfo.executionKey = executionContext;
|
312
|
+
|
313
|
+
const queryInfo: QueryInfo = {
|
314
|
+
name: TEST_QUERY_NAME,
|
315
|
+
id: TEST_QUERY_ID,
|
316
|
+
versionId: '0.0.0',
|
317
|
+
groupId: 'test.group',
|
318
|
+
artifactId: 'test-artifact',
|
319
|
+
executionContext: execContextInfo,
|
320
|
+
content: 'some content',
|
321
|
+
isCurrentUserQuery: true,
|
322
|
+
};
|
323
|
+
|
281
324
|
createSpy(
|
282
325
|
MOCK__editorStore.depotServerClient,
|
283
326
|
'getProject',
|
@@ -285,7 +328,7 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
|
285
328
|
createSpy(
|
286
329
|
MOCK__editorStore.depotServerClient,
|
287
330
|
'getEntities',
|
288
|
-
).mockResolvedValue([]);
|
331
|
+
).mockResolvedValue(buildWithMinimalGraph ? [] : entities);
|
289
332
|
createSpy(
|
290
333
|
MOCK__editorStore.depotServerClient,
|
291
334
|
'getIndexedDependencyEntities',
|
@@ -294,6 +337,10 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
|
294
337
|
MOCK__editorStore.depotServerClient,
|
295
338
|
'getEntitiesByClassifier',
|
296
339
|
).mockResolvedValue([]);
|
340
|
+
createSpy(
|
341
|
+
MOCK__editorStore.depotServerClient,
|
342
|
+
'getGenerationContentByPath',
|
343
|
+
).mockResolvedValue(JSON.stringify(V1_dataspaceAnalyticsResult));
|
297
344
|
createSpy(graphManagerState.graphManager, 'getLightQuery').mockResolvedValue(
|
298
345
|
lightQuery,
|
299
346
|
);
|
@@ -308,10 +355,9 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
|
308
355
|
createSpy(graphManagerState.graphManager, 'getQuery').mockResolvedValue(
|
309
356
|
query,
|
310
357
|
);
|
311
|
-
createSpy(
|
312
|
-
|
313
|
-
|
314
|
-
).mockResolvedValue('');
|
358
|
+
createSpy(graphManagerState.graphManager, 'getQueryInfo').mockResolvedValue(
|
359
|
+
queryInfo,
|
360
|
+
);
|
315
361
|
createSpy(graphManagerState.graphManager, 'surveyDatasets').mockResolvedValue(
|
316
362
|
[],
|
317
363
|
);
|
@@ -325,20 +371,12 @@ export const TEST__setUpDataSpaceExistingQueryEditor = async (
|
|
325
371
|
);
|
326
372
|
const dataspaceAnalyticsResult =
|
327
373
|
await graphManagerExtension.buildDataSpaceAnalytics(
|
328
|
-
|
374
|
+
V1_dataspaceAnalyticsResult,
|
329
375
|
graphManagerState.graphManager.pluginManager.getPureProtocolProcessorPlugins(),
|
330
376
|
);
|
331
377
|
createSpy(graphManagerExtension, 'analyzeDataSpace').mockResolvedValue(
|
332
378
|
dataspaceAnalyticsResult,
|
333
379
|
);
|
334
|
-
const mappingAnalyticsResult =
|
335
|
-
dataspaceAnalyticsResult.mappingToMappingCoverageResult?.get(mappingPath);
|
336
|
-
if (mappingAnalyticsResult) {
|
337
|
-
createSpy(
|
338
|
-
graphManagerState.graphManager,
|
339
|
-
'analyzeMappingModelCoverage',
|
340
|
-
).mockResolvedValue(mappingAnalyticsResult);
|
341
|
-
}
|
342
380
|
|
343
381
|
MOCK__editorStore.buildGraph = createMock();
|
344
382
|
graphManagerState.graphManager.initialize = createMock();
|
@@ -15,17 +15,18 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { LegendApplicationPlugin } from '@finos/legend-application';
|
18
|
-
import type { Query } from '@finos/legend-graph';
|
19
18
|
import type {
|
20
|
-
QueryBuilderState,
|
21
19
|
QueryBuilder_LegendApplicationPlugin_Extension,
|
20
|
+
QueryBuilderState,
|
22
21
|
} from '@finos/legend-query-builder';
|
22
|
+
import type React from 'react';
|
23
23
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
24
|
-
import {
|
25
|
-
|
26
|
-
|
24
|
+
import type {
|
25
|
+
ExistingQueryEditorStore,
|
26
|
+
QueryEditorStore,
|
27
27
|
} from './QueryEditorStore.js';
|
28
28
|
import type { QuerySetupLandingPageStore } from './QuerySetupStore.js';
|
29
|
+
import type { Query } from '@finos/legend-graph';
|
29
30
|
|
30
31
|
export enum QuerySetupActionTag {
|
31
32
|
PRODUCTIONIZATION = 'Productionization',
|