@finos/legend-extension-dsl-data-space 10.0.10 → 10.0.12

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 (131) hide show
  1. package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.d.ts +28 -0
  2. package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.d.ts.map +1 -0
  3. package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.js +70 -0
  4. package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.js.map +1 -0
  5. package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.d.ts +20 -0
  6. package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.d.ts.map +1 -0
  7. package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.js +21 -0
  8. package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.js.map +1 -0
  9. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts +5 -2
  10. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
  11. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +47 -1
  12. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
  13. package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
  14. package/lib/components/DataSpaceDataAccess.js +5 -76
  15. package/lib/components/DataSpaceDataAccess.js.map +1 -1
  16. package/lib/components/DataSpaceDescription.d.ts.map +1 -1
  17. package/lib/components/DataSpaceDescription.js +2 -1
  18. package/lib/components/DataSpaceDescription.js.map +1 -1
  19. package/lib/components/DataSpaceDiagramViewer.d.ts.map +1 -1
  20. package/lib/components/DataSpaceDiagramViewer.js +110 -39
  21. package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
  22. package/lib/components/DataSpaceExecutionContextViewer.d.ts.map +1 -1
  23. package/lib/components/DataSpaceExecutionContextViewer.js +3 -3
  24. package/lib/components/DataSpaceExecutionContextViewer.js.map +1 -1
  25. package/lib/components/DataSpaceInfoPanel.d.ts.map +1 -1
  26. package/lib/components/DataSpaceInfoPanel.js +6 -6
  27. package/lib/components/DataSpaceInfoPanel.js.map +1 -1
  28. package/lib/components/DataSpaceModelsDocumentation.d.ts.map +1 -1
  29. package/lib/components/DataSpaceModelsDocumentation.js +18 -8
  30. package/lib/components/DataSpaceModelsDocumentation.js.map +1 -1
  31. package/lib/components/DataSpacePlaceholder.d.ts +4 -0
  32. package/lib/components/DataSpacePlaceholder.d.ts.map +1 -1
  33. package/lib/components/DataSpacePlaceholder.js +6 -1
  34. package/lib/components/DataSpacePlaceholder.js.map +1 -1
  35. package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
  36. package/lib/components/DataSpaceQuickStart.js +24 -11
  37. package/lib/components/DataSpaceQuickStart.js.map +1 -1
  38. package/lib/components/DataSpaceSupportPanel.d.ts.map +1 -1
  39. package/lib/components/DataSpaceSupportPanel.js +17 -8
  40. package/lib/components/DataSpaceSupportPanel.js.map +1 -1
  41. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  42. package/lib/components/DataSpaceViewer.js +34 -13
  43. package/lib/components/DataSpaceViewer.js.map +1 -1
  44. package/lib/components/DataSpaceViewerActivityBar.d.ts.map +1 -1
  45. package/lib/components/DataSpaceViewerActivityBar.js +15 -12
  46. package/lib/components/DataSpaceViewerActivityBar.js.map +1 -1
  47. package/lib/components/index.d.ts +1 -0
  48. package/lib/components/index.d.ts.map +1 -1
  49. package/lib/components/index.js +1 -0
  50. package/lib/components/index.js.map +1 -1
  51. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  52. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +1 -0
  53. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  54. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +1 -1
  55. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  56. package/lib/index.css +2 -2
  57. package/lib/index.css.map +1 -1
  58. package/lib/package.json +1 -1
  59. package/lib/stores/DataSpaceLayoutState.d.ts +48 -0
  60. package/lib/stores/DataSpaceLayoutState.d.ts.map +1 -0
  61. package/lib/stores/DataSpaceLayoutState.js +185 -0
  62. package/lib/stores/DataSpaceLayoutState.js.map +1 -0
  63. package/lib/stores/DataSpaceModelsDocumentationState.d.ts +11 -2
  64. package/lib/stores/DataSpaceModelsDocumentationState.d.ts.map +1 -1
  65. package/lib/stores/DataSpaceModelsDocumentationState.js +41 -0
  66. package/lib/stores/DataSpaceModelsDocumentationState.js.map +1 -1
  67. package/lib/stores/DataSpaceQuickStartState.d.ts +24 -0
  68. package/lib/stores/DataSpaceQuickStartState.d.ts.map +1 -0
  69. package/lib/stores/DataSpaceQuickStartState.js +48 -0
  70. package/lib/stores/DataSpaceQuickStartState.js.map +1 -0
  71. package/lib/stores/DataSpaceViewerDiagramViewerState.d.ts +44 -0
  72. package/lib/stores/DataSpaceViewerDiagramViewerState.d.ts.map +1 -0
  73. package/lib/stores/DataSpaceViewerDiagramViewerState.js +194 -0
  74. package/lib/stores/DataSpaceViewerDiagramViewerState.js.map +1 -0
  75. package/lib/stores/DataSpaceViewerNavigation.d.ts +36 -0
  76. package/lib/stores/DataSpaceViewerNavigation.d.ts.map +1 -0
  77. package/lib/stores/DataSpaceViewerNavigation.js +47 -0
  78. package/lib/stores/DataSpaceViewerNavigation.js.map +1 -0
  79. package/lib/stores/DataSpaceViewerState.d.ts +22 -74
  80. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  81. package/lib/stores/DataSpaceViewerState.js +34 -259
  82. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  83. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
  84. package/lib/stores/query/DataSpaceAdvancedSearchState.js +8 -5
  85. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
  86. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts +8 -8
  87. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  88. package/lib/stores/query/DataSpaceQueryCreatorStore.js +1 -1
  89. package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -1
  90. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +1 -1
  91. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +1 -1
  92. package/lib/stores/query/DataSpaceQuerySetupStore.js +1 -1
  93. package/lib/stores/query/DataSpaceQuerySetupStore.js.map +1 -1
  94. package/lib/stores/studio/DataSpacePreviewState.d.ts.map +1 -1
  95. package/lib/stores/studio/DataSpacePreviewState.js +15 -3
  96. package/lib/stores/studio/DataSpacePreviewState.js.map +1 -1
  97. package/package.json +13 -13
  98. package/src/__lib__/DSL_DataSpace_LegendApplicationCommand.ts +74 -0
  99. package/src/__lib__/DSL_DataSpace_LegendApplicationNavigation.ts +33 -0
  100. package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +116 -0
  101. package/src/components/DataSpaceDataAccess.tsx +9 -122
  102. package/src/components/DataSpaceDescription.tsx +5 -5
  103. package/src/components/DataSpaceDiagramViewer.tsx +449 -69
  104. package/src/components/DataSpaceExecutionContextViewer.tsx +47 -40
  105. package/src/components/DataSpaceInfoPanel.tsx +107 -117
  106. package/src/components/DataSpaceModelsDocumentation.tsx +31 -12
  107. package/src/components/DataSpacePlaceholder.tsx +22 -0
  108. package/src/components/DataSpaceQuickStart.tsx +95 -15
  109. package/src/components/DataSpaceSupportPanel.tsx +146 -14
  110. package/src/components/DataSpaceViewer.tsx +153 -23
  111. package/src/components/DataSpaceViewerActivityBar.tsx +40 -20
  112. package/src/components/index.ts +1 -0
  113. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +1 -0
  114. package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +1 -1
  115. package/src/stores/DataSpaceLayoutState.ts +272 -0
  116. package/src/stores/DataSpaceModelsDocumentationState.ts +61 -2
  117. package/src/stores/DataSpaceQuickStartState.ts +91 -0
  118. package/src/stores/DataSpaceViewerDiagramViewerState.ts +245 -0
  119. package/src/stores/DataSpaceViewerNavigation.ts +64 -0
  120. package/src/stores/DataSpaceViewerState.ts +88 -401
  121. package/src/stores/query/DataSpaceAdvancedSearchState.ts +30 -6
  122. package/src/stores/query/DataSpaceQueryCreatorStore.ts +8 -8
  123. package/src/stores/query/DataSpaceQuerySetupStore.ts +1 -1
  124. package/src/stores/studio/DataSpacePreviewState.ts +27 -5
  125. package/tsconfig.json +7 -2
  126. package/lib/stores/DataSpaceViewerDataAccessState.d.ts +0 -35
  127. package/lib/stores/DataSpaceViewerDataAccessState.d.ts.map +0 -1
  128. package/lib/stores/DataSpaceViewerDataAccessState.js +0 -98
  129. package/lib/stores/DataSpaceViewerDataAccessState.js.map +0 -1
  130. package/src/components/DSL_DataSpace_LegendApplicationPlugin.ts +0 -45
  131. package/src/stores/DataSpaceViewerDataAccessState.ts +0 -143
@@ -19,318 +19,36 @@ import {
19
19
  type GenericLegendApplicationStore,
20
20
  type NavigationZone,
21
21
  } from '@finos/legend-application';
22
- import { type ClassView } from '@finos/legend-extension-dsl-diagram/graph';
23
- import {
24
- type DiagramRenderer,
25
- DIAGRAM_INTERACTION_MODE,
26
- } from '@finos/legend-extension-dsl-diagram/application';
27
22
  import type {
28
23
  BasicGraphManagerState,
24
+ Class,
25
+ DatasetEntitlementReport,
26
+ DatasetSpecification,
29
27
  GraphData,
30
28
  PackageableRuntime,
31
29
  } from '@finos/legend-graph';
32
- import {
33
- getNonNullableEnry,
34
- getNullableEntry,
35
- getNullableFirstEntry,
36
- guaranteeNonNullable,
37
- isNonNullable,
38
- } from '@finos/legend-shared';
30
+ import { getNullableEntry } from '@finos/legend-shared';
39
31
  import { action, computed, makeObservable, observable } from 'mobx';
40
32
  import type {
41
33
  DataSpaceAnalysisResult,
42
- DataSpaceDiagramAnalysisResult,
43
- DataSpaceExecutableAnalysisResult,
44
34
  DataSpaceExecutionContextAnalysisResult,
45
35
  } from '../graph-manager/action/analytics/DataSpaceAnalysis.js';
46
36
  import {
47
37
  PURE_DATA_SPACE_INFO_PROFILE_PATH,
48
38
  PURE_DATA_SPACE_INFO_PROFILE_VERIFIED_STEREOTYPE,
49
39
  } from '../graph-manager/DSL_DataSpace_PureGraphManagerPlugin.js';
50
- import { DataSpaceViewerDataAccessState } from './DataSpaceViewerDataAccessState.js';
51
40
  import { DataSpaceViewerModelsDocumentationState } from './DataSpaceModelsDocumentationState.js';
52
-
53
- export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
54
- DESCRIPTION = 'description',
55
- DIAGRAM_VIEWER = 'diagram-viewer',
56
- MODELS_DOCUMENTATION = 'models-documentation',
57
- QUICK_START = 'quick-start',
58
- EXECUTION_CONTEXT = 'execution-context',
59
- DATA_ACCESS = 'data-access',
60
-
61
- DATA_STORES = 'data-stores', // TODO: with test-data, also let user call TDS query on top of these
62
- DATA_AVAILABILITY = 'data-availability',
63
- DATA_READINESS = 'data-readiness',
64
- DATA_COST = 'data-cost',
65
- DATA_GOVERNANCE = 'data-governance',
66
- INFO = 'info', // TODO: test coverage? (or maybe this should be done in elements/diagrams/data-quality section)
67
- SUPPORT = 'support',
68
- }
69
-
70
- const generateAnchorChunk = (text: string): string =>
71
- encodeURIComponent(
72
- text
73
- .trim()
74
- .toLowerCase() // anchor is case-insensitive
75
- .replace(/\s+/gu, '-'), // spaces will be replaced by hyphens
76
- );
77
- export const generateAnchorForActivity = (activity: string): string =>
78
- generateAnchorChunk(activity);
79
- export const extractActivityFromAnchor = (anchor: string): string =>
80
- decodeURIComponent(anchor);
81
- export const generateAnchorForQuickStart = (
82
- quickStart: DataSpaceExecutableAnalysisResult,
83
- ): string =>
84
- [
85
- DATA_SPACE_VIEWER_ACTIVITY_MODE.QUICK_START,
86
- generateAnchorChunk(quickStart.title),
87
- ].join(NAVIGATION_ZONE_SEPARATOR);
88
- export const generateAnchorForDiagram = (
89
- diagram: DataSpaceDiagramAnalysisResult,
90
- ): string =>
91
- [
92
- DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
93
- generateAnchorChunk(diagram.title),
94
- ].join(NAVIGATION_ZONE_SEPARATOR);
95
-
96
- export const DATA_SPACE_WIKI_PAGE_SECTIONS = [
97
- DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION,
98
- DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
99
- DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_DOCUMENTATION,
100
- DATA_SPACE_VIEWER_ACTIVITY_MODE.QUICK_START,
101
- DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_ACCESS,
102
- ];
103
-
104
- const DATA_SPACE_WIKI_PAGE_ANCHORS = DATA_SPACE_WIKI_PAGE_SECTIONS.map(
105
- (activity) => generateAnchorForActivity(activity),
106
- );
107
-
108
- type DataSpacePageNavigationCommand = {
109
- anchor: string;
110
- };
111
-
112
- class DataSpaceLayoutState {
113
- readonly dataSpaceViewerState: DataSpaceViewerState;
114
-
115
- currentNavigationZone = '';
116
- isExpandedModeEnabled = false;
117
-
118
- frame?: HTMLElement | undefined;
119
- header?: HTMLElement | undefined;
120
- isTopScrollerVisible = false;
121
-
122
- private wikiPageAnchorIndex = new Map<string, HTMLElement>();
123
- wikiPageNavigationCommand?: DataSpacePageNavigationCommand | undefined;
124
- private wikiPageVisibleAnchors: string[] = [];
125
- private wikiPageScrollIntersectionObserver?: IntersectionObserver | undefined;
126
-
127
- constructor(dataSpaceViewerState: DataSpaceViewerState) {
128
- makeObservable<
129
- DataSpaceLayoutState,
130
- | 'wikiPageAnchorIndex'
131
- | 'wikiPageVisibleAnchors'
132
- | 'updatePageVisibleAnchors'
133
- >(this, {
134
- currentNavigationZone: observable,
135
- isExpandedModeEnabled: observable,
136
- isTopScrollerVisible: observable,
137
- wikiPageAnchorIndex: observable,
138
- wikiPageVisibleAnchors: observable,
139
- frame: observable.ref,
140
- wikiPageNavigationCommand: observable.ref,
141
- isWikiPageFullyRendered: computed,
142
- registerWikiPageScrollObserver: action,
143
- setCurrentNavigationZone: action,
144
- enableExpandedMode: action,
145
- setFrame: action,
146
- setTopScrollerVisible: action,
147
- setWikiPageAnchor: action,
148
- unsetWikiPageAnchor: action,
149
- setWikiPageAnchorToNavigate: action,
150
- updatePageVisibleAnchors: action,
151
- });
152
-
153
- this.dataSpaceViewerState = dataSpaceViewerState;
154
- }
155
-
156
- setCurrentNavigationZone(val: string): void {
157
- this.currentNavigationZone = val;
158
- }
159
-
160
- get isWikiPageFullyRendered(): boolean {
161
- return (
162
- Boolean(this.frame) &&
163
- DATA_SPACE_WIKI_PAGE_SECTIONS.includes(
164
- this.dataSpaceViewerState.currentActivity,
165
- ) &&
166
- DATA_SPACE_WIKI_PAGE_ANCHORS.every((anchor) =>
167
- this.wikiPageAnchorIndex.has(anchor),
168
- ) &&
169
- Array.from(this.wikiPageAnchorIndex.values()).every(isNonNullable)
170
- );
171
- }
172
-
173
- registerWikiPageScrollObserver(): void {
174
- if (this.frame && this.isWikiPageFullyRendered) {
175
- const wikiPageIntersectionObserver = new IntersectionObserver(
176
- (entries, observer) => {
177
- const anchorsWithVisibilityChanged = entries
178
- .map((entry) => {
179
- for (const [key, element] of this.wikiPageAnchorIndex.entries()) {
180
- if (element === entry.target) {
181
- return { key, isIntersecting: entry.isIntersecting };
182
- }
183
- }
184
- return undefined;
185
- })
186
- .filter(isNonNullable);
187
- anchorsWithVisibilityChanged.forEach((entry) => {
188
- this.updatePageVisibleAnchors(entry.key, entry.isIntersecting);
189
- });
190
- // NOTE: sync scroll with menu/address is quite a delicate piece of work
191
- // as it interferes with programatic scroll operations we do elsewhere.
192
- // This is particularly bad when we do a programatic `smooth` scroll, which
193
- // mimic user scrolling behavior and would tangle up with this observer
194
- // Since currently, there's no good mechanism to detect scroll end event, and as such,
195
- // there is no good way to temporarily disable this logic while doing the programmatic
196
- // smooth scroll as such, we avoid supporting programatic smooth scrolling for now
197
- // See https://github.com/w3c/csswg-drafts/issues/3744
198
- // See https://developer.mozilla.org/en-US/docs/Web/API/Document/scrollend_event
199
- if (
200
- // if current navigation zone is not set, do not update zone
201
- this.currentNavigationZone === '' ||
202
- // if there is no visible anchors, do not update zone
203
- !this.wikiPageVisibleAnchors.length ||
204
- // if some of the current visible anchors match or is parent section of the current
205
- // navigation zone, do not update zone
206
- this.wikiPageVisibleAnchors.some(
207
- (visibleAnchor) =>
208
- this.currentNavigationZone === visibleAnchor ||
209
- this.currentNavigationZone.startsWith(
210
- `${visibleAnchor}${NAVIGATION_ZONE_SEPARATOR}`,
211
- ),
212
- )
213
- ) {
214
- return;
215
- }
216
- const anchor = getNonNullableEnry(this.wikiPageVisibleAnchors, 0);
217
- this.dataSpaceViewerState.syncZoneWithNavigation(anchor);
218
- const anchorChunks = anchor.split(NAVIGATION_ZONE_SEPARATOR);
219
- const activity = getNullableFirstEntry(anchorChunks);
220
- if (activity) {
221
- this.dataSpaceViewerState.setCurrentActivity(
222
- extractActivityFromAnchor(
223
- activity,
224
- ) as DATA_SPACE_VIEWER_ACTIVITY_MODE,
225
- );
226
- }
227
- },
228
- {
229
- root: this.frame,
230
- threshold: 0.5,
231
- },
232
- );
233
- Array.from(this.wikiPageAnchorIndex.values()).forEach((el) =>
234
- wikiPageIntersectionObserver.observe(el),
235
- );
236
- this.wikiPageScrollIntersectionObserver = wikiPageIntersectionObserver;
237
- }
238
- }
239
-
240
- unregisterWikiPageScrollObserver(): void {
241
- this.wikiPageScrollIntersectionObserver?.disconnect();
242
- this.wikiPageScrollIntersectionObserver = undefined;
243
- this.wikiPageVisibleAnchors = [];
244
- }
245
-
246
- private updatePageVisibleAnchors(
247
- changedAnchor: string,
248
- isIntersecting: boolean,
249
- ): void {
250
- if (isIntersecting) {
251
- const anchors = this.wikiPageVisibleAnchors.filter(
252
- (anchor) => changedAnchor !== anchor,
253
- );
254
- // NOTE: the newly visible anchors should be the furthest one in
255
- // the direction of scroll
256
- anchors.push(changedAnchor);
257
- this.wikiPageVisibleAnchors = anchors;
258
- } else {
259
- this.wikiPageVisibleAnchors = this.wikiPageVisibleAnchors.filter(
260
- (anchor) => changedAnchor !== anchor,
261
- );
262
- }
263
- }
264
-
265
- enableExpandedMode(val: boolean): void {
266
- this.isExpandedModeEnabled = val;
267
- }
268
-
269
- setFrame(val: HTMLElement | undefined): void {
270
- this.frame = val;
271
- }
272
-
273
- setTopScrollerVisible(val: boolean): void {
274
- this.isTopScrollerVisible = val;
275
- }
276
-
277
- setWikiPageAnchor(anchorKey: string, element: HTMLElement): void {
278
- // do not allow overriding existing anchor
279
- if (!this.wikiPageAnchorIndex.has(anchorKey)) {
280
- this.wikiPageAnchorIndex.set(anchorKey, element);
281
- }
282
- }
283
-
284
- unsetWikiPageAnchor(anchorKey: string): void {
285
- this.wikiPageAnchorIndex.delete(anchorKey);
286
- }
287
-
288
- setWikiPageAnchorToNavigate(
289
- val: DataSpacePageNavigationCommand | undefined,
290
- ): void {
291
- this.wikiPageNavigationCommand = val;
292
- }
293
-
294
- navigateWikiPageAnchor(): void {
295
- if (
296
- this.frame &&
297
- this.wikiPageNavigationCommand &&
298
- this.isWikiPageFullyRendered
299
- ) {
300
- const anchor = this.wikiPageNavigationCommand.anchor;
301
- const matchingWikiPageSection = this.wikiPageAnchorIndex.get(anchor);
302
- const anchorChunks = anchor.split(NAVIGATION_ZONE_SEPARATOR);
303
- if (matchingWikiPageSection) {
304
- this.frame.scrollTop =
305
- matchingWikiPageSection.offsetTop -
306
- (this.header?.getBoundingClientRect().height ?? 0);
307
- } else if (
308
- getNullableFirstEntry(anchorChunks) ===
309
- generateAnchorForActivity(
310
- DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
311
- )
312
- ) {
313
- this.frame.scrollTop =
314
- guaranteeNonNullable(
315
- this.wikiPageAnchorIndex.get(
316
- generateAnchorForActivity(
317
- DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
318
- ),
319
- ),
320
- ).offsetTop - (this.header?.getBoundingClientRect().height ?? 0);
321
- const matchingDiagram =
322
- this.dataSpaceViewerState.dataSpaceAnalysisResult.diagrams.find(
323
- (diagram) => generateAnchorForDiagram(diagram) === anchor,
324
- );
325
- if (matchingDiagram) {
326
- this.dataSpaceViewerState.setCurrentDiagram(matchingDiagram);
327
- }
328
- }
329
-
330
- this.setWikiPageAnchorToNavigate(undefined);
331
- }
332
- }
333
- }
41
+ import { DataSpaceViewerDiagramViewerState } from './DataSpaceViewerDiagramViewerState.js';
42
+ import {
43
+ DATA_SPACE_WIKI_PAGE_SECTIONS,
44
+ DataSpaceLayoutState,
45
+ } from './DataSpaceLayoutState.js';
46
+ import {
47
+ DATA_SPACE_VIEWER_ACTIVITY_MODE,
48
+ generateAnchorForActivity,
49
+ } from './DataSpaceViewerNavigation.js';
50
+ import { DataAccessState } from '@finos/legend-query-builder';
51
+ import { DataSpaceQuickStartState } from './DataSpaceQuickStartState.js';
334
52
 
335
53
  export class DataSpaceViewerState {
336
54
  readonly applicationStore: GenericLegendApplicationStore;
@@ -341,37 +59,25 @@ export class DataSpaceViewerState {
341
59
  readonly groupId: string;
342
60
  readonly artifactId: string;
343
61
  readonly versionId: string;
344
- readonly retriveGraphData: () => GraphData;
345
- readonly viewProject: (
346
- groupId: string,
347
- artifactId: string,
348
- versionId: string,
349
- entityPath: string | undefined,
350
- ) => void;
351
- readonly viewSDLCProject: (
352
- groupId: string,
353
- artifactId: string,
354
- entityPath: string | undefined,
355
- ) => Promise<void>;
356
- readonly onDiagramClassDoubleClick: (classView: ClassView) => void;
62
+ readonly retrieveGraphData: () => GraphData;
63
+ readonly queryDataSpace: (executionContextKey: string) => void;
64
+ readonly viewProject: (path: string | undefined) => void;
65
+ readonly viewSDLCProject: (path: string | undefined) => Promise<void>;
357
66
  readonly onZoneChange?:
358
67
  | ((zone: NavigationZone | undefined) => void)
359
68
  | undefined;
69
+ readonly queryClass: (_class: Class) => void;
70
+ readonly openServiceQuery: (servicePath: string) => void;
360
71
 
72
+ readonly diagramViewerState: DataSpaceViewerDiagramViewerState;
361
73
  readonly modelsDocumentationState: DataSpaceViewerModelsDocumentationState;
74
+ readonly quickStartState: DataSpaceQuickStartState;
362
75
 
363
- // TODO: change this so it holds the data access state for each execution context
364
- readonly dataAccessState: DataSpaceViewerDataAccessState;
365
- // TODO: have a state similar to dataAccessState for each executables
366
-
367
- _renderer?: DiagramRenderer | undefined;
368
76
  currentActivity = DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION;
369
- currentDiagram?: DataSpaceDiagramAnalysisResult | undefined;
77
+ currentDataAccessState: DataAccessState;
370
78
  currentExecutionContext: DataSpaceExecutionContextAnalysisResult;
371
79
  currentRuntime: PackageableRuntime;
372
80
 
373
- TEMPORARY__enableExperimentalFeatures = false;
374
-
375
81
  constructor(
376
82
  applicationStore: GenericLegendApplicationStore,
377
83
  graphManagerState: BasicGraphManagerState,
@@ -380,35 +86,21 @@ export class DataSpaceViewerState {
380
86
  versionId: string,
381
87
  dataSpaceAnalysisResult: DataSpaceAnalysisResult,
382
88
  actions: {
383
- retriveGraphData: () => GraphData;
384
- viewProject: (
385
- groupId: string,
386
- artifactId: string,
387
- versionId: string,
388
- entityPath: string | undefined,
389
- ) => void;
390
- viewSDLCProject: (
391
- groupId: string,
392
- artifactId: string,
393
- entityPath: string | undefined,
394
- ) => Promise<void>;
395
- onDiagramClassDoubleClick: (classView: ClassView) => void;
89
+ retrieveGraphData: () => GraphData;
90
+ queryDataSpace: (executionContextKey: string) => void;
91
+ viewProject: (path: string | undefined) => void;
92
+ viewSDLCProject: (path: string | undefined) => Promise<void>;
93
+ queryClass: (_class: Class) => void;
94
+ openServiceQuery: (servicePath: string) => void;
396
95
  onZoneChange?: ((zone: NavigationZone | undefined) => void) | undefined;
397
96
  },
398
- options?: {
399
- TEMPORARY__enableExperimentalFeatures?: boolean | undefined;
400
- },
401
97
  ) {
402
98
  makeObservable(this, {
403
- _renderer: observable,
404
- currentDiagram: observable,
405
99
  currentActivity: observable,
406
100
  currentExecutionContext: observable,
407
101
  currentRuntime: observable,
102
+ currentDataAccessState: observable,
408
103
  isVerified: computed,
409
- diagramRenderer: computed,
410
- setDiagramRenderer: action,
411
- setCurrentDiagram: action,
412
104
  setCurrentActivity: action,
413
105
  setCurrentExecutionContext: action,
414
106
  setCurrentRuntime: action,
@@ -422,60 +114,47 @@ export class DataSpaceViewerState {
422
114
  this.groupId = groupId;
423
115
  this.artifactId = artifactId;
424
116
  this.versionId = versionId;
117
+ this.retrieveGraphData = actions.retrieveGraphData;
118
+ this.queryDataSpace = actions.queryDataSpace;
119
+ this.viewProject = actions.viewProject;
120
+ this.viewSDLCProject = actions.viewSDLCProject;
121
+ this.onZoneChange = actions.onZoneChange;
122
+ this.queryClass = actions.queryClass;
123
+ this.openServiceQuery = actions.openServiceQuery;
124
+
425
125
  this.currentExecutionContext =
426
126
  dataSpaceAnalysisResult.defaultExecutionContext;
427
127
  this.currentRuntime = this.currentExecutionContext.defaultRuntime;
428
- this.currentDiagram = getNullableFirstEntry(
429
- this.dataSpaceAnalysisResult.diagrams,
128
+ this.currentDataAccessState = new DataAccessState(
129
+ this.applicationStore,
130
+ this.graphManagerState,
131
+ {
132
+ initialDatasets: this.currentExecutionContext.datasets,
133
+ surveyDatasets: async (): Promise<DatasetSpecification[]> =>
134
+ this.graphManagerState.graphManager.surveyDatasets(
135
+ this.currentExecutionContext.mapping.path,
136
+ this.currentExecutionContext.defaultRuntime.path,
137
+ undefined,
138
+ this.retrieveGraphData(),
139
+ ),
140
+ checkDatasetEntitlements: async (
141
+ datasets: DatasetSpecification[],
142
+ ): Promise<DatasetEntitlementReport[]> =>
143
+ this.graphManagerState.graphManager.checkDatasetEntitlements(
144
+ datasets,
145
+ this.currentExecutionContext.mapping.path,
146
+ this.currentExecutionContext.defaultRuntime.path,
147
+ undefined,
148
+ this.retrieveGraphData(),
149
+ ),
150
+ },
430
151
  );
431
- this.retriveGraphData = actions.retriveGraphData;
432
- this.viewProject = actions.viewProject;
433
- this.viewSDLCProject = actions.viewSDLCProject;
434
- this.onDiagramClassDoubleClick = actions.onDiagramClassDoubleClick;
435
- this.onZoneChange = actions.onZoneChange;
436
152
 
437
- this.dataAccessState = new DataSpaceViewerDataAccessState(this);
438
153
  this.modelsDocumentationState = new DataSpaceViewerModelsDocumentationState(
439
154
  this,
440
155
  );
441
-
442
- this.TEMPORARY__enableExperimentalFeatures = Boolean(
443
- options?.TEMPORARY__enableExperimentalFeatures,
444
- );
445
- }
446
-
447
- get diagramRenderer(): DiagramRenderer {
448
- return guaranteeNonNullable(
449
- this._renderer,
450
- `Diagram renderer must be initialized (this is likely caused by calling this method at the wrong place)`,
451
- );
452
- }
453
-
454
- get isDiagramRendererInitialized(): boolean {
455
- return Boolean(this._renderer);
456
- }
457
-
458
- // NOTE: we have tried to use React to control the cursor and
459
- // could not overcome the jank/lag problem, so we settle with CSS-based approach
460
- // See https://css-tricks.com/using-css-cursors/
461
- // See https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
462
- get diagramCursorClass(): string {
463
- if (!this.isDiagramRendererInitialized) {
464
- return '';
465
- }
466
- if (this.diagramRenderer.middleClick || this.diagramRenderer.rightClick) {
467
- return 'diagram-editor__cursor--grabbing';
468
- }
469
- switch (this.diagramRenderer.interactionMode) {
470
- case DIAGRAM_INTERACTION_MODE.LAYOUT: {
471
- if (this.diagramRenderer.mouseOverClassView) {
472
- return 'diagram-editor__cursor--pointer';
473
- }
474
- return '';
475
- }
476
- default:
477
- return '';
478
- }
156
+ this.diagramViewerState = new DataSpaceViewerDiagramViewerState(this);
157
+ this.quickStartState = new DataSpaceQuickStartState(this);
479
158
  }
480
159
 
481
160
  get isVerified(): boolean {
@@ -488,14 +167,6 @@ export class DataSpaceViewerState {
488
167
  );
489
168
  }
490
169
 
491
- setDiagramRenderer(val: DiagramRenderer): void {
492
- this._renderer = val;
493
- }
494
-
495
- setCurrentDiagram(val: DataSpaceDiagramAnalysisResult): void {
496
- this.currentDiagram = val;
497
- }
498
-
499
170
  setCurrentActivity(val: DATA_SPACE_VIEWER_ACTIVITY_MODE): void {
500
171
  this.currentActivity = val;
501
172
  }
@@ -505,20 +176,36 @@ export class DataSpaceViewerState {
505
176
  ): void {
506
177
  this.currentExecutionContext = val;
507
178
  this.currentRuntime = val.defaultRuntime;
179
+ this.currentDataAccessState = new DataAccessState(
180
+ this.applicationStore,
181
+ this.graphManagerState,
182
+ {
183
+ initialDatasets: val.datasets,
184
+ surveyDatasets: async (): Promise<DatasetSpecification[]> =>
185
+ this.graphManagerState.graphManager.surveyDatasets(
186
+ val.mapping.path,
187
+ val.defaultRuntime.path,
188
+ undefined,
189
+ this.retrieveGraphData(),
190
+ ),
191
+ checkDatasetEntitlements: async (
192
+ datasets: DatasetSpecification[],
193
+ ): Promise<DatasetEntitlementReport[]> =>
194
+ this.graphManagerState.graphManager.checkDatasetEntitlements(
195
+ datasets,
196
+ val.mapping.path,
197
+ val.defaultRuntime.path,
198
+ undefined,
199
+ this.retrieveGraphData(),
200
+ ),
201
+ },
202
+ );
508
203
  }
509
204
 
510
205
  setCurrentRuntime(val: PackageableRuntime): void {
511
206
  this.currentRuntime = val;
512
207
  }
513
208
 
514
- setupDiagramRenderer(): void {
515
- this.diagramRenderer.setIsReadOnly(true);
516
- this.diagramRenderer.setEnableLayoutAutoAdjustment(true);
517
- this.diagramRenderer.onClassViewDoubleClick = (
518
- classView: ClassView,
519
- ): void => this.onDiagramClassDoubleClick(classView);
520
- }
521
-
522
209
  syncZoneWithNavigation(zone: NavigationZone): void {
523
210
  this.layoutState.setCurrentNavigationZone(zone);
524
211
  this.onZoneChange?.(zone);
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { ClassView } from '@finos/legend-extension-dsl-diagram/graph';
18
17
  import {
19
18
  GraphDataWithOrigin,
20
19
  type Class,
@@ -47,6 +46,7 @@ import {
47
46
  } from '@finos/legend-application';
48
47
  import { retrieveAnalyticsResultCache } from '../../graph-manager/action/analytics/DataSpaceAnalysisHelper.js';
49
48
  import type { DataSpaceAnalysisResult } from '../../graph-manager/action/analytics/DataSpaceAnalysis.js';
49
+ import { generateServiceQueryCreatorRoute } from '@finos/legend-application-query';
50
50
 
51
51
  export class DataSpaceAdvancedSearchState {
52
52
  readonly applicationStore: GenericLegendApplicationStore;
@@ -197,7 +197,7 @@ export class DataSpaceAdvancedSearchState {
197
197
  dataSpace.versionId,
198
198
  analysisResult,
199
199
  {
200
- retriveGraphData: () =>
200
+ retrieveGraphData: () =>
201
201
  new GraphDataWithOrigin(
202
202
  new LegendSDLC(
203
203
  dataSpace.groupId,
@@ -205,11 +205,35 @@ export class DataSpaceAdvancedSearchState {
205
205
  dataSpace.versionId,
206
206
  ),
207
207
  ),
208
- viewProject: this.viewProject,
209
- viewSDLCProject: this.viewSDLCProject,
210
- onDiagramClassDoubleClick: (classView: ClassView): void => {
211
- this.proceedToCreateQuery(classView.class.value);
208
+ queryDataSpace: (executionContextKey: string) =>
209
+ generateDataSpaceQueryCreatorRoute(
210
+ dataSpace.groupId,
211
+ dataSpace.artifactId,
212
+ dataSpace.versionId,
213
+ analysisResult.path,
214
+ executionContextKey,
215
+ ),
216
+ viewProject: (path: string | undefined) =>
217
+ this.viewProject(
218
+ dataSpace.groupId,
219
+ dataSpace.artifactId,
220
+ dataSpace.versionId,
221
+ path,
222
+ ),
223
+ viewSDLCProject: (path: string | undefined) =>
224
+ this.viewSDLCProject(dataSpace.groupId, dataSpace.artifactId, path),
225
+ queryClass: (_class: Class): void => {
226
+ this.proceedToCreateQuery(_class);
212
227
  },
228
+ openServiceQuery: (servicePath: string): void =>
229
+ this.applicationStore.navigationService.navigator.visitAddress(
230
+ generateServiceQueryCreatorRoute(
231
+ dataSpace.groupId,
232
+ dataSpace.artifactId,
233
+ dataSpace.versionId,
234
+ servicePath,
235
+ ),
236
+ ),
213
237
  },
214
238
  );
215
239
  this.loadDataSpaceState.pass();
@@ -71,13 +71,13 @@ export const createQueryClassTaggedValue = (
71
71
  };
72
72
 
73
73
  export class DataSpaceQueryCreatorStore extends QueryEditorStore {
74
- groupId: string;
75
- artifactId: string;
76
- versionId: string;
77
- dataSpacePath: string;
78
- executionContext: string;
79
- runtimePath: string | undefined;
80
- classPath: string | undefined;
74
+ readonly groupId: string;
75
+ readonly artifactId: string;
76
+ readonly versionId: string;
77
+ readonly dataSpacePath: string;
78
+ readonly executionContext: string;
79
+ readonly runtimePath: string | undefined;
80
+ readonly classPath: string | undefined;
81
81
 
82
82
  constructor(
83
83
  applicationStore: LegendQueryApplicationStore,
@@ -237,7 +237,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
237
237
  return queryBuilderState;
238
238
  }
239
239
 
240
- async getExportConfiguration(
240
+ async getPersistConfiguration(
241
241
  lambda: RawLambda,
242
242
  options?: { update?: boolean | undefined },
243
243
  ): Promise<QueryPersistConfiguration> {
@@ -163,7 +163,7 @@ export class DataSpaceQuerySetupStore extends QueryEditorStore {
163
163
  throw new UnsupportedOperationError();
164
164
  }
165
165
 
166
- getExportConfiguration(
166
+ getPersistConfiguration(
167
167
  lambda: RawLambda,
168
168
  options?: { update?: boolean | undefined },
169
169
  ): Promise<QueryPersistConfiguration> {