@finos/legend-extension-dsl-data-space 10.3.19 → 10.3.21
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +1 -1
- 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 +1 -8
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.js.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilder.js +19 -14
- 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 -4
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +2 -2
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts +36 -19
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js +114 -73
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -1
- package/package.json +13 -13
- package/src/components/index.ts +3 -1
- package/src/components/query-builder/DataSpaceAdvancedSearchModal.tsx +1 -27
- package/src/components/query-builder/DataSpaceQueryBuilder.tsx +22 -28
- package/src/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +7 -12
- package/src/stores/query-builder/DataSpaceQueryBuilderState.ts +188 -103
@@ -34,6 +34,7 @@ import { useApplicationStore } from '@finos/legend-application';
|
|
34
34
|
import {
|
35
35
|
type DataSpaceQueryBuilderState,
|
36
36
|
resolveUsableDataSpaceClasses,
|
37
|
+
DataSpacesDepotRepository,
|
37
38
|
} from '../../stores/query-builder/DataSpaceQueryBuilderState.js';
|
38
39
|
import {
|
39
40
|
buildRuntimeValueOption,
|
@@ -82,22 +83,6 @@ export const formatDataSpaceOptionLabel = (
|
|
82
83
|
<div className="query-builder__setup__data-space__option__label">
|
83
84
|
{option.label}
|
84
85
|
</div>
|
85
|
-
<div className="query-builder__setup__data-space__option__path">
|
86
|
-
{option.value.path}
|
87
|
-
</div>
|
88
|
-
<div className="query-builder__setup__data-space__option__gav">
|
89
|
-
{option.value.groupId &&
|
90
|
-
option.value.artifactId &&
|
91
|
-
option.value.versionId && (
|
92
|
-
<>
|
93
|
-
{generateGAVCoordinates(
|
94
|
-
option.value.groupId,
|
95
|
-
option.value.artifactId,
|
96
|
-
option.value.versionId,
|
97
|
-
)}
|
98
|
-
</>
|
99
|
-
)}
|
100
|
-
</div>
|
101
86
|
</div>
|
102
87
|
);
|
103
88
|
|
@@ -126,10 +111,14 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
126
111
|
(props: { queryBuilderState: DataSpaceQueryBuilderState }) => {
|
127
112
|
const { queryBuilderState } = props;
|
128
113
|
const applicationStore = useApplicationStore();
|
114
|
+
const repo = queryBuilderState.dataSpaceRepo;
|
115
|
+
const depotRepo =
|
116
|
+
repo instanceof DataSpacesDepotRepository ? repo : undefined;
|
117
|
+
const project = depotRepo?.project;
|
129
118
|
|
130
119
|
// data space
|
131
120
|
const prioritizeDataSpaceFunc = queryBuilderState.prioritizeDataSpaceFunc;
|
132
|
-
const sortedAllOptions = queryBuilderState.dataSpaces
|
121
|
+
const sortedAllOptions = (queryBuilderState.dataSpaceRepo.dataSpaces ?? [])
|
133
122
|
.map(buildDataSpaceOption)
|
134
123
|
.sort(compareLabelFn);
|
135
124
|
|
@@ -148,9 +137,9 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
148
137
|
label:
|
149
138
|
queryBuilderState.dataSpace.title ?? queryBuilderState.dataSpace.name,
|
150
139
|
value: {
|
151
|
-
groupId:
|
152
|
-
artifactId:
|
153
|
-
versionId:
|
140
|
+
groupId: project?.groupId,
|
141
|
+
artifactId: project?.artifactId,
|
142
|
+
versionId: project?.versionId,
|
154
143
|
title: queryBuilderState.dataSpace.title,
|
155
144
|
name: queryBuilderState.dataSpace.name,
|
156
145
|
path: queryBuilderState.dataSpace.path,
|
@@ -162,8 +151,11 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
162
151
|
queryBuilderState.onDataSpaceChange(option.value);
|
163
152
|
};
|
164
153
|
|
165
|
-
const openDataSpaceAdvancedSearch = (): void =>
|
166
|
-
|
154
|
+
const openDataSpaceAdvancedSearch = (): void => {
|
155
|
+
if (repo.isAdvancedDataSpaceSearchEnabled && depotRepo) {
|
156
|
+
depotRepo.showAdvancedSearchPanel(queryBuilderState.dataSpace);
|
157
|
+
}
|
158
|
+
};
|
167
159
|
|
168
160
|
// execution context
|
169
161
|
const executionContextOptions =
|
@@ -227,7 +219,7 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
227
219
|
);
|
228
220
|
|
229
221
|
useEffect(() => {
|
230
|
-
flowResult(queryBuilderState.loadDataSpaces()).catch(
|
222
|
+
flowResult(queryBuilderState.dataSpaceRepo.loadDataSpaces()).catch(
|
231
223
|
applicationStore.alertUnhandledError,
|
232
224
|
);
|
233
225
|
}, [queryBuilderState, applicationStore]);
|
@@ -281,7 +273,9 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
281
273
|
inputId="query-builder__setup__data-space-selector"
|
282
274
|
className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
|
283
275
|
options={dataSpaceOptions}
|
284
|
-
isLoading={
|
276
|
+
isLoading={
|
277
|
+
queryBuilderState.dataSpaceRepo.loadDataSpacesState.isInProgress
|
278
|
+
}
|
285
279
|
onChange={onDataSpaceOptionChange}
|
286
280
|
value={selectedDataSpaceOption}
|
287
281
|
placeholder="Search for data space..."
|
@@ -292,7 +286,7 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
292
286
|
}
|
293
287
|
formatOptionLabel={formatDataSpaceOptionLabel}
|
294
288
|
/>
|
295
|
-
{
|
289
|
+
{depotRepo && (
|
296
290
|
<>
|
297
291
|
<button
|
298
292
|
tabIndex={-1}
|
@@ -302,10 +296,10 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
302
296
|
>
|
303
297
|
<SearchIcon />
|
304
298
|
</button>
|
305
|
-
{
|
299
|
+
{depotRepo.advancedSearchState && (
|
306
300
|
<DataSpaceAdvancedSearchModal
|
307
|
-
searchState={
|
308
|
-
onClose={() =>
|
301
|
+
searchState={depotRepo.advancedSearchState}
|
302
|
+
onClose={() => depotRepo.hideAdvancedSearchPanel()}
|
309
303
|
/>
|
310
304
|
)}
|
311
305
|
</>
|
@@ -30,7 +30,6 @@ import {
|
|
30
30
|
useApplicationStore,
|
31
31
|
} from '@finos/legend-application';
|
32
32
|
import { DocumentationLink } from '@finos/legend-lego/application';
|
33
|
-
import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js';
|
34
33
|
import { DataSpaceExecutableTemplate } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
|
35
34
|
import type { DataSpaceQueryBuilderState } from '../../stores/query-builder/DataSpaceQueryBuilderState.js';
|
36
35
|
import { DSL_DATA_SPACE_LEGEND_QUERY_DOCUMENTATION_KEY } from '../../__lib__/query/DSL_DataSpace_LegendQueryDocumentation.js';
|
@@ -94,17 +93,10 @@ const DataSpaceTemplateQueryDialog = observer(
|
|
94
93
|
const visitTemplateQuery = (
|
95
94
|
template: DataSpaceExecutableTemplate,
|
96
95
|
): void => {
|
97
|
-
if (queryBuilderState.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
queryBuilderState.projectInfo.groupId,
|
102
|
-
queryBuilderState.projectInfo.artifactId,
|
103
|
-
queryBuilderState.projectInfo.versionId,
|
104
|
-
queryBuilderState.dataSpace.path,
|
105
|
-
template.id,
|
106
|
-
),
|
107
|
-
),
|
96
|
+
if (queryBuilderState.dataSpaceRepo.canVisitTemplateQuery) {
|
97
|
+
queryBuilderState.dataSpaceRepo.visitTemplateQuery(
|
98
|
+
queryBuilderState.dataSpace,
|
99
|
+
template,
|
108
100
|
);
|
109
101
|
}
|
110
102
|
};
|
@@ -165,6 +157,9 @@ const DataSpaceTemplateQueryDialog = observer(
|
|
165
157
|
<button
|
166
158
|
className="query-builder__data-space__template-query-panel__query__share"
|
167
159
|
title="Visit..."
|
160
|
+
disabled={
|
161
|
+
!queryBuilderState.dataSpaceRepo.canVisitTemplateQuery
|
162
|
+
}
|
168
163
|
onClick={() => visitTemplateQuery(query)}
|
169
164
|
>
|
170
165
|
<ShareIcon />
|
@@ -53,6 +53,7 @@ import { renderDataSpaceQueryBuilderSetupPanelContent } from '../../components/q
|
|
53
53
|
import {
|
54
54
|
DataSpace,
|
55
55
|
type DataSpaceExecutionContext,
|
56
|
+
type DataSpaceExecutableTemplate,
|
56
57
|
} from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
|
57
58
|
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
|
58
59
|
import { DataSpaceAdvancedSearchState } from '../query/DataSpaceAdvancedSearchState.js';
|
@@ -61,6 +62,8 @@ import {
|
|
61
62
|
extractDataSpaceInfo,
|
62
63
|
type DataSpaceInfo,
|
63
64
|
} from '../shared/DataSpaceInfo.js';
|
65
|
+
import type { ProjectGAVCoordinates } from '@finos/legend-storage';
|
66
|
+
import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js';
|
64
67
|
|
65
68
|
export const resolveUsableDataSpaceClasses = (
|
66
69
|
dataSpace: DataSpace,
|
@@ -80,11 +83,92 @@ export const resolveUsableDataSpaceClasses = (
|
|
80
83
|
}
|
81
84
|
return getMappingCompatibleClasses(mapping, graphManagerState.usableClasses);
|
82
85
|
};
|
86
|
+
export interface DataSpaceQuerySDLC extends QuerySDLC {
|
87
|
+
groupId: string;
|
88
|
+
artifactId: string;
|
89
|
+
versionId: string;
|
90
|
+
dataSpace: string;
|
91
|
+
}
|
92
|
+
|
93
|
+
// could be abstracted for element
|
94
|
+
export abstract class DataSpacesBuilderRepoistory {
|
95
|
+
readonly applicationStore: GenericLegendApplicationStore;
|
96
|
+
readonly graphManagerState: GraphManagerState;
|
97
|
+
readonly loadDataSpacesState = ActionState.create();
|
98
|
+
dataSpaces: DataSpaceInfo[] | undefined;
|
99
|
+
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined;
|
100
|
+
|
101
|
+
constructor(
|
102
|
+
applicatonstore: GenericLegendApplicationStore,
|
103
|
+
graphManagerState: GraphManagerState,
|
104
|
+
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
105
|
+
) {
|
106
|
+
this.applicationStore = applicatonstore;
|
107
|
+
this.graphManagerState = graphManagerState;
|
108
|
+
this.prioritizeDataSpaceFunc = prioritizeDataSpaceFunc;
|
109
|
+
}
|
110
|
+
|
111
|
+
get isAdvancedDataSpaceSearchEnabled(): boolean {
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
|
115
|
+
get canVisitTemplateQuery(): boolean {
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
|
119
|
+
abstract loadDataSpaces(): GeneratorFn<void>;
|
120
|
+
abstract visitTemplateQuery(
|
121
|
+
dataSpace: DataSpace,
|
122
|
+
template: DataSpaceExecutableTemplate,
|
123
|
+
): void;
|
124
|
+
|
125
|
+
configureDataSpaceOptions(val: DataSpaceInfo[]): void {
|
126
|
+
this.dataSpaces = val;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
export class DataSpacesGraphRepoistory extends DataSpacesBuilderRepoistory {
|
131
|
+
constructor(
|
132
|
+
applicatonstore: GenericLegendApplicationStore,
|
133
|
+
graphManagerState: GraphManagerState,
|
134
|
+
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
135
|
+
) {
|
136
|
+
super(applicatonstore, graphManagerState, prioritizeDataSpaceFunc);
|
137
|
+
makeObservable(this, {
|
138
|
+
dataSpaces: observable,
|
139
|
+
loadDataSpaces: flow,
|
140
|
+
configureDataSpaceOptions: action,
|
141
|
+
});
|
142
|
+
}
|
143
|
+
|
144
|
+
*loadDataSpaces(): GeneratorFn<void> {
|
145
|
+
this.dataSpaces = this.graphManagerState.graph.allOwnElements
|
146
|
+
.filter(filterByType(DataSpace))
|
147
|
+
.map(
|
148
|
+
(e) =>
|
149
|
+
({
|
150
|
+
groupId: undefined,
|
151
|
+
artifactId: undefined,
|
152
|
+
versionId: undefined,
|
153
|
+
path: e.path,
|
154
|
+
name: e.name,
|
155
|
+
title: e.title,
|
156
|
+
defaultExecutionContext: e.defaultExecutionContext.title,
|
157
|
+
}) as DataSpaceInfo,
|
158
|
+
);
|
159
|
+
}
|
83
160
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
161
|
+
override visitTemplateQuery(
|
162
|
+
dataSpace: DataSpace,
|
163
|
+
template: DataSpaceExecutableTemplate,
|
164
|
+
): void {
|
165
|
+
throw new Error('Method not implemented.');
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
export class DataSpacesDepotRepository extends DataSpacesBuilderRepoistory {
|
170
|
+
readonly depotServerClient: DepotServerClient;
|
171
|
+
readonly project: ProjectGAVCoordinates;
|
88
172
|
readonly viewProject: (
|
89
173
|
groupId: string,
|
90
174
|
artifactId: string,
|
@@ -96,11 +180,13 @@ export class DataSpaceProjectInfo {
|
|
96
180
|
artifactId: string,
|
97
181
|
entityPath: string | undefined,
|
98
182
|
) => Promise<void>;
|
183
|
+
advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
|
99
184
|
|
100
185
|
constructor(
|
101
|
-
|
102
|
-
|
103
|
-
|
186
|
+
depotServerClient: DepotServerClient,
|
187
|
+
applicatonstore: GenericLegendApplicationStore,
|
188
|
+
graphManagerState: GraphManagerState,
|
189
|
+
project: ProjectGAVCoordinates,
|
104
190
|
viewProject: (
|
105
191
|
groupId: string,
|
106
192
|
artifactId: string,
|
@@ -112,26 +198,101 @@ export class DataSpaceProjectInfo {
|
|
112
198
|
artifactId: string,
|
113
199
|
entityPath: string | undefined,
|
114
200
|
) => Promise<void>,
|
201
|
+
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
115
202
|
) {
|
116
|
-
|
117
|
-
this
|
118
|
-
|
203
|
+
super(applicatonstore, graphManagerState, prioritizeDataSpaceFunc);
|
204
|
+
makeObservable(this, {
|
205
|
+
advancedSearchState: observable,
|
206
|
+
dataSpaces: observable,
|
207
|
+
showAdvancedSearchPanel: action,
|
208
|
+
hideAdvancedSearchPanel: action,
|
209
|
+
visitTemplateQuery: action,
|
210
|
+
configureDataSpaceOptions: action,
|
211
|
+
loadDataSpaces: flow,
|
212
|
+
});
|
213
|
+
this.depotServerClient = depotServerClient;
|
214
|
+
this.project = project;
|
119
215
|
this.viewProject = viewProject;
|
120
216
|
this.viewSDLCProject = viewSDLCProject;
|
121
217
|
}
|
122
|
-
}
|
123
218
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
219
|
+
override get isAdvancedDataSpaceSearchEnabled(): boolean {
|
220
|
+
return true;
|
221
|
+
}
|
222
|
+
|
223
|
+
override get canVisitTemplateQuery(): boolean {
|
224
|
+
return true;
|
225
|
+
}
|
226
|
+
|
227
|
+
override visitTemplateQuery(
|
228
|
+
dataSpace: DataSpace,
|
229
|
+
template: DataSpaceExecutableTemplate,
|
230
|
+
): void {
|
231
|
+
this.applicationStore.navigationService.navigator.visitAddress(
|
232
|
+
this.applicationStore.navigationService.navigator.generateAddress(
|
233
|
+
generateDataSpaceTemplateQueryCreatorRoute(
|
234
|
+
this.project.groupId,
|
235
|
+
this.project.artifactId,
|
236
|
+
this.project.versionId,
|
237
|
+
dataSpace.path,
|
238
|
+
template.id,
|
239
|
+
),
|
240
|
+
),
|
241
|
+
);
|
242
|
+
}
|
243
|
+
|
244
|
+
showAdvancedSearchPanel(dataSpace: DataSpace): void {
|
245
|
+
this.advancedSearchState = new DataSpaceAdvancedSearchState(
|
246
|
+
this.applicationStore,
|
247
|
+
this.graphManagerState,
|
248
|
+
this.depotServerClient,
|
249
|
+
{
|
250
|
+
viewProject: this.viewProject,
|
251
|
+
viewSDLCProject: this.viewSDLCProject,
|
252
|
+
},
|
253
|
+
{
|
254
|
+
groupId: this.project.groupId,
|
255
|
+
artifactId: this.project.artifactId,
|
256
|
+
versionId: this.project.versionId,
|
257
|
+
title: dataSpace.title,
|
258
|
+
name: dataSpace.name,
|
259
|
+
path: dataSpace.path,
|
260
|
+
defaultExecutionContext: dataSpace.defaultExecutionContext.name,
|
261
|
+
},
|
262
|
+
this.project.versionId === SNAPSHOT_VERSION_ALIAS,
|
263
|
+
);
|
264
|
+
}
|
265
|
+
|
266
|
+
hideAdvancedSearchPanel(): void {
|
267
|
+
this.advancedSearchState = undefined;
|
268
|
+
}
|
269
|
+
|
270
|
+
*loadDataSpaces(): GeneratorFn<void> {
|
271
|
+
if (this.dataSpaces === undefined) {
|
272
|
+
this.loadDataSpacesState.inProgress();
|
273
|
+
const toGetSnapShot = this.project.versionId === SNAPSHOT_VERSION_ALIAS;
|
274
|
+
try {
|
275
|
+
this.dataSpaces = (
|
276
|
+
(yield this.depotServerClient.getEntitiesByClassifier(
|
277
|
+
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
278
|
+
{
|
279
|
+
scope: toGetSnapShot ? DepotScope.SNAPSHOT : DepotScope.RELEASES,
|
280
|
+
},
|
281
|
+
)) as StoredEntity[]
|
282
|
+
).map((storedEntity) =>
|
283
|
+
extractDataSpaceInfo(storedEntity, toGetSnapShot),
|
284
|
+
);
|
285
|
+
this.loadDataSpacesState.pass();
|
286
|
+
} catch (error) {
|
287
|
+
assertErrorThrown(error);
|
288
|
+
this.loadDataSpacesState.fail();
|
289
|
+
this.applicationStore.notificationService.notifyError(error);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
}
|
129
293
|
}
|
130
294
|
|
131
295
|
export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
132
|
-
readonly depotServerClient: DepotServerClient;
|
133
|
-
readonly isAdvancedDataSpaceSearchEnabled: boolean;
|
134
|
-
readonly loadDataSpacesState = ActionState.create();
|
135
296
|
readonly onDataSpaceChange: (val: DataSpaceInfo) => void;
|
136
297
|
readonly onExecutionContextChange?:
|
137
298
|
| ((val: DataSpaceExecutionContext) => void)
|
@@ -139,68 +300,60 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
139
300
|
readonly onRuntimeChange?: ((val: Runtime) => void) | undefined;
|
140
301
|
readonly onClassChange?: ((val: Class) => void) | undefined;
|
141
302
|
readonly dataSpaceAnalysisResult?: DataSpaceAnalysisResult | undefined;
|
142
|
-
readonly
|
303
|
+
readonly dataSpaceRepo: DataSpacesBuilderRepoistory;
|
143
304
|
|
144
305
|
override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
|
145
306
|
renderDataSpaceQueryBuilderSetupPanelContent(this);
|
146
307
|
|
147
308
|
dataSpace: DataSpace;
|
148
309
|
executionContext!: DataSpaceExecutionContext;
|
149
|
-
dataSpaces: DataSpaceInfo[] = [];
|
150
310
|
readonly prioritizeDataSpaceFunc?:
|
151
311
|
| ((val: DataSpaceInfo) => boolean)
|
152
312
|
| undefined;
|
153
313
|
showRuntimeSelector = false;
|
154
|
-
advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
|
155
314
|
isTemplateQueryDialogOpen = false;
|
156
315
|
|
157
316
|
constructor(
|
158
317
|
applicationStore: GenericLegendApplicationStore,
|
159
318
|
graphManagerState: GraphManagerState,
|
160
|
-
depotServerClient: DepotServerClient,
|
161
319
|
workflow: QueryBuilderWorkflowState,
|
162
320
|
actionConfig: QueryBuilderActionConfig,
|
163
321
|
dataSpace: DataSpace,
|
164
322
|
executionContext: DataSpaceExecutionContext,
|
323
|
+
dataSpaceRepo: DataSpacesBuilderRepoistory | undefined,
|
165
324
|
onDataSpaceChange: (val: DataSpaceInfo) => void,
|
166
|
-
isAdvancedDataSpaceSearchEnabled: boolean,
|
167
325
|
dataSpaceAnalysisResult?: DataSpaceAnalysisResult | undefined,
|
168
326
|
onExecutionContextChange?:
|
169
327
|
| ((val: DataSpaceExecutionContext) => void)
|
170
328
|
| undefined,
|
171
329
|
onRuntimeChange?: ((val: Runtime) => void) | undefined,
|
172
330
|
onClassChange?: ((val: Class) => void) | undefined,
|
173
|
-
projectInfo?: DataSpaceProjectInfo | undefined,
|
174
331
|
config?: QueryBuilderConfig | undefined,
|
175
332
|
sourceInfo?: QuerySDLC | undefined,
|
176
|
-
prioritizeDataSpaceFunc?: ((val: DataSpaceInfo) => boolean) | undefined,
|
177
333
|
) {
|
178
334
|
super(applicationStore, graphManagerState, workflow, config, sourceInfo);
|
179
335
|
|
180
336
|
makeObservable(this, {
|
181
|
-
dataSpaces: observable,
|
182
337
|
executionContext: observable,
|
183
338
|
showRuntimeSelector: observable,
|
184
|
-
advancedSearchState: observable,
|
185
339
|
isTemplateQueryDialogOpen: observable,
|
186
|
-
showAdvancedSearchPanel: action,
|
187
|
-
hideAdvancedSearchPanel: action,
|
188
340
|
setExecutionContext: action,
|
189
341
|
setShowRuntimeSelector: action,
|
190
342
|
setTemplateQueryDialogOpen: action,
|
191
|
-
loadDataSpaces: flow,
|
192
343
|
});
|
193
344
|
|
194
|
-
this.depotServerClient = depotServerClient;
|
195
345
|
this.dataSpace = dataSpace;
|
196
346
|
this.executionContext = executionContext;
|
197
|
-
this.projectInfo = projectInfo;
|
198
347
|
this.onDataSpaceChange = onDataSpaceChange;
|
199
348
|
this.onExecutionContextChange = onExecutionContextChange;
|
200
349
|
this.onRuntimeChange = onRuntimeChange;
|
201
350
|
this.onClassChange = onClassChange;
|
202
|
-
this.
|
203
|
-
|
351
|
+
this.dataSpaceRepo =
|
352
|
+
dataSpaceRepo ??
|
353
|
+
new DataSpacesGraphRepoistory(
|
354
|
+
this.applicationStore,
|
355
|
+
this.graphManagerState,
|
356
|
+
);
|
204
357
|
this.dataSpaceAnalysisResult = dataSpaceAnalysisResult;
|
205
358
|
this.workflowState.updateActionConfig(actionConfig);
|
206
359
|
}
|
@@ -222,34 +375,6 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
222
375
|
this.isTemplateQueryDialogOpen = val;
|
223
376
|
}
|
224
377
|
|
225
|
-
showAdvancedSearchPanel(): void {
|
226
|
-
if (this.projectInfo && this.isAdvancedDataSpaceSearchEnabled) {
|
227
|
-
this.advancedSearchState = new DataSpaceAdvancedSearchState(
|
228
|
-
this.applicationStore,
|
229
|
-
this.graphManagerState,
|
230
|
-
this.depotServerClient,
|
231
|
-
{
|
232
|
-
viewProject: this.projectInfo.viewProject,
|
233
|
-
viewSDLCProject: this.projectInfo.viewSDLCProject,
|
234
|
-
},
|
235
|
-
{
|
236
|
-
groupId: this.projectInfo.groupId,
|
237
|
-
artifactId: this.projectInfo.artifactId,
|
238
|
-
versionId: this.projectInfo.versionId,
|
239
|
-
title: this.dataSpace.title,
|
240
|
-
name: this.dataSpace.name,
|
241
|
-
path: this.dataSpace.path,
|
242
|
-
defaultExecutionContext: this.dataSpace.defaultExecutionContext.name,
|
243
|
-
},
|
244
|
-
this.projectInfo.versionId === SNAPSHOT_VERSION_ALIAS,
|
245
|
-
);
|
246
|
-
}
|
247
|
-
}
|
248
|
-
|
249
|
-
hideAdvancedSearchPanel(): void {
|
250
|
-
this.advancedSearchState = undefined;
|
251
|
-
}
|
252
|
-
|
253
378
|
setExecutionContext(val: DataSpaceExecutionContext): void {
|
254
379
|
this.executionContext = val;
|
255
380
|
}
|
@@ -258,46 +383,6 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
|
|
258
383
|
this.showRuntimeSelector = val;
|
259
384
|
}
|
260
385
|
|
261
|
-
*loadDataSpaces(): GeneratorFn<void> {
|
262
|
-
if (this.projectInfo) {
|
263
|
-
this.loadDataSpacesState.inProgress();
|
264
|
-
const toGetSnapShot =
|
265
|
-
this.projectInfo.versionId === SNAPSHOT_VERSION_ALIAS;
|
266
|
-
try {
|
267
|
-
this.dataSpaces = (
|
268
|
-
(yield this.depotServerClient.getEntitiesByClassifier(
|
269
|
-
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
270
|
-
{
|
271
|
-
scope: toGetSnapShot ? DepotScope.SNAPSHOT : DepotScope.RELEASES,
|
272
|
-
},
|
273
|
-
)) as StoredEntity[]
|
274
|
-
).map((storedEntity) =>
|
275
|
-
extractDataSpaceInfo(storedEntity, toGetSnapShot),
|
276
|
-
);
|
277
|
-
this.loadDataSpacesState.pass();
|
278
|
-
} catch (error) {
|
279
|
-
assertErrorThrown(error);
|
280
|
-
this.loadDataSpacesState.fail();
|
281
|
-
this.applicationStore.notificationService.notifyError(error);
|
282
|
-
}
|
283
|
-
} else {
|
284
|
-
this.dataSpaces = this.graphManagerState.graph.allOwnElements
|
285
|
-
.filter(filterByType(DataSpace))
|
286
|
-
.map(
|
287
|
-
(e) =>
|
288
|
-
({
|
289
|
-
groupId: undefined,
|
290
|
-
artifactId: undefined,
|
291
|
-
versionId: undefined,
|
292
|
-
path: e.path,
|
293
|
-
name: e.name,
|
294
|
-
title: e.title,
|
295
|
-
defaultExecutionContext: e.defaultExecutionContext.title,
|
296
|
-
}) as DataSpaceInfo,
|
297
|
-
);
|
298
|
-
}
|
299
|
-
}
|
300
|
-
|
301
386
|
/**
|
302
387
|
* Propagation after changing the execution context:
|
303
388
|
* - The mapping will be updated to the mapping of the execution context
|