@finos/legend-application-query 13.8.42 → 13.8.43
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 +2 -2
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/data-space/DataSpaceInfo.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceInfo.js +8 -6
- package/lib/components/data-space/DataSpaceInfo.js.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js +8 -7
- 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.map +1 -1
- package/lib/stores/QueryEditorStore.js +26 -19
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.js +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js +3 -2
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js.map +1 -1
- package/package.json +8 -8
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +8 -3
- package/src/components/data-space/DataSpaceInfo.tsx +39 -28
- package/src/components/data-space/LegendQueryDataSpaceQueryBuilder.tsx +25 -14
- package/src/stores/QueryEditorStore.ts +38 -26
- package/src/stores/data-space/DataProductQueryCreatorStore.ts +1 -1
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +1 -1
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +9 -3
|
@@ -101,14 +101,15 @@ export const QueryEditorDataspaceInfoModal = observer(
|
|
|
101
101
|
const dataSpaceMedata = dataSpaceAnalysisResult?.executionContextsIndex.get(
|
|
102
102
|
executionContext.name,
|
|
103
103
|
)?.runtimeMetadata;
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
: undefined
|
|
104
|
+
const defaultRuntimeValue = executionContext.defaultRuntime?.value;
|
|
105
|
+
const executionContextMappingValue = executionContext.mapping?.value;
|
|
106
|
+
const connection = defaultRuntimeValue?.runtimeValue.connections.length
|
|
107
|
+
? defaultRuntimeValue.runtimeValue.connections[0]?.storeConnections?.[0]
|
|
108
|
+
?.connection instanceof ConnectionPointer
|
|
109
|
+
? defaultRuntimeValue.runtimeValue.connections[0]?.storeConnections?.[0]
|
|
110
|
+
?.connection
|
|
111
|
+
: undefined
|
|
112
|
+
: undefined;
|
|
112
113
|
const connectionPath = connection
|
|
113
114
|
? connection.packageableConnection.value.path
|
|
114
115
|
: dataSpaceMedata
|
|
@@ -210,31 +211,41 @@ export const QueryEditorDataspaceInfoModal = observer(
|
|
|
210
211
|
<div className="dataspace-info-modal__field__label">
|
|
211
212
|
Mapping
|
|
212
213
|
</div>
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
{executionContextMappingValue ? (
|
|
215
|
+
<div
|
|
216
|
+
className="dataspace-info-modal__field__value dataspace-info-modal__field__value--linkable"
|
|
217
|
+
onClick={() =>
|
|
218
|
+
flowResult(
|
|
219
|
+
visitElement(executionContextMappingValue.path),
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
>
|
|
223
|
+
{executionContextMappingValue.name}
|
|
224
|
+
</div>
|
|
225
|
+
) : (
|
|
226
|
+
<div className="dataspace-info-modal__field__value">
|
|
227
|
+
(none)
|
|
228
|
+
</div>
|
|
229
|
+
)}
|
|
223
230
|
</div>
|
|
224
231
|
<div className="dataspace-info-modal__field">
|
|
225
232
|
<div className="dataspace-info-modal__field__label">
|
|
226
233
|
Runtime
|
|
227
234
|
</div>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
visitElement(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
{defaultRuntimeValue ? (
|
|
236
|
+
<div
|
|
237
|
+
className="dataspace-info-modal__field__value dataspace-info-modal__field__value--linkable"
|
|
238
|
+
onClick={() =>
|
|
239
|
+
flowResult(visitElement(defaultRuntimeValue.path))
|
|
240
|
+
}
|
|
241
|
+
>
|
|
242
|
+
{defaultRuntimeValue.name}
|
|
243
|
+
</div>
|
|
244
|
+
) : (
|
|
245
|
+
<div className="dataspace-info-modal__field__value">
|
|
246
|
+
(none)
|
|
247
|
+
</div>
|
|
248
|
+
)}
|
|
238
249
|
</div>
|
|
239
250
|
{(connection || dataSpaceMedata) && (
|
|
240
251
|
<>
|
|
@@ -65,18 +65,18 @@ import type { LegendQueryDataSpaceQueryBuilderState } from '../../stores/data-sp
|
|
|
65
65
|
const resolveExecutionContextRuntimes = (
|
|
66
66
|
queryBuilderState: LegendQueryDataSpaceQueryBuilderState,
|
|
67
67
|
): PackageableRuntime[] => {
|
|
68
|
+
const currentMapping = guaranteeNonNullable(
|
|
69
|
+
queryBuilderState.executionContext.mapping,
|
|
70
|
+
`Execution context '${queryBuilderState.executionContext.name}' does not have a mapping`,
|
|
71
|
+
).value;
|
|
68
72
|
if (queryBuilderState.dataSpaceAnalysisResult) {
|
|
69
73
|
const executionContext = Array.from(
|
|
70
74
|
queryBuilderState.dataSpaceAnalysisResult.executionContextsIndex.values(),
|
|
71
|
-
).find(
|
|
72
|
-
(e) =>
|
|
73
|
-
e.mapping.path ===
|
|
74
|
-
queryBuilderState.executionContext.mapping.value.path,
|
|
75
|
-
);
|
|
75
|
+
).find((e) => e.mapping.path === currentMapping.path);
|
|
76
76
|
return guaranteeNonNullable(executionContext).compatibleRuntimes;
|
|
77
77
|
}
|
|
78
78
|
return getMappingCompatibleRuntimes(
|
|
79
|
-
|
|
79
|
+
currentMapping,
|
|
80
80
|
queryBuilderState.graphManagerState.usableRuntimes,
|
|
81
81
|
);
|
|
82
82
|
};
|
|
@@ -127,10 +127,12 @@ const LegendQueryDataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
// execution context
|
|
130
|
-
const executionContextOptions =
|
|
131
|
-
queryBuilderState.dataSpace.executionContexts
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
const executionContextOptions = guaranteeNonNullable(
|
|
131
|
+
queryBuilderState.dataSpace.executionContexts,
|
|
132
|
+
`Data product '${queryBuilderState.dataSpace.path}' does not have any execution contexts`,
|
|
133
|
+
)
|
|
134
|
+
.map(buildExecutionContextOption)
|
|
135
|
+
.sort(compareLabelFn);
|
|
134
136
|
const showExecutionContextOptions = executionContextOptions.length > 1;
|
|
135
137
|
const selectedExecutionContextOption = buildExecutionContextOption(
|
|
136
138
|
queryBuilderState.executionContext,
|
|
@@ -142,11 +144,17 @@ const LegendQueryDataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
142
144
|
if (option.value === queryBuilderState.executionContext) {
|
|
143
145
|
return;
|
|
144
146
|
}
|
|
145
|
-
const
|
|
146
|
-
queryBuilderState.executionContext.mapping
|
|
147
|
+
const currentMappingPath = guaranteeNonNullable(
|
|
148
|
+
queryBuilderState.executionContext.mapping,
|
|
149
|
+
`Execution context '${queryBuilderState.executionContext.name}' does not have a mapping`,
|
|
150
|
+
).value.path;
|
|
151
|
+
const nextMappingPath = guaranteeNonNullable(
|
|
152
|
+
option.value.mapping,
|
|
153
|
+
`Execution context '${option.value.name}' does not have a mapping`,
|
|
154
|
+
).value.path;
|
|
147
155
|
queryBuilderState.setExecutionContext(option.value);
|
|
148
156
|
await queryBuilderState.propagateExecutionContextChange(
|
|
149
|
-
|
|
157
|
+
currentMappingPath === nextMappingPath,
|
|
150
158
|
);
|
|
151
159
|
queryBuilderState.onExecutionContextChange?.(option.value);
|
|
152
160
|
};
|
|
@@ -191,7 +199,10 @@ const LegendQueryDataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
191
199
|
// class
|
|
192
200
|
const classes = resolveUsableDataSpaceClasses(
|
|
193
201
|
queryBuilderState.dataSpace,
|
|
194
|
-
|
|
202
|
+
guaranteeNonNullable(
|
|
203
|
+
queryBuilderState.executionContext.mapping,
|
|
204
|
+
`Execution context '${queryBuilderState.executionContext.name}' does not have a mapping`,
|
|
205
|
+
).value,
|
|
195
206
|
queryBuilderState.graphManagerState,
|
|
196
207
|
queryBuilderState,
|
|
197
208
|
);
|
|
@@ -1836,33 +1836,37 @@ const resolveExecutionContext = (
|
|
|
1836
1836
|
queryMapping: Mapping | undefined,
|
|
1837
1837
|
queryRuntime: PackageableRuntime | undefined,
|
|
1838
1838
|
): DataSpaceExecutionContext | undefined => {
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1839
|
+
const executionContexts = dataSpace.executionContexts ?? [];
|
|
1840
|
+
if (ex) {
|
|
1841
|
+
return executionContexts.find((ec) => ec.name === ex);
|
|
1842
|
+
}
|
|
1843
|
+
const defaultExecutionContext = dataSpace.defaultExecutionContext;
|
|
1844
|
+
if (!defaultExecutionContext) {
|
|
1845
|
+
return undefined;
|
|
1846
|
+
}
|
|
1847
|
+
if (queryMapping && queryRuntime) {
|
|
1848
|
+
const defaultExecutionContextMapping = defaultExecutionContext.mapping;
|
|
1849
|
+
const defaultExecutionContextRuntime =
|
|
1850
|
+
defaultExecutionContext.defaultRuntime;
|
|
1851
|
+
if (
|
|
1852
|
+
defaultExecutionContextMapping &&
|
|
1853
|
+
defaultExecutionContextRuntime &&
|
|
1854
|
+
defaultExecutionContextMapping.value !== queryMapping &&
|
|
1855
|
+
defaultExecutionContextRuntime.value.path !== queryRuntime.path
|
|
1856
|
+
) {
|
|
1857
|
+
const matchingExecContexts = executionContexts.filter(
|
|
1858
|
+
(ec) => ec.mapping?.value === queryMapping,
|
|
1859
|
+
);
|
|
1860
|
+
if (matchingExecContexts.length > 1) {
|
|
1861
|
+
const matchRuntime = matchingExecContexts.find(
|
|
1862
|
+
(exec) => exec.defaultRuntime?.value.path === queryRuntime.path,
|
|
1848
1863
|
);
|
|
1849
|
-
|
|
1850
|
-
const matchRuntime = matchingExecContexts.find(
|
|
1851
|
-
(exec) => exec.defaultRuntime.value.path === queryRuntime.path,
|
|
1852
|
-
);
|
|
1853
|
-
// TODO: we will safely do this for now. Long term we should save exec context key into query store
|
|
1854
|
-
// we should make runtime/mapping optional
|
|
1855
|
-
return matchRuntime ?? matchingExecContexts[0];
|
|
1856
|
-
}
|
|
1857
|
-
return matchingExecContexts[0];
|
|
1864
|
+
return matchRuntime ?? matchingExecContexts[0];
|
|
1858
1865
|
}
|
|
1866
|
+
return matchingExecContexts[0];
|
|
1859
1867
|
}
|
|
1860
|
-
return dataSpace.defaultExecutionContext;
|
|
1861
1868
|
}
|
|
1862
|
-
|
|
1863
|
-
(ec) => ec.name === ex,
|
|
1864
|
-
);
|
|
1865
|
-
return matchingExecContexts[0];
|
|
1869
|
+
return defaultExecutionContext;
|
|
1866
1870
|
};
|
|
1867
1871
|
|
|
1868
1872
|
export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
@@ -2219,21 +2223,29 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
2219
2223
|
this.applicationStore.config.options.queryBuilderConfig,
|
|
2220
2224
|
sourceInfo,
|
|
2221
2225
|
);
|
|
2226
|
+
const matchingExecutionContextMapping = guaranteeNonNullable(
|
|
2227
|
+
matchingExecutionContext.mapping,
|
|
2228
|
+
`Execution context '${matchingExecutionContext.name}' does not have a mapping`,
|
|
2229
|
+
);
|
|
2230
|
+
const matchingExecutionContextRuntime = guaranteeNonNullable(
|
|
2231
|
+
matchingExecutionContext.defaultRuntime,
|
|
2232
|
+
`Execution context '${matchingExecutionContext.name}' does not have a default runtime`,
|
|
2233
|
+
);
|
|
2222
2234
|
const mappingModelCoverageAnalysisResult =
|
|
2223
2235
|
dataSpaceAnalysisResult?.mappingToMappingCoverageResult?.get(
|
|
2224
|
-
|
|
2236
|
+
matchingExecutionContextMapping.value.path,
|
|
2225
2237
|
);
|
|
2226
2238
|
if (mappingModelCoverageAnalysisResult) {
|
|
2227
2239
|
dataSpaceQueryBuilderState.explorerState.mappingModelCoverageAnalysisResult =
|
|
2228
2240
|
mappingModelCoverageAnalysisResult;
|
|
2229
2241
|
}
|
|
2230
2242
|
dataSpaceQueryBuilderState.executionContextState.setMapping(
|
|
2231
|
-
|
|
2243
|
+
matchingExecutionContextMapping.value,
|
|
2232
2244
|
);
|
|
2233
2245
|
dataSpaceQueryBuilderState.executionContextState.setRuntimeValue(
|
|
2234
2246
|
new RuntimePointer(
|
|
2235
2247
|
PackageableElementExplicitReference.create(
|
|
2236
|
-
|
|
2248
|
+
matchingExecutionContextRuntime.value,
|
|
2237
2249
|
),
|
|
2238
2250
|
),
|
|
2239
2251
|
);
|
|
@@ -432,7 +432,7 @@ export class DataProductQueryCreatorStore extends QueryEditorStore {
|
|
|
432
432
|
this.graphManagerState.graph,
|
|
433
433
|
);
|
|
434
434
|
const executionContext = guaranteeNonNullable(
|
|
435
|
-
dataSpace.executionContexts
|
|
435
|
+
dataSpace.executionContexts?.find(
|
|
436
436
|
(context) => context.name === queryableDataSpace.executionContext,
|
|
437
437
|
),
|
|
438
438
|
`Can't find execution context '${queryableDataSpace.executionContext}'`,
|
|
@@ -145,7 +145,7 @@ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreator
|
|
|
145
145
|
executionContext =
|
|
146
146
|
template.info?.executionContextKey === undefined
|
|
147
147
|
? dataSpace.defaultExecutionContext
|
|
148
|
-
: dataSpace.executionContexts
|
|
148
|
+
: dataSpace.executionContexts?.find(
|
|
149
149
|
(ex) => ex.name === template.info?.executionContextKey,
|
|
150
150
|
);
|
|
151
151
|
if (template.info) {
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
createViewProjectHandler,
|
|
60
60
|
createViewSDLCProjectHandler,
|
|
61
61
|
} from '../DataSpaceQueryBuilderHelper.js';
|
|
62
|
-
import type
|
|
62
|
+
import { guaranteeNonNullable, type GeneratorFn } from '@finos/legend-shared';
|
|
63
63
|
import { flowResult } from 'mobx';
|
|
64
64
|
import type {
|
|
65
65
|
DepotEntityWithOrigin,
|
|
@@ -220,7 +220,10 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
220
220
|
this.dataSpace.title,
|
|
221
221
|
this.dataSpace.name,
|
|
222
222
|
this.dataSpace.path,
|
|
223
|
-
|
|
223
|
+
guaranteeNonNullable(
|
|
224
|
+
this.dataSpace.defaultExecutionContext,
|
|
225
|
+
`Data space '${this.dataSpace.path}' does not have a default execution context`,
|
|
226
|
+
).name,
|
|
224
227
|
),
|
|
225
228
|
};
|
|
226
229
|
}
|
|
@@ -293,7 +296,10 @@ export class LegendQueryDataSpaceQueryBuilderState extends DataSpaceQueryBuilder
|
|
|
293
296
|
dataSpace.title,
|
|
294
297
|
dataSpace.name,
|
|
295
298
|
dataSpace.path,
|
|
296
|
-
|
|
299
|
+
guaranteeNonNullable(
|
|
300
|
+
dataSpace.defaultExecutionContext,
|
|
301
|
+
`Data space '${dataSpace.path}' does not have a default execution context`,
|
|
302
|
+
).name,
|
|
297
303
|
),
|
|
298
304
|
this.project.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
299
305
|
);
|