@finos/legend-application-query 13.8.48 → 13.8.50
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/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +52 -18
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +14 -2
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/data-space/DataSpaceInfo.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceInfo.js +13 -9
- package/lib/components/data-space/DataSpaceInfo.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +3 -3
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js +23 -13
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryEditorStore.d.ts +14 -11
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +68 -35
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.d.ts +33 -0
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.d.ts.map +1 -0
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.js +74 -0
- package/lib/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.js.map +1 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js +3 -3
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.js +13 -5
- package/lib/stores/data-space/DataProductQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +11 -4
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts +5 -4
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js +37 -8
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js.map +1 -1
- package/lib/stores/ingest/IngestQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/ingest/IngestQueryCreatorStore.js +2 -2
- package/lib/stores/ingest/IngestQueryCreatorStore.js.map +1 -1
- package/package.json +8 -8
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +72 -33
- package/src/components/QueryEditor.tsx +22 -4
- package/src/components/data-space/DataSpaceInfo.tsx +28 -11
- package/src/components/data-space/DataSpaceQuerySetup.tsx +4 -4
- package/src/components/data-space/LegendQueryDataSpaceQueryBuilder.tsx +94 -38
- package/src/stores/QueryEditorStore.ts +118 -59
- package/src/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.ts +138 -0
- package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +9 -2
- package/src/stores/data-space/DataProductQueryCreatorStore.ts +29 -6
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +23 -4
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +51 -13
- package/src/stores/ingest/IngestQueryCreatorStore.ts +5 -1
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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 { ApplicationStore } from '@finos/legend-application';
|
|
18
|
+
import {
|
|
19
|
+
Core_GraphManagerPreset,
|
|
20
|
+
DataProduct,
|
|
21
|
+
Mapping,
|
|
22
|
+
ModelAccessPointGroup,
|
|
23
|
+
PackageableElementExplicitReference,
|
|
24
|
+
PackageableRuntime,
|
|
25
|
+
} from '@finos/legend-graph';
|
|
26
|
+
import { TEST__getTestGraphManagerState } from '@finos/legend-graph/test';
|
|
27
|
+
import {
|
|
28
|
+
QueryBuilderActionConfig,
|
|
29
|
+
QueryBuilderAdvancedWorkflowState,
|
|
30
|
+
QueryBuilder_GraphManagerPreset,
|
|
31
|
+
type QueryBuilderConfig,
|
|
32
|
+
TEST__LegendApplicationPluginManager,
|
|
33
|
+
} from '@finos/legend-query-builder';
|
|
34
|
+
import {
|
|
35
|
+
DataSpace,
|
|
36
|
+
DataSpaceExecutionContext,
|
|
37
|
+
DataSpaceMappingProvider,
|
|
38
|
+
DSL_DataSpace_GraphManagerPreset,
|
|
39
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
40
|
+
import { DataSpaceQueryBuilderState } from '@finos/legend-extension-dsl-data-space/application';
|
|
41
|
+
import { TEST__getTestLegendQueryApplicationConfig } from './LegendQueryApplicationTestUtils.js';
|
|
42
|
+
|
|
43
|
+
export const TEST_DATA_SPACE_PATH = 'COVIDDatapace';
|
|
44
|
+
|
|
45
|
+
const DEFAULT_MAPG_ID = 'PureAlloyUsageMAPG';
|
|
46
|
+
|
|
47
|
+
export const buildRuntime = (name: string): PackageableRuntime =>
|
|
48
|
+
new PackageableRuntime(name);
|
|
49
|
+
|
|
50
|
+
export const buildMapping = (name: string): Mapping => new Mapping(name);
|
|
51
|
+
|
|
52
|
+
export const buildMappingProvider = (
|
|
53
|
+
mapping: Mapping,
|
|
54
|
+
groupId = DEFAULT_MAPG_ID,
|
|
55
|
+
dataProductName = 'Pure_Usage_Stats_Modeled',
|
|
56
|
+
): DataSpaceMappingProvider => {
|
|
57
|
+
const group = new ModelAccessPointGroup();
|
|
58
|
+
group.id = groupId;
|
|
59
|
+
group.mapping = PackageableElementExplicitReference.create(mapping);
|
|
60
|
+
const dataProduct = new DataProduct(dataProductName);
|
|
61
|
+
dataProduct.accessPointGroups = [group];
|
|
62
|
+
const provider = new DataSpaceMappingProvider();
|
|
63
|
+
provider.element = PackageableElementExplicitReference.create(dataProduct);
|
|
64
|
+
provider.keys = [groupId];
|
|
65
|
+
return provider;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const buildContext = (
|
|
69
|
+
name: string,
|
|
70
|
+
config: {
|
|
71
|
+
mapping?: Mapping | undefined;
|
|
72
|
+
mappingProvider?: DataSpaceMappingProvider | undefined;
|
|
73
|
+
defaultRuntime?: PackageableRuntime | undefined;
|
|
74
|
+
},
|
|
75
|
+
): DataSpaceExecutionContext => {
|
|
76
|
+
const context = new DataSpaceExecutionContext();
|
|
77
|
+
context.name = name;
|
|
78
|
+
context.mapping = config.mapping
|
|
79
|
+
? PackageableElementExplicitReference.create(config.mapping)
|
|
80
|
+
: undefined;
|
|
81
|
+
context.mappingProvider = config.mappingProvider;
|
|
82
|
+
context.defaultRuntime = config.defaultRuntime
|
|
83
|
+
? PackageableElementExplicitReference.create(config.defaultRuntime)
|
|
84
|
+
: undefined;
|
|
85
|
+
return context;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const buildDataSpace = (
|
|
89
|
+
name: string,
|
|
90
|
+
contexts: DataSpaceExecutionContext[] | undefined,
|
|
91
|
+
defaultContextName?: string | undefined,
|
|
92
|
+
): DataSpace => {
|
|
93
|
+
const dataSpace = new DataSpace(name);
|
|
94
|
+
dataSpace.package = undefined;
|
|
95
|
+
dataSpace.executionContexts = contexts;
|
|
96
|
+
dataSpace.defaultExecutionContext =
|
|
97
|
+
defaultContextName && contexts
|
|
98
|
+
? contexts.find((ctx) => ctx.name === defaultContextName)
|
|
99
|
+
: undefined;
|
|
100
|
+
return dataSpace;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const buildState = (
|
|
104
|
+
dataSpace: DataSpace,
|
|
105
|
+
executionContext: DataSpaceExecutionContext,
|
|
106
|
+
options?: { config?: QueryBuilderConfig },
|
|
107
|
+
): DataSpaceQueryBuilderState => {
|
|
108
|
+
const pluginManager = TEST__LegendApplicationPluginManager.create();
|
|
109
|
+
pluginManager
|
|
110
|
+
.usePresets([
|
|
111
|
+
new Core_GraphManagerPreset(),
|
|
112
|
+
new QueryBuilder_GraphManagerPreset(),
|
|
113
|
+
new DSL_DataSpace_GraphManagerPreset(),
|
|
114
|
+
])
|
|
115
|
+
.install();
|
|
116
|
+
const applicationStore = new ApplicationStore(
|
|
117
|
+
TEST__getTestLegendQueryApplicationConfig(),
|
|
118
|
+
pluginManager,
|
|
119
|
+
);
|
|
120
|
+
return new DataSpaceQueryBuilderState(
|
|
121
|
+
applicationStore,
|
|
122
|
+
TEST__getTestGraphManagerState(pluginManager),
|
|
123
|
+
QueryBuilderAdvancedWorkflowState.INSTANCE,
|
|
124
|
+
QueryBuilderActionConfig.INSTANCE,
|
|
125
|
+
dataSpace,
|
|
126
|
+
executionContext,
|
|
127
|
+
false,
|
|
128
|
+
undefined,
|
|
129
|
+
async () => {
|
|
130
|
+
/* no-op */
|
|
131
|
+
},
|
|
132
|
+
undefined,
|
|
133
|
+
undefined,
|
|
134
|
+
undefined,
|
|
135
|
+
undefined,
|
|
136
|
+
options?.config,
|
|
137
|
+
);
|
|
138
|
+
};
|
|
@@ -37,6 +37,7 @@ import type {
|
|
|
37
37
|
} from '@finos/legend-storage';
|
|
38
38
|
import {
|
|
39
39
|
LegendSDLC,
|
|
40
|
+
INTERNAL_ELEMENT_PATH,
|
|
40
41
|
type PackageableRuntime,
|
|
41
42
|
type Class,
|
|
42
43
|
type DataProduct,
|
|
@@ -144,7 +145,10 @@ export class LegendQueryDataProductQueryBuilderState extends DataProductQueryBui
|
|
|
144
145
|
versionId: origin.versionId,
|
|
145
146
|
},
|
|
146
147
|
);
|
|
147
|
-
this.graphManagerState.graph.addElement(
|
|
148
|
+
this.graphManagerState.graph.addElement(
|
|
149
|
+
packageableRuntime,
|
|
150
|
+
INTERNAL_ELEMENT_PATH,
|
|
151
|
+
);
|
|
148
152
|
|
|
149
153
|
if (!this.executionState.adhocRuntime) {
|
|
150
154
|
this.executionState.withAdhocRuntime();
|
|
@@ -163,7 +167,10 @@ export class LegendQueryDataProductQueryBuilderState extends DataProductQueryBui
|
|
|
163
167
|
versionId: origin.versionId,
|
|
164
168
|
},
|
|
165
169
|
);
|
|
166
|
-
this.graphManagerState.graph.addElement(
|
|
170
|
+
this.graphManagerState.graph.addElement(
|
|
171
|
+
packageableRuntime,
|
|
172
|
+
INTERNAL_ELEMENT_PATH,
|
|
173
|
+
);
|
|
167
174
|
this.executionState.changeSelectedRuntime(packageableRuntime);
|
|
168
175
|
}
|
|
169
176
|
await super.prepareAccessForExecution();
|
|
@@ -27,7 +27,9 @@ import {
|
|
|
27
27
|
} from '@finos/legend-graph';
|
|
28
28
|
import {
|
|
29
29
|
type DepotServerClient,
|
|
30
|
+
isSnapshotVersion,
|
|
30
31
|
LATEST_VERSION_ALIAS,
|
|
32
|
+
SNAPSHOT_VERSION_ALIAS,
|
|
31
33
|
} from '@finos/legend-server-depot';
|
|
32
34
|
import {
|
|
33
35
|
LogEvent,
|
|
@@ -51,10 +53,12 @@ import {
|
|
|
51
53
|
import {
|
|
52
54
|
type DataSpaceExecutionContext,
|
|
53
55
|
getDataSpace,
|
|
56
|
+
resolveExecutionContextMapping,
|
|
54
57
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
55
58
|
import {
|
|
56
59
|
QueryBuilderActionConfig_QueryApplication,
|
|
57
60
|
QueryEditorStore,
|
|
61
|
+
resolveExecutionContext,
|
|
58
62
|
type QueryPersistConfiguration,
|
|
59
63
|
} from '../QueryEditorStore.js';
|
|
60
64
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
|
@@ -431,11 +435,31 @@ export class DataProductQueryCreatorStore extends QueryEditorStore {
|
|
|
431
435
|
queryableDataSpace.dataSpacePath,
|
|
432
436
|
this.graphManagerState.graph,
|
|
433
437
|
);
|
|
434
|
-
const executionContext =
|
|
435
|
-
dataSpace
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
const executionContext = resolveExecutionContext(
|
|
439
|
+
dataSpace,
|
|
440
|
+
queryableDataSpace.executionContext,
|
|
441
|
+
undefined,
|
|
442
|
+
undefined,
|
|
443
|
+
);
|
|
444
|
+
if (!executionContext) {
|
|
445
|
+
throw new Error(
|
|
446
|
+
`Execution context '${queryableDataSpace.executionContext}' does not exist in data space '${dataSpace.path}'.`,
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
if (
|
|
450
|
+
executionContext.mappingProvider &&
|
|
451
|
+
!resolveExecutionContextMapping(executionContext)
|
|
452
|
+
) {
|
|
453
|
+
throw new Error(
|
|
454
|
+
`Execution context '${executionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
await this.attachDataSpaceFallbackRuntimes(
|
|
459
|
+
dataSpace,
|
|
460
|
+
dataSpaceAnalysisResult,
|
|
461
|
+
isSnapshotVersion(queryableDataSpace.versionId) ||
|
|
462
|
+
queryableDataSpace.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
439
463
|
);
|
|
440
464
|
const sourceInfo = {
|
|
441
465
|
groupId: queryableDataSpace.groupId,
|
|
@@ -494,7 +518,6 @@ export class DataProductQueryCreatorStore extends QueryEditorStore {
|
|
|
494
518
|
this.productSelectorState.legacyDataProducts,
|
|
495
519
|
this.productSelectorState.dataProducts,
|
|
496
520
|
);
|
|
497
|
-
queryBuilderState.setExecutionContext(executionContext);
|
|
498
521
|
await queryBuilderState.propagateExecutionContextChange(true);
|
|
499
522
|
|
|
500
523
|
// set runtime if already chosen
|
|
@@ -21,13 +21,18 @@ import {
|
|
|
21
21
|
} from '@finos/legend-query-builder';
|
|
22
22
|
import { QueryBuilderActionConfig_QueryApplication } from '../QueryEditorStore.js';
|
|
23
23
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
|
24
|
-
import
|
|
24
|
+
import {
|
|
25
|
+
type DepotServerClient,
|
|
26
|
+
isSnapshotVersion,
|
|
27
|
+
SNAPSHOT_VERSION_ALIAS,
|
|
28
|
+
} from '@finos/legend-server-depot';
|
|
25
29
|
import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
|
26
30
|
import {
|
|
27
31
|
DataSpacePackageableElementExecutable,
|
|
28
32
|
getDataSpace,
|
|
29
33
|
getExecutionContextFromDataspaceExecutable,
|
|
30
34
|
getQueryFromDataspaceExecutable,
|
|
35
|
+
resolveExecutionContextMapping,
|
|
31
36
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
32
37
|
import {
|
|
33
38
|
type ResolvedDataSpaceEntityWithOrigin,
|
|
@@ -157,7 +162,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
157
162
|
}
|
|
158
163
|
if (!query) {
|
|
159
164
|
throw new IllegalStateError(
|
|
160
|
-
`Can't fetch query from data
|
|
165
|
+
`Can't fetch query from data space executable`,
|
|
161
166
|
);
|
|
162
167
|
}
|
|
163
168
|
if (!executionContext) {
|
|
@@ -165,6 +170,20 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
165
170
|
`Can't find a correpsonding execution context`,
|
|
166
171
|
);
|
|
167
172
|
}
|
|
173
|
+
if (
|
|
174
|
+
executionContext.mappingProvider &&
|
|
175
|
+
!resolveExecutionContextMapping(executionContext)
|
|
176
|
+
) {
|
|
177
|
+
throw new IllegalStateError(
|
|
178
|
+
`Execution context '${executionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
await this.attachDataSpaceFallbackRuntimes(
|
|
182
|
+
dataSpace,
|
|
183
|
+
dataSpaceAnalysisResult,
|
|
184
|
+
isSnapshotVersion(this.versionId) ||
|
|
185
|
+
this.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
186
|
+
);
|
|
168
187
|
const sourceInfo = {
|
|
169
188
|
groupId: this.groupId,
|
|
170
189
|
artifactId: this.artifactId,
|
|
@@ -188,7 +207,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
188
207
|
undefined,
|
|
189
208
|
async (dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin) => {
|
|
190
209
|
this.applicationStore.notificationService.notifyWarning(
|
|
191
|
-
`Can't switch data
|
|
210
|
+
`Can't switch data space to visit current template query`,
|
|
192
211
|
);
|
|
193
212
|
},
|
|
194
213
|
new DataProductSelectorState(
|
|
@@ -197,7 +216,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
197
216
|
),
|
|
198
217
|
() => {
|
|
199
218
|
this.applicationStore.notificationService.notifyWarning(
|
|
200
|
-
`Can't switch data
|
|
219
|
+
`Can't switch data space to visit current template query`,
|
|
201
220
|
);
|
|
202
221
|
},
|
|
203
222
|
dataSpaceAnalysisResult,
|
|
@@ -40,11 +40,14 @@ import {
|
|
|
40
40
|
} from '@finos/legend-server-depot';
|
|
41
41
|
import {
|
|
42
42
|
GraphDataWithOrigin,
|
|
43
|
+
INTERNAL_ELEMENT_PATH,
|
|
44
|
+
LakehouseRuntime,
|
|
43
45
|
LegendSDLC,
|
|
44
46
|
RuntimePointer,
|
|
45
47
|
type Class,
|
|
46
48
|
type GraphData,
|
|
47
49
|
type GraphManagerState,
|
|
50
|
+
type PackageableElement,
|
|
48
51
|
type Runtime,
|
|
49
52
|
} from '@finos/legend-graph';
|
|
50
53
|
import {
|
|
@@ -59,8 +62,8 @@ import {
|
|
|
59
62
|
createViewProjectHandler,
|
|
60
63
|
createViewSDLCProjectHandler,
|
|
61
64
|
} from '../DataSpaceQueryBuilderHelper.js';
|
|
62
|
-
import {
|
|
63
|
-
import { flowResult } from 'mobx';
|
|
65
|
+
import { type GeneratorFn } from '@finos/legend-shared';
|
|
66
|
+
import { action, flowResult, makeObservable, observable, reaction } from 'mobx';
|
|
64
67
|
import type {
|
|
65
68
|
DepotEntityWithOrigin,
|
|
66
69
|
ProjectGAVCoordinates,
|
|
@@ -68,9 +71,6 @@ import type {
|
|
|
68
71
|
} from '@finos/legend-storage';
|
|
69
72
|
import type { DataProductSelectorState } from '../DataProductSelectorState.js';
|
|
70
73
|
|
|
71
|
-
/**
|
|
72
|
-
* Legend Query DataSpace query builder state.
|
|
73
|
-
*/
|
|
74
74
|
export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilderState {
|
|
75
75
|
declare applicationStore: LegendQueryApplicationStore;
|
|
76
76
|
depotServerClient: DepotServerClient;
|
|
@@ -78,6 +78,8 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
78
78
|
readonly onDataProductChange: (val: DepotEntityWithOrigin) => void;
|
|
79
79
|
productSelectorState: DataProductSelectorState;
|
|
80
80
|
|
|
81
|
+
injectedLakehouseRuntime: LakehouseRuntime | undefined;
|
|
82
|
+
|
|
81
83
|
override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
|
|
82
84
|
renderLegendQueryDataSpaceQueryBuilderSetupPanelContent(this);
|
|
83
85
|
|
|
@@ -129,6 +131,38 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
129
131
|
this.depotServerClient = depotServerClient;
|
|
130
132
|
this.productSelectorState = productSelectorState;
|
|
131
133
|
this.onDataProductChange = onDataProductChange;
|
|
134
|
+
this.injectedLakehouseRuntime = this.resolveInjectedLakehouseRuntime();
|
|
135
|
+
|
|
136
|
+
makeObservable(this, {
|
|
137
|
+
injectedLakehouseRuntime: observable,
|
|
138
|
+
setInjectedLakehouseRuntime: action,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
reaction(
|
|
142
|
+
() => this.executionContextState.runtimeValue,
|
|
143
|
+
() =>
|
|
144
|
+
this.setInjectedLakehouseRuntime(
|
|
145
|
+
this.resolveInjectedLakehouseRuntime(),
|
|
146
|
+
),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
setInjectedLakehouseRuntime(val: LakehouseRuntime | undefined): void {
|
|
151
|
+
this.injectedLakehouseRuntime = val;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private resolveInjectedLakehouseRuntime(): LakehouseRuntime | undefined {
|
|
155
|
+
const runtime = this.executionContextState.runtimeValue;
|
|
156
|
+
if (!(runtime instanceof RuntimePointer)) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
const packageableRuntime = runtime.packageableRuntime.value;
|
|
160
|
+
if (packageableRuntime.package?.path !== INTERNAL_ELEMENT_PATH) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
return packageableRuntime.runtimeValue instanceof LakehouseRuntime
|
|
164
|
+
? packageableRuntime.runtimeValue
|
|
165
|
+
: undefined;
|
|
132
166
|
}
|
|
133
167
|
|
|
134
168
|
override get isAdvancedDataSpaceSearchEnabled(): boolean {
|
|
@@ -220,10 +254,7 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
220
254
|
this.dataSpace.title,
|
|
221
255
|
this.dataSpace.name,
|
|
222
256
|
this.dataSpace.path,
|
|
223
|
-
|
|
224
|
-
this.dataSpace.defaultExecutionContext,
|
|
225
|
-
`Data space '${this.dataSpace.path}' does not have a default execution context`,
|
|
226
|
-
).name,
|
|
257
|
+
this.dataSpace.defaultExecutionContext?.name,
|
|
227
258
|
),
|
|
228
259
|
};
|
|
229
260
|
}
|
|
@@ -296,10 +327,7 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
296
327
|
dataSpace.title,
|
|
297
328
|
dataSpace.name,
|
|
298
329
|
dataSpace.path,
|
|
299
|
-
|
|
300
|
-
dataSpace.defaultExecutionContext,
|
|
301
|
-
`Data space '${dataSpace.path}' does not have a default execution context`,
|
|
302
|
-
).name,
|
|
330
|
+
dataSpace.defaultExecutionContext?.name,
|
|
303
331
|
),
|
|
304
332
|
this.project.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
305
333
|
);
|
|
@@ -308,4 +336,14 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
308
336
|
override getGraphData(): GraphData {
|
|
309
337
|
return new GraphDataWithOrigin(this.sdlc);
|
|
310
338
|
}
|
|
339
|
+
|
|
340
|
+
override get floatingExecutionElements(): PackageableElement[] | undefined {
|
|
341
|
+
if (!this.injectedLakehouseRuntime) {
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
const runtime = this.executionContextState.runtimeValue;
|
|
345
|
+
return runtime instanceof RuntimePointer
|
|
346
|
+
? [runtime.packageableRuntime.value]
|
|
347
|
+
: undefined;
|
|
348
|
+
}
|
|
311
349
|
}
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
type Query,
|
|
37
37
|
type RawLambda,
|
|
38
38
|
GRAPH_MANAGER_EVENT,
|
|
39
|
+
INTERNAL_ELEMENT_PATH,
|
|
39
40
|
IngestDefinition,
|
|
40
41
|
} from '@finos/legend-graph';
|
|
41
42
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
|
@@ -196,7 +197,10 @@ export class IngestQueryCreatorStore extends QueryEditorStore {
|
|
|
196
197
|
versionId: this.versionId,
|
|
197
198
|
},
|
|
198
199
|
);
|
|
199
|
-
this.graphManagerState.graph.addElement(
|
|
200
|
+
this.graphManagerState.graph.addElement(
|
|
201
|
+
adhocRuntime,
|
|
202
|
+
INTERNAL_ELEMENT_PATH,
|
|
203
|
+
);
|
|
200
204
|
|
|
201
205
|
const queryBuilderState = new IngestLegendQueryBuilderState(
|
|
202
206
|
this.applicationStore,
|
package/tsconfig.json
CHANGED
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"./src/stores/QueryProductionizerSetupStore.ts",
|
|
79
79
|
"./src/stores/QuerySetupStore.ts",
|
|
80
80
|
"./src/stores/UpdateExistingServiceQuerySetupStore.ts",
|
|
81
|
+
"./src/stores/__test-utils__/DataSpaceQueryBuilderStateTestUtils.ts",
|
|
81
82
|
"./src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts",
|
|
82
83
|
"./src/stores/data-cube/ExistingQueryDataCubeViewer.ts",
|
|
83
84
|
"./src/stores/data-product/DataProductSampleQueryCreatorStore.ts",
|