@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
@@ -19,8 +19,6 @@ import {
|
|
19
19
|
extractElementNameFromPath,
|
20
20
|
RuntimePointer,
|
21
21
|
PackageableElementExplicitReference,
|
22
|
-
type Runtime,
|
23
|
-
type Class,
|
24
22
|
type RawLambda,
|
25
23
|
} from '@finos/legend-graph';
|
26
24
|
import {
|
@@ -31,16 +29,17 @@ import {
|
|
31
29
|
import {
|
32
30
|
LogEvent,
|
33
31
|
assertErrorThrown,
|
32
|
+
assertTrue,
|
34
33
|
guaranteeNonNullable,
|
35
|
-
guaranteeType,
|
36
34
|
returnUndefOnError,
|
37
35
|
uuid,
|
36
|
+
type GeneratorFn,
|
38
37
|
} from '@finos/legend-shared';
|
39
38
|
import {
|
40
|
-
type QueryBuilderState,
|
41
39
|
QueryBuilderDataBrowserWorkflow,
|
40
|
+
type QueryBuilderState,
|
42
41
|
} from '@finos/legend-query-builder';
|
43
|
-
import type { ProjectGAVCoordinates } from '@finos/legend-storage';
|
42
|
+
import type { Entity, ProjectGAVCoordinates } from '@finos/legend-storage';
|
44
43
|
import {
|
45
44
|
type DataSpaceExecutionContext,
|
46
45
|
DSL_DataSpace_getGraphManagerExtension,
|
@@ -50,87 +49,251 @@ import {
|
|
50
49
|
import {
|
51
50
|
QueryBuilderActionConfig_QueryApplication,
|
52
51
|
QueryEditorStore,
|
53
|
-
createViewProjectHandler,
|
54
|
-
createViewSDLCProjectHandler,
|
55
52
|
type QueryPersistConfiguration,
|
56
53
|
} from '../QueryEditorStore.js';
|
57
54
|
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
58
55
|
import {
|
59
|
-
DataSpaceProjectInfo,
|
60
56
|
DataSpaceQueryBuilderState,
|
61
57
|
createQueryClassTaggedValue,
|
62
58
|
type DataSpaceInfo,
|
63
59
|
} from '@finos/legend-extension-dsl-data-space/application';
|
64
|
-
import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
65
60
|
import { LegendQueryUserDataHelper } from '../../__lib__/LegendQueryUserDataHelper.js';
|
66
61
|
import {
|
67
62
|
createVisitedDataSpaceId,
|
68
63
|
hasDataSpaceInfoBeenVisited,
|
69
64
|
createSimpleVisitedDataspace,
|
65
|
+
type VisitedDataspace,
|
70
66
|
} from '../../__lib__/LegendQueryUserDataSpaceHelper.js';
|
71
67
|
import { LEGEND_QUERY_APP_EVENT } from '../../__lib__/LegendQueryEvent.js';
|
68
|
+
import {
|
69
|
+
action,
|
70
|
+
computed,
|
71
|
+
flow,
|
72
|
+
flowResult,
|
73
|
+
makeObservable,
|
74
|
+
observable,
|
75
|
+
} from 'mobx';
|
76
|
+
import { DataSpaceQuerySetupState } from './DataSpaceQuerySetupState.js';
|
77
|
+
import {
|
78
|
+
createDataSpaceDepoRepo,
|
79
|
+
createViewProjectHandler,
|
80
|
+
createViewSDLCProjectHandler,
|
81
|
+
} from './DataSpaceQueryBuilderHelper.js';
|
82
|
+
|
83
|
+
export type QueryableDataSpace = {
|
84
|
+
groupId: string;
|
85
|
+
artifactId: string;
|
86
|
+
versionId: string;
|
87
|
+
dataSpacePath: string;
|
88
|
+
executionContext: string;
|
89
|
+
runtimePath?: string | undefined;
|
90
|
+
classPath?: string | undefined;
|
91
|
+
};
|
92
|
+
|
93
|
+
type DataSpaceVisitedEntity = {
|
94
|
+
visited: VisitedDataspace;
|
95
|
+
entity: Entity;
|
96
|
+
};
|
72
97
|
|
73
98
|
export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
readonly dataSpacePath: string;
|
78
|
-
readonly executionContext: string;
|
79
|
-
readonly runtimePath: string | undefined;
|
80
|
-
readonly classPath: string | undefined;
|
99
|
+
queryableDataSpace: QueryableDataSpace | undefined;
|
100
|
+
dataSpaceCache: DataSpaceInfo[] | undefined;
|
101
|
+
declare queryBuilderState?: DataSpaceQueryBuilderState | undefined;
|
81
102
|
|
82
103
|
constructor(
|
83
104
|
applicationStore: LegendQueryApplicationStore,
|
84
105
|
depotServerClient: DepotServerClient,
|
85
|
-
|
86
|
-
artifactId: string,
|
87
|
-
versionId: string,
|
88
|
-
dataSpacePath: string,
|
89
|
-
executionContext: string,
|
90
|
-
runtimePath: string | undefined,
|
91
|
-
executionKey: string | undefined,
|
106
|
+
queryableDataSpace: QueryableDataSpace | undefined,
|
92
107
|
) {
|
93
108
|
super(applicationStore, depotServerClient);
|
109
|
+
makeObservable(this, {
|
110
|
+
changeDataSpace: flow,
|
111
|
+
dataSpaceCache: observable,
|
112
|
+
queryableDataSpace: observable,
|
113
|
+
setDataSpaceCache: action,
|
114
|
+
setQueryableDataSpace: action,
|
115
|
+
canPersistToSavedQuery: computed,
|
116
|
+
});
|
117
|
+
this.queryableDataSpace = queryableDataSpace;
|
118
|
+
}
|
94
119
|
|
95
|
-
|
96
|
-
this.
|
97
|
-
this.versionId = versionId;
|
98
|
-
this.dataSpacePath = dataSpacePath;
|
99
|
-
this.executionContext = executionContext;
|
100
|
-
this.runtimePath = runtimePath;
|
101
|
-
this.classPath = executionKey;
|
120
|
+
override get canPersistToSavedQuery(): boolean {
|
121
|
+
return Boolean(this.queryableDataSpace);
|
102
122
|
}
|
103
123
|
|
104
|
-
|
105
|
-
return
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
124
|
+
override get isViewProjectActionDisabled(): boolean {
|
125
|
+
return !this.queryableDataSpace;
|
126
|
+
}
|
127
|
+
|
128
|
+
getProjectInfo(): ProjectGAVCoordinates | undefined {
|
129
|
+
return this.queryableDataSpace;
|
130
|
+
}
|
131
|
+
|
132
|
+
setDataSpaceCache(val: DataSpaceInfo[]): void {
|
133
|
+
this.dataSpaceCache = val;
|
134
|
+
}
|
135
|
+
|
136
|
+
setQueryableDataSpace(val: QueryableDataSpace | undefined): void {
|
137
|
+
this.queryableDataSpace = val;
|
138
|
+
}
|
139
|
+
|
140
|
+
reConfigureWithDataSpaceInfo(info: DataSpaceInfo): boolean {
|
141
|
+
if (
|
142
|
+
info.groupId &&
|
143
|
+
info.artifactId &&
|
144
|
+
info.versionId &&
|
145
|
+
info.defaultExecutionContext
|
146
|
+
) {
|
147
|
+
this.queryableDataSpace = {
|
148
|
+
groupId: info.groupId,
|
149
|
+
artifactId: info.artifactId,
|
150
|
+
versionId: LATEST_VERSION_ALIAS,
|
151
|
+
dataSpacePath: info.path,
|
152
|
+
executionContext: info.defaultExecutionContext,
|
153
|
+
};
|
154
|
+
return true;
|
155
|
+
}
|
156
|
+
return false;
|
157
|
+
}
|
158
|
+
|
159
|
+
override *initialize(): GeneratorFn<void> {
|
160
|
+
if (!this.queryableDataSpace) {
|
161
|
+
const hydrated = (yield flowResult(this.redirectIfPossible())) as
|
162
|
+
| DataSpaceVisitedEntity
|
163
|
+
| undefined;
|
164
|
+
if (hydrated) {
|
165
|
+
this.setQueryableDataSpace({
|
166
|
+
groupId: hydrated.visited.groupId,
|
167
|
+
artifactId: hydrated.visited.artifactId,
|
168
|
+
versionId: hydrated.visited.versionId ?? LATEST_VERSION_ALIAS,
|
169
|
+
dataSpacePath: hydrated.visited.path,
|
170
|
+
executionContext: hydrated.entity.content
|
171
|
+
.defaultExecutionContext as string,
|
172
|
+
});
|
173
|
+
}
|
174
|
+
}
|
175
|
+
super.initialize();
|
110
176
|
}
|
111
177
|
|
112
178
|
async initializeQueryBuilderState(): Promise<QueryBuilderState> {
|
179
|
+
if (this.queryableDataSpace) {
|
180
|
+
return this.initializeQueryBuilderStateWithQueryableDataSpace(
|
181
|
+
this.queryableDataSpace,
|
182
|
+
);
|
183
|
+
} else {
|
184
|
+
const queryBuilderState = new DataSpaceQuerySetupState(
|
185
|
+
this,
|
186
|
+
this.applicationStore,
|
187
|
+
this.graphManagerState,
|
188
|
+
this.depotServerClient,
|
189
|
+
(dataSpaceInfo: DataSpaceInfo) => {
|
190
|
+
if (dataSpaceInfo.defaultExecutionContext) {
|
191
|
+
this.changeDataSpace(dataSpaceInfo);
|
192
|
+
} else {
|
193
|
+
this.applicationStore.notificationService.notifyWarning(
|
194
|
+
`Can't switch data space: default execution context not specified`,
|
195
|
+
);
|
196
|
+
}
|
197
|
+
},
|
198
|
+
createViewProjectHandler(this.applicationStore),
|
199
|
+
createViewSDLCProjectHandler(
|
200
|
+
this.applicationStore,
|
201
|
+
this.depotServerClient,
|
202
|
+
),
|
203
|
+
this.applicationStore.config.options.queryBuilderConfig,
|
204
|
+
);
|
205
|
+
if (this.dataSpaceCache?.length) {
|
206
|
+
queryBuilderState.configureDataSpaceOptions(this.dataSpaceCache);
|
207
|
+
}
|
208
|
+
return queryBuilderState;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
async redirectIfPossible(): Promise<DataSpaceVisitedEntity | undefined> {
|
213
|
+
const visitedQueries =
|
214
|
+
LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(
|
215
|
+
this.applicationStore.userDataService,
|
216
|
+
);
|
217
|
+
let redirect: DataSpaceVisitedEntity | undefined = undefined;
|
218
|
+
for (let i = 0; i < visitedQueries.length; i++) {
|
219
|
+
const visited = visitedQueries[i];
|
220
|
+
if (visited) {
|
221
|
+
const hydrated = await this.hyrdateVisitedDataSpace(visited);
|
222
|
+
if (hydrated) {
|
223
|
+
redirect = hydrated;
|
224
|
+
break;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
return redirect;
|
229
|
+
}
|
230
|
+
|
231
|
+
async hyrdateVisitedDataSpace(
|
232
|
+
visited: VisitedDataspace,
|
233
|
+
): Promise<DataSpaceVisitedEntity | undefined> {
|
234
|
+
try {
|
235
|
+
const entity = (await this.depotServerClient.getVersionEntity(
|
236
|
+
visited.groupId,
|
237
|
+
visited.artifactId,
|
238
|
+
visited.versionId ?? LATEST_VERSION_ALIAS,
|
239
|
+
visited.path,
|
240
|
+
)) as unknown as Entity;
|
241
|
+
const content = entity.content as {
|
242
|
+
executionContexts: { name: string }[];
|
243
|
+
};
|
244
|
+
if (visited.execContext) {
|
245
|
+
const found = content.executionContexts.find(
|
246
|
+
(e) => e.name === visited.execContext,
|
247
|
+
);
|
248
|
+
if (!found) {
|
249
|
+
visited.execContext = undefined;
|
250
|
+
return {
|
251
|
+
visited,
|
252
|
+
entity,
|
253
|
+
};
|
254
|
+
}
|
255
|
+
}
|
256
|
+
return {
|
257
|
+
visited,
|
258
|
+
entity,
|
259
|
+
};
|
260
|
+
} catch (error) {
|
261
|
+
assertErrorThrown(error);
|
262
|
+
LegendQueryUserDataHelper.removeRecentlyViewedDataSpace(
|
263
|
+
this.applicationStore.userDataService,
|
264
|
+
visited.id,
|
265
|
+
);
|
266
|
+
}
|
267
|
+
return undefined;
|
268
|
+
}
|
269
|
+
|
270
|
+
async initializeQueryBuilderStateWithQueryableDataSpace(
|
271
|
+
queryableDataSpace: QueryableDataSpace,
|
272
|
+
): Promise<QueryBuilderState> {
|
113
273
|
const dataSpace = getDataSpace(
|
114
|
-
|
274
|
+
queryableDataSpace.dataSpacePath,
|
115
275
|
this.graphManagerState.graph,
|
116
276
|
);
|
117
277
|
const executionContext = guaranteeNonNullable(
|
118
278
|
dataSpace.executionContexts.find(
|
119
|
-
(context) => context.name ===
|
279
|
+
(context) => context.name === queryableDataSpace.executionContext,
|
120
280
|
),
|
121
|
-
`Can't find execution context '${
|
281
|
+
`Can't find execution context '${queryableDataSpace.executionContext}'`,
|
122
282
|
);
|
123
283
|
let dataSpaceAnalysisResult;
|
124
284
|
try {
|
125
285
|
const project = StoreProjectData.serialization.fromJson(
|
126
|
-
await this.depotServerClient.getProject(
|
286
|
+
await this.depotServerClient.getProject(
|
287
|
+
queryableDataSpace.groupId,
|
288
|
+
queryableDataSpace.artifactId,
|
289
|
+
),
|
127
290
|
);
|
128
291
|
dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
|
129
292
|
this.graphManagerState.graphManager,
|
130
293
|
).retrieveDataSpaceAnalysisFromCache(() =>
|
131
294
|
retrieveAnalyticsResultCache(
|
132
295
|
project,
|
133
|
-
|
296
|
+
queryableDataSpace.versionId,
|
134
297
|
dataSpace.path,
|
135
298
|
this.depotServerClient,
|
136
299
|
),
|
@@ -138,20 +301,10 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
138
301
|
} catch {
|
139
302
|
// do nothing
|
140
303
|
}
|
141
|
-
const projectInfo = new DataSpaceProjectInfo(
|
142
|
-
this.groupId,
|
143
|
-
this.artifactId,
|
144
|
-
this.versionId,
|
145
|
-
createViewProjectHandler(this.applicationStore),
|
146
|
-
createViewSDLCProjectHandler(
|
147
|
-
this.applicationStore,
|
148
|
-
this.depotServerClient,
|
149
|
-
),
|
150
|
-
);
|
151
304
|
const sourceInfo = {
|
152
|
-
groupId:
|
153
|
-
artifactId:
|
154
|
-
versionId:
|
305
|
+
groupId: queryableDataSpace.groupId,
|
306
|
+
artifactId: queryableDataSpace.artifactId,
|
307
|
+
versionId: queryableDataSpace.versionId,
|
155
308
|
dataSpace: dataSpace.path,
|
156
309
|
};
|
157
310
|
const visitedDataSpaces =
|
@@ -161,142 +314,112 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
161
314
|
const queryBuilderState = new DataSpaceQueryBuilderState(
|
162
315
|
this.applicationStore,
|
163
316
|
this.graphManagerState,
|
164
|
-
this.depotServerClient,
|
165
317
|
QueryBuilderDataBrowserWorkflow.INSTANCE,
|
166
318
|
new QueryBuilderActionConfig_QueryApplication(this),
|
167
319
|
dataSpace,
|
168
320
|
executionContext,
|
321
|
+
createDataSpaceDepoRepo(
|
322
|
+
this,
|
323
|
+
queryableDataSpace.groupId,
|
324
|
+
queryableDataSpace.artifactId,
|
325
|
+
queryableDataSpace.versionId,
|
326
|
+
(dataSpaceInfo: DataSpaceInfo) =>
|
327
|
+
hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
|
328
|
+
),
|
169
329
|
(dataSpaceInfo: DataSpaceInfo) => {
|
170
|
-
|
171
|
-
this.applicationStore.
|
172
|
-
|
173
|
-
guaranteeNonNullable(dataSpaceInfo.groupId),
|
174
|
-
guaranteeNonNullable(dataSpaceInfo.artifactId),
|
175
|
-
LATEST_VERSION_ALIAS, //always default to latest
|
176
|
-
dataSpaceInfo.path,
|
177
|
-
dataSpaceInfo.defaultExecutionContext,
|
178
|
-
undefined,
|
179
|
-
undefined,
|
180
|
-
),
|
181
|
-
);
|
182
|
-
} else {
|
183
|
-
this.applicationStore.notificationService.notifyWarning(
|
184
|
-
`Can't switch data space: default execution context not specified`,
|
185
|
-
);
|
186
|
-
}
|
330
|
+
flowResult(this.changeDataSpace(dataSpaceInfo)).catch(
|
331
|
+
this.applicationStore.alertUnhandledError,
|
332
|
+
);
|
187
333
|
},
|
188
|
-
true,
|
189
334
|
dataSpaceAnalysisResult,
|
190
335
|
(ec: DataSpaceExecutionContext) => {
|
191
|
-
// runtime should already be set
|
192
|
-
const runtimePointer = guaranteeType(
|
193
|
-
queryBuilderState.executionContextState.runtimeValue,
|
194
|
-
RuntimePointer,
|
195
|
-
);
|
196
|
-
this.applicationStore.navigationService.navigator.updateCurrentLocation(
|
197
|
-
generateDataSpaceQueryCreatorRoute(
|
198
|
-
this.groupId,
|
199
|
-
this.artifactId,
|
200
|
-
this.versionId,
|
201
|
-
dataSpace.path,
|
202
|
-
ec.name,
|
203
|
-
runtimePointer.packageableRuntime.value ===
|
204
|
-
queryBuilderState.executionContext.defaultRuntime.value
|
205
|
-
? undefined
|
206
|
-
: runtimePointer.packageableRuntime.value.path,
|
207
|
-
queryBuilderState.class?.path,
|
208
|
-
),
|
209
|
-
);
|
210
336
|
returnUndefOnError(() =>
|
211
337
|
LegendQueryUserDataHelper.updateVisitedDataSpaceExecContext(
|
212
338
|
this.applicationStore.userDataService,
|
213
|
-
|
214
|
-
|
339
|
+
queryableDataSpace.groupId,
|
340
|
+
queryableDataSpace.artifactId,
|
215
341
|
dataSpace.path,
|
216
342
|
ec.name,
|
217
343
|
),
|
218
344
|
);
|
219
345
|
},
|
220
|
-
|
221
|
-
|
222
|
-
queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(
|
223
|
-
generateDataSpaceQueryCreatorRoute(
|
224
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).groupId,
|
225
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).artifactId,
|
226
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).versionId,
|
227
|
-
queryBuilderState.dataSpace.path,
|
228
|
-
queryBuilderState.executionContext.name,
|
229
|
-
runtimePointer.packageableRuntime.value ===
|
230
|
-
queryBuilderState.executionContext.defaultRuntime.value
|
231
|
-
? undefined
|
232
|
-
: runtimePointer.packageableRuntime.value.path,
|
233
|
-
queryBuilderState.class?.path,
|
234
|
-
),
|
235
|
-
);
|
236
|
-
},
|
237
|
-
(_class: Class) => {
|
238
|
-
// runtime should already be set
|
239
|
-
const runtimePointer = guaranteeType(
|
240
|
-
queryBuilderState.executionContextState.runtimeValue,
|
241
|
-
RuntimePointer,
|
242
|
-
);
|
243
|
-
queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(
|
244
|
-
generateDataSpaceQueryCreatorRoute(
|
245
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).groupId,
|
246
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).artifactId,
|
247
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).versionId,
|
248
|
-
queryBuilderState.dataSpace.path,
|
249
|
-
queryBuilderState.executionContext.name,
|
250
|
-
runtimePointer.packageableRuntime.value ===
|
251
|
-
queryBuilderState.executionContext.defaultRuntime.value
|
252
|
-
? undefined
|
253
|
-
: runtimePointer.packageableRuntime.value.path,
|
254
|
-
_class.path,
|
255
|
-
),
|
256
|
-
);
|
257
|
-
},
|
258
|
-
projectInfo,
|
346
|
+
undefined,
|
347
|
+
undefined,
|
259
348
|
this.applicationStore.config.options.queryBuilderConfig,
|
260
349
|
sourceInfo,
|
261
|
-
(dataSpaceInfo: DataSpaceInfo) =>
|
262
|
-
hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces),
|
263
350
|
);
|
351
|
+
if (this.dataSpaceCache?.length) {
|
352
|
+
queryBuilderState.dataSpaceRepo.configureDataSpaceOptions(
|
353
|
+
this.dataSpaceCache,
|
354
|
+
);
|
355
|
+
}
|
264
356
|
queryBuilderState.setExecutionContext(executionContext);
|
265
357
|
queryBuilderState.propagateExecutionContextChange(executionContext);
|
266
358
|
|
267
359
|
// set runtime if already chosen
|
268
|
-
if (
|
360
|
+
if (queryableDataSpace.runtimePath) {
|
269
361
|
queryBuilderState.changeRuntime(
|
270
362
|
new RuntimePointer(
|
271
363
|
PackageableElementExplicitReference.create(
|
272
|
-
this.graphManagerState.graph.getRuntime(
|
364
|
+
this.graphManagerState.graph.getRuntime(
|
365
|
+
queryableDataSpace.runtimePath,
|
366
|
+
),
|
273
367
|
),
|
274
368
|
),
|
275
369
|
);
|
276
370
|
}
|
277
371
|
|
278
372
|
// set class if already chosen
|
279
|
-
if (
|
373
|
+
if (queryableDataSpace.classPath) {
|
280
374
|
queryBuilderState.changeClass(
|
281
|
-
this.graphManagerState.graph.getClass(
|
375
|
+
this.graphManagerState.graph.getClass(queryableDataSpace.classPath),
|
282
376
|
);
|
283
377
|
}
|
284
378
|
|
285
379
|
// add to visited dataspaces
|
286
|
-
this.addVisitedDataSpace(
|
380
|
+
this.addVisitedDataSpace(queryableDataSpace);
|
287
381
|
return queryBuilderState;
|
288
382
|
}
|
289
383
|
|
290
|
-
|
384
|
+
*changeDataSpace(val: DataSpaceInfo): GeneratorFn<void> {
|
385
|
+
try {
|
386
|
+
assertTrue(
|
387
|
+
this.reConfigureWithDataSpaceInfo(val),
|
388
|
+
'Dataspace selected does not contain valid inputs, groupId, artifactId, and version',
|
389
|
+
);
|
390
|
+
this.initState.inProgress();
|
391
|
+
if (
|
392
|
+
this.queryBuilderState instanceof DataSpaceQueryBuilderState &&
|
393
|
+
this.queryBuilderState.dataSpaceRepo.dataSpaces?.length
|
394
|
+
) {
|
395
|
+
this.setDataSpaceCache(this.queryBuilderState.dataSpaceRepo.dataSpaces);
|
396
|
+
}
|
397
|
+
this.graphManagerState.resetGraph();
|
398
|
+
yield flowResult(this.buildGraph());
|
399
|
+
this.queryBuilderState =
|
400
|
+
(yield this.initializeQueryBuilderState()) as DataSpaceQueryBuilderState;
|
401
|
+
this.queryLoaderState.initialize(this.queryBuilderState);
|
402
|
+
this.initState.pass();
|
403
|
+
} catch (error) {
|
404
|
+
assertErrorThrown(error);
|
405
|
+
this.applicationStore.notificationService.notify(
|
406
|
+
`Unable to change dataspace: ${error.message}`,
|
407
|
+
);
|
408
|
+
this.onInitializeFailure();
|
409
|
+
this.initState.fail();
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
413
|
+
addVisitedDataSpace(queryableDataSpace: QueryableDataSpace): void {
|
291
414
|
try {
|
292
415
|
LegendQueryUserDataHelper.addVisitedDatspace(
|
293
416
|
this.applicationStore.userDataService,
|
294
417
|
createSimpleVisitedDataspace(
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
418
|
+
queryableDataSpace.groupId,
|
419
|
+
queryableDataSpace.artifactId,
|
420
|
+
queryableDataSpace.versionId,
|
421
|
+
queryableDataSpace.dataSpacePath,
|
422
|
+
queryableDataSpace.executionContext,
|
300
423
|
),
|
301
424
|
);
|
302
425
|
} catch (error) {
|
@@ -311,35 +434,41 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
311
434
|
getPersistConfiguration(
|
312
435
|
lambda: RawLambda,
|
313
436
|
options?: { update?: boolean | undefined },
|
314
|
-
): QueryPersistConfiguration {
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
:
|
319
|
-
|
320
|
-
}
|
321
|
-
|
322
|
-
|
323
|
-
query
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
query.
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
437
|
+
): QueryPersistConfiguration | undefined {
|
438
|
+
const queryableDataSpace = this.queryableDataSpace;
|
439
|
+
if (queryableDataSpace) {
|
440
|
+
return {
|
441
|
+
defaultName: options?.update
|
442
|
+
? `${extractElementNameFromPath(queryableDataSpace.dataSpacePath)}`
|
443
|
+
: `New Query for ${extractElementNameFromPath(queryableDataSpace.dataSpacePath)}[${
|
444
|
+
queryableDataSpace.executionContext
|
445
|
+
}]`,
|
446
|
+
decorator: (query: Query): void => {
|
447
|
+
query.id = uuid();
|
448
|
+
query.groupId = queryableDataSpace.groupId;
|
449
|
+
query.artifactId = queryableDataSpace.artifactId;
|
450
|
+
query.versionId = queryableDataSpace.versionId;
|
451
|
+
if (this.queryBuilderState?.class) {
|
452
|
+
query.taggedValues = [
|
453
|
+
createQueryClassTaggedValue(this.queryBuilderState.class.path),
|
454
|
+
];
|
455
|
+
}
|
456
|
+
},
|
457
|
+
};
|
458
|
+
}
|
459
|
+
return undefined;
|
333
460
|
}
|
334
461
|
|
335
462
|
override onInitializeFailure(): void {
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
463
|
+
if (this.queryableDataSpace) {
|
464
|
+
LegendQueryUserDataHelper.removeRecentlyViewedDataSpace(
|
465
|
+
this.applicationStore.userDataService,
|
466
|
+
createVisitedDataSpaceId(
|
467
|
+
this.queryableDataSpace.groupId,
|
468
|
+
this.queryableDataSpace.artifactId,
|
469
|
+
this.queryableDataSpace.dataSpacePath,
|
470
|
+
),
|
471
|
+
);
|
472
|
+
}
|
344
473
|
}
|
345
474
|
}
|