@finos/legend-application-query 13.8.49 → 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 +33 -16
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +3 -1
- 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 +12 -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 +16 -8
- 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 +6 -9
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +52 -25
- package/lib/stores/QueryEditorStore.js.map +1 -1
- 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 +3 -1
- 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 +3 -0
- 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 +34 -5
- 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 +40 -24
- package/src/components/QueryEditor.tsx +3 -1
- package/src/components/data-space/DataSpaceInfo.tsx +15 -9
- package/src/components/data-space/DataSpaceQuerySetup.tsx +4 -4
- package/src/components/data-space/LegendQueryDataSpaceQueryBuilder.tsx +81 -25
- package/src/stores/QueryEditorStore.ts +92 -45
- package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +9 -2
- package/src/stores/data-space/DataProductQueryCreatorStore.ts +9 -0
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +11 -1
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +48 -4
- package/src/stores/ingest/IngestQueryCreatorStore.ts +5 -1
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
type ValueSpecification,
|
|
51
51
|
type GraphInitializationReport,
|
|
52
52
|
PackageableRuntime,
|
|
53
|
+
createPath,
|
|
53
54
|
type QueryInfo,
|
|
54
55
|
GraphManagerState,
|
|
55
56
|
Query,
|
|
@@ -69,6 +70,7 @@ import {
|
|
|
69
70
|
cloneQueryTaggedValue,
|
|
70
71
|
QueryProjectCoordinates,
|
|
71
72
|
CORE_PURE_PATH,
|
|
73
|
+
INTERNAL_ELEMENT_PATH,
|
|
72
74
|
isValidFullPath,
|
|
73
75
|
QUERY_PROFILE_PATH,
|
|
74
76
|
QueryDataSpaceExecutionContextInfo,
|
|
@@ -1143,24 +1145,9 @@ export abstract class QueryEditorStore {
|
|
|
1143
1145
|
);
|
|
1144
1146
|
}
|
|
1145
1147
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
*
|
|
1150
|
-
* Resolution order:
|
|
1151
|
-
* 1. Check local storage (`LakehouseUserInfo`) for a previously persisted value.
|
|
1152
|
-
* 2. If not found, fetch from the lakehouse contract server via
|
|
1153
|
-
* `getUserEntitlementEnvs()` and persist the result to local storage.
|
|
1154
|
-
*/
|
|
1155
|
-
async createLakehousePackageableRuntime(
|
|
1156
|
-
dataProductPath: string,
|
|
1157
|
-
gav: {
|
|
1158
|
-
groupId: string;
|
|
1159
|
-
artifactId: string;
|
|
1160
|
-
versionId: string;
|
|
1161
|
-
},
|
|
1162
|
-
): Promise<PackageableRuntime> {
|
|
1163
|
-
// 1. Check local storage for persisted lakehouse user info
|
|
1148
|
+
async resolveLakehouseEnvAndWarehouse(
|
|
1149
|
+
isSnapshot: boolean,
|
|
1150
|
+
): Promise<{ env: string; warehouse: string }> {
|
|
1164
1151
|
const persistedInfo = LegendQueryUserDataHelper.getLakehouseUserInfo(
|
|
1165
1152
|
this.applicationStore.userDataService,
|
|
1166
1153
|
);
|
|
@@ -1168,7 +1155,6 @@ export abstract class QueryEditorStore {
|
|
|
1168
1155
|
let userEnvironment: string | undefined = persistedInfo?.env;
|
|
1169
1156
|
const userWarehouse: string =
|
|
1170
1157
|
persistedInfo?.snowflakeWarehouse ?? 'LAKEHOUSE_CONSUMER_DEFAULT_WH';
|
|
1171
|
-
// 2. If no persisted environment, fetch from the server
|
|
1172
1158
|
if (userEnvironment === undefined && this.lakehouseState) {
|
|
1173
1159
|
try {
|
|
1174
1160
|
const entitlementEnvs =
|
|
@@ -1179,7 +1165,6 @@ export abstract class QueryEditorStore {
|
|
|
1179
1165
|
userEnvironment = entitlementEnvs.users
|
|
1180
1166
|
.map((e) => e.lakehouseEnvironment)
|
|
1181
1167
|
.at(0);
|
|
1182
|
-
// Persist to local storage for future use
|
|
1183
1168
|
LegendQueryUserDataHelper.persistLakehouseUserInfo(
|
|
1184
1169
|
this.applicationStore.userDataService,
|
|
1185
1170
|
{
|
|
@@ -1198,30 +1183,82 @@ export abstract class QueryEditorStore {
|
|
|
1198
1183
|
|
|
1199
1184
|
if (userEnvironment === undefined) {
|
|
1200
1185
|
throw new Error(
|
|
1201
|
-
`
|
|
1202
|
-
`Please ensure your lakehouse entitlements are configured.`,
|
|
1186
|
+
`Unable to resolve lakehouse user environment. Please ensure your lakehouse entitlements are configured.`,
|
|
1203
1187
|
);
|
|
1204
1188
|
}
|
|
1205
|
-
if (
|
|
1206
|
-
isSnapshotVersion(gav.versionId) ||
|
|
1207
|
-
gav.versionId === SNAPSHOT_VERSION_ALIAS
|
|
1208
|
-
) {
|
|
1189
|
+
if (isSnapshot) {
|
|
1209
1190
|
userEnvironment = decorateEnvWithRealm(
|
|
1210
1191
|
userEnvironment,
|
|
1211
1192
|
LakehouseEnvironmentType.PRODUCTION_PARALLEL,
|
|
1212
1193
|
);
|
|
1213
1194
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1195
|
+
return { env: userEnvironment, warehouse: userWarehouse };
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
async createLakehousePackageableRuntime(
|
|
1199
|
+
dataProductPath: string,
|
|
1200
|
+
gav: {
|
|
1201
|
+
groupId: string;
|
|
1202
|
+
artifactId: string;
|
|
1203
|
+
versionId: string;
|
|
1204
|
+
},
|
|
1205
|
+
): Promise<PackageableRuntime> {
|
|
1206
|
+
const isSnapshot =
|
|
1207
|
+
isSnapshotVersion(gav.versionId) ||
|
|
1208
|
+
gav.versionId === SNAPSHOT_VERSION_ALIAS;
|
|
1209
|
+
const { env, warehouse } =
|
|
1210
|
+
await this.resolveLakehouseEnvAndWarehouse(isSnapshot);
|
|
1218
1211
|
const packageableRuntime = new PackageableRuntime(
|
|
1219
1212
|
`${dataProductPath}_LakehouseRuntime`,
|
|
1220
1213
|
);
|
|
1221
|
-
packageableRuntime.runtimeValue =
|
|
1214
|
+
packageableRuntime.runtimeValue = new LakehouseRuntime(env, warehouse);
|
|
1222
1215
|
return packageableRuntime;
|
|
1223
1216
|
}
|
|
1224
1217
|
|
|
1218
|
+
async createOrGetDataSpaceLakehouseFallbackRuntime(
|
|
1219
|
+
isSnapshot: boolean,
|
|
1220
|
+
): Promise<PackageableRuntime> {
|
|
1221
|
+
const runtimePath = createPath(INTERNAL_ELEMENT_PATH, 'LakehouseRuntime');
|
|
1222
|
+
const existing =
|
|
1223
|
+
this.graphManagerState.graph.getNullableRuntime(runtimePath);
|
|
1224
|
+
if (existing) {
|
|
1225
|
+
return existing;
|
|
1226
|
+
}
|
|
1227
|
+
const { env, warehouse } =
|
|
1228
|
+
await this.resolveLakehouseEnvAndWarehouse(isSnapshot);
|
|
1229
|
+
const created = new PackageableRuntime('LakehouseRuntime');
|
|
1230
|
+
created.runtimeValue = new LakehouseRuntime(env, warehouse);
|
|
1231
|
+
this.graphManagerState.graph.addElement(created, INTERNAL_ELEMENT_PATH);
|
|
1232
|
+
return created;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
async attachDataSpaceFallbackRuntimes(
|
|
1236
|
+
dataSpace: DataSpace,
|
|
1237
|
+
dataSpaceAnalysisResult: DataSpaceAnalysisResult | undefined,
|
|
1238
|
+
isSnapshot: boolean,
|
|
1239
|
+
): Promise<void> {
|
|
1240
|
+
const contexts = dataSpace.executionContexts ?? [];
|
|
1241
|
+
let sharedRuntime: PackageableRuntime | undefined;
|
|
1242
|
+
for (const context of contexts) {
|
|
1243
|
+
const analyticsContext =
|
|
1244
|
+
dataSpaceAnalysisResult?.executionContextsIndex.get(context.name);
|
|
1245
|
+
|
|
1246
|
+
if (
|
|
1247
|
+
context.mappingProvider === undefined ||
|
|
1248
|
+
context.defaultRuntime !== undefined ||
|
|
1249
|
+
(analyticsContext?.compatibleRuntimes.length ?? 0) !== 0
|
|
1250
|
+
) {
|
|
1251
|
+
continue;
|
|
1252
|
+
}
|
|
1253
|
+
if (!sharedRuntime) {
|
|
1254
|
+
sharedRuntime =
|
|
1255
|
+
await this.createOrGetDataSpaceLakehouseFallbackRuntime(isSnapshot);
|
|
1256
|
+
}
|
|
1257
|
+
context.defaultRuntime =
|
|
1258
|
+
PackageableElementExplicitReference.create(sharedRuntime);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1225
1262
|
/**
|
|
1226
1263
|
* Centralized method to build a data product query builder state.
|
|
1227
1264
|
* Used by both the creator flow (new query from data product route/picker)
|
|
@@ -1281,7 +1318,10 @@ export abstract class QueryEditorStore {
|
|
|
1281
1318
|
versionId,
|
|
1282
1319
|
},
|
|
1283
1320
|
);
|
|
1284
|
-
this.graphManagerState.graph.addElement(
|
|
1321
|
+
this.graphManagerState.graph.addElement(
|
|
1322
|
+
packageableRuntime,
|
|
1323
|
+
INTERNAL_ELEMENT_PATH,
|
|
1324
|
+
);
|
|
1285
1325
|
}
|
|
1286
1326
|
// 6. Create query builder state
|
|
1287
1327
|
const projectInfo = { groupId, artifactId, versionId };
|
|
@@ -2103,6 +2143,12 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
2103
2143
|
exec.dataSpacePath,
|
|
2104
2144
|
this.graphManagerState.graph,
|
|
2105
2145
|
);
|
|
2146
|
+
await this.attachDataSpaceFallbackRuntimes(
|
|
2147
|
+
dataSpace,
|
|
2148
|
+
dataSpaceAnalysisResult,
|
|
2149
|
+
isSnapshotVersion(queryInfo.versionId) ||
|
|
2150
|
+
queryInfo.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
2151
|
+
);
|
|
2106
2152
|
const mapping = queryInfo.mapping
|
|
2107
2153
|
? this.graphManagerState.graph.getMapping(queryInfo.mapping)
|
|
2108
2154
|
: undefined;
|
|
@@ -2242,10 +2288,6 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
2242
2288
|
`Execution context '${matchingExecutionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
2243
2289
|
);
|
|
2244
2290
|
}
|
|
2245
|
-
const matchingExecutionContextRuntime = guaranteeNonNullable(
|
|
2246
|
-
matchingExecutionContext.defaultRuntime,
|
|
2247
|
-
`Execution context '${matchingExecutionContext.name}' does not have a default runtime`,
|
|
2248
|
-
);
|
|
2249
2291
|
const mappingModelCoverageAnalysisResult =
|
|
2250
2292
|
matchingExecutionContextMapping
|
|
2251
2293
|
? dataSpaceAnalysisResult?.mappingToMappingCoverageResult?.get(
|
|
@@ -2256,15 +2298,17 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
2256
2298
|
dataSpaceQueryBuilderState.explorerState.mappingModelCoverageAnalysisResult =
|
|
2257
2299
|
mappingModelCoverageAnalysisResult;
|
|
2258
2300
|
}
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2301
|
+
if (matchingExecutionContextMapping) {
|
|
2302
|
+
dataSpaceQueryBuilderState.executionContextState.setMapping(
|
|
2303
|
+
matchingExecutionContextMapping,
|
|
2304
|
+
);
|
|
2305
|
+
}
|
|
2306
|
+
const matchingExecutionContextRuntime =
|
|
2307
|
+
matchingExecutionContext.defaultRuntime
|
|
2308
|
+
? new RuntimePointer(matchingExecutionContext.defaultRuntime)
|
|
2309
|
+
: undefined;
|
|
2262
2310
|
dataSpaceQueryBuilderState.executionContextState.setRuntimeValue(
|
|
2263
|
-
|
|
2264
|
-
PackageableElementExplicitReference.create(
|
|
2265
|
-
matchingExecutionContextRuntime.value,
|
|
2266
|
-
),
|
|
2267
|
-
),
|
|
2311
|
+
matchingExecutionContextRuntime,
|
|
2268
2312
|
);
|
|
2269
2313
|
return dataSpaceQueryBuilderState;
|
|
2270
2314
|
} else {
|
|
@@ -2359,7 +2403,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
2359
2403
|
exec.ingestDefinitionPath,
|
|
2360
2404
|
projectInfo,
|
|
2361
2405
|
);
|
|
2362
|
-
this.graphManagerState.graph.addElement(
|
|
2406
|
+
this.graphManagerState.graph.addElement(
|
|
2407
|
+
adhocRuntime,
|
|
2408
|
+
INTERNAL_ELEMENT_PATH,
|
|
2409
|
+
);
|
|
2363
2410
|
|
|
2364
2411
|
// Tracked separately from the closure on `ingestQueryBuilderState` so
|
|
2365
2412
|
// the swap callback can capture it directly without forming a self-
|
|
@@ -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,
|
|
@@ -452,6 +454,13 @@ export class DataProductQueryCreatorStore extends QueryEditorStore {
|
|
|
452
454
|
`Execution context '${executionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
453
455
|
);
|
|
454
456
|
}
|
|
457
|
+
|
|
458
|
+
await this.attachDataSpaceFallbackRuntimes(
|
|
459
|
+
dataSpace,
|
|
460
|
+
dataSpaceAnalysisResult,
|
|
461
|
+
isSnapshotVersion(queryableDataSpace.versionId) ||
|
|
462
|
+
queryableDataSpace.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
463
|
+
);
|
|
455
464
|
const sourceInfo = {
|
|
456
465
|
groupId: queryableDataSpace.groupId,
|
|
457
466
|
artifactId: queryableDataSpace.artifactId,
|
|
@@ -21,7 +21,11 @@ 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,
|
|
@@ -174,6 +178,12 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
174
178
|
`Execution context '${executionContext.name}' in data space '${dataSpace.path}' sources its mapping from a data product access point group that does not exist.`,
|
|
175
179
|
);
|
|
176
180
|
}
|
|
181
|
+
await this.attachDataSpaceFallbackRuntimes(
|
|
182
|
+
dataSpace,
|
|
183
|
+
dataSpaceAnalysisResult,
|
|
184
|
+
isSnapshotVersion(this.versionId) ||
|
|
185
|
+
this.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
186
|
+
);
|
|
177
187
|
const sourceInfo = {
|
|
178
188
|
groupId: this.groupId,
|
|
179
189
|
artifactId: this.artifactId,
|
|
@@ -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 {
|
|
@@ -60,7 +63,7 @@ import {
|
|
|
60
63
|
createViewSDLCProjectHandler,
|
|
61
64
|
} from '../DataSpaceQueryBuilderHelper.js';
|
|
62
65
|
import { type GeneratorFn } from '@finos/legend-shared';
|
|
63
|
-
import { flowResult } from 'mobx';
|
|
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 {
|
|
@@ -302,4 +336,14 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
302
336
|
override getGraphData(): GraphData {
|
|
303
337
|
return new GraphDataWithOrigin(this.sdlc);
|
|
304
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
|
+
}
|
|
305
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,
|