@finos/legend-extension-dsl-data-space 10.4.190 → 10.4.192
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/index.d.ts +2 -2
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +2 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.js.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts +4 -4
- package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilder.js +32 -57
- package/lib/components/query-builder/DataSpaceQueryBuilder.js.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js +3 -3
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
- package/lib/components/query-builder/index.d.ts +1 -1
- package/lib/components/query-builder/index.d.ts.map +1 -1
- package/lib/components/query-builder/index.js +1 -1
- package/lib/components/query-builder/index.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +6 -6
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js +4 -3
- package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts +27 -43
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js +79 -152
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -1
- package/lib/stores/shared/DataSpaceInfo.d.ts +5 -8
- package/lib/stores/shared/DataSpaceInfo.d.ts.map +1 -1
- package/lib/stores/shared/DataSpaceInfo.js +24 -13
- package/lib/stores/shared/DataSpaceInfo.js.map +1 -1
- package/package.json +10 -10
- package/src/components/index.ts +2 -7
- package/src/components/query-builder/DataSpaceAdvancedSearchModal.tsx +8 -3
- package/src/components/query-builder/DataSpaceQueryBuilder.tsx +49 -102
- package/src/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +3 -5
- package/src/components/query-builder/index.ts +0 -1
- package/src/stores/query/DataSpaceAdvancedSearchState.ts +14 -9
- package/src/stores/query-builder/DataSpaceQueryBuilderState.ts +142 -272
- package/src/stores/shared/DataSpaceInfo.ts +38 -25
|
@@ -14,18 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
APPLICATION_EVENT,
|
|
19
|
-
type GenericLegendApplicationStore,
|
|
20
|
-
} from '@finos/legend-application';
|
|
17
|
+
import { type GenericLegendApplicationStore } from '@finos/legend-application';
|
|
21
18
|
import {
|
|
22
19
|
type QueryBuilderConfig,
|
|
23
|
-
type QuerySDLC,
|
|
24
20
|
type QueryBuilderWorkflowState,
|
|
25
21
|
type QueryBuilderActionConfig,
|
|
26
22
|
QueryBuilderState,
|
|
27
23
|
type QueryBuilderExtraFunctionAnalysisInfo,
|
|
28
24
|
QUERY_BUILDER_LAMBDA_WRITER_MODE,
|
|
25
|
+
type ExtraOptionsConfig,
|
|
29
26
|
} from '@finos/legend-query-builder';
|
|
30
27
|
import {
|
|
31
28
|
type Class,
|
|
@@ -34,51 +31,39 @@ import {
|
|
|
34
31
|
type Runtime,
|
|
35
32
|
type Mapping,
|
|
36
33
|
type FunctionAnalysisInfo,
|
|
37
|
-
type GraphData,
|
|
38
34
|
getMappingCompatibleClasses,
|
|
39
35
|
Package,
|
|
40
36
|
QueryDataSpaceExecutionContext,
|
|
41
37
|
elementBelongsToPackage,
|
|
42
|
-
GraphDataWithOrigin,
|
|
43
|
-
LegendSDLC,
|
|
44
|
-
InMemoryGraphData,
|
|
45
38
|
} from '@finos/legend-graph';
|
|
46
|
-
import {
|
|
47
|
-
type DepotServerClient,
|
|
48
|
-
type StoredEntity,
|
|
49
|
-
DepotScope,
|
|
50
|
-
resolveVersion,
|
|
51
|
-
SNAPSHOT_VERSION_ALIAS,
|
|
52
|
-
} from '@finos/legend-server-depot';
|
|
53
39
|
import {
|
|
54
40
|
type GeneratorFn,
|
|
55
41
|
ActionState,
|
|
56
|
-
assertErrorThrown,
|
|
57
42
|
filterByType,
|
|
58
|
-
LogEvent,
|
|
59
43
|
uniq,
|
|
60
44
|
} from '@finos/legend-shared';
|
|
61
|
-
import { action, flow, makeObservable, observable } from 'mobx';
|
|
62
|
-
import {
|
|
45
|
+
import { action, computed, flow, makeObservable, observable } from 'mobx';
|
|
46
|
+
import {
|
|
47
|
+
renderDataSpaceQueryBuilderSetupPanelContent,
|
|
48
|
+
type DataSpaceOption,
|
|
49
|
+
} from '../../components/query-builder/DataSpaceQueryBuilder.js';
|
|
63
50
|
import {
|
|
64
51
|
type DataSpaceElement,
|
|
65
52
|
type DataSpaceExecutionContext,
|
|
66
53
|
DataSpace,
|
|
67
54
|
} from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
|
|
68
|
-
import {
|
|
69
|
-
import { DataSpaceAdvancedSearchState } from '../query/DataSpaceAdvancedSearchState.js';
|
|
55
|
+
import type { DataSpaceAdvancedSearchState } from '../query/DataSpaceAdvancedSearchState.js';
|
|
70
56
|
import {
|
|
71
57
|
type DataSpaceAnalysisResult,
|
|
72
58
|
type DataSpaceExecutableAnalysisResult,
|
|
73
|
-
DataSpaceServiceExecutableInfo,
|
|
74
59
|
} from '../../graph-manager/action/analytics/DataSpaceAnalysis.js';
|
|
75
|
-
import {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js';
|
|
60
|
+
import { ResolvedDataSpaceEntityWithOrigin } from '../shared/DataSpaceInfo.js';
|
|
61
|
+
import type {
|
|
62
|
+
DepotEntityWithOrigin,
|
|
63
|
+
QueryableSourceInfo,
|
|
64
|
+
} from '@finos/legend-storage';
|
|
81
65
|
import { buildDataSpaceExecutableAnalysisResultFromExecutable } from '../../graph-manager/action/analytics/DataSpaceAnalysisHelper.js';
|
|
66
|
+
import { compareLabelFn } from '@finos/legend-art';
|
|
82
67
|
|
|
83
68
|
const matchesDataElement = (
|
|
84
69
|
_class: Class,
|
|
@@ -142,242 +127,34 @@ export const resolveUsableDataSpaceClasses = (
|
|
|
142
127
|
return compatibleClasses;
|
|
143
128
|
};
|
|
144
129
|
|
|
145
|
-
export interface DataSpaceQuerySDLC extends
|
|
130
|
+
export interface DataSpaceQuerySDLC extends QueryableSourceInfo {
|
|
146
131
|
groupId: string;
|
|
147
132
|
artifactId: string;
|
|
148
133
|
versionId: string;
|
|
149
134
|
dataSpace: string;
|
|
150
135
|
}
|
|
151
136
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined;
|
|
159
|
-
|
|
160
|
-
constructor(
|
|
161
|
-
applicatonstore: GenericLegendApplicationStore,
|
|
162
|
-
graphManagerState: GraphManagerState,
|
|
163
|
-
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
|
164
|
-
) {
|
|
165
|
-
this.applicationStore = applicatonstore;
|
|
166
|
-
this.graphManagerState = graphManagerState;
|
|
167
|
-
this.prioritizeDataSpaceFunc = prioritizeDataSpaceFunc;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
get isAdvancedDataSpaceSearchEnabled(): boolean {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
get canVisitTemplateQuery(): boolean {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
abstract loadDataSpaces(): GeneratorFn<void>;
|
|
179
|
-
abstract visitTemplateQuery(
|
|
180
|
-
dataSpace: DataSpace,
|
|
181
|
-
template: DataSpaceExecutableAnalysisResult,
|
|
182
|
-
): void;
|
|
183
|
-
|
|
184
|
-
configureDataSpaceOptions(val: DataSpaceInfo[]): void {
|
|
185
|
-
this.dataSpaces = val;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export class DataSpacesGraphRepoistory extends DataSpacesBuilderRepoistory {
|
|
190
|
-
constructor(
|
|
191
|
-
applicatonstore: GenericLegendApplicationStore,
|
|
192
|
-
graphManagerState: GraphManagerState,
|
|
193
|
-
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
|
194
|
-
) {
|
|
195
|
-
super(applicatonstore, graphManagerState, prioritizeDataSpaceFunc);
|
|
196
|
-
makeObservable(this, {
|
|
197
|
-
dataSpaces: observable,
|
|
198
|
-
loadDataSpaces: flow,
|
|
199
|
-
configureDataSpaceOptions: action,
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
*loadDataSpaces(): GeneratorFn<void> {
|
|
204
|
-
this.dataSpaces = this.graphManagerState.graph.allOwnElements
|
|
205
|
-
.filter(filterByType(DataSpace))
|
|
206
|
-
.map(
|
|
207
|
-
(e) =>
|
|
208
|
-
({
|
|
209
|
-
groupId: undefined,
|
|
210
|
-
artifactId: undefined,
|
|
211
|
-
versionId: undefined,
|
|
212
|
-
path: e.path,
|
|
213
|
-
name: e.name,
|
|
214
|
-
title: e.title,
|
|
215
|
-
defaultExecutionContext: e.defaultExecutionContext.title,
|
|
216
|
-
}) as DataSpaceInfo,
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
override visitTemplateQuery(
|
|
221
|
-
dataSpace: DataSpace,
|
|
222
|
-
template: DataSpaceExecutableAnalysisResult,
|
|
223
|
-
): void {
|
|
224
|
-
throw new Error('Method not implemented.');
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export class DataSpacesDepotRepository extends DataSpacesBuilderRepoistory {
|
|
229
|
-
readonly depotServerClient: DepotServerClient;
|
|
230
|
-
readonly project: ProjectGAVCoordinates;
|
|
231
|
-
readonly viewProject: (
|
|
232
|
-
groupId: string,
|
|
233
|
-
artifactId: string,
|
|
234
|
-
versionId: string,
|
|
235
|
-
entityPath: string | undefined,
|
|
236
|
-
) => void;
|
|
237
|
-
readonly viewSDLCProject: (
|
|
238
|
-
groupId: string,
|
|
239
|
-
artifactId: string,
|
|
240
|
-
entityPath: string | undefined,
|
|
241
|
-
) => Promise<void>;
|
|
242
|
-
advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
|
|
243
|
-
|
|
244
|
-
constructor(
|
|
245
|
-
depotServerClient: DepotServerClient,
|
|
246
|
-
applicatonstore: GenericLegendApplicationStore,
|
|
247
|
-
graphManagerState: GraphManagerState,
|
|
248
|
-
project: ProjectGAVCoordinates,
|
|
249
|
-
viewProject: (
|
|
250
|
-
groupId: string,
|
|
251
|
-
artifactId: string,
|
|
252
|
-
versionId: string,
|
|
253
|
-
entityPath: string | undefined,
|
|
254
|
-
) => void,
|
|
255
|
-
viewSDLCProject: (
|
|
256
|
-
groupId: string,
|
|
257
|
-
artifactId: string,
|
|
258
|
-
entityPath: string | undefined,
|
|
259
|
-
) => Promise<void>,
|
|
260
|
-
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
|
261
|
-
) {
|
|
262
|
-
super(applicatonstore, graphManagerState, prioritizeDataSpaceFunc);
|
|
263
|
-
makeObservable(this, {
|
|
264
|
-
advancedSearchState: observable,
|
|
265
|
-
dataSpaces: observable,
|
|
266
|
-
showAdvancedSearchPanel: action,
|
|
267
|
-
hideAdvancedSearchPanel: action,
|
|
268
|
-
visitTemplateQuery: action,
|
|
269
|
-
configureDataSpaceOptions: action,
|
|
270
|
-
loadDataSpaces: flow,
|
|
271
|
-
});
|
|
272
|
-
this.depotServerClient = depotServerClient;
|
|
273
|
-
this.project = project;
|
|
274
|
-
this.viewProject = viewProject;
|
|
275
|
-
this.viewSDLCProject = viewSDLCProject;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
override get isAdvancedDataSpaceSearchEnabled(): boolean {
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
override get canVisitTemplateQuery(): boolean {
|
|
283
|
-
return true;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
override visitTemplateQuery(
|
|
287
|
-
dataSpace: DataSpace,
|
|
288
|
-
template: DataSpaceExecutableAnalysisResult,
|
|
289
|
-
): void {
|
|
290
|
-
let templateId;
|
|
291
|
-
if (template.info) {
|
|
292
|
-
if (template.info.id) {
|
|
293
|
-
templateId = template.info.id;
|
|
294
|
-
} else if (template.info instanceof DataSpaceServiceExecutableInfo) {
|
|
295
|
-
templateId = template.executable ?? template.info.pattern;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
if (!templateId) {
|
|
299
|
-
this.applicationStore.notificationService.notifyWarning(
|
|
300
|
-
`Can't visit tempalte query without a Id`,
|
|
301
|
-
);
|
|
302
|
-
} else {
|
|
303
|
-
this.applicationStore.navigationService.navigator.visitAddress(
|
|
304
|
-
this.applicationStore.navigationService.navigator.generateAddress(
|
|
305
|
-
generateDataSpaceTemplateQueryCreatorRoute(
|
|
306
|
-
this.project.groupId,
|
|
307
|
-
this.project.artifactId,
|
|
308
|
-
this.project.versionId,
|
|
309
|
-
dataSpace.path,
|
|
310
|
-
templateId,
|
|
311
|
-
),
|
|
312
|
-
),
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
showAdvancedSearchPanel(dataSpace: DataSpace): void {
|
|
318
|
-
this.advancedSearchState = new DataSpaceAdvancedSearchState(
|
|
319
|
-
this.applicationStore,
|
|
320
|
-
this.graphManagerState,
|
|
321
|
-
this.depotServerClient,
|
|
322
|
-
{
|
|
323
|
-
viewProject: this.viewProject,
|
|
324
|
-
viewSDLCProject: this.viewSDLCProject,
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
groupId: this.project.groupId,
|
|
328
|
-
artifactId: this.project.artifactId,
|
|
329
|
-
versionId: this.project.versionId,
|
|
330
|
-
title: dataSpace.title,
|
|
331
|
-
name: dataSpace.name,
|
|
332
|
-
path: dataSpace.path,
|
|
333
|
-
defaultExecutionContext: dataSpace.defaultExecutionContext.name,
|
|
334
|
-
},
|
|
335
|
-
this.project.versionId === SNAPSHOT_VERSION_ALIAS,
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
hideAdvancedSearchPanel(): void {
|
|
340
|
-
this.advancedSearchState = undefined;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
*loadDataSpaces(): GeneratorFn<void> {
|
|
344
|
-
if (this.dataSpaces === undefined) {
|
|
345
|
-
this.loadDataSpacesState.inProgress();
|
|
346
|
-
const toGetSnapShot = this.project.versionId === SNAPSHOT_VERSION_ALIAS;
|
|
347
|
-
try {
|
|
348
|
-
this.dataSpaces = (
|
|
349
|
-
(yield this.depotServerClient.getEntitiesByClassifier(
|
|
350
|
-
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
351
|
-
{
|
|
352
|
-
scope: toGetSnapShot ? DepotScope.SNAPSHOT : DepotScope.RELEASES,
|
|
353
|
-
},
|
|
354
|
-
)) as StoredEntity[]
|
|
355
|
-
).map((storedEntity) =>
|
|
356
|
-
extractDataSpaceInfo(storedEntity, toGetSnapShot),
|
|
357
|
-
);
|
|
358
|
-
this.loadDataSpacesState.pass();
|
|
359
|
-
} catch (error) {
|
|
360
|
-
assertErrorThrown(error);
|
|
361
|
-
this.loadDataSpacesState.fail();
|
|
362
|
-
this.applicationStore.notificationService.notifyError(error);
|
|
363
|
-
this.applicationStore.logService.error(
|
|
364
|
-
LogEvent.create(APPLICATION_EVENT.GENERIC_FAILURE),
|
|
365
|
-
error,
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
137
|
+
export const buildDataSpaceOption = (
|
|
138
|
+
value: ResolvedDataSpaceEntityWithOrigin,
|
|
139
|
+
): DataSpaceOption => ({
|
|
140
|
+
label: value.title ?? value.name,
|
|
141
|
+
value,
|
|
142
|
+
});
|
|
371
143
|
|
|
372
144
|
export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
373
|
-
readonly onDataSpaceChange: (
|
|
145
|
+
readonly onDataSpaceChange: (
|
|
146
|
+
val: ResolvedDataSpaceEntityWithOrigin,
|
|
147
|
+
) => Promise<void>;
|
|
374
148
|
readonly onExecutionContextChange?:
|
|
375
149
|
| ((val: DataSpaceExecutionContext) => void)
|
|
376
150
|
| undefined;
|
|
377
151
|
readonly onRuntimeChange?: ((val: Runtime) => void) | undefined;
|
|
378
152
|
readonly onClassChange?: ((val: Class) => void) | undefined;
|
|
379
153
|
readonly dataSpaceAnalysisResult?: DataSpaceAnalysisResult | undefined;
|
|
380
|
-
readonly
|
|
154
|
+
readonly extraOptionsConfig?:
|
|
155
|
+
| ExtraOptionsConfig<DepotEntityWithOrigin>
|
|
156
|
+
| undefined;
|
|
157
|
+
entities: ResolvedDataSpaceEntityWithOrigin[] | undefined;
|
|
381
158
|
|
|
382
159
|
override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
|
|
383
160
|
renderDataSpaceQueryBuilderSetupPanelContent(this);
|
|
@@ -388,6 +165,11 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
388
165
|
isTemplateQueryDialogOpen = false;
|
|
389
166
|
isLightGraphEnabled!: boolean;
|
|
390
167
|
displayedTemplateQueries: DataSpaceExecutableAnalysisResult[] | undefined;
|
|
168
|
+
advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
|
|
169
|
+
loadEntitiesState = ActionState.create();
|
|
170
|
+
prioritizeEntityFunc?:
|
|
171
|
+
| ((val: ResolvedDataSpaceEntityWithOrigin) => boolean)
|
|
172
|
+
| undefined;
|
|
391
173
|
|
|
392
174
|
constructor(
|
|
393
175
|
applicationStore: GenericLegendApplicationStore,
|
|
@@ -397,8 +179,12 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
397
179
|
dataSpace: DataSpace,
|
|
398
180
|
executionContext: DataSpaceExecutionContext,
|
|
399
181
|
isLightGraphEnabled: boolean,
|
|
400
|
-
|
|
401
|
-
|
|
182
|
+
prioritizeEntityFunc:
|
|
183
|
+
| ((val: ResolvedDataSpaceEntityWithOrigin) => boolean)
|
|
184
|
+
| undefined,
|
|
185
|
+
onDataSpaceChange: (
|
|
186
|
+
val: ResolvedDataSpaceEntityWithOrigin,
|
|
187
|
+
) => Promise<void>,
|
|
402
188
|
dataSpaceAnalysisResult?: DataSpaceAnalysisResult | undefined,
|
|
403
189
|
onExecutionContextChange?:
|
|
404
190
|
| ((val: DataSpaceExecutionContext) => void)
|
|
@@ -406,7 +192,8 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
406
192
|
onRuntimeChange?: ((val: Runtime) => void) | undefined,
|
|
407
193
|
onClassChange?: ((val: Class) => void) | undefined,
|
|
408
194
|
config?: QueryBuilderConfig | undefined,
|
|
409
|
-
sourceInfo?:
|
|
195
|
+
sourceInfo?: QueryableSourceInfo | undefined,
|
|
196
|
+
extraOptionsConfig?: ExtraOptionsConfig<DepotEntityWithOrigin> | undefined,
|
|
410
197
|
) {
|
|
411
198
|
super(applicationStore, graphManagerState, workflow, config, sourceInfo);
|
|
412
199
|
|
|
@@ -416,11 +203,15 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
416
203
|
isTemplateQueryDialogOpen: observable,
|
|
417
204
|
isLightGraphEnabled: observable,
|
|
418
205
|
displayedTemplateQueries: observable,
|
|
206
|
+
advancedSearchState: observable,
|
|
207
|
+
selectedDataSpaceOption: computed,
|
|
419
208
|
setExecutionContext: action,
|
|
420
209
|
setShowRuntimeSelector: action,
|
|
421
210
|
setTemplateQueryDialogOpen: action,
|
|
422
211
|
setIsLightGraphEnabled: action,
|
|
423
212
|
intialize: flow,
|
|
213
|
+
loadEntities: flow,
|
|
214
|
+
entities: observable,
|
|
424
215
|
});
|
|
425
216
|
|
|
426
217
|
this.dataSpace = dataSpace;
|
|
@@ -429,15 +220,11 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
429
220
|
this.onExecutionContextChange = onExecutionContextChange;
|
|
430
221
|
this.onRuntimeChange = onRuntimeChange;
|
|
431
222
|
this.onClassChange = onClassChange;
|
|
432
|
-
this.dataSpaceRepo =
|
|
433
|
-
dataSpaceRepo ??
|
|
434
|
-
new DataSpacesGraphRepoistory(
|
|
435
|
-
this.applicationStore,
|
|
436
|
-
this.graphManagerState,
|
|
437
|
-
);
|
|
438
223
|
this.dataSpaceAnalysisResult = dataSpaceAnalysisResult;
|
|
439
224
|
this.workflowState.updateActionConfig(actionConfig);
|
|
440
225
|
this.isLightGraphEnabled = isLightGraphEnabled;
|
|
226
|
+
this.prioritizeEntityFunc = prioritizeEntityFunc;
|
|
227
|
+
this.extraOptionsConfig = extraOptionsConfig;
|
|
441
228
|
if (dataSpaceAnalysisResult?.__INTERNAL__useRelationTDS) {
|
|
442
229
|
this.setLambdaWriteMode(
|
|
443
230
|
QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE,
|
|
@@ -445,6 +232,23 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
445
232
|
}
|
|
446
233
|
}
|
|
447
234
|
|
|
235
|
+
get dataSpaceOptions(): DataSpaceOption[] {
|
|
236
|
+
const sortedAllOptions = (this.entities ?? [])
|
|
237
|
+
.map(buildDataSpaceOption)
|
|
238
|
+
.sort(compareLabelFn);
|
|
239
|
+
|
|
240
|
+
return this.prioritizeEntityFunc
|
|
241
|
+
? [
|
|
242
|
+
...sortedAllOptions.filter((val) =>
|
|
243
|
+
this.prioritizeEntityFunc?.(val.value),
|
|
244
|
+
),
|
|
245
|
+
...sortedAllOptions.filter(
|
|
246
|
+
(val) => !this.prioritizeEntityFunc?.(val.value),
|
|
247
|
+
),
|
|
248
|
+
]
|
|
249
|
+
: sortedAllOptions;
|
|
250
|
+
}
|
|
251
|
+
|
|
448
252
|
override get sideBarClassName(): string | undefined {
|
|
449
253
|
return this.showRuntimeSelector
|
|
450
254
|
? 'query-builder__setup__data-space--with-runtime'
|
|
@@ -458,6 +262,65 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
458
262
|
return queryExeContext;
|
|
459
263
|
}
|
|
460
264
|
|
|
265
|
+
get isAdvancedDataSpaceSearchEnabled(): boolean {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
get isDataSpaceLinkable(): boolean {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
copyDataSpaceLinkToClipboard(): void {
|
|
274
|
+
if (!this.isDataSpaceLinkable) {
|
|
275
|
+
this.applicationStore.notificationService.notifyError(
|
|
276
|
+
'Data space link is not available.',
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
get selectedDataSpaceOption(): DataSpaceOption {
|
|
282
|
+
return {
|
|
283
|
+
label: this.dataSpace.title ?? this.dataSpace.name,
|
|
284
|
+
value: new ResolvedDataSpaceEntityWithOrigin(
|
|
285
|
+
undefined,
|
|
286
|
+
this.dataSpace.title,
|
|
287
|
+
this.dataSpace.name,
|
|
288
|
+
this.dataSpace.path,
|
|
289
|
+
this.dataSpace.defaultExecutionContext.title ??
|
|
290
|
+
this.dataSpace.defaultExecutionContext.name,
|
|
291
|
+
),
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
get canVisitTemplateQuery(): boolean {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
protected getElementType(): typeof DataSpace {
|
|
300
|
+
return DataSpace;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
*loadEntities(): GeneratorFn<void> {
|
|
304
|
+
this.loadEntitiesState.inProgress();
|
|
305
|
+
this.entities = this.graphManagerState.graph.allOwnElements
|
|
306
|
+
.filter(filterByType(this.getElementType()))
|
|
307
|
+
.map((element) => this.transformElement(element));
|
|
308
|
+
this.loadEntitiesState.complete();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
protected transformElement(
|
|
312
|
+
element: DataSpace,
|
|
313
|
+
): ResolvedDataSpaceEntityWithOrigin {
|
|
314
|
+
return new ResolvedDataSpaceEntityWithOrigin(
|
|
315
|
+
undefined,
|
|
316
|
+
element.title,
|
|
317
|
+
element.name,
|
|
318
|
+
element.path,
|
|
319
|
+
element.defaultExecutionContext.title ??
|
|
320
|
+
element.defaultExecutionContext.name,
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
461
324
|
setTemplateQueryDialogOpen(val: boolean): void {
|
|
462
325
|
this.isTemplateQueryDialogOpen = val;
|
|
463
326
|
}
|
|
@@ -500,18 +363,6 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
500
363
|
};
|
|
501
364
|
}
|
|
502
365
|
|
|
503
|
-
override getGraphData(): GraphData {
|
|
504
|
-
if (this.dataSpaceRepo instanceof DataSpacesDepotRepository) {
|
|
505
|
-
const option = new LegendSDLC(
|
|
506
|
-
this.dataSpaceRepo.project.groupId,
|
|
507
|
-
this.dataSpaceRepo.project.artifactId,
|
|
508
|
-
resolveVersion(this.dataSpaceRepo.project.versionId),
|
|
509
|
-
);
|
|
510
|
-
return new GraphDataWithOrigin(option);
|
|
511
|
-
}
|
|
512
|
-
return new InMemoryGraphData(this.graphManagerState.graph);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
366
|
*intialize(): GeneratorFn<void> {
|
|
516
367
|
this.displayedTemplateQueries =
|
|
517
368
|
this.dataSpace.executables && this.dataSpace.executables.length > 0
|
|
@@ -524,4 +375,23 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
|
524
375
|
(ex) => ex.info !== undefined,
|
|
525
376
|
);
|
|
526
377
|
}
|
|
378
|
+
|
|
379
|
+
visitTemplateQuery(
|
|
380
|
+
dataSpace: DataSpace,
|
|
381
|
+
template: DataSpaceExecutableAnalysisResult,
|
|
382
|
+
): void {
|
|
383
|
+
this.applicationStore.notificationService.notifyError(
|
|
384
|
+
'Visiting template query is not supported yet.',
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
hideAdvancedSearchPanel(): void {
|
|
389
|
+
this.advancedSearchState = undefined;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
showAdvancedSearchPanel(dataSpace: DataSpace): void {
|
|
393
|
+
this.applicationStore.notificationService.notifyError(
|
|
394
|
+
'Advanced search panel not supported.',
|
|
395
|
+
);
|
|
396
|
+
}
|
|
527
397
|
}
|
|
@@ -19,39 +19,52 @@ import {
|
|
|
19
19
|
type StoredEntity,
|
|
20
20
|
} from '@finos/legend-server-depot';
|
|
21
21
|
import { isString } from '@finos/legend-shared';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
DepotEntityWithOrigin,
|
|
24
|
+
extractEntityNameFromPath,
|
|
25
|
+
type ProjectGAVCoordinates,
|
|
26
|
+
} from '@finos/legend-storage';
|
|
27
|
+
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
|
|
23
28
|
|
|
24
|
-
export
|
|
25
|
-
groupId: string | undefined;
|
|
26
|
-
artifactId: string | undefined;
|
|
27
|
-
versionId: string | undefined;
|
|
29
|
+
export class ResolvedDataSpaceEntityWithOrigin extends DepotEntityWithOrigin {
|
|
28
30
|
title: string | undefined;
|
|
29
|
-
name: string;
|
|
30
|
-
path: string;
|
|
31
31
|
/**
|
|
32
32
|
* NOTE: technically, this should be always available, but we must not
|
|
33
|
-
* assume that no data product is
|
|
33
|
+
* assume that no data product is malformed, so we leave it as optional
|
|
34
34
|
*/
|
|
35
35
|
defaultExecutionContext: string | undefined;
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
origin: ProjectGAVCoordinates | undefined,
|
|
39
|
+
title: string | undefined,
|
|
40
|
+
name: string,
|
|
41
|
+
path: string,
|
|
42
|
+
defaultExecutionContext: string | undefined,
|
|
43
|
+
) {
|
|
44
|
+
super(origin, name, path, DATA_SPACE_ELEMENT_CLASSIFIER_PATH);
|
|
45
|
+
this.title = title;
|
|
46
|
+
this.defaultExecutionContext = defaultExecutionContext;
|
|
47
|
+
}
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
export const extractDataSpaceInfo = (
|
|
39
51
|
storedEntity: StoredEntity,
|
|
40
52
|
isSnapshot: boolean,
|
|
41
|
-
):
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
): ResolvedDataSpaceEntityWithOrigin =>
|
|
54
|
+
new ResolvedDataSpaceEntityWithOrigin(
|
|
55
|
+
{
|
|
56
|
+
groupId: storedEntity.groupId,
|
|
57
|
+
artifactId: storedEntity.artifactId,
|
|
58
|
+
versionId: isSnapshot ? SNAPSHOT_VERSION_ALIAS : storedEntity.versionId,
|
|
59
|
+
},
|
|
60
|
+
isString(storedEntity.entity.content.title)
|
|
61
|
+
? storedEntity.entity.content.title
|
|
62
|
+
: undefined,
|
|
63
|
+
extractEntityNameFromPath(storedEntity.entity.path),
|
|
64
|
+
storedEntity.entity.path,
|
|
65
|
+
// NOTE: we don't want to assert the existence of this field even when it
|
|
66
|
+
// is required in the specification of data product, so we don't throw error here
|
|
67
|
+
isString(storedEntity.entity.content.defaultExecutionContext)
|
|
68
|
+
? storedEntity.entity.content.defaultExecutionContext
|
|
69
|
+
: undefined,
|
|
70
|
+
);
|