@finos/legend-extension-dsl-data-space 8.0.0 → 9.0.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.
Files changed (60) hide show
  1. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  2. package/lib/components/DataSpaceViewer.js +12 -5
  3. package/lib/components/DataSpaceViewer.js.map +1 -1
  4. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts +2 -4
  5. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +24 -35
  7. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  8. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts +24 -0
  9. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts.map +1 -0
  10. package/lib/components/query/DataSpaceAdvancedSearchModal.js +82 -0
  11. package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +1 -0
  12. package/lib/components/query/DataSpaceQueryBuilder.d.ts +7 -0
  13. package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -1
  14. package/lib/components/query/DataSpaceQueryBuilder.js +7 -5
  15. package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -1
  16. package/lib/components/query/DataSpaceQuerySetup.d.ts +3 -4
  17. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
  18. package/lib/components/query/DataSpaceQuerySetup.js +45 -56
  19. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  20. package/lib/index.css +2 -2
  21. package/lib/index.css.map +1 -1
  22. package/lib/package.json +4 -4
  23. package/lib/stores/DataSpaceViewerState.d.ts +9 -5
  24. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  25. package/lib/stores/DataSpaceViewerState.js +8 -4
  26. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  27. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.d.ts +5 -1
  28. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.d.ts.map +1 -1
  29. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.js +10 -5
  30. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.js.map +1 -1
  31. package/lib/stores/query/{DataSpaceQuerySetupState.d.ts → DataSpaceAdvancedSearchState.d.ts} +16 -7
  32. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -0
  33. package/lib/stores/query/{DataSpaceQuerySetupState.js → DataSpaceAdvancedSearchState.js} +28 -16
  34. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -0
  35. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +9 -2
  36. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -1
  37. package/lib/stores/query/DataSpaceQueryBuilderState.js +32 -2
  38. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -1
  39. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  40. package/lib/stores/query/DataSpaceQueryCreatorStore.js +6 -6
  41. package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -1
  42. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +50 -0
  43. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +1 -0
  44. package/lib/stores/query/DataSpaceQuerySetupStore.js +112 -0
  45. package/lib/stores/query/DataSpaceQuerySetupStore.js.map +1 -0
  46. package/package.json +15 -15
  47. package/src/components/DataSpaceViewer.tsx +53 -24
  48. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +35 -69
  49. package/src/components/query/DataSpaceAdvancedSearchModal.tsx +248 -0
  50. package/src/components/query/DataSpaceQueryBuilder.tsx +57 -37
  51. package/src/components/query/DataSpaceQuerySetup.tsx +124 -186
  52. package/src/stores/DataSpaceViewerState.ts +28 -15
  53. package/src/stores/query/DSL_DataSpace_LegendQueryRouter.ts +34 -20
  54. package/src/stores/query/{DataSpaceQuerySetupState.ts → DataSpaceAdvancedSearchState.ts} +63 -37
  55. package/src/stores/query/DataSpaceQueryBuilderState.ts +61 -2
  56. package/src/stores/query/DataSpaceQueryCreatorStore.ts +11 -4
  57. package/src/stores/query/DataSpaceQuerySetupStore.ts +207 -0
  58. package/tsconfig.json +3 -1
  59. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +0 -1
  60. package/lib/stores/query/DataSpaceQuerySetupState.js.map +0 -1
@@ -15,17 +15,13 @@
15
15
  */
16
16
 
17
17
  import type { ClassView } from '@finos/legend-extension-dsl-diagram';
18
- import type { Class } from '@finos/legend-graph';
18
+ import type { Class, GraphManagerState } from '@finos/legend-graph';
19
19
  import type { Entity } from '@finos/legend-storage';
20
- import {
21
- type QuerySetupStore,
22
- QuerySetupState,
23
- EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
24
- } from '@finos/legend-application-query';
25
20
  import {
26
21
  type StoredEntity,
27
22
  DepotScope,
28
23
  ProjectData,
24
+ type DepotServerClient,
29
25
  } from '@finos/legend-server-depot';
30
26
  import {
31
27
  type GeneratorFn,
@@ -42,21 +38,54 @@ import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
42
38
  import {
43
39
  DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
44
40
  DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
41
+ type GenericLegendApplicationStore,
45
42
  } from '@finos/legend-application';
46
43
  import { retrieveAnalyticsResultCache } from '../../graphManager/action/analytics/DataSpaceAnalysisHelper.js';
47
44
  import type { DataSpaceAnalysisResult } from '../../graphManager/action/analytics/DataSpaceAnalysis.js';
48
45
 
49
- export class DataSpaceQuerySetupState extends QuerySetupState {
46
+ export class DataSpaceAdvancedSearchState {
47
+ readonly applicationStore: GenericLegendApplicationStore;
48
+ readonly graphManagerState: GraphManagerState;
49
+ readonly depotServerClient: DepotServerClient;
50
+ readonly viewProject: (
51
+ groupId: string,
52
+ artifactId: string,
53
+ versionId: string,
54
+ entityPath: string | undefined,
55
+ ) => void;
56
+ readonly viewSDLCProject: (
57
+ groupId: string,
58
+ artifactId: string,
59
+ entityPath: string | undefined,
60
+ ) => Promise<void>;
61
+
50
62
  dataSpaces: DataSpaceInfo[] = [];
51
- loadDataSpacesState = ActionState.create();
52
- loadDataSpaceState = ActionState.create();
63
+ readonly loadDataSpacesState = ActionState.create();
64
+ readonly loadDataSpaceState = ActionState.create();
53
65
  currentDataSpace?: DataSpaceInfo | undefined;
54
66
  dataSpaceViewerState?: DataSpaceViewerState | undefined;
55
67
  toGetSnapShot = false;
56
68
 
57
- constructor(setupStore: QuerySetupStore) {
58
- super(setupStore);
59
-
69
+ constructor(
70
+ applicationStore: GenericLegendApplicationStore,
71
+ graphManagerState: GraphManagerState,
72
+ depotServerClient: DepotServerClient,
73
+ actions: {
74
+ viewProject: (
75
+ groupId: string,
76
+ artifactId: string,
77
+ versionId: string,
78
+ entityPath: string | undefined,
79
+ ) => void;
80
+ viewSDLCProject: (
81
+ groupId: string,
82
+ artifactId: string,
83
+ entityPath: string | undefined,
84
+ ) => Promise<void>;
85
+ },
86
+ currentDataSpace?: DataSpaceInfo | undefined,
87
+ toGetSnapshot?: boolean | undefined,
88
+ ) {
60
89
  makeObservable(this, {
61
90
  dataSpaces: observable,
62
91
  currentDataSpace: observable.ref,
@@ -69,6 +98,16 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
69
98
  loadDataSpace: flow,
70
99
  proceedToCreateQuery: flow,
71
100
  });
101
+
102
+ this.applicationStore = applicationStore;
103
+ this.graphManagerState = graphManagerState;
104
+ this.depotServerClient = depotServerClient;
105
+ this.viewProject = actions.viewProject;
106
+ this.viewSDLCProject = actions.viewSDLCProject;
107
+ this.currentDataSpace = currentDataSpace;
108
+ if (toGetSnapshot !== undefined) {
109
+ this.toGetSnapShot = toGetSnapshot;
110
+ }
72
111
  }
73
112
 
74
113
  setCurrentDataSpace(val: DataSpaceInfo | undefined): void {
@@ -89,7 +128,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
89
128
  this.loadDataSpacesState.inProgress();
90
129
  try {
91
130
  this.dataSpaces = (
92
- (yield this.setupStore.depotServerClient.getEntitiesByClassifierPath(
131
+ (yield this.depotServerClient.getEntitiesByClassifierPath(
93
132
  DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
94
133
  {
95
134
  search: isValidSearchString ? searchText : undefined,
@@ -106,7 +145,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
106
145
  } catch (error) {
107
146
  assertErrorThrown(error);
108
147
  this.loadDataSpacesState.fail();
109
- this.setupStore.applicationStore.notifyError(error);
148
+ this.applicationStore.notifyError(error);
110
149
  }
111
150
  }
112
151
 
@@ -119,7 +158,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
119
158
  this.loadDataSpaceState.setMessage(`Fetching project...`);
120
159
  const project = ProjectData.serialization.fromJson(
121
160
  (yield flowResult(
122
- this.setupStore.depotServerClient.getProject(
161
+ this.depotServerClient.getProject(
123
162
  dataSpace.groupId,
124
163
  dataSpace.artifactId,
125
164
  ),
@@ -128,7 +167,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
128
167
 
129
168
  // fetch entities
130
169
  this.loadDataSpaceState.setMessage(`Fetching entities...`);
131
- const entities = (yield this.setupStore.depotServerClient.getEntities(
170
+ const entities = (yield this.depotServerClient.getEntities(
132
171
  project,
133
172
  dataSpace.versionId,
134
173
  )) as Entity[];
@@ -136,7 +175,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
136
175
  // fetch dependencies
137
176
  this.loadDataSpaceState.setMessage(`Fetching dependencies...`);
138
177
  const dependencyEntitiesIndex = (yield flowResult(
139
- this.setupStore.depotServerClient.getIndexedDependencyEntities(
178
+ this.depotServerClient.getIndexedDependencyEntities(
140
179
  project,
141
180
  dataSpace.versionId,
142
181
  ),
@@ -145,7 +184,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
145
184
  // analyze data space
146
185
  this.loadDataSpaceState.setMessage(`Analyzing data space...`);
147
186
  const analysisResult = (yield DSL_DataSpace_getGraphManagerExtension(
148
- this.setupStore.graphManagerState.graphManager,
187
+ this.graphManagerState.graphManager,
149
188
  ).analyzeDataSpace(
150
189
  dataSpace.path,
151
190
  entities,
@@ -156,30 +195,18 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
156
195
  dataSpace.artifactId,
157
196
  dataSpace.versionId,
158
197
  dataSpace.path,
159
- this.setupStore.depotServerClient,
198
+ this.depotServerClient,
160
199
  ),
161
200
  )) as DataSpaceAnalysisResult;
162
201
  this.dataSpaceViewerState = new DataSpaceViewerState(
202
+ this.applicationStore,
163
203
  dataSpace.groupId,
164
204
  dataSpace.artifactId,
165
205
  dataSpace.versionId,
166
206
  analysisResult,
167
207
  {
168
- viewProject: (
169
- groupId: string,
170
- artifactId: string,
171
- versionId: string,
172
- entityPath: string | undefined,
173
- ): void =>
174
- this.setupStore.applicationStore.navigator.visitAddress(
175
- EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl(
176
- this.setupStore.applicationStore.config.studioUrl,
177
- groupId,
178
- artifactId,
179
- versionId,
180
- entityPath,
181
- ),
182
- ),
208
+ viewProject: this.viewProject,
209
+ viewSDLCProject: this.viewSDLCProject,
183
210
  onDiagramClassDoubleClick: (classView: ClassView): void => {
184
211
  this.proceedToCreateQuery(classView.class.value);
185
212
  },
@@ -189,7 +216,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
189
216
  } catch (error) {
190
217
  assertErrorThrown(error);
191
218
  this.loadDataSpaceState.fail();
192
- this.setupStore.applicationStore.notifyError(error);
219
+ this.applicationStore.notifyError(error);
193
220
  } finally {
194
221
  this.loadDataSpaceState.setMessage(undefined);
195
222
  }
@@ -197,7 +224,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
197
224
 
198
225
  *proceedToCreateQuery(_class?: Class): GeneratorFn<void> {
199
226
  if (this.dataSpaceViewerState) {
200
- this.setupStore.applicationStore.navigator.goToLocation(
227
+ this.applicationStore.navigator.goToLocation(
201
228
  generateDataSpaceQueryCreatorRoute(
202
229
  this.dataSpaceViewerState.groupId,
203
230
  this.dataSpaceViewerState.artifactId,
@@ -211,7 +238,6 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
211
238
  _class?.path,
212
239
  ),
213
240
  );
214
- this.setupStore.setSetupState(undefined);
215
241
  }
216
242
  }
217
243
  }
@@ -47,13 +47,26 @@ import type {
47
47
  } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
48
48
  import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
49
49
  import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
50
+ import { DataSpaceAdvancedSearchState } from './DataSpaceAdvancedSearchState.js';
50
51
 
51
52
  export class DataSpaceQueryBuilderState extends QueryBuilderState {
53
+ readonly depotServerClient: DepotServerClient;
52
54
  readonly dataSpace: DataSpace;
53
55
  readonly groupId: string;
54
56
  readonly artifactId: string;
55
57
  readonly versionId: string;
56
- readonly depotServerClient: DepotServerClient;
58
+ readonly viewProject: (
59
+ groupId: string,
60
+ artifactId: string,
61
+ versionId: string,
62
+ entityPath: string | undefined,
63
+ ) => void;
64
+ readonly viewSDLCProject: (
65
+ groupId: string,
66
+ artifactId: string,
67
+ entityPath: string | undefined,
68
+ ) => Promise<void>;
69
+ readonly isAdvancedDataSpaceSearchEnabled: boolean;
57
70
  readonly loadDataSpacesState = ActionState.create();
58
71
  readonly onDataSpaceChange: (val: DataSpaceInfo) => void;
59
72
  readonly onExecutionContextChange?:
@@ -68,6 +81,7 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
68
81
  executionContext!: DataSpaceExecutionContext;
69
82
  dataSpaces: DataSpaceInfo[] = [];
70
83
  showRuntimeSelector = false;
84
+ advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
71
85
 
72
86
  constructor(
73
87
  applicationStore: GenericLegendApplicationStore,
@@ -76,8 +90,19 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
76
90
  dataSpace: DataSpace,
77
91
  executionContext: DataSpaceExecutionContext,
78
92
  groupId: string,
79
- versionId: string,
80
93
  artifactId: string,
94
+ versionId: string,
95
+ viewProject: (
96
+ groupId: string,
97
+ artifactId: string,
98
+ versionId: string,
99
+ entityPath: string | undefined,
100
+ ) => void,
101
+ viewSDLCProject: (
102
+ groupId: string,
103
+ artifactId: string,
104
+ entityPath: string | undefined,
105
+ ) => Promise<void>,
81
106
  onDataSpaceChange: (val: DataSpaceInfo) => void,
82
107
  onExecutionContextChange?:
83
108
  | ((val: DataSpaceExecutionContext) => void)
@@ -91,6 +116,9 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
91
116
  dataSpaces: observable,
92
117
  executionContext: observable,
93
118
  showRuntimeSelector: observable,
119
+ advancedSearchState: observable,
120
+ showAdvancedSearchPanel: action,
121
+ hideAdvancedSearchPanel: action,
94
122
  setExecutionContext: action,
95
123
  setShowRuntimeSelector: action,
96
124
  loadDataSpaces: flow,
@@ -102,10 +130,15 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
102
130
  this.groupId = groupId;
103
131
  this.artifactId = artifactId;
104
132
  this.versionId = versionId;
133
+ this.viewProject = viewProject;
134
+ this.viewSDLCProject = viewSDLCProject;
105
135
  this.onDataSpaceChange = onDataSpaceChange;
106
136
  this.onExecutionContextChange = onExecutionContextChange;
107
137
  this.onRuntimeChange = onRuntimeChange;
108
138
  this.onClassChange = onClassChange;
139
+ // NOTE: if we reuse this state in the future (e.g. in Studio), we might need
140
+ // to turn this flag off
141
+ this.isAdvancedDataSpaceSearchEnabled = true;
109
142
  }
110
143
 
111
144
  override get sideBarClassName(): string | undefined {
@@ -114,6 +147,32 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
114
147
  : 'query-builder__setup__data-space';
115
148
  }
116
149
 
150
+ showAdvancedSearchPanel(): void {
151
+ this.advancedSearchState = new DataSpaceAdvancedSearchState(
152
+ this.applicationStore,
153
+ this.graphManagerState,
154
+ this.depotServerClient,
155
+ {
156
+ viewProject: this.viewProject,
157
+ viewSDLCProject: this.viewSDLCProject,
158
+ },
159
+ {
160
+ groupId: this.groupId,
161
+ artifactId: this.artifactId,
162
+ versionId: this.versionId,
163
+ title: this.dataSpace.title,
164
+ name: this.dataSpace.name,
165
+ path: this.dataSpace.path,
166
+ defaultExecutionContext: this.dataSpace.defaultExecutionContext.name,
167
+ },
168
+ this.versionId === SNAPSHOT_VERSION_ALIAS,
169
+ );
170
+ }
171
+
172
+ hideAdvancedSearchPanel(): void {
173
+ this.advancedSearchState = undefined;
174
+ }
175
+
117
176
  setExecutionContext(val: DataSpaceExecutionContext): void {
118
177
  this.executionContext = val;
119
178
  }
@@ -27,6 +27,8 @@ import {
27
27
  QueryEditorStore,
28
28
  type QueryExportConfiguration,
29
29
  type LegendQueryApplicationStore,
30
+ createViewProjectHandler,
31
+ createViewSDLCProjectHandler,
30
32
  } from '@finos/legend-application-query';
31
33
  import type { DepotServerClient } from '@finos/legend-server-depot';
32
34
  import {
@@ -115,9 +117,14 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
115
117
  this.groupId,
116
118
  this.artifactId,
117
119
  this.versionId,
120
+ createViewProjectHandler(this.applicationStore),
121
+ createViewSDLCProjectHandler(
122
+ this.applicationStore,
123
+ this.depotServerClient,
124
+ ),
118
125
  (dataSpaceInfo: DataSpaceInfo) => {
119
126
  if (dataSpaceInfo.defaultExecutionContext) {
120
- this.applicationStore.navigator.reloadToLocation(
127
+ this.applicationStore.navigator.goToLocation(
121
128
  generateDataSpaceQueryCreatorRoute(
122
129
  dataSpaceInfo.groupId,
123
130
  dataSpaceInfo.artifactId,
@@ -140,7 +147,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
140
147
  queryBuilderState.runtimeValue,
141
148
  RuntimePointer,
142
149
  );
143
- this.applicationStore.navigator.goToLocation(
150
+ this.applicationStore.navigator.updateCurrentLocation(
144
151
  generateDataSpaceQueryCreatorRoute(
145
152
  this.groupId,
146
153
  this.artifactId,
@@ -157,7 +164,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
157
164
  },
158
165
  (runtimeValue: Runtime) => {
159
166
  const runtimePointer = guaranteeType(runtimeValue, RuntimePointer);
160
- queryBuilderState.applicationStore.navigator.goToLocation(
167
+ queryBuilderState.applicationStore.navigator.updateCurrentLocation(
161
168
  generateDataSpaceQueryCreatorRoute(
162
169
  queryBuilderState.groupId,
163
170
  queryBuilderState.artifactId,
@@ -178,7 +185,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
178
185
  queryBuilderState.runtimeValue,
179
186
  RuntimePointer,
180
187
  );
181
- queryBuilderState.applicationStore.navigator.goToLocation(
188
+ queryBuilderState.applicationStore.navigator.updateCurrentLocation(
182
189
  generateDataSpaceQueryCreatorRoute(
183
190
  queryBuilderState.groupId,
184
191
  queryBuilderState.artifactId,
@@ -0,0 +1,207 @@
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
+ createViewProjectHandler,
19
+ createViewSDLCProjectHandler,
20
+ QueryEditorStore,
21
+ type QueryExportConfiguration,
22
+ } from '@finos/legend-application-query';
23
+ import {
24
+ DepotScope,
25
+ type DepotServerClient,
26
+ type StoredEntity,
27
+ } from '@finos/legend-server-depot';
28
+ import type { GraphManagerState, RawLambda } from '@finos/legend-graph';
29
+ import {
30
+ DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
31
+ DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
32
+ type GenericLegendApplicationStore,
33
+ } from '@finos/legend-application';
34
+ import { action, flow, makeObservable, observable } from 'mobx';
35
+ import { QueryBuilderState } from '@finos/legend-query-builder';
36
+ import type { ProjectGAVCoordinates } from '@finos/legend-storage';
37
+ import {
38
+ ActionState,
39
+ assertErrorThrown,
40
+ UnsupportedOperationError,
41
+ type GeneratorFn,
42
+ } from '@finos/legend-shared';
43
+ import { type DataSpaceInfo, extractDataSpaceInfo } from './DataSpaceInfo.js';
44
+ import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
45
+ import { generateDataSpaceQueryCreatorRoute } from './DSL_DataSpace_LegendQueryRouter.js';
46
+ import { renderDataSpaceQuerySetupSetupPanelContent } from '../../components/query/DataSpaceQuerySetup.js';
47
+ import { DataSpaceAdvancedSearchState } from './DataSpaceAdvancedSearchState.js';
48
+
49
+ export class DataSpaceQuerySetupState extends QueryBuilderState {
50
+ readonly depotServerClient: DepotServerClient;
51
+ readonly loadDataSpacesState = ActionState.create();
52
+ readonly onDataSpaceChange: (val: DataSpaceInfo) => void;
53
+ readonly viewProject: (
54
+ groupId: string,
55
+ artifactId: string,
56
+ versionId: string,
57
+ entityPath: string | undefined,
58
+ ) => void;
59
+ readonly viewSDLCProject: (
60
+ groupId: string,
61
+ artifactId: string,
62
+ entityPath: string | undefined,
63
+ ) => Promise<void>;
64
+
65
+ override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
66
+ renderDataSpaceQuerySetupSetupPanelContent(this);
67
+
68
+ dataSpaces: DataSpaceInfo[] = [];
69
+ showRuntimeSelector = false;
70
+ advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
71
+
72
+ constructor(
73
+ applicationStore: GenericLegendApplicationStore,
74
+ graphManagerState: GraphManagerState,
75
+ depotServerClient: DepotServerClient,
76
+ onDataSpaceChange: (val: DataSpaceInfo) => void,
77
+ viewProject: (
78
+ groupId: string,
79
+ artifactId: string,
80
+ versionId: string,
81
+ entityPath: string | undefined,
82
+ ) => void,
83
+ viewSDLCProject: (
84
+ groupId: string,
85
+ artifactId: string,
86
+ entityPath: string | undefined,
87
+ ) => Promise<void>,
88
+ ) {
89
+ super(applicationStore, graphManagerState);
90
+
91
+ makeObservable(this, {
92
+ dataSpaces: observable,
93
+ advancedSearchState: observable,
94
+ showAdvancedSearchPanel: action,
95
+ hideAdvancedSearchPanel: action,
96
+ loadDataSpaces: flow,
97
+ });
98
+
99
+ this.depotServerClient = depotServerClient;
100
+ this.onDataSpaceChange = onDataSpaceChange;
101
+ this.viewProject = viewProject;
102
+ this.viewSDLCProject = viewSDLCProject;
103
+ }
104
+
105
+ override get isResultPanelHidden(): boolean {
106
+ return true;
107
+ }
108
+
109
+ override get sideBarClassName(): string | undefined {
110
+ return 'query-builder__setup__data-space-setup';
111
+ }
112
+
113
+ showAdvancedSearchPanel(): void {
114
+ this.advancedSearchState = new DataSpaceAdvancedSearchState(
115
+ this.applicationStore,
116
+ this.graphManagerState,
117
+ this.depotServerClient,
118
+ {
119
+ viewProject: this.viewProject,
120
+ viewSDLCProject: this.viewSDLCProject,
121
+ },
122
+ );
123
+ }
124
+
125
+ hideAdvancedSearchPanel(): void {
126
+ this.advancedSearchState = undefined;
127
+ }
128
+
129
+ *loadDataSpaces(searchText: string): GeneratorFn<void> {
130
+ const isValidSearchString =
131
+ searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
132
+ this.loadDataSpacesState.inProgress();
133
+ try {
134
+ this.dataSpaces = (
135
+ (yield this.depotServerClient.getEntitiesByClassifierPath(
136
+ DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
137
+ {
138
+ search: isValidSearchString ? searchText : undefined,
139
+ scope: DepotScope.RELEASES,
140
+ limit: DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
141
+ },
142
+ )) as StoredEntity[]
143
+ ).map((storedEntity) => extractDataSpaceInfo(storedEntity, false));
144
+ this.loadDataSpacesState.pass();
145
+ } catch (error) {
146
+ assertErrorThrown(error);
147
+ this.loadDataSpacesState.fail();
148
+ this.applicationStore.notifyError(error);
149
+ }
150
+ }
151
+ }
152
+
153
+ export class DataSpaceQuerySetupStore extends QueryEditorStore {
154
+ override get isViewProjectActionDisabled(): boolean {
155
+ return true;
156
+ }
157
+
158
+ override get isSaveActionDisabled(): boolean {
159
+ return true;
160
+ }
161
+
162
+ getProjectInfo(): ProjectGAVCoordinates {
163
+ throw new UnsupportedOperationError();
164
+ }
165
+
166
+ getExportConfiguration(lambda: RawLambda): Promise<QueryExportConfiguration> {
167
+ throw new UnsupportedOperationError();
168
+ }
169
+
170
+ async initializeQueryBuilderState(): Promise<QueryBuilderState> {
171
+ const queryBuilderState = new DataSpaceQuerySetupState(
172
+ this.applicationStore,
173
+ this.graphManagerState,
174
+ this.depotServerClient,
175
+ (dataSpaceInfo: DataSpaceInfo) => {
176
+ if (dataSpaceInfo.defaultExecutionContext) {
177
+ this.applicationStore.navigator.goToLocation(
178
+ generateDataSpaceQueryCreatorRoute(
179
+ dataSpaceInfo.groupId,
180
+ dataSpaceInfo.artifactId,
181
+ dataSpaceInfo.versionId,
182
+ dataSpaceInfo.path,
183
+ dataSpaceInfo.defaultExecutionContext,
184
+ undefined,
185
+ undefined,
186
+ ),
187
+ );
188
+ } else {
189
+ this.applicationStore.notifyWarning(
190
+ `Can't switch data space: default execution context not specified`,
191
+ );
192
+ }
193
+ },
194
+ createViewProjectHandler(this.applicationStore),
195
+ createViewSDLCProjectHandler(
196
+ this.applicationStore,
197
+ this.depotServerClient,
198
+ ),
199
+ );
200
+
201
+ return queryBuilderState;
202
+ }
203
+
204
+ override *buildGraph(): GeneratorFn<void> {
205
+ // do nothing
206
+ }
207
+ }
package/tsconfig.json CHANGED
@@ -56,13 +56,15 @@
56
56
  "./src/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts",
57
57
  "./src/stores/DataSpaceViewerState.ts",
58
58
  "./src/stores/query/DSL_DataSpace_LegendQueryRouter.ts",
59
+ "./src/stores/query/DataSpaceAdvancedSearchState.ts",
59
60
  "./src/stores/query/DataSpaceInfo.ts",
60
61
  "./src/stores/query/DataSpaceQueryBuilderState.ts",
61
62
  "./src/stores/query/DataSpaceQueryCreatorStore.ts",
62
- "./src/stores/query/DataSpaceQuerySetupState.ts",
63
+ "./src/stores/query/DataSpaceQuerySetupStore.ts",
63
64
  "./src/components/DSL_DataSpace_Icon.tsx",
64
65
  "./src/components/DataSpaceViewer.tsx",
65
66
  "./src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx",
67
+ "./src/components/query/DataSpaceAdvancedSearchModal.tsx",
66
68
  "./src/components/query/DataSpaceQueryBuilder.tsx",
67
69
  "./src/components/query/DataSpaceQueryCreator.tsx",
68
70
  "./src/components/query/DataSpaceQuerySetup.tsx",
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataSpaceQuerySetupState.d.ts","sourceRoot":"","sources":["../../../src/stores/query/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,KAAK,eAAe,EACpB,eAAe,EAEhB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EACL,KAAK,WAAW,EAEhB,WAAW,EAEZ,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,oBAAoB,CAAC;AAQ9E,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,UAAU,EAAE,aAAa,EAAE,CAAM;IACjC,mBAAmB,cAAwB;I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