@finos/legend-application-query 13.4.21 → 13.5.0
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__/DSL_DataSpace_LegendQueryNavigation.d.ts +1 -1
- package/lib/__lib__/DSL_DataSpace_LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/DSL_DataSpace_LegendQueryNavigation.js +4 -4
- package/lib/__lib__/DSL_DataSpace_LegendQueryNavigation.js.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.d.ts +1 -0
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +1 -0
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +20 -11
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryWebApplication.js +15 -14
- package/lib/components/LegendQueryWebApplication.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +2 -1
- 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 +25 -8
- package/lib/components/data-space/DataSpaceQueryCreator.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts +0 -3
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +2 -12
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -3
- package/lib/stores/QueryEditorStore.d.ts +3 -4
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +54 -62
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.d.ts +23 -0
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.d.ts.map +1 -0
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.js +39 -0
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.js.map +1 -0
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +35 -12
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +189 -86
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +3 -20
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +8 -81
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +8 -8
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/package.json +14 -13
- package/src/__lib__/DSL_DataSpace_LegendQueryNavigation.ts +6 -4
- package/src/__lib__/LegendQueryNavigation.ts +1 -0
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +25 -17
- package/src/components/LegendQueryWebApplication.tsx +30 -27
- package/src/components/QueryEditor.tsx +2 -1
- package/src/components/data-space/DataSpaceQueryCreator.tsx +36 -18
- package/src/components/data-space/DataSpaceQuerySetup.tsx +2 -36
- package/src/index.ts +4 -2
- package/src/stores/QueryEditorStore.ts +109 -157
- package/src/stores/data-space/DataSpaceQueryBuilderHelper.ts +107 -0
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +302 -173
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +8 -156
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +11 -19
- package/tsconfig.json +1 -0
@@ -68,8 +68,6 @@ import {
|
|
68
68
|
QueryExplicitExecutionContext,
|
69
69
|
} from '@finos/legend-graph';
|
70
70
|
import {
|
71
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
|
72
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl,
|
73
71
|
generateExistingQueryEditorRoute,
|
74
72
|
generateMappingQueryCreatorRoute,
|
75
73
|
generateServiceQueryCreatorRoute,
|
@@ -79,7 +77,6 @@ import {
|
|
79
77
|
type Entity,
|
80
78
|
type ProjectGAVCoordinates,
|
81
79
|
type EntitiesWithOrigin,
|
82
|
-
parseProjectIdentifier,
|
83
80
|
} from '@finos/legend-storage';
|
84
81
|
import {
|
85
82
|
type DepotServerClient,
|
@@ -111,7 +108,6 @@ import {
|
|
111
108
|
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
112
109
|
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
113
110
|
import {
|
114
|
-
DataSpaceProjectInfo,
|
115
111
|
DataSpaceQueryBuilderState,
|
116
112
|
type DataSpaceInfo,
|
117
113
|
} from '@finos/legend-extension-dsl-data-space/application';
|
@@ -124,58 +120,7 @@ import {
|
|
124
120
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
125
121
|
import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
126
122
|
import { hasDataSpaceInfoBeenVisited } from '../__lib__/LegendQueryUserDataSpaceHelper.js';
|
127
|
-
|
128
|
-
export const createViewProjectHandler =
|
129
|
-
(applicationStore: LegendQueryApplicationStore) =>
|
130
|
-
(
|
131
|
-
groupId: string,
|
132
|
-
artifactId: string,
|
133
|
-
versionId: string,
|
134
|
-
entityPath: string | undefined,
|
135
|
-
): void =>
|
136
|
-
applicationStore.navigationService.navigator.visitAddress(
|
137
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl(
|
138
|
-
applicationStore.config.studioApplicationUrl,
|
139
|
-
groupId,
|
140
|
-
artifactId,
|
141
|
-
versionId,
|
142
|
-
entityPath,
|
143
|
-
),
|
144
|
-
);
|
145
|
-
|
146
|
-
export const createViewSDLCProjectHandler =
|
147
|
-
(
|
148
|
-
applicationStore: LegendQueryApplicationStore,
|
149
|
-
depotServerClient: DepotServerClient,
|
150
|
-
) =>
|
151
|
-
async (
|
152
|
-
groupId: string,
|
153
|
-
artifactId: string,
|
154
|
-
entityPath: string | undefined,
|
155
|
-
): Promise<void> => {
|
156
|
-
// fetch project data
|
157
|
-
const project = StoreProjectData.serialization.fromJson(
|
158
|
-
await depotServerClient.getProject(groupId, artifactId),
|
159
|
-
);
|
160
|
-
// find the matching SDLC instance
|
161
|
-
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
162
|
-
const matchingSDLCEntry = applicationStore.config.studioInstances.find(
|
163
|
-
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
164
|
-
);
|
165
|
-
if (matchingSDLCEntry) {
|
166
|
-
applicationStore.navigationService.navigator.visitAddress(
|
167
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl(
|
168
|
-
matchingSDLCEntry.url,
|
169
|
-
project.projectId,
|
170
|
-
entityPath,
|
171
|
-
),
|
172
|
-
);
|
173
|
-
} else {
|
174
|
-
applicationStore.notificationService.notifyWarning(
|
175
|
-
`Can't find the corresponding SDLC instance to view the SDLC project`,
|
176
|
-
);
|
177
|
-
}
|
178
|
-
};
|
123
|
+
import { createDataSpaceDepoRepo } from './data-space/DataSpaceQueryBuilderHelper.js';
|
179
124
|
|
180
125
|
export interface QueryPersistConfiguration {
|
181
126
|
defaultName?: string | undefined;
|
@@ -405,6 +350,10 @@ export abstract class QueryEditorStore {
|
|
405
350
|
return false;
|
406
351
|
}
|
407
352
|
|
353
|
+
get canPersistToSavedQuery(): boolean {
|
354
|
+
return true;
|
355
|
+
}
|
356
|
+
|
408
357
|
setExistingQueryName(val: string | undefined): void {
|
409
358
|
this.existingQueryName = val;
|
410
359
|
}
|
@@ -421,7 +370,7 @@ export abstract class QueryEditorStore {
|
|
421
370
|
return this.queryCreatorState.createQueryState.isInProgress;
|
422
371
|
}
|
423
372
|
|
424
|
-
abstract getProjectInfo(): ProjectGAVCoordinates;
|
373
|
+
abstract getProjectInfo(): ProjectGAVCoordinates | undefined;
|
425
374
|
/**
|
426
375
|
* Set up the editor state before building the graph
|
427
376
|
*/
|
@@ -498,7 +447,7 @@ export abstract class QueryEditorStore {
|
|
498
447
|
abstract getPersistConfiguration(
|
499
448
|
lambda: RawLambda,
|
500
449
|
options?: { update?: boolean | undefined },
|
501
|
-
): QueryPersistConfiguration;
|
450
|
+
): QueryPersistConfiguration | undefined;
|
502
451
|
|
503
452
|
*initialize(): GeneratorFn<void> {
|
504
453
|
if (!this.initState.isInInitialState) {
|
@@ -587,91 +536,101 @@ export abstract class QueryEditorStore {
|
|
587
536
|
*buildGraph(): GeneratorFn<void> {
|
588
537
|
const stopWatch = new StopWatch();
|
589
538
|
|
590
|
-
const
|
539
|
+
const projectInfo = this.getProjectInfo();
|
591
540
|
|
592
|
-
|
593
|
-
|
594
|
-
(yield this.depotServerClient.getProject(
|
595
|
-
groupId,
|
596
|
-
artifactId,
|
597
|
-
)) as PlainObject<StoreProjectData>,
|
598
|
-
);
|
541
|
+
if (projectInfo) {
|
542
|
+
const { groupId, artifactId, versionId } = projectInfo;
|
599
543
|
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
this.initState.setMessage(`Fetching entities...`);
|
608
|
-
const entities = (yield this.depotServerClient.getEntities(
|
609
|
-
project,
|
610
|
-
versionId,
|
611
|
-
)) as Entity[];
|
612
|
-
this.initState.setMessage(undefined);
|
613
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS);
|
614
|
-
|
615
|
-
// fetch and build dependencies
|
616
|
-
stopWatch.record();
|
617
|
-
const dependencyManager =
|
618
|
-
this.graphManagerState.graphManager.createDependencyManager();
|
619
|
-
this.graphManagerState.graph.dependencyManager = dependencyManager;
|
620
|
-
this.graphManagerState.dependenciesBuildState.setMessage(
|
621
|
-
`Fetching dependencies...`,
|
622
|
-
);
|
623
|
-
const dependencyEntitiesIndex = (yield flowResult(
|
624
|
-
this.depotServerClient.getIndexedDependencyEntities(project, versionId),
|
625
|
-
)) as Map<string, EntitiesWithOrigin>;
|
626
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
|
627
|
-
|
628
|
-
const dependency_buildReport = createGraphBuilderReport();
|
629
|
-
yield this.graphManagerState.graphManager.buildDependencies(
|
630
|
-
this.graphManagerState.coreModel,
|
631
|
-
this.graphManagerState.systemModel,
|
632
|
-
dependencyManager,
|
633
|
-
dependencyEntitiesIndex,
|
634
|
-
this.graphManagerState.dependenciesBuildState,
|
635
|
-
{},
|
636
|
-
dependency_buildReport,
|
637
|
-
);
|
638
|
-
dependency_buildReport.timings[
|
639
|
-
GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS
|
640
|
-
] = stopWatch.getRecord(
|
641
|
-
GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS,
|
642
|
-
);
|
544
|
+
// fetch project data
|
545
|
+
const project = StoreProjectData.serialization.fromJson(
|
546
|
+
(yield this.depotServerClient.getProject(
|
547
|
+
groupId,
|
548
|
+
artifactId,
|
549
|
+
)) as PlainObject<StoreProjectData>,
|
550
|
+
);
|
643
551
|
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
entities,
|
649
|
-
this.graphManagerState.graphBuildState,
|
650
|
-
{
|
651
|
-
origin: new LegendSDLC(groupId, artifactId, resolveVersion(versionId)),
|
652
|
-
},
|
653
|
-
graph_buildReport,
|
654
|
-
);
|
655
|
-
graph_buildReport.timings[
|
656
|
-
GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS
|
657
|
-
] = stopWatch.getRecord(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS);
|
658
|
-
|
659
|
-
// report
|
660
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
|
661
|
-
const graphBuilderReportData = {
|
662
|
-
timings:
|
663
|
-
this.applicationStore.timeService.finalizeTimingsRecord(stopWatch),
|
664
|
-
dependencies: dependency_buildReport,
|
665
|
-
dependenciesCount:
|
666
|
-
this.graphManagerState.graph.dependencyManager.numberOfDependencies,
|
667
|
-
graph: graph_buildReport,
|
668
|
-
};
|
669
|
-
this.logBuildGraphMetrics(graphBuilderReportData);
|
552
|
+
// initialize system
|
553
|
+
stopWatch.record();
|
554
|
+
yield this.graphManagerState.initializeSystem();
|
555
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS);
|
670
556
|
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
557
|
+
// fetch entities
|
558
|
+
stopWatch.record();
|
559
|
+
this.initState.setMessage(`Fetching entities...`);
|
560
|
+
const entities = (yield this.depotServerClient.getEntities(
|
561
|
+
project,
|
562
|
+
versionId,
|
563
|
+
)) as Entity[];
|
564
|
+
this.initState.setMessage(undefined);
|
565
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS);
|
566
|
+
|
567
|
+
// fetch and build dependencies
|
568
|
+
stopWatch.record();
|
569
|
+
const dependencyManager =
|
570
|
+
this.graphManagerState.graphManager.createDependencyManager();
|
571
|
+
this.graphManagerState.graph.dependencyManager = dependencyManager;
|
572
|
+
this.graphManagerState.dependenciesBuildState.setMessage(
|
573
|
+
`Fetching dependencies...`,
|
574
|
+
);
|
575
|
+
const dependencyEntitiesIndex = (yield flowResult(
|
576
|
+
this.depotServerClient.getIndexedDependencyEntities(project, versionId),
|
577
|
+
)) as Map<string, EntitiesWithOrigin>;
|
578
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
|
579
|
+
|
580
|
+
const dependency_buildReport = createGraphBuilderReport();
|
581
|
+
yield this.graphManagerState.graphManager.buildDependencies(
|
582
|
+
this.graphManagerState.coreModel,
|
583
|
+
this.graphManagerState.systemModel,
|
584
|
+
dependencyManager,
|
585
|
+
dependencyEntitiesIndex,
|
586
|
+
this.graphManagerState.dependenciesBuildState,
|
587
|
+
{},
|
588
|
+
dependency_buildReport,
|
589
|
+
);
|
590
|
+
dependency_buildReport.timings[
|
591
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS
|
592
|
+
] = stopWatch.getRecord(
|
593
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS,
|
594
|
+
);
|
595
|
+
|
596
|
+
// build graph
|
597
|
+
const graph_buildReport = createGraphBuilderReport();
|
598
|
+
yield this.graphManagerState.graphManager.buildGraph(
|
599
|
+
this.graphManagerState.graph,
|
600
|
+
entities,
|
601
|
+
this.graphManagerState.graphBuildState,
|
602
|
+
{
|
603
|
+
origin: new LegendSDLC(
|
604
|
+
groupId,
|
605
|
+
artifactId,
|
606
|
+
resolveVersion(versionId),
|
607
|
+
),
|
608
|
+
},
|
609
|
+
graph_buildReport,
|
610
|
+
);
|
611
|
+
graph_buildReport.timings[
|
612
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS
|
613
|
+
] = stopWatch.getRecord(
|
614
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS,
|
615
|
+
);
|
616
|
+
|
617
|
+
// report
|
618
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
|
619
|
+
const graphBuilderReportData = {
|
620
|
+
timings:
|
621
|
+
this.applicationStore.timeService.finalizeTimingsRecord(stopWatch),
|
622
|
+
dependencies: dependency_buildReport,
|
623
|
+
dependenciesCount:
|
624
|
+
this.graphManagerState.graph.dependencyManager.numberOfDependencies,
|
625
|
+
graph: graph_buildReport,
|
626
|
+
};
|
627
|
+
this.logBuildGraphMetrics(graphBuilderReportData);
|
628
|
+
|
629
|
+
this.applicationStore.logService.info(
|
630
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS),
|
631
|
+
graphBuilderReportData,
|
632
|
+
);
|
633
|
+
}
|
675
634
|
}
|
676
635
|
}
|
677
636
|
|
@@ -1231,20 +1190,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
1231
1190
|
} catch {
|
1232
1191
|
// do nothing
|
1233
1192
|
}
|
1234
|
-
const projectInfo = new DataSpaceProjectInfo(
|
1235
|
-
query.groupId,
|
1236
|
-
query.artifactId,
|
1237
|
-
query.versionId,
|
1238
|
-
createViewProjectHandler(this.applicationStore),
|
1239
|
-
createViewSDLCProjectHandler(
|
1240
|
-
this.applicationStore,
|
1241
|
-
this.depotServerClient,
|
1242
|
-
),
|
1243
|
-
);
|
1244
1193
|
const sourceInfo = {
|
1245
|
-
groupId:
|
1246
|
-
artifactId:
|
1247
|
-
versionId:
|
1194
|
+
groupId: query.groupId,
|
1195
|
+
artifactId: query.artifactId,
|
1196
|
+
versionId: query.versionId,
|
1248
1197
|
dataSpace: dataSpace.path,
|
1249
1198
|
};
|
1250
1199
|
const visitedDataSpaces =
|
@@ -1254,11 +1203,18 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
1254
1203
|
const dataSpaceQueryBuilderState = new DataSpaceQueryBuilderState(
|
1255
1204
|
this.applicationStore,
|
1256
1205
|
this.graphManagerState,
|
1257
|
-
this.depotServerClient,
|
1258
1206
|
QueryBuilderDataBrowserWorkflow.INSTANCE,
|
1259
1207
|
new QueryBuilderActionConfig_QueryApplication(this),
|
1260
1208
|
dataSpace,
|
1261
1209
|
matchingExecutionContext,
|
1210
|
+
createDataSpaceDepoRepo(
|
1211
|
+
this,
|
1212
|
+
query.groupId,
|
1213
|
+
query.artifactId,
|
1214
|
+
query.versionId,
|
1215
|
+
(dataSpaceInfo: DataSpaceInfo) =>
|
1216
|
+
hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
|
1217
|
+
),
|
1262
1218
|
(dataSpaceInfo: DataSpaceInfo) => {
|
1263
1219
|
if (dataSpaceInfo.defaultExecutionContext) {
|
1264
1220
|
const proceed = (): void =>
|
@@ -1322,16 +1278,12 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
1322
1278
|
);
|
1323
1279
|
}
|
1324
1280
|
},
|
1325
|
-
true,
|
1326
1281
|
dataSpaceAnalysisResult,
|
1327
1282
|
undefined,
|
1328
1283
|
undefined,
|
1329
1284
|
undefined,
|
1330
|
-
projectInfo,
|
1331
1285
|
this.applicationStore.config.options.queryBuilderConfig,
|
1332
1286
|
sourceInfo,
|
1333
|
-
(dataSpaceInfo: DataSpaceInfo) =>
|
1334
|
-
hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
|
1335
1287
|
);
|
1336
1288
|
const mappingModelCoverageAnalysisResult =
|
1337
1289
|
dataSpaceAnalysisResult?.executionContextsIndex.get(
|
@@ -0,0 +1,107 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
StoreProjectData,
|
19
|
+
type DepotServerClient,
|
20
|
+
} from '@finos/legend-server-depot';
|
21
|
+
import {
|
22
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
|
23
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl,
|
24
|
+
} from '../../__lib__/LegendQueryNavigation.js';
|
25
|
+
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
26
|
+
import { parseProjectIdentifier } from '@finos/legend-storage';
|
27
|
+
import type { QueryEditorStore } from '../QueryEditorStore.js';
|
28
|
+
import {
|
29
|
+
DataSpacesDepotRepository,
|
30
|
+
type DataSpaceInfo,
|
31
|
+
} from '@finos/legend-extension-dsl-data-space/application';
|
32
|
+
|
33
|
+
export const createViewProjectHandler =
|
34
|
+
(applicationStore: LegendQueryApplicationStore) =>
|
35
|
+
(
|
36
|
+
groupId: string,
|
37
|
+
artifactId: string,
|
38
|
+
versionId: string,
|
39
|
+
entityPath: string | undefined,
|
40
|
+
): void =>
|
41
|
+
applicationStore.navigationService.navigator.visitAddress(
|
42
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl(
|
43
|
+
applicationStore.config.studioApplicationUrl,
|
44
|
+
groupId,
|
45
|
+
artifactId,
|
46
|
+
versionId,
|
47
|
+
entityPath,
|
48
|
+
),
|
49
|
+
);
|
50
|
+
|
51
|
+
export const createViewSDLCProjectHandler =
|
52
|
+
(
|
53
|
+
applicationStore: LegendQueryApplicationStore,
|
54
|
+
depotServerClient: DepotServerClient,
|
55
|
+
) =>
|
56
|
+
async (
|
57
|
+
groupId: string,
|
58
|
+
artifactId: string,
|
59
|
+
entityPath: string | undefined,
|
60
|
+
): Promise<void> => {
|
61
|
+
// fetch project data
|
62
|
+
const project = StoreProjectData.serialization.fromJson(
|
63
|
+
await depotServerClient.getProject(groupId, artifactId),
|
64
|
+
);
|
65
|
+
// find the matching SDLC instance
|
66
|
+
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
67
|
+
const matchingSDLCEntry = applicationStore.config.studioInstances.find(
|
68
|
+
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
69
|
+
);
|
70
|
+
if (matchingSDLCEntry) {
|
71
|
+
applicationStore.navigationService.navigator.visitAddress(
|
72
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl(
|
73
|
+
matchingSDLCEntry.url,
|
74
|
+
project.projectId,
|
75
|
+
entityPath,
|
76
|
+
),
|
77
|
+
);
|
78
|
+
} else {
|
79
|
+
applicationStore.notificationService.notifyWarning(
|
80
|
+
`Can't find the corresponding SDLC instance to view the SDLC project`,
|
81
|
+
);
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
export const createDataSpaceDepoRepo = (
|
86
|
+
editorStore: QueryEditorStore,
|
87
|
+
groupId: string,
|
88
|
+
artifactId: string,
|
89
|
+
versionId: string,
|
90
|
+
prioritizeDataSpaceFunc: ((val: DataSpaceInfo) => boolean) | undefined,
|
91
|
+
): DataSpacesDepotRepository =>
|
92
|
+
new DataSpacesDepotRepository(
|
93
|
+
editorStore.depotServerClient,
|
94
|
+
editorStore.applicationStore,
|
95
|
+
editorStore.graphManagerState,
|
96
|
+
{
|
97
|
+
groupId,
|
98
|
+
artifactId,
|
99
|
+
versionId,
|
100
|
+
},
|
101
|
+
createViewProjectHandler(editorStore.applicationStore),
|
102
|
+
createViewSDLCProjectHandler(
|
103
|
+
editorStore.applicationStore,
|
104
|
+
editorStore.depotServerClient,
|
105
|
+
),
|
106
|
+
prioritizeDataSpaceFunc,
|
107
|
+
);
|