@finos/legend-extension-dsl-data-space 9.2.0 → 9.2.1

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 (49) hide show
  1. package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
  2. package/lib/components/DataSpaceDataAccess.js +71 -3
  3. package/lib/components/DataSpaceDataAccess.js.map +1 -1
  4. package/lib/components/DataSpaceDescription.d.ts.map +1 -1
  5. package/lib/components/DataSpaceDescription.js +6 -1
  6. package/lib/components/DataSpaceDescription.js.map +1 -1
  7. package/lib/components/DataSpaceDiagramViewer.js +3 -3
  8. package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
  9. package/lib/components/DataSpaceViewer.js +2 -2
  10. package/lib/components/DataSpaceViewer.js.map +1 -1
  11. package/lib/components/DataSpaceViewerActivityBar.d.ts.map +1 -1
  12. package/lib/components/DataSpaceViewerActivityBar.js +7 -3
  13. package/lib/components/DataSpaceViewerActivityBar.js.map +1 -1
  14. package/lib/components/DataSpaceWiki.d.ts.map +1 -1
  15. package/lib/components/DataSpaceWiki.js +1 -0
  16. package/lib/components/DataSpaceWiki.js.map +1 -1
  17. package/lib/components/query/DataSpaceQueryCreator.js +1 -1
  18. package/lib/components/query/DataSpaceQueryCreator.js.map +1 -1
  19. package/lib/index.css +2 -2
  20. package/lib/index.css.map +1 -1
  21. package/lib/package.json +2 -2
  22. package/lib/stores/DataSpaceViewerDataAccessState.d.ts +35 -0
  23. package/lib/stores/DataSpaceViewerDataAccessState.d.ts.map +1 -0
  24. package/lib/stores/DataSpaceViewerDataAccessState.js +100 -0
  25. package/lib/stores/DataSpaceViewerDataAccessState.js.map +1 -0
  26. package/lib/stores/DataSpaceViewerState.d.ts +34 -21
  27. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  28. package/lib/stores/DataSpaceViewerState.js +100 -30
  29. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  30. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +1 -1
  31. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
  32. package/lib/stores/query/DataSpaceAdvancedSearchState.js +2 -0
  33. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
  34. package/lib/stores/studio/DataSpacePreviewState.d.ts.map +1 -1
  35. package/lib/stores/studio/DataSpacePreviewState.js +2 -0
  36. package/lib/stores/studio/DataSpacePreviewState.js.map +1 -1
  37. package/package.json +12 -12
  38. package/src/components/DataSpaceDataAccess.tsx +116 -2
  39. package/src/components/DataSpaceDescription.tsx +7 -1
  40. package/src/components/DataSpaceDiagramViewer.tsx +3 -3
  41. package/src/components/DataSpaceViewer.tsx +2 -2
  42. package/src/components/DataSpaceViewerActivityBar.tsx +6 -5
  43. package/src/components/DataSpaceWiki.tsx +2 -0
  44. package/src/components/query/DataSpaceQueryCreator.tsx +1 -1
  45. package/src/stores/DataSpaceViewerDataAccessState.ts +146 -0
  46. package/src/stores/DataSpaceViewerState.ts +126 -34
  47. package/src/stores/query/DataSpaceAdvancedSearchState.ts +14 -1
  48. package/src/stores/studio/DataSpacePreviewState.ts +3 -0
  49. package/tsconfig.json +1 -0
@@ -15,14 +15,30 @@
15
15
  */
16
16
 
17
17
  import { observer } from 'mobx-react-lite';
18
- import { AnchorLinkIcon, QuestionCircleIcon } from '@finos/legend-art';
18
+ import {
19
+ AnchorLinkIcon,
20
+ PanelLoadingIndicator,
21
+ QuestionCircleIcon,
22
+ } from '@finos/legend-art';
19
23
  import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
20
24
  import { useApplicationStore } from '@finos/legend-application';
21
25
  import { DataSpaceWikiPlaceholder } from './DataSpacePlaceholder.js';
26
+ import { useEffect } from 'react';
27
+ import { flowResult } from 'mobx';
28
+ import { AgGridReact } from '@ag-grid-community/react';
29
+ import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
30
+ import {
31
+ DatasetEntitlementAccessApprovedReport,
32
+ DatasetEntitlementAccessGrantedReport,
33
+ DatasetEntitlementAccessNotGrantedReport,
34
+ DatasetEntitlementAccessRequestedReport,
35
+ DatasetEntitlementUnsupportedReport,
36
+ } from '@finos/legend-graph';
22
37
 
23
38
  export const DataSpaceDataAccess = observer(
24
39
  (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
25
40
  const { dataSpaceViewerState } = props;
41
+ const dataAccessState = dataSpaceViewerState.dataAccessState;
26
42
  const applicationStore = useApplicationStore();
27
43
  const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult;
28
44
  const documentationUrl = analysisResult.supportInfo?.documentationUrl;
@@ -35,6 +51,19 @@ export const DataSpaceDataAccess = observer(
35
51
  }
36
52
  };
37
53
 
54
+ useEffect(() => {
55
+ flowResult(dataAccessState.fetchDatasetSpecifications()).catch(
56
+ applicationStore.alertUnhandledError,
57
+ );
58
+ flowResult(dataAccessState.fetchDatasetEntitlementReports()).catch(
59
+ applicationStore.alertUnhandledError,
60
+ );
61
+ }, [
62
+ applicationStore,
63
+ dataAccessState,
64
+ dataSpaceViewerState.currentExecutionContext,
65
+ ]);
66
+
38
67
  return (
39
68
  <div className="data-space__viewer__wiki__section">
40
69
  <div className="data-space__viewer__wiki__section__header">
@@ -56,8 +85,93 @@ export const DataSpaceDataAccess = observer(
56
85
  )}
57
86
  </div>
58
87
  <div className="data-space__viewer__wiki__section__content">
88
+ <PanelLoadingIndicator
89
+ isLoading={
90
+ dataAccessState.fetchDatasetSpecificationsState.isInProgress ||
91
+ dataAccessState.fetchDatasetEntitlementReportsState.isInProgress
92
+ }
93
+ />
59
94
  <div className="data-space__viewer__data-access">
60
- <DataSpaceWikiPlaceholder message="View Data Access (Work in Progress)" />
95
+ {dataAccessState.datasets.length > 0 && (
96
+ <DataSpaceWikiPlaceholder message="View Data Access (Work in Progress)" />
97
+ )}
98
+ {dataAccessState.datasets.length === 0 && (
99
+ <>
100
+ <div className="data-space__viewer__data-access__chart"></div>
101
+ <div className="data-space__viewer__data-access__grid data-space__viewer__grid ag-theme-balham-dark">
102
+ <AgGridReact
103
+ rowData={dataAccessState.datasets}
104
+ gridOptions={{
105
+ suppressScrollOnNewData: true,
106
+ getRowId: (rowData) => rowData.data.uuid,
107
+ }}
108
+ modules={[ClientSideRowModelModule]}
109
+ suppressFieldDotNotation={true}
110
+ columnDefs={[
111
+ {
112
+ minWidth: 50,
113
+ sortable: true,
114
+ resizable: true,
115
+ valueGetter: (params) =>
116
+ params.data?.specification.name,
117
+ headerName: 'Dataset',
118
+ flex: 1,
119
+ },
120
+ {
121
+ minWidth: 50,
122
+ sortable: true,
123
+ resizable: true,
124
+ valueGetter: (params) =>
125
+ params.data?.specification.type,
126
+ headerName: 'Type',
127
+ flex: 1,
128
+ },
129
+ {
130
+ minWidth: 50,
131
+ sortable: true,
132
+ resizable: true,
133
+ headerName: 'Access Status',
134
+ valueGetter: (params) => {
135
+ const entitlementReport =
136
+ params.data?.entitlementReport;
137
+ if (
138
+ entitlementReport instanceof
139
+ DatasetEntitlementAccessGrantedReport
140
+ ) {
141
+ return 'Access Granted';
142
+ } else if (
143
+ entitlementReport instanceof
144
+ DatasetEntitlementAccessApprovedReport
145
+ ) {
146
+ return 'Access Approved';
147
+ } else if (
148
+ entitlementReport instanceof
149
+ DatasetEntitlementAccessRequestedReport
150
+ ) {
151
+ return 'Access Requested';
152
+ } else if (
153
+ entitlementReport instanceof
154
+ DatasetEntitlementAccessNotGrantedReport
155
+ ) {
156
+ return '(x) Access Not Granted';
157
+ } else if (
158
+ entitlementReport instanceof
159
+ DatasetEntitlementUnsupportedReport
160
+ ) {
161
+ return '(unsupported)';
162
+ }
163
+ return '';
164
+ },
165
+ flex: 1,
166
+ wrapText: true,
167
+ autoHeight: true,
168
+ },
169
+ ]}
170
+ />
171
+ </div>
172
+ <DataSpaceWikiPlaceholder message="No documentation provided" />
173
+ </>
174
+ )}
61
175
  </div>
62
176
  </div>
63
177
  </div>
@@ -19,14 +19,20 @@ import type { DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
19
19
  import { observer } from 'mobx-react-lite';
20
20
  import { DataSpaceWikiPlaceholder } from './DataSpacePlaceholder.js';
21
21
  import { DataSpaceMarkdownTextViewer } from './DataSpaceMarkdownTextViewer.js';
22
+ import { useEffect, useRef } from 'react';
22
23
 
23
24
  export const DataSpaceDescription = observer(
24
25
  (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
25
26
  const { dataSpaceViewerState } = props;
26
27
  const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult;
28
+ const sectionRef = useRef<HTMLDivElement>(null);
29
+
30
+ useEffect(() => {
31
+ // do
32
+ }, [dataSpaceViewerState]);
27
33
 
28
34
  return (
29
- <div className="data-space__viewer__wiki__section">
35
+ <div ref={sectionRef} className="data-space__viewer__wiki__section">
30
36
  <div className="data-space__viewer__wiki__section__header">
31
37
  <div className="data-space__viewer__wiki__section__header__label">
32
38
  Description
@@ -55,14 +55,14 @@ const DataSpaceDiagramCanvas = observer(
55
55
 
56
56
  useEffect(() => {
57
57
  const renderer = new DiagramRenderer(diagramCanvasRef.current, diagram);
58
- dataSpaceViewerState.setRenderer(renderer);
59
- dataSpaceViewerState.setupRenderer();
58
+ dataSpaceViewerState.setDiagramRenderer(renderer);
59
+ dataSpaceViewerState.setupDiagramRenderer();
60
60
  renderer.render({ initial: true });
61
61
  }, [diagramCanvasRef, dataSpaceViewerState, diagram]);
62
62
 
63
63
  useEffect(() => {
64
64
  if (dataSpaceViewerState.isDiagramRendererInitialized) {
65
- dataSpaceViewerState.renderer.refresh();
65
+ dataSpaceViewerState.diagramRenderer.refresh();
66
66
  }
67
67
  }, [dataSpaceViewerState, width, height]);
68
68
 
@@ -44,7 +44,7 @@ const DataSpaceHeader = observer(
44
44
  <div
45
45
  className={clsx('data-space__viewer__header__content', {
46
46
  'data-space__viewer__header__content--expanded':
47
- dataSpaceViewerState.isExpandedModeEnabled,
47
+ dataSpaceViewerState.layoutState.isExpandedModeEnabled,
48
48
  })}
49
49
  >
50
50
  <div
@@ -115,7 +115,7 @@ export const DataSpaceViewer = observer(
115
115
  className={clsx('data-space__viewer__frame', {
116
116
  'data-space__viewer__frame--boundless': isShowingWiki,
117
117
  'data-space__viewer__frame--expanded':
118
- dataSpaceViewerState.isExpandedModeEnabled,
118
+ dataSpaceViewerState.layoutState.isExpandedModeEnabled,
119
119
  })}
120
120
  >
121
121
  <div className="data-space__viewer__content">
@@ -43,12 +43,11 @@ import {
43
43
  const ActivityBarMenu = observer(
44
44
  (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
45
45
  const { dataSpaceViewerState } = props;
46
+ const layoutState = dataSpaceViewerState.layoutState;
46
47
 
47
48
  // actions
48
49
  const toggleExpandedMode = (): void =>
49
- dataSpaceViewerState.enableExpandedMode(
50
- !dataSpaceViewerState.isExpandedModeEnabled,
51
- );
50
+ layoutState.enableExpandedMode(!layoutState.isExpandedModeEnabled);
52
51
 
53
52
  return (
54
53
  <>
@@ -63,7 +62,7 @@ const ActivityBarMenu = observer(
63
62
  content={
64
63
  <MenuContent>
65
64
  <MenuContentItem onClick={toggleExpandedMode}>
66
- {dataSpaceViewerState.isExpandedModeEnabled
65
+ {layoutState.isExpandedModeEnabled
67
66
  ? 'Disable Expanded Mode'
68
67
  : 'Enable Expanded Mode'}{' '}
69
68
  </MenuContentItem>
@@ -89,8 +88,10 @@ export const DataSpaceViewerActivityBar = observer(
89
88
  const { dataSpaceViewerState } = props;
90
89
  const changeActivity =
91
90
  (activity: DATA_SPACE_VIEWER_ACTIVITY_MODE): (() => void) =>
92
- (): void =>
91
+ (): void => {
93
92
  dataSpaceViewerState.setCurrentActivity(activity);
93
+ dataSpaceViewerState.onZoneChange?.(activity);
94
+ };
94
95
 
95
96
  const wikiActivities: DataSpaceViewerActivityConfig[] = [
96
97
  {
@@ -26,6 +26,8 @@ export const DataSpaceWiki = observer(
26
26
  (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
27
27
  const { dataSpaceViewerState } = props;
28
28
 
29
+ // const a = new IntersectionObserver(() => {});
30
+
29
31
  return (
30
32
  <div className="data-space__viewer__wiki">
31
33
  <DataSpaceDescription dataSpaceViewerState={dataSpaceViewerState} />
@@ -80,7 +80,7 @@ export const DataSpaceQueryCreator = observer(() => {
80
80
  const runtimePath =
81
81
  parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.RUNTIME_PATH];
82
82
  const classPath =
83
- applicationStore.navigationService.navigator.getAddressParameterValue(
83
+ applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
84
84
  DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.CLASS_PATH,
85
85
  );
86
86
 
@@ -0,0 +1,146 @@
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
+ type GeneratorFn,
19
+ ActionState,
20
+ assertErrorThrown,
21
+ uuid,
22
+ } from '@finos/legend-shared';
23
+ import { action, flow, makeObservable, observable } from 'mobx';
24
+ import type { DataSpaceViewerState } from './DataSpaceViewerState.js';
25
+ import type {
26
+ DatasetSpecification,
27
+ DatasetEntitlementReport,
28
+ } from '@finos/legend-graph';
29
+
30
+ export class DataSpaceDatasetInfo {
31
+ readonly uuid = uuid();
32
+ readonly specification!: DatasetSpecification;
33
+
34
+ entitlementReport?: DatasetEntitlementReport | undefined;
35
+
36
+ constructor(specification: DatasetSpecification) {
37
+ makeObservable(this, {
38
+ entitlementReport: observable,
39
+ setEntitlementReport: action,
40
+ });
41
+
42
+ this.specification = specification;
43
+ }
44
+
45
+ setEntitlementReport(val: DatasetEntitlementReport | undefined): void {
46
+ this.entitlementReport = val;
47
+ }
48
+ }
49
+
50
+ export class DataSpaceViewerDataAccessState {
51
+ readonly dataSpaceViewerState: DataSpaceViewerState;
52
+
53
+ readonly fetchDatasetSpecificationsState = ActionState.create();
54
+ readonly fetchDatasetEntitlementReportsState = ActionState.create();
55
+
56
+ datasets: DataSpaceDatasetInfo[] = [];
57
+
58
+ constructor(dataSpaceViewerState: DataSpaceViewerState) {
59
+ makeObservable(this, {
60
+ datasets: observable,
61
+ fetchDatasetSpecifications: flow,
62
+ fetchDatasetEntitlementReports: flow,
63
+ });
64
+
65
+ this.dataSpaceViewerState = dataSpaceViewerState;
66
+ }
67
+
68
+ *fetchDatasetSpecifications(): GeneratorFn<void> {
69
+ this.fetchDatasetSpecificationsState.inProgress();
70
+
71
+ try {
72
+ const datasets =
73
+ (yield this.dataSpaceViewerState.graphManagerState.graphManager.surveyDatasets(
74
+ this.dataSpaceViewerState.currentExecutionContext.mapping,
75
+ this.dataSpaceViewerState.currentExecutionContext.defaultRuntime,
76
+ undefined,
77
+ this.dataSpaceViewerState.retriveGraphData(),
78
+ )) as DatasetSpecification[];
79
+ this.datasets = datasets.map((dataset) => {
80
+ const existingDataset = this.datasets.find(
81
+ (ds) => ds.specification.hashCode === dataset.hashCode,
82
+ );
83
+ if (existingDataset) {
84
+ return existingDataset;
85
+ }
86
+ return new DataSpaceDatasetInfo(dataset);
87
+ });
88
+ } catch (error) {
89
+ assertErrorThrown(error);
90
+ this.dataSpaceViewerState.applicationStore.notificationService.notifyError(
91
+ error,
92
+ );
93
+ } finally {
94
+ this.fetchDatasetSpecificationsState.complete();
95
+ }
96
+ }
97
+
98
+ *fetchDatasetEntitlementReports(): GeneratorFn<void> {
99
+ this.fetchDatasetEntitlementReportsState.inProgress();
100
+
101
+ try {
102
+ const reports =
103
+ (yield this.dataSpaceViewerState.graphManagerState.graphManager.checkEntitlements(
104
+ this.dataSpaceViewerState.currentExecutionContext.mapping,
105
+ this.dataSpaceViewerState.currentExecutionContext.defaultRuntime,
106
+ undefined,
107
+ this.dataSpaceViewerState.retriveGraphData(),
108
+ )) as DatasetEntitlementReport[];
109
+ this.datasets.forEach((dataset) => {
110
+ const matchingReport = reports.find(
111
+ (report) =>
112
+ report.storeSpecification.hashCode ===
113
+ dataset.specification.hashCode,
114
+ );
115
+ if (matchingReport) {
116
+ dataset.setEntitlementReport(matchingReport);
117
+ return;
118
+ }
119
+ dataset.setEntitlementReport(undefined);
120
+ });
121
+ const newDatasets: DataSpaceDatasetInfo[] = [];
122
+ reports.forEach((report) => {
123
+ const matchingDataset = this.datasets.find(
124
+ (dataset) =>
125
+ dataset.specification.hashCode ===
126
+ report.storeSpecification.hashCode,
127
+ );
128
+ if (!matchingDataset) {
129
+ const newDataset = new DataSpaceDatasetInfo(
130
+ report.storeSpecification,
131
+ );
132
+ newDataset.setEntitlementReport(report);
133
+ newDatasets.push(newDataset);
134
+ }
135
+ });
136
+ this.datasets = this.datasets.concat(newDatasets);
137
+ } catch (error) {
138
+ assertErrorThrown(error);
139
+ this.dataSpaceViewerState.applicationStore.notificationService.notifyError(
140
+ error,
141
+ );
142
+ } finally {
143
+ this.fetchDatasetEntitlementReportsState.complete();
144
+ }
145
+ }
146
+ }
@@ -14,7 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { GenericLegendApplicationStore } from '@finos/legend-application';
17
+ import type {
18
+ GenericLegendApplicationStore,
19
+ NavigationZone,
20
+ } from '@finos/legend-application';
18
21
  import {
19
22
  type ClassView,
20
23
  type DiagramRenderer,
@@ -22,6 +25,7 @@ import {
22
25
  } from '@finos/legend-extension-dsl-diagram';
23
26
  import type {
24
27
  BasicGraphManagerState,
28
+ GraphData,
25
29
  PackageableRuntime,
26
30
  } from '@finos/legend-graph';
27
31
  import {
@@ -38,32 +42,54 @@ import {
38
42
  PURE_DATA_SPACE_INFO_PROFILE_PATH,
39
43
  PURE_DATA_SPACE_INFO_PROFILE_VERIFIED_STEREOTYPE,
40
44
  } from '../graphManager/DSL_DataSpace_PureGraphManagerPlugin.js';
45
+ import { DataSpaceViewerDataAccessState } from './DataSpaceViewerDataAccessState.js';
41
46
 
42
47
  export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
43
- DESCRIPTION = 'DESCRIPTION',
44
- DIAGRAM_VIEWER = 'DIAGRAM_VIEWER',
45
- MODELS_DOCUMENTATION = 'MODELS_DOCUMENTATION',
46
- QUICK_START = 'QUICK_START',
47
- EXECUTION_CONTEXT = 'EXECUTION_CONTEXT',
48
- DATA_ACCESS = 'DATA_ACCESS',
49
-
50
- DATA_STORES = 'DATA_STORES', // TODO: with test-data, also let user call TDS query on top of these
51
- DATA_AVAILABILITY = 'DATA_AVAILABILITY',
52
- DATA_READINESS = 'DATA_READINESS',
53
- DATA_COST = 'DATA_COST',
54
- DATA_GOVERNANCE = 'DATA_GOVERNANCE',
55
- INFO = 'INFO', // TODO: test coverage? (or maybe this should be done in elements/diagrams/data-quality section)
56
- SUPPORT = 'SUPPORT',
48
+ DESCRIPTION = 'description',
49
+ DIAGRAM_VIEWER = 'diagram_viewer',
50
+ MODELS_DOCUMENTATION = 'models_documentation',
51
+ QUICK_START = 'quick_start',
52
+ EXECUTION_CONTEXT = 'execution_context',
53
+ DATA_ACCESS = 'data_access',
54
+
55
+ DATA_STORES = 'data_stores', // TODO: with test-data, also let user call TDS query on top of these
56
+ DATA_AVAILABILITY = 'data_availability',
57
+ DATA_READINESS = 'data_readiness',
58
+ DATA_COST = 'data_cost',
59
+ DATA_GOVERNANCE = 'data_governance',
60
+ INFO = 'info', // TODO: test coverage? (or maybe this should be done in elements/diagrams/data-quality section)
61
+ SUPPORT = 'support',
62
+ }
63
+
64
+ class DataSpaceLayoutState {
65
+ readonly dataSpaceViewerState: DataSpaceViewerState;
66
+
67
+ isExpandedModeEnabled = false;
68
+
69
+ constructor(dataSpaceViewerState: DataSpaceViewerState) {
70
+ makeObservable(this, {
71
+ isExpandedModeEnabled: observable,
72
+ enableExpandedMode: action,
73
+ });
74
+
75
+ this.dataSpaceViewerState = dataSpaceViewerState;
76
+ }
77
+
78
+ enableExpandedMode(val: boolean): void {
79
+ this.isExpandedModeEnabled = val;
80
+ }
57
81
  }
58
82
 
59
83
  export class DataSpaceViewerState {
60
84
  readonly applicationStore: GenericLegendApplicationStore;
61
85
  readonly graphManagerState: BasicGraphManagerState;
86
+ readonly layoutState: DataSpaceLayoutState;
62
87
 
88
+ readonly dataSpaceAnalysisResult: DataSpaceAnalysisResult;
63
89
  readonly groupId: string;
64
90
  readonly artifactId: string;
65
91
  readonly versionId: string;
66
- readonly dataSpaceAnalysisResult: DataSpaceAnalysisResult;
92
+ readonly retriveGraphData: () => GraphData;
67
93
  readonly viewProject: (
68
94
  groupId: string,
69
95
  artifactId: string,
@@ -76,6 +102,11 @@ export class DataSpaceViewerState {
76
102
  entityPath: string | undefined,
77
103
  ) => Promise<void>;
78
104
  readonly onDiagramClassDoubleClick: (classView: ClassView) => void;
105
+ readonly onZoneChange?:
106
+ | ((zone: NavigationZone | undefined) => void)
107
+ | undefined;
108
+
109
+ readonly dataAccessState: DataSpaceViewerDataAccessState;
79
110
 
80
111
  _renderer?: DiagramRenderer | undefined;
81
112
  currentDiagram?: DataSpaceDiagramAnalysisResult | undefined;
@@ -83,8 +114,6 @@ export class DataSpaceViewerState {
83
114
  currentExecutionContext: DataSpaceExecutionContextAnalysisResult;
84
115
  currentRuntime: PackageableRuntime;
85
116
 
86
- isExpandedModeEnabled = false;
87
-
88
117
  constructor(
89
118
  applicationStore: GenericLegendApplicationStore,
90
119
  graphManagerState: BasicGraphManagerState,
@@ -93,6 +122,7 @@ export class DataSpaceViewerState {
93
122
  versionId: string,
94
123
  dataSpaceAnalysisResult: DataSpaceAnalysisResult,
95
124
  actions: {
125
+ retriveGraphData: () => GraphData;
96
126
  viewProject: (
97
127
  groupId: string,
98
128
  artifactId: string,
@@ -105,6 +135,7 @@ export class DataSpaceViewerState {
105
135
  entityPath: string | undefined,
106
136
  ) => Promise<void>;
107
137
  onDiagramClassDoubleClick: (classView: ClassView) => void;
138
+ onZoneChange?: ((zone: NavigationZone | undefined) => void) | undefined;
108
139
  },
109
140
  ) {
110
141
  makeObservable(this, {
@@ -113,19 +144,19 @@ export class DataSpaceViewerState {
113
144
  currentActivity: observable,
114
145
  currentExecutionContext: observable,
115
146
  currentRuntime: observable,
116
- isExpandedModeEnabled: observable,
117
147
  isVerified: computed,
118
- renderer: computed,
119
- setRenderer: action,
148
+ diagramRenderer: computed,
149
+ setDiagramRenderer: action,
120
150
  setCurrentDiagram: action,
121
151
  setCurrentActivity: action,
122
152
  setCurrentExecutionContext: action,
123
153
  setCurrentRuntime: action,
124
- enableExpandedMode: action,
125
154
  });
126
155
 
127
156
  this.applicationStore = applicationStore;
128
157
  this.graphManagerState = graphManagerState;
158
+ this.layoutState = new DataSpaceLayoutState(this);
159
+
129
160
  this.dataSpaceAnalysisResult = dataSpaceAnalysisResult;
130
161
  this.groupId = groupId;
131
162
  this.artifactId = artifactId;
@@ -136,12 +167,16 @@ export class DataSpaceViewerState {
136
167
  this.currentDiagram = getNullableFirstElement(
137
168
  this.dataSpaceAnalysisResult.diagrams,
138
169
  );
170
+ this.retriveGraphData = actions.retriveGraphData;
139
171
  this.viewProject = actions.viewProject;
140
172
  this.viewSDLCProject = actions.viewSDLCProject;
141
173
  this.onDiagramClassDoubleClick = actions.onDiagramClassDoubleClick;
174
+ this.onZoneChange = actions.onZoneChange;
175
+
176
+ this.dataAccessState = new DataSpaceViewerDataAccessState(this);
142
177
  }
143
178
 
144
- get renderer(): DiagramRenderer {
179
+ get diagramRenderer(): DiagramRenderer {
145
180
  return guaranteeNonNullable(
146
181
  this._renderer,
147
182
  `Diagram renderer must be initialized (this is likely caused by calling this method at the wrong place)`,
@@ -160,12 +195,12 @@ export class DataSpaceViewerState {
160
195
  if (!this.isDiagramRendererInitialized) {
161
196
  return '';
162
197
  }
163
- if (this.renderer.middleClick || this.renderer.rightClick) {
198
+ if (this.diagramRenderer.middleClick || this.diagramRenderer.rightClick) {
164
199
  return 'diagram-editor__cursor--grabbing';
165
200
  }
166
- switch (this.renderer.interactionMode) {
201
+ switch (this.diagramRenderer.interactionMode) {
167
202
  case DIAGRAM_INTERACTION_MODE.LAYOUT: {
168
- if (this.renderer.mouseOverClassView) {
203
+ if (this.diagramRenderer.mouseOverClassView) {
169
204
  return 'diagram-editor__cursor--pointer';
170
205
  }
171
206
  return '';
@@ -185,7 +220,7 @@ export class DataSpaceViewerState {
185
220
  );
186
221
  }
187
222
 
188
- setRenderer(val: DiagramRenderer): void {
223
+ setDiagramRenderer(val: DiagramRenderer): void {
189
224
  this._renderer = val;
190
225
  }
191
226
 
@@ -208,14 +243,71 @@ export class DataSpaceViewerState {
208
243
  this.currentRuntime = val;
209
244
  }
210
245
 
211
- setupRenderer(): void {
212
- this.renderer.setIsReadOnly(true);
213
- this.renderer.setEnableLayoutAutoAdjustment(true);
214
- this.renderer.onClassViewDoubleClick = (classView: ClassView): void =>
215
- this.onDiagramClassDoubleClick(classView);
246
+ setupDiagramRenderer(): void {
247
+ this.diagramRenderer.setIsReadOnly(true);
248
+ this.diagramRenderer.setEnableLayoutAutoAdjustment(true);
249
+ this.diagramRenderer.onClassViewDoubleClick = (
250
+ classView: ClassView,
251
+ ): void => this.onDiagramClassDoubleClick(classView);
216
252
  }
217
253
 
218
- enableExpandedMode(val: boolean): void {
219
- this.isExpandedModeEnabled = val;
254
+ changeZone(zone: NavigationZone): void {
255
+ switch (zone) {
256
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION:
257
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER:
258
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_DOCUMENTATION:
259
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.QUICK_START: {
260
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION);
261
+ break;
262
+ }
263
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.EXECUTION_CONTEXT: {
264
+ this.setCurrentActivity(
265
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.EXECUTION_CONTEXT,
266
+ );
267
+ break;
268
+ }
269
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_ACCESS: {
270
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_ACCESS);
271
+ break;
272
+ }
273
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_STORES: {
274
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_STORES);
275
+ break;
276
+ }
277
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_AVAILABILITY: {
278
+ this.setCurrentActivity(
279
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_AVAILABILITY,
280
+ );
281
+ break;
282
+ }
283
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_READINESS: {
284
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_READINESS);
285
+ break;
286
+ }
287
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_COST: {
288
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_COST);
289
+ break;
290
+ }
291
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_GOVERNANCE: {
292
+ this.setCurrentActivity(
293
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_GOVERNANCE,
294
+ );
295
+ break;
296
+ }
297
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.INFO: {
298
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.INFO);
299
+ break;
300
+ }
301
+ case DATA_SPACE_VIEWER_ACTIVITY_MODE.SUPPORT: {
302
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.SUPPORT);
303
+ break;
304
+ }
305
+ default: {
306
+ // unknown
307
+ this.setCurrentActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION);
308
+ this.onZoneChange?.(undefined);
309
+ break;
310
+ }
311
+ }
220
312
  }
221
313
  }