@finos/legend-application-query 13.7.192 → 13.7.195
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/__lib__/LegendQueryNavigation.d.ts +18 -0
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +21 -0
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts +9 -9
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts +7 -7
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js +5 -5
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +7 -7
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +46 -50
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/data-space/DataSpaceQueryCreator.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQueryCreator.js +2 -0
- package/lib/components/data-space/DataSpaceQueryCreator.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts +2 -2
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +32 -15
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryEditorStore.d.ts +3 -3
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +20 -12
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts +30 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js +41 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js.map +1 -0
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.d.ts +0 -3
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.js +0 -6
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +45 -17
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +195 -67
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +7 -3
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts +46 -0
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js +63 -0
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js.map +1 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts +47 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js +145 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js.map +1 -0
- package/package.json +11 -11
- package/src/__lib__/LegendQueryNavigation.ts +43 -0
- package/src/__lib__/LegendQueryUserDataHelper.ts +14 -12
- package/src/__lib__/LegendQueryUserDataSpaceHelper.ts +14 -14
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +5 -13
- package/src/components/QueryEditor.tsx +145 -103
- package/src/components/data-space/DataSpaceQueryCreator.tsx +4 -2
- package/src/components/data-space/DataSpaceQuerySetup.tsx +63 -20
- package/src/index.ts +1 -1
- package/src/stores/QueryEditorStore.ts +100 -91
- package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +129 -0
- package/src/stores/data-space/DataSpaceQueryBuilderHelper.ts +0 -29
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +293 -101
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +11 -12
- package/src/stores/data-space/LegendQueryBareQueryBuilderState.ts +117 -0
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +340 -0
- package/tsconfig.json +3 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +0 -44
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +0 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +0 -89
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +0 -1
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +0 -171
|
@@ -22,12 +22,19 @@ import {
|
|
|
22
22
|
RuntimePointer,
|
|
23
23
|
PackageableElementExplicitReference,
|
|
24
24
|
QueryProjectCoordinates,
|
|
25
|
+
CORE_PURE_PATH,
|
|
26
|
+
type V1_DataProduct,
|
|
25
27
|
} from '@finos/legend-graph';
|
|
26
28
|
import {
|
|
29
|
+
DepotScope,
|
|
27
30
|
type DepotServerClient,
|
|
31
|
+
extractDepotEntityInfo,
|
|
28
32
|
LATEST_VERSION_ALIAS,
|
|
33
|
+
type StoredEntity,
|
|
34
|
+
type StoredSummaryEntity,
|
|
29
35
|
} from '@finos/legend-server-depot';
|
|
30
36
|
import {
|
|
37
|
+
ActionState,
|
|
31
38
|
LogEvent,
|
|
32
39
|
assertErrorThrown,
|
|
33
40
|
assertTrue,
|
|
@@ -44,10 +51,14 @@ import {
|
|
|
44
51
|
parseGACoordinates,
|
|
45
52
|
type Entity,
|
|
46
53
|
type ProjectGAVCoordinates,
|
|
54
|
+
type DepotEntityWithOrigin,
|
|
47
55
|
} from '@finos/legend-storage';
|
|
48
56
|
import {
|
|
57
|
+
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
49
58
|
type DataSpaceExecutionContext,
|
|
59
|
+
extractDataSpaceInfo,
|
|
50
60
|
getDataSpace,
|
|
61
|
+
type V1_DataSpace,
|
|
51
62
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
52
63
|
import {
|
|
53
64
|
QueryBuilderActionConfig_QueryApplication,
|
|
@@ -56,14 +67,14 @@ import {
|
|
|
56
67
|
} from '../QueryEditorStore.js';
|
|
57
68
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
|
58
69
|
import {
|
|
59
|
-
type
|
|
60
|
-
|
|
70
|
+
type DataSpaceQueryBuilderState,
|
|
71
|
+
ResolvedDataSpaceEntityWithOrigin,
|
|
61
72
|
createQueryClassTaggedValue,
|
|
62
73
|
createQueryDataSpaceTaggedValue,
|
|
63
74
|
} from '@finos/legend-extension-dsl-data-space/application';
|
|
64
75
|
import { LegendQueryUserDataHelper } from '../../__lib__/LegendQueryUserDataHelper.js';
|
|
65
76
|
import {
|
|
66
|
-
type
|
|
77
|
+
type VisitedDataProduct,
|
|
67
78
|
createVisitedDataSpaceId,
|
|
68
79
|
hasDataSpaceInfoBeenVisited,
|
|
69
80
|
createSimpleVisitedDataspace,
|
|
@@ -77,15 +88,18 @@ import {
|
|
|
77
88
|
makeObservable,
|
|
78
89
|
observable,
|
|
79
90
|
} from 'mobx';
|
|
80
|
-
import { DataSpaceQuerySetupState } from './DataSpaceQuerySetupState.js';
|
|
81
91
|
import {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} from './
|
|
86
|
-
import {
|
|
92
|
+
APPLICATION_EVENT,
|
|
93
|
+
type GenericLegendApplicationStore,
|
|
94
|
+
} from '@finos/legend-application';
|
|
95
|
+
import { LegendQueryBareQueryBuilderState } from './LegendQueryBareQueryBuilderState.js';
|
|
96
|
+
import type { DataSpaceOption } from '@finos/legend-extension-dsl-data-space/application-query';
|
|
97
|
+
import { LegendQueryDataSpaceQueryBuilderState } from './query-builder/LegendQueryDataSpaceQueryBuilderState.js';
|
|
87
98
|
|
|
88
|
-
export type
|
|
99
|
+
export type QueryableDataProduct = {
|
|
100
|
+
classifier:
|
|
101
|
+
| typeof DATA_SPACE_ELEMENT_CLASSIFIER_PATH
|
|
102
|
+
| CORE_PURE_PATH.DATA_PRODUCT;
|
|
89
103
|
groupId: string;
|
|
90
104
|
artifactId: string;
|
|
91
105
|
versionId: string;
|
|
@@ -96,30 +110,156 @@ export type QueryableDataSpace = {
|
|
|
96
110
|
};
|
|
97
111
|
|
|
98
112
|
type DataSpaceVisitedEntity = {
|
|
99
|
-
visited:
|
|
113
|
+
visited: VisitedDataProduct;
|
|
114
|
+
defaultExecKey: string;
|
|
100
115
|
entity: Entity;
|
|
116
|
+
classifier:
|
|
117
|
+
| CORE_PURE_PATH.DATA_PRODUCT
|
|
118
|
+
| typeof DATA_SPACE_ELEMENT_CLASSIFIER_PATH;
|
|
101
119
|
};
|
|
102
120
|
|
|
121
|
+
export type DataProductOption = {
|
|
122
|
+
label: string;
|
|
123
|
+
value: DepotEntityWithOrigin;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type DataProductWithLegacyOption = DataSpaceOption | DataProductOption;
|
|
127
|
+
|
|
128
|
+
// Helper function to build option for both DataSpace and DataProduct
|
|
129
|
+
const buildDataSpaceOrProductOption = (
|
|
130
|
+
value: ResolvedDataSpaceEntityWithOrigin | DepotEntityWithOrigin,
|
|
131
|
+
): DataProductWithLegacyOption => {
|
|
132
|
+
// For ResolvedDataSpaceEntityWithOrigin, use title if available, otherwise name
|
|
133
|
+
// For DepotEntityWithOrigin, just use name
|
|
134
|
+
const label =
|
|
135
|
+
value instanceof ResolvedDataSpaceEntityWithOrigin
|
|
136
|
+
? (value.title ?? value.name)
|
|
137
|
+
: value.name;
|
|
138
|
+
return {
|
|
139
|
+
label,
|
|
140
|
+
value: value,
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export class DataProductSelectorState {
|
|
145
|
+
legacyDataProducts: ResolvedDataSpaceEntityWithOrigin[] | undefined;
|
|
146
|
+
dataProducts: DepotEntityWithOrigin[] | undefined;
|
|
147
|
+
readonly loadProductsState = ActionState.create();
|
|
148
|
+
readonly depotServerClient: DepotServerClient;
|
|
149
|
+
readonly applicationStore: GenericLegendApplicationStore;
|
|
150
|
+
disableDataProducts = true;
|
|
151
|
+
|
|
152
|
+
constructor(
|
|
153
|
+
depotServerClient: DepotServerClient,
|
|
154
|
+
applicationStore: GenericLegendApplicationStore,
|
|
155
|
+
) {
|
|
156
|
+
makeObservable(this, {
|
|
157
|
+
legacyDataProducts: observable,
|
|
158
|
+
dataProducts: observable,
|
|
159
|
+
loadProductsState: observable,
|
|
160
|
+
loadProducts: flow,
|
|
161
|
+
setLegacyDataProducts: action,
|
|
162
|
+
setDataProducts: action,
|
|
163
|
+
clearProducts: action,
|
|
164
|
+
});
|
|
165
|
+
this.applicationStore = applicationStore;
|
|
166
|
+
this.depotServerClient = depotServerClient;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
setLegacyDataProducts(val: ResolvedDataSpaceEntityWithOrigin[]): void {
|
|
170
|
+
this.legacyDataProducts = val;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
setDataProducts(val: DepotEntityWithOrigin[]): void {
|
|
174
|
+
this.dataProducts = val;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
clearProducts(): void {
|
|
178
|
+
this.legacyDataProducts = undefined;
|
|
179
|
+
this.dataProducts = undefined;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
get isFetchingProducts(): boolean {
|
|
183
|
+
return this.loadProductsState.isInProgress;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
get isCompletelyLoaded(): boolean {
|
|
187
|
+
return Boolean(this.legacyDataProducts) && Boolean(this.dataProducts);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
*loadProducts(): GeneratorFn<void> {
|
|
191
|
+
this.loadProductsState.inProgress();
|
|
192
|
+
try {
|
|
193
|
+
// Load DataSpaces
|
|
194
|
+
const dataSpaces = (
|
|
195
|
+
(yield this.depotServerClient.getEntitiesByClassifier(
|
|
196
|
+
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
197
|
+
{
|
|
198
|
+
scope: DepotScope.RELEASES,
|
|
199
|
+
},
|
|
200
|
+
)) as StoredEntity[]
|
|
201
|
+
).map((storedEntity) => {
|
|
202
|
+
return extractDataSpaceInfo(storedEntity, false);
|
|
203
|
+
});
|
|
204
|
+
const dataProducts = this.disableDataProducts
|
|
205
|
+
? []
|
|
206
|
+
: (
|
|
207
|
+
(yield this.depotServerClient.getEntitiesSummaryByClassifier(
|
|
208
|
+
CORE_PURE_PATH.DATA_PRODUCT,
|
|
209
|
+
{
|
|
210
|
+
scope: DepotScope.RELEASES,
|
|
211
|
+
summary: true,
|
|
212
|
+
},
|
|
213
|
+
)) as StoredSummaryEntity[]
|
|
214
|
+
).map((storedEntity) => {
|
|
215
|
+
return extractDepotEntityInfo(storedEntity, false);
|
|
216
|
+
});
|
|
217
|
+
// Set both lists separately
|
|
218
|
+
this.legacyDataProducts = dataSpaces;
|
|
219
|
+
this.dataProducts = dataProducts;
|
|
220
|
+
this.loadProductsState.pass();
|
|
221
|
+
} catch (error) {
|
|
222
|
+
assertErrorThrown(error);
|
|
223
|
+
this.loadProductsState.fail();
|
|
224
|
+
this.applicationStore.notificationService.notifyError(error);
|
|
225
|
+
this.applicationStore.logService.error(
|
|
226
|
+
LogEvent.create(APPLICATION_EVENT.GENERIC_FAILURE),
|
|
227
|
+
error,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
get dataProductOptions(): DataProductWithLegacyOption[] {
|
|
233
|
+
return [
|
|
234
|
+
...(this.legacyDataProducts?.map(buildDataSpaceOrProductOption) ?? []),
|
|
235
|
+
...(this.dataProducts?.map(buildDataSpaceOrProductOption) ?? []),
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
103
240
|
export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
104
|
-
queryableDataSpace:
|
|
105
|
-
|
|
241
|
+
queryableDataSpace: QueryableDataProduct | undefined;
|
|
242
|
+
productSelectorState: DataProductSelectorState;
|
|
106
243
|
declare queryBuilderState?: DataSpaceQueryBuilderState | undefined;
|
|
107
244
|
|
|
108
245
|
constructor(
|
|
109
246
|
applicationStore: LegendQueryApplicationStore,
|
|
110
247
|
depotServerClient: DepotServerClient,
|
|
111
|
-
queryableDataSpace:
|
|
248
|
+
queryableDataSpace: QueryableDataProduct | undefined,
|
|
112
249
|
) {
|
|
113
250
|
super(applicationStore, depotServerClient);
|
|
114
251
|
makeObservable(this, {
|
|
115
252
|
changeDataSpace: flow,
|
|
116
|
-
|
|
253
|
+
productSelectorState: observable,
|
|
117
254
|
queryableDataSpace: observable,
|
|
118
|
-
setDataSpaceCache: action,
|
|
119
255
|
setQueryableDataSpace: action,
|
|
120
256
|
canPersistToSavedQuery: computed,
|
|
121
257
|
});
|
|
122
258
|
this.queryableDataSpace = queryableDataSpace;
|
|
259
|
+
this.productSelectorState = new DataProductSelectorState(
|
|
260
|
+
depotServerClient,
|
|
261
|
+
applicationStore,
|
|
262
|
+
);
|
|
123
263
|
}
|
|
124
264
|
|
|
125
265
|
override get canPersistToSavedQuery(): boolean {
|
|
@@ -134,27 +274,36 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
134
274
|
return this.queryableDataSpace;
|
|
135
275
|
}
|
|
136
276
|
|
|
137
|
-
|
|
138
|
-
this.dataSpaceCache = val;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
setQueryableDataSpace(val: QueryableDataSpace | undefined): void {
|
|
277
|
+
setQueryableDataSpace(val: QueryableDataProduct | undefined): void {
|
|
142
278
|
this.queryableDataSpace = val;
|
|
143
279
|
}
|
|
144
280
|
|
|
145
|
-
reConfigureWithDataSpaceInfo(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
info.versionId &&
|
|
150
|
-
info.defaultExecutionContext
|
|
151
|
-
) {
|
|
281
|
+
reConfigureWithDataSpaceInfo(
|
|
282
|
+
info: ResolvedDataSpaceEntityWithOrigin,
|
|
283
|
+
): boolean {
|
|
284
|
+
if (info.origin && info.defaultExecutionContext) {
|
|
152
285
|
this.queryableDataSpace = {
|
|
153
|
-
groupId: info.groupId,
|
|
154
|
-
artifactId: info.artifactId,
|
|
286
|
+
groupId: info.origin.groupId,
|
|
287
|
+
artifactId: info.origin.artifactId,
|
|
155
288
|
versionId: LATEST_VERSION_ALIAS,
|
|
156
289
|
dataSpacePath: info.path,
|
|
157
290
|
executionContext: info.defaultExecutionContext,
|
|
291
|
+
classifier: DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
292
|
+
};
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
reConfigureWithDataProductInfo(info: DepotEntityWithOrigin): boolean {
|
|
299
|
+
if (info.origin) {
|
|
300
|
+
this.queryableDataSpace = {
|
|
301
|
+
groupId: info.origin.groupId,
|
|
302
|
+
artifactId: info.origin.artifactId,
|
|
303
|
+
versionId: LATEST_VERSION_ALIAS,
|
|
304
|
+
dataSpacePath: info.path,
|
|
305
|
+
executionContext: '',
|
|
306
|
+
classifier: CORE_PURE_PATH.DATA_PRODUCT,
|
|
158
307
|
};
|
|
159
308
|
return true;
|
|
160
309
|
}
|
|
@@ -172,8 +321,8 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
172
321
|
artifactId: hydrated.visited.artifactId,
|
|
173
322
|
versionId: hydrated.visited.versionId ?? LATEST_VERSION_ALIAS,
|
|
174
323
|
dataSpacePath: hydrated.visited.path,
|
|
175
|
-
executionContext: hydrated.
|
|
176
|
-
|
|
324
|
+
executionContext: hydrated.defaultExecKey,
|
|
325
|
+
classifier: hydrated.classifier,
|
|
177
326
|
});
|
|
178
327
|
}
|
|
179
328
|
}
|
|
@@ -186,30 +335,33 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
186
335
|
this.queryableDataSpace,
|
|
187
336
|
);
|
|
188
337
|
} else {
|
|
189
|
-
const queryBuilderState = new
|
|
338
|
+
const queryBuilderState = new LegendQueryBareQueryBuilderState(
|
|
190
339
|
this,
|
|
191
340
|
this.applicationStore,
|
|
192
341
|
this.graphManagerState,
|
|
193
342
|
this.depotServerClient,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
343
|
+
{
|
|
344
|
+
onDataSpaceChange: (
|
|
345
|
+
dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin,
|
|
346
|
+
) => {
|
|
347
|
+
if (dataSpaceInfo.defaultExecutionContext) {
|
|
348
|
+
this.changeDataSpace(dataSpaceInfo);
|
|
349
|
+
} else {
|
|
350
|
+
this.applicationStore.notificationService.notifyWarning(
|
|
351
|
+
`Can't switch data product: default execution context not specified`,
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
onDataProductChange: (dataProductInfo: DepotEntityWithOrigin) => {
|
|
356
|
+
// TODO: Implement data product change logic
|
|
198
357
|
this.applicationStore.notificationService.notifyWarning(
|
|
199
|
-
`
|
|
358
|
+
`Data product change not yet implemented`,
|
|
200
359
|
);
|
|
201
|
-
}
|
|
360
|
+
},
|
|
202
361
|
},
|
|
203
|
-
createViewProjectHandler(this.applicationStore),
|
|
204
|
-
createViewSDLCProjectHandler(
|
|
205
|
-
this.applicationStore,
|
|
206
|
-
this.depotServerClient,
|
|
207
|
-
),
|
|
208
362
|
this.applicationStore.config.options.queryBuilderConfig,
|
|
363
|
+
this.productSelectorState,
|
|
209
364
|
);
|
|
210
|
-
if (this.dataSpaceCache?.length) {
|
|
211
|
-
queryBuilderState.configureDataSpaceOptions(this.dataSpaceCache);
|
|
212
|
-
}
|
|
213
365
|
return queryBuilderState;
|
|
214
366
|
}
|
|
215
367
|
}
|
|
@@ -219,22 +371,19 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
219
371
|
LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(
|
|
220
372
|
this.applicationStore.userDataService,
|
|
221
373
|
);
|
|
222
|
-
|
|
223
|
-
for (
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
if (hydrated) {
|
|
228
|
-
redirect = hydrated;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
374
|
+
|
|
375
|
+
for (const visited of visitedQueries) {
|
|
376
|
+
const hydrated = await this.verifyDataSpaceExists(visited);
|
|
377
|
+
if (hydrated) {
|
|
378
|
+
return hydrated;
|
|
231
379
|
}
|
|
232
380
|
}
|
|
233
|
-
|
|
381
|
+
|
|
382
|
+
return undefined;
|
|
234
383
|
}
|
|
235
384
|
|
|
236
|
-
async
|
|
237
|
-
visited:
|
|
385
|
+
async verifyDataSpaceExists(
|
|
386
|
+
visited: VisitedDataProduct,
|
|
238
387
|
): Promise<DataSpaceVisitedEntity | undefined> {
|
|
239
388
|
try {
|
|
240
389
|
const entity = (await this.depotServerClient.getVersionEntity(
|
|
@@ -243,37 +392,61 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
243
392
|
visited.versionId ?? LATEST_VERSION_ALIAS,
|
|
244
393
|
visited.path,
|
|
245
394
|
)) as unknown as Entity;
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
395
|
+
const classifierPath = entity.classifierPath;
|
|
396
|
+
if (classifierPath === CORE_PURE_PATH.DATA_PRODUCT) {
|
|
397
|
+
const entityContent = entity.content as unknown as V1_DataProduct;
|
|
398
|
+
const native = guaranteeNonNullable(entityContent.nativeModelAccess);
|
|
399
|
+
if (visited.execContext) {
|
|
400
|
+
const executionContextExists =
|
|
401
|
+
native.nativeModelExecutionContexts.some(
|
|
402
|
+
(context) => context.key === visited.execContext,
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
// If execution context no longer exists, clear it but still return the entity
|
|
406
|
+
if (!executionContextExists) {
|
|
407
|
+
visited.execContext = undefined;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
defaultExecKey: native.defaultExecutionContext,
|
|
412
|
+
visited,
|
|
413
|
+
entity,
|
|
414
|
+
classifier: CORE_PURE_PATH.DATA_PRODUCT,
|
|
415
|
+
};
|
|
416
|
+
} else {
|
|
417
|
+
const entityContent = entity.content as unknown as V1_DataSpace;
|
|
418
|
+
|
|
419
|
+
// Verify the execution context still exists
|
|
420
|
+
if (visited.execContext) {
|
|
421
|
+
const executionContextExists = entityContent.executionContexts.some(
|
|
422
|
+
(context) => context.name === visited.execContext,
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
// If execution context no longer exists, clear it but still return the entity
|
|
426
|
+
if (!executionContextExists) {
|
|
427
|
+
visited.execContext = undefined;
|
|
428
|
+
}
|
|
259
429
|
}
|
|
430
|
+
return {
|
|
431
|
+
defaultExecKey: entityContent.defaultExecutionContext,
|
|
432
|
+
visited,
|
|
433
|
+
entity,
|
|
434
|
+
classifier: DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
435
|
+
};
|
|
260
436
|
}
|
|
261
|
-
return {
|
|
262
|
-
visited,
|
|
263
|
-
entity,
|
|
264
|
-
};
|
|
265
437
|
} catch (error) {
|
|
266
438
|
assertErrorThrown(error);
|
|
439
|
+
// If the data space no longer exists, remove it from visited list
|
|
267
440
|
LegendQueryUserDataHelper.removeRecentlyViewedDataSpace(
|
|
268
441
|
this.applicationStore.userDataService,
|
|
269
442
|
visited.id,
|
|
270
443
|
);
|
|
444
|
+
return undefined;
|
|
271
445
|
}
|
|
272
|
-
return undefined;
|
|
273
446
|
}
|
|
274
447
|
|
|
275
448
|
async initializeQueryBuilderStateWithQueryableDataSpace(
|
|
276
|
-
queryableDataSpace:
|
|
449
|
+
queryableDataSpace: QueryableDataProduct,
|
|
277
450
|
): Promise<QueryBuilderState> {
|
|
278
451
|
const { dataSpaceAnalysisResult, isLightGraphEnabled } =
|
|
279
452
|
await this.buildGraphAndDataspaceAnalyticsResult(
|
|
@@ -303,7 +476,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
303
476
|
LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(
|
|
304
477
|
this.applicationStore.userDataService,
|
|
305
478
|
);
|
|
306
|
-
const queryBuilderState = new
|
|
479
|
+
const queryBuilderState = new LegendQueryDataSpaceQueryBuilderState(
|
|
307
480
|
this.applicationStore,
|
|
308
481
|
this.graphManagerState,
|
|
309
482
|
QueryBuilderDataBrowserWorkflow.INSTANCE,
|
|
@@ -311,15 +484,15 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
311
484
|
dataSpace,
|
|
312
485
|
executionContext,
|
|
313
486
|
isLightGraphEnabled,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
queryableDataSpace.groupId,
|
|
317
|
-
queryableDataSpace.artifactId,
|
|
318
|
-
queryableDataSpace.versionId,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
async (dataSpaceInfo:
|
|
487
|
+
this.depotServerClient,
|
|
488
|
+
{
|
|
489
|
+
groupId: queryableDataSpace.groupId,
|
|
490
|
+
artifactId: queryableDataSpace.artifactId,
|
|
491
|
+
versionId: queryableDataSpace.versionId,
|
|
492
|
+
},
|
|
493
|
+
(dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin) =>
|
|
494
|
+
hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
|
|
495
|
+
async (dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin) => {
|
|
323
496
|
flowResult(this.changeDataSpace(dataSpaceInfo)).catch(
|
|
324
497
|
this.applicationStore.alertUnhandledError,
|
|
325
498
|
);
|
|
@@ -340,12 +513,10 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
340
513
|
undefined,
|
|
341
514
|
this.applicationStore.config.options.queryBuilderConfig,
|
|
342
515
|
sourceInfo,
|
|
516
|
+
).withOptions(
|
|
517
|
+
this.productSelectorState.legacyDataProducts,
|
|
518
|
+
this.productSelectorState.dataProducts,
|
|
343
519
|
);
|
|
344
|
-
if (this.dataSpaceCache?.length) {
|
|
345
|
-
queryBuilderState.dataSpaceRepo.configureDataSpaceOptions(
|
|
346
|
-
this.dataSpaceCache,
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
520
|
queryBuilderState.setExecutionContext(executionContext);
|
|
350
521
|
await queryBuilderState.propagateExecutionContextChange(true);
|
|
351
522
|
|
|
@@ -374,19 +545,40 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
374
545
|
return queryBuilderState;
|
|
375
546
|
}
|
|
376
547
|
|
|
377
|
-
*changeDataSpace(val:
|
|
548
|
+
*changeDataSpace(val: ResolvedDataSpaceEntityWithOrigin): GeneratorFn<void> {
|
|
378
549
|
try {
|
|
379
550
|
assertTrue(
|
|
380
551
|
this.reConfigureWithDataSpaceInfo(val),
|
|
381
552
|
'Data product selected does not contain valid inputs, groupId, artifactId, and version',
|
|
382
553
|
);
|
|
383
554
|
this.initState.inProgress();
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
555
|
+
this.graphManagerState.resetGraph();
|
|
556
|
+
yield flowResult(this.buildGraph());
|
|
557
|
+
this.queryBuilderState =
|
|
558
|
+
(yield this.initializeQueryBuilderState()) as DataSpaceQueryBuilderState;
|
|
559
|
+
this.queryLoaderState.initialize(this.queryBuilderState);
|
|
560
|
+
this.initState.pass();
|
|
561
|
+
} catch (error) {
|
|
562
|
+
assertErrorThrown(error);
|
|
563
|
+
this.applicationStore.notificationService.notify(
|
|
564
|
+
`Can't to change data product: ${error.message}`,
|
|
565
|
+
);
|
|
566
|
+
this.applicationStore.logService.error(
|
|
567
|
+
LogEvent.create(APPLICATION_EVENT.GENERIC_FAILURE),
|
|
568
|
+
error,
|
|
569
|
+
);
|
|
570
|
+
this.onInitializeFailure();
|
|
571
|
+
this.initState.fail();
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
*changeDataProduct(val: DepotEntityWithOrigin): GeneratorFn<void> {
|
|
576
|
+
try {
|
|
577
|
+
assertTrue(
|
|
578
|
+
this.reConfigureWithDataProductInfo(val),
|
|
579
|
+
'Data product selected does not contain valid inputs, groupId, artifactId, and version',
|
|
580
|
+
);
|
|
581
|
+
this.initState.inProgress();
|
|
390
582
|
this.graphManagerState.resetGraph();
|
|
391
583
|
yield flowResult(this.buildGraph());
|
|
392
584
|
this.queryBuilderState =
|
|
@@ -411,7 +603,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
|
411
603
|
// do nothing
|
|
412
604
|
}
|
|
413
605
|
|
|
414
|
-
addVisitedDataSpace(queryableDataSpace:
|
|
606
|
+
addVisitedDataSpace(queryableDataSpace: QueryableDataProduct): void {
|
|
415
607
|
try {
|
|
416
608
|
LegendQueryUserDataHelper.addVisitedDatspace(
|
|
417
609
|
this.applicationStore.userDataService,
|
|
@@ -48,12 +48,11 @@ import {
|
|
|
48
48
|
getQueryFromDataspaceExecutable,
|
|
49
49
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
50
50
|
import {
|
|
51
|
-
type
|
|
52
|
-
DataSpaceQueryBuilderState,
|
|
51
|
+
type ResolvedDataSpaceEntityWithOrigin,
|
|
53
52
|
createQueryClassTaggedValue,
|
|
54
53
|
createQueryDataSpaceTaggedValue,
|
|
55
54
|
} from '@finos/legend-extension-dsl-data-space/application';
|
|
56
|
-
import {
|
|
55
|
+
import { LegendQueryDataSpaceQueryBuilderState } from './query-builder/LegendQueryDataSpaceQueryBuilderState.js';
|
|
57
56
|
|
|
58
57
|
export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
59
58
|
readonly groupId: string;
|
|
@@ -174,7 +173,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
|
174
173
|
versionId: this.versionId,
|
|
175
174
|
dataSpace: dataSpace.path,
|
|
176
175
|
};
|
|
177
|
-
const queryBuilderState = new
|
|
176
|
+
const queryBuilderState = new LegendQueryDataSpaceQueryBuilderState(
|
|
178
177
|
this.applicationStore,
|
|
179
178
|
this.graphManagerState,
|
|
180
179
|
QueryBuilderDataBrowserWorkflow.INSTANCE,
|
|
@@ -182,14 +181,14 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
|
|
|
182
181
|
dataSpace,
|
|
183
182
|
executionContext,
|
|
184
183
|
isLightGraphEnabled,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
this.groupId,
|
|
188
|
-
this.artifactId,
|
|
189
|
-
this.versionId,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
async (dataSpaceInfo:
|
|
184
|
+
this.depotServerClient,
|
|
185
|
+
{
|
|
186
|
+
groupId: this.groupId,
|
|
187
|
+
artifactId: this.artifactId,
|
|
188
|
+
versionId: this.versionId,
|
|
189
|
+
},
|
|
190
|
+
undefined,
|
|
191
|
+
async (dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin) => {
|
|
193
192
|
this.applicationStore.notificationService.notifyWarning(
|
|
194
193
|
`Can't switch data product to visit current template query`,
|
|
195
194
|
);
|