@finos/legend-extension-dsl-data-space 9.1.4 → 9.1.6

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 (168) hide show
  1. package/lib/application/studio/DSL_DataSpace_LegendStudioCodeSnippet.d.ts +1 -1
  2. package/lib/application/studio/DSL_DataSpace_LegendStudioCodeSnippet.d.ts.map +1 -1
  3. package/lib/application/studio/DSL_DataSpace_LegendStudioCodeSnippet.js +15 -2
  4. package/lib/application/studio/DSL_DataSpace_LegendStudioCodeSnippet.js.map +1 -1
  5. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts +0 -4
  6. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
  7. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +0 -3
  8. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
  9. package/lib/components/DataSpaceDataAccess.d.ts +23 -0
  10. package/lib/components/DataSpaceDataAccess.d.ts.map +1 -0
  11. package/lib/components/DataSpaceDataAccess.js +34 -0
  12. package/lib/components/DataSpaceDataAccess.js.map +1 -0
  13. package/lib/components/DataSpaceDescription.d.ts +23 -0
  14. package/lib/components/DataSpaceDescription.d.ts.map +1 -0
  15. package/lib/components/DataSpaceDescription.js +26 -0
  16. package/lib/components/DataSpaceDescription.js.map +1 -0
  17. package/lib/components/DataSpaceDiagramViewer.d.ts +23 -0
  18. package/lib/components/DataSpaceDiagramViewer.d.ts.map +1 -0
  19. package/lib/components/DataSpaceDiagramViewer.js +75 -0
  20. package/lib/components/DataSpaceDiagramViewer.js.map +1 -0
  21. package/lib/components/DataSpaceExecutionContextViewer.d.ts +23 -0
  22. package/lib/components/DataSpaceExecutionContextViewer.d.ts.map +1 -0
  23. package/lib/components/DataSpaceExecutionContextViewer.js +58 -0
  24. package/lib/components/DataSpaceExecutionContextViewer.js.map +1 -0
  25. package/lib/components/DataSpaceInfoPanel.d.ts +23 -0
  26. package/lib/components/DataSpaceInfoPanel.d.ts.map +1 -0
  27. package/lib/components/DataSpaceInfoPanel.js +38 -0
  28. package/lib/components/DataSpaceInfoPanel.js.map +1 -0
  29. package/lib/components/DataSpaceMarkdownTextViewer.d.ts +20 -0
  30. package/lib/components/DataSpaceMarkdownTextViewer.d.ts.map +1 -0
  31. package/lib/components/DataSpaceMarkdownTextViewer.js +25 -0
  32. package/lib/components/DataSpaceMarkdownTextViewer.js.map +1 -0
  33. package/lib/components/DataSpaceModelsDocumentation.d.ts +23 -0
  34. package/lib/components/DataSpaceModelsDocumentation.d.ts.map +1 -0
  35. package/lib/components/DataSpaceModelsDocumentation.js +58 -0
  36. package/lib/components/DataSpaceModelsDocumentation.js.map +1 -0
  37. package/lib/components/{studio/DataSpacePreview.d.ts → DataSpacePlaceholder.d.ts} +4 -4
  38. package/lib/components/DataSpacePlaceholder.d.ts.map +1 -0
  39. package/lib/components/DataSpacePlaceholder.js +18 -0
  40. package/lib/components/DataSpacePlaceholder.js.map +1 -0
  41. package/lib/components/DataSpaceQuickStart.d.ts +23 -0
  42. package/lib/components/DataSpaceQuickStart.d.ts.map +1 -0
  43. package/lib/components/DataSpaceQuickStart.js +108 -0
  44. package/lib/components/DataSpaceQuickStart.js.map +1 -0
  45. package/lib/components/DataSpaceSupportPanel.d.ts +23 -0
  46. package/lib/components/DataSpaceSupportPanel.d.ts.map +1 -0
  47. package/lib/components/DataSpaceSupportPanel.js +40 -0
  48. package/lib/components/DataSpaceSupportPanel.js.map +1 -0
  49. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  50. package/lib/components/DataSpaceViewer.js +40 -276
  51. package/lib/components/DataSpaceViewer.js.map +1 -1
  52. package/lib/components/DataSpaceViewerActivityBar.d.ts +23 -0
  53. package/lib/components/DataSpaceViewerActivityBar.d.ts.map +1 -0
  54. package/lib/components/DataSpaceViewerActivityBar.js +105 -0
  55. package/lib/components/DataSpaceViewerActivityBar.js.map +1 -0
  56. package/lib/components/DataSpaceWiki.d.ts +23 -0
  57. package/lib/components/DataSpaceWiki.d.ts.map +1 -0
  58. package/lib/components/DataSpaceWiki.js +12 -0
  59. package/lib/components/DataSpaceWiki.js.map +1 -0
  60. package/lib/components/query/DataSpaceAdvancedSearchModal.js +1 -1
  61. package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +1 -1
  62. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +1 -2
  63. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
  64. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js +0 -13
  65. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -1
  66. package/lib/components/studio/DataSpacePreviewAction.js +1 -1
  67. package/lib/components/studio/DataSpacePreviewAction.js.map +1 -1
  68. package/lib/graph/DSL_DataSpace_HashUtils.d.ts +3 -2
  69. package/lib/graph/DSL_DataSpace_HashUtils.d.ts.map +1 -1
  70. package/lib/graph/DSL_DataSpace_HashUtils.js +3 -2
  71. package/lib/graph/DSL_DataSpace_HashUtils.js.map +1 -1
  72. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts +23 -0
  73. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts.map +1 -1
  74. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js +50 -0
  75. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js.map +1 -1
  76. package/lib/graphManager/DSL_DataSpace_PureGraphManagerPlugin.d.ts +5 -0
  77. package/lib/graphManager/DSL_DataSpace_PureGraphManagerPlugin.d.ts.map +1 -1
  78. package/lib/graphManager/DSL_DataSpace_PureGraphManagerPlugin.js +7 -0
  79. package/lib/graphManager/DSL_DataSpace_PureGraphManagerPlugin.js.map +1 -1
  80. package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts +39 -5
  81. package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
  82. package/lib/graphManager/action/analytics/DataSpaceAnalysis.js +40 -8
  83. package/lib/graphManager/action/analytics/DataSpaceAnalysis.js.map +1 -1
  84. package/lib/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  85. package/lib/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js +70 -11
  86. package/lib/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  87. package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  88. package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +62 -10
  89. package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  90. package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_SystemModels.json +7 -0
  91. package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +39 -0
  92. package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
  93. package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +92 -3
  94. package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
  95. package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts +23 -0
  96. package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts.map +1 -1
  97. package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js +50 -0
  98. package/lib/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js.map +1 -1
  99. package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts +0 -1
  100. package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts.map +1 -1
  101. package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js +33 -5
  102. package/lib/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js.map +1 -1
  103. package/lib/index.css +2 -2
  104. package/lib/index.css.map +1 -1
  105. package/lib/index.d.ts +2 -1
  106. package/lib/index.d.ts.map +1 -1
  107. package/lib/index.js +2 -1
  108. package/lib/index.js.map +1 -1
  109. package/lib/package.json +10 -6
  110. package/lib/stores/DSL_DataSpace_LegendApplicationPlugin_Extension.d.ts +32 -0
  111. package/lib/stores/DSL_DataSpace_LegendApplicationPlugin_Extension.d.ts.map +1 -0
  112. package/lib/stores/DSL_DataSpace_LegendApplicationPlugin_Extension.js +17 -0
  113. package/lib/stores/DSL_DataSpace_LegendApplicationPlugin_Extension.js.map +1 -0
  114. package/lib/stores/DataSpaceViewerState.d.ts +17 -14
  115. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  116. package/lib/stores/DataSpaceViewerState.js +25 -12
  117. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  118. package/lib/stores/studio/DataSpacePreviewState.d.ts.map +1 -1
  119. package/lib/stores/studio/DataSpacePreviewState.js +0 -3
  120. package/lib/stores/studio/DataSpacePreviewState.js.map +1 -1
  121. package/package.json +21 -17
  122. package/src/application/studio/DSL_DataSpace_LegendStudioCodeSnippet.ts +15 -2
  123. package/src/components/DSL_DataSpace_LegendApplicationPlugin.ts +0 -9
  124. package/src/components/DataSpaceDataAccess.tsx +66 -0
  125. package/src/components/DataSpaceDescription.tsx +55 -0
  126. package/src/components/DataSpaceDiagramViewer.tsx +199 -0
  127. package/src/components/DataSpaceExecutionContextViewer.tsx +167 -0
  128. package/src/components/DataSpaceInfoPanel.tsx +170 -0
  129. package/src/components/DataSpaceMarkdownTextViewer.tsx +33 -0
  130. package/src/components/DataSpaceModelsDocumentation.tsx +99 -0
  131. package/src/components/DataSpacePlaceholder.tsx +21 -0
  132. package/src/components/DataSpaceQuickStart.tsx +381 -0
  133. package/src/components/DataSpaceSupportPanel.tsx +80 -0
  134. package/src/components/DataSpaceViewer.tsx +88 -1052
  135. package/src/components/DataSpaceViewerActivityBar.tsx +215 -0
  136. package/src/components/DataSpaceWiki.tsx +41 -0
  137. package/src/components/query/DataSpaceAdvancedSearchModal.tsx +1 -1
  138. package/src/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +0 -15
  139. package/src/components/studio/DataSpacePreviewAction.tsx +1 -1
  140. package/src/graph/DSL_DataSpace_HashUtils.ts +3 -2
  141. package/src/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.ts +60 -0
  142. package/src/graphManager/DSL_DataSpace_PureGraphManagerPlugin.ts +9 -0
  143. package/src/graphManager/action/analytics/DataSpaceAnalysis.ts +54 -15
  144. package/src/graphManager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.ts +99 -14
  145. package/src/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +86 -17
  146. package/src/graphManager/protocol/pure/v1/V1_DSL_DataSpace_SystemModels.json +7 -0
  147. package/src/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +140 -2
  148. package/src/graphManager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.ts +60 -0
  149. package/src/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts +51 -7
  150. package/src/index.ts +2 -4
  151. package/src/stores/DSL_DataSpace_LegendApplicationPlugin_Extension.ts +41 -0
  152. package/src/stores/DataSpaceViewerState.ts +39 -20
  153. package/src/stores/studio/DataSpacePreviewState.ts +0 -5
  154. package/tsconfig.json +13 -3
  155. package/lib/application/studio/DSL_DataSpace_LegendStudioNavigation.d.ts +0 -28
  156. package/lib/application/studio/DSL_DataSpace_LegendStudioNavigation.d.ts.map +0 -1
  157. package/lib/application/studio/DSL_DataSpace_LegendStudioNavigation.js +0 -30
  158. package/lib/application/studio/DSL_DataSpace_LegendStudioNavigation.js.map +0 -1
  159. package/lib/components/studio/DataSpacePreview.d.ts.map +0 -1
  160. package/lib/components/studio/DataSpacePreview.js +0 -52
  161. package/lib/components/studio/DataSpacePreview.js.map +0 -1
  162. package/lib/stores/studio/DataSpacePreviewStore.d.ts +0 -34
  163. package/lib/stores/studio/DataSpacePreviewStore.d.ts.map +0 -1
  164. package/lib/stores/studio/DataSpacePreviewStore.js +0 -98
  165. package/lib/stores/studio/DataSpacePreviewStore.js.map +0 -1
  166. package/src/application/studio/DSL_DataSpace_LegendStudioNavigation.ts +0 -53
  167. package/src/components/studio/DataSpacePreview.tsx +0 -129
  168. package/src/stores/studio/DataSpacePreviewStore.ts +0 -172
@@ -0,0 +1,199 @@
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
+ AnchorLinkIcon,
19
+ CircleIcon,
20
+ ThinChevronLeftIcon,
21
+ ThinChevronRightIcon,
22
+ clsx,
23
+ useResizeDetector,
24
+ } from '@finos/legend-art';
25
+ import type { DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
26
+ import { observer } from 'mobx-react-lite';
27
+ import { forwardRef, useEffect, useRef } from 'react';
28
+ import {
29
+ DiagramRenderer,
30
+ type Diagram,
31
+ } from '@finos/legend-extension-dsl-diagram';
32
+ import {
33
+ getNullableFirstElement,
34
+ getNullableLastElement,
35
+ guaranteeNonNullable,
36
+ } from '@finos/legend-shared';
37
+ import { DataSpaceWikiPlaceholder } from './DataSpacePlaceholder.js';
38
+
39
+ const DataSpaceDiagramCanvas = observer(
40
+ forwardRef<
41
+ HTMLDivElement,
42
+ {
43
+ dataSpaceViewerState: DataSpaceViewerState;
44
+ diagram: Diagram;
45
+ }
46
+ >(function DataSpaceDiagramCanvas(props, ref) {
47
+ const { dataSpaceViewerState, diagram } = props;
48
+ const diagramCanvasRef = ref as React.MutableRefObject<HTMLDivElement>;
49
+
50
+ const { width, height } = useResizeDetector<HTMLDivElement>({
51
+ refreshMode: 'debounce',
52
+ refreshRate: 50,
53
+ targetRef: diagramCanvasRef,
54
+ });
55
+
56
+ useEffect(() => {
57
+ const renderer = new DiagramRenderer(diagramCanvasRef.current, diagram);
58
+ dataSpaceViewerState.setRenderer(renderer);
59
+ dataSpaceViewerState.setupRenderer();
60
+ renderer.render({ initial: true });
61
+ }, [diagramCanvasRef, dataSpaceViewerState, diagram]);
62
+
63
+ useEffect(() => {
64
+ if (dataSpaceViewerState.isDiagramRendererInitialized) {
65
+ dataSpaceViewerState.renderer.refresh();
66
+ }
67
+ }, [dataSpaceViewerState, width, height]);
68
+
69
+ return (
70
+ <div
71
+ ref={diagramCanvasRef}
72
+ className={clsx(
73
+ 'diagram-canvas ',
74
+ dataSpaceViewerState.diagramCursorClass,
75
+ )}
76
+ tabIndex={0}
77
+ />
78
+ );
79
+ }),
80
+ );
81
+
82
+ export const DataSpaceDiagramViewer = observer(
83
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
84
+ const { dataSpaceViewerState } = props;
85
+ const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult;
86
+
87
+ // diagram selector
88
+ const diagramCanvasRef = useRef<HTMLDivElement>(null);
89
+
90
+ const showPreviousDiagram = (): void => {
91
+ if (!dataSpaceViewerState.currentDiagram) {
92
+ return;
93
+ }
94
+ const idx = analysisResult.diagrams.indexOf(
95
+ dataSpaceViewerState.currentDiagram,
96
+ );
97
+ if (idx === 0 || idx === -1) {
98
+ return;
99
+ }
100
+ dataSpaceViewerState.setCurrentDiagram(
101
+ guaranteeNonNullable(analysisResult.diagrams[idx - 1]),
102
+ );
103
+ };
104
+ const showNextDiagram = (): void => {
105
+ if (!dataSpaceViewerState.currentDiagram) {
106
+ return;
107
+ }
108
+ const idx = analysisResult.diagrams.indexOf(
109
+ dataSpaceViewerState.currentDiagram,
110
+ );
111
+ if (idx === analysisResult.diagrams.length - 1 || idx === -1) {
112
+ return;
113
+ }
114
+ dataSpaceViewerState.setCurrentDiagram(
115
+ guaranteeNonNullable(analysisResult.diagrams[idx + 1]),
116
+ );
117
+ };
118
+
119
+ return (
120
+ <div className="data-space__viewer__wiki__section">
121
+ <div className="data-space__viewer__wiki__section__header">
122
+ <div className="data-space__viewer__wiki__section__header__label">
123
+ Diagrams
124
+ <div className="data-space__viewer__wiki__section__header__anchor">
125
+ <AnchorLinkIcon />
126
+ </div>
127
+ </div>
128
+ </div>
129
+ <div className="data-space__viewer__wiki__section__content">
130
+ {analysisResult.diagrams.length > 0 && (
131
+ <div className="data-space__viewer__diagram-viewer">
132
+ <div className="data-space__viewer__diagram-viewer__carousel">
133
+ <div className="data-space__viewer__diagram-viewer__carousel__frame">
134
+ <div className="data-space__viewer__diagram-viewer__carousel__frame__display">
135
+ {dataSpaceViewerState.currentDiagram && (
136
+ <DataSpaceDiagramCanvas
137
+ dataSpaceViewerState={dataSpaceViewerState}
138
+ diagram={dataSpaceViewerState.currentDiagram.diagram}
139
+ ref={diagramCanvasRef}
140
+ />
141
+ )}
142
+ </div>
143
+ <button
144
+ className="data-space__viewer__diagram-viewer__carousel__frame__navigator data-space__viewer__diagram-viewer__carousel__frame__navigator--back"
145
+ tabIndex={-1}
146
+ title="Previous"
147
+ disabled={
148
+ getNullableFirstElement(analysisResult.diagrams) ===
149
+ dataSpaceViewerState.currentDiagram
150
+ }
151
+ onClick={showPreviousDiagram}
152
+ >
153
+ <ThinChevronLeftIcon />
154
+ </button>
155
+ <button
156
+ className="data-space__viewer__diagram-viewer__carousel__frame__navigator data-space__viewer__diagram-viewer__carousel__frame__navigator--next"
157
+ tabIndex={-1}
158
+ title="Next"
159
+ disabled={
160
+ getNullableLastElement(analysisResult.diagrams) ===
161
+ dataSpaceViewerState.currentDiagram
162
+ }
163
+ onClick={showNextDiagram}
164
+ >
165
+ <ThinChevronRightIcon />
166
+ </button>
167
+ <div className="data-space__viewer__diagram-viewer__carousel__frame__indicators">
168
+ <div className="data-space__viewer__diagram-viewer__carousel__frame__indicators__notch">
169
+ {analysisResult.diagrams.map((diagram) => (
170
+ <button
171
+ key={diagram.diagram.path}
172
+ className={clsx(
173
+ 'data-space__viewer__diagram-viewer__carousel__frame__indicator',
174
+ {
175
+ 'data-space__viewer__diagram-viewer__carousel__frame__indicator--active':
176
+ dataSpaceViewerState.currentDiagram === diagram,
177
+ },
178
+ )}
179
+ onClick={() =>
180
+ dataSpaceViewerState.setCurrentDiagram(diagram)
181
+ }
182
+ >
183
+ <CircleIcon />
184
+ </button>
185
+ ))}
186
+ </div>
187
+ </div>
188
+ </div>
189
+ </div>
190
+ </div>
191
+ )}
192
+ {analysisResult.diagrams.length <= 0 && (
193
+ <DataSpaceWikiPlaceholder message="No diagrams provided" />
194
+ )}
195
+ </div>
196
+ </div>
197
+ );
198
+ },
199
+ );
@@ -0,0 +1,167 @@
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 { observer } from 'mobx-react-lite';
18
+ import {
19
+ CustomSelectorInput,
20
+ PURE_MappingIcon,
21
+ PURE_RuntimeIcon,
22
+ PlayIcon,
23
+ } from '@finos/legend-art';
24
+ import { type PackageableRuntime } from '@finos/legend-graph';
25
+ import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
26
+ import type { DataSpaceExecutionContextAnalysisResult } from '../graphManager/action/analytics/DataSpaceAnalysis.js';
27
+ import { useApplicationStore } from '@finos/legend-application';
28
+
29
+ type ExecutionContextOption = {
30
+ label: string;
31
+ value: DataSpaceExecutionContextAnalysisResult;
32
+ };
33
+ const buildExecutionContextOption = (
34
+ value: DataSpaceExecutionContextAnalysisResult,
35
+ ): ExecutionContextOption => ({
36
+ label: value.name,
37
+ value: value,
38
+ });
39
+
40
+ type RuntimeOption = {
41
+ label: string;
42
+ value: PackageableRuntime;
43
+ };
44
+ const buildRuntimeOption = (value: PackageableRuntime): RuntimeOption => ({
45
+ label: value.name,
46
+ value: value,
47
+ });
48
+
49
+ export const DataSpaceExecutionContextViewer = observer(
50
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
51
+ const { dataSpaceViewerState } = props;
52
+ const applicationStore = useApplicationStore();
53
+ const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult;
54
+ const executionContexts = Array.from(
55
+ dataSpaceViewerState.dataSpaceAnalysisResult.executionContextsIndex.values(),
56
+ );
57
+
58
+ // execution
59
+ const executionContextOptions = executionContexts.map(
60
+ buildExecutionContextOption,
61
+ );
62
+ const selectedExecutionContextOption = buildExecutionContextOption(
63
+ dataSpaceViewerState.currentExecutionContext,
64
+ );
65
+ const onExecutionContextOptionChange = (
66
+ option: ExecutionContextOption,
67
+ ): void => {
68
+ if (option.value !== dataSpaceViewerState.currentExecutionContext) {
69
+ dataSpaceViewerState.setCurrentExecutionContext(option.value);
70
+ }
71
+ };
72
+ const formatExecutionContextOptionLabel = (
73
+ option: ExecutionContextOption,
74
+ ): React.ReactNode => (
75
+ <div className="data-space__viewer__execution-context__entry__content__dropdown__option">
76
+ <div className="data-space__viewer__execution-context__entry__content__dropdown__option__label">
77
+ {option.label}
78
+ </div>
79
+ {option.value === analysisResult.defaultExecutionContext && (
80
+ <div className="data-space__viewer__execution-context__entry__content__dropdown__option__tag">
81
+ default
82
+ </div>
83
+ )}
84
+ </div>
85
+ );
86
+
87
+ // runtime
88
+ const runtimeOptions =
89
+ dataSpaceViewerState.currentExecutionContext.compatibleRuntimes.map(
90
+ buildRuntimeOption,
91
+ );
92
+ const selectedRuntimeOption = buildRuntimeOption(
93
+ dataSpaceViewerState.currentRuntime,
94
+ );
95
+ const onRuntimeOptionChange = (option: RuntimeOption): void => {
96
+ if (option.value !== dataSpaceViewerState.currentRuntime) {
97
+ dataSpaceViewerState.setCurrentRuntime(option.value);
98
+ }
99
+ };
100
+ const formatRuntimeOptionLabel = (
101
+ option: RuntimeOption,
102
+ ): React.ReactNode => (
103
+ <div className="data-space__viewer__execution-context__entry__content__dropdown__option">
104
+ <div className="data-space__viewer__execution-context__entry__content__dropdown__option__label">
105
+ {option.label}
106
+ </div>
107
+ {option.value ===
108
+ dataSpaceViewerState.currentExecutionContext.defaultRuntime && (
109
+ <div className="data-space__viewer__execution-context__entry__content__dropdown__option__tag">
110
+ default
111
+ </div>
112
+ )}
113
+ </div>
114
+ );
115
+
116
+ return (
117
+ <div className="data-space__viewer__panel">
118
+ <div className="data-space__viewer__execution-context">
119
+ <div className="data-space__viewer__execution-context__entry">
120
+ <div className="data-space__viewer__execution-context__entry__icon">
121
+ <PlayIcon className="data-space__viewer__execution-context__context-icon" />
122
+ </div>
123
+ <div className="data-space__viewer__execution-context__entry__content data-space__viewer__execution-context__entry__content__dropdown__container">
124
+ <CustomSelectorInput
125
+ className="data-space__viewer__execution-context__entry__content__dropdown"
126
+ options={executionContextOptions}
127
+ onChange={onExecutionContextOptionChange}
128
+ value={selectedExecutionContextOption}
129
+ darkMode={
130
+ !applicationStore.layoutService
131
+ .TEMPORARY__isLightColorThemeEnabled
132
+ }
133
+ formatOptionLabel={formatExecutionContextOptionLabel}
134
+ />
135
+ </div>
136
+ </div>
137
+ <div className="data-space__viewer__execution-context__entry data-space__viewer__execution-context__mapping">
138
+ <div className="data-space__viewer__execution-context__entry__icon">
139
+ <PURE_MappingIcon />
140
+ </div>
141
+ <div className="data-space__viewer__execution-context__entry__content data-space__viewer__execution-context__entry__content__text">
142
+ {dataSpaceViewerState.currentExecutionContext.mapping.path}
143
+ </div>
144
+ </div>
145
+ <div className="data-space__viewer__execution-context__entry">
146
+ <div className="data-space__viewer__execution-context__entry__icon">
147
+ <PURE_RuntimeIcon />
148
+ </div>
149
+ <div className="data-space__viewer__execution-context__entry__content data-space__viewer__execution-context__entry__content__dropdown__container">
150
+ <CustomSelectorInput
151
+ className="data-space__viewer__execution-context__entry__content__dropdown"
152
+ options={runtimeOptions}
153
+ onChange={onRuntimeOptionChange}
154
+ value={selectedRuntimeOption}
155
+ darkMode={
156
+ !applicationStore.layoutService
157
+ .TEMPORARY__isLightColorThemeEnabled
158
+ }
159
+ formatOptionLabel={formatRuntimeOptionLabel}
160
+ />
161
+ </div>
162
+ </div>
163
+ </div>
164
+ </div>
165
+ );
166
+ },
167
+ );
@@ -0,0 +1,170 @@
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 { observer } from 'mobx-react-lite';
18
+ import { ExternalLinkIcon, PencilIcon } from '@finos/legend-art';
19
+ import { extractElementNameFromPath } from '@finos/legend-graph';
20
+ import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
21
+ import { generateGAVCoordinates } from '@finos/legend-storage';
22
+ import { useApplicationStore } from '@finos/legend-application';
23
+
24
+ export const DataSpaceInfoPanel = observer(
25
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
26
+ const { dataSpaceViewerState } = props;
27
+ const applicationStore = useApplicationStore();
28
+ const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult;
29
+
30
+ const viewProject = (): void =>
31
+ dataSpaceViewerState.viewProject(
32
+ dataSpaceViewerState.groupId,
33
+ dataSpaceViewerState.artifactId,
34
+ dataSpaceViewerState.versionId,
35
+ undefined,
36
+ );
37
+ const viewDataSpaceInProject = (): void =>
38
+ dataSpaceViewerState.viewProject(
39
+ dataSpaceViewerState.groupId,
40
+ dataSpaceViewerState.artifactId,
41
+ dataSpaceViewerState.versionId,
42
+ analysisResult.path,
43
+ );
44
+ const viewDataSpaceInSDLCProject = (): void => {
45
+ dataSpaceViewerState
46
+ .viewSDLCProject(
47
+ dataSpaceViewerState.groupId,
48
+ dataSpaceViewerState.artifactId,
49
+ analysisResult.path,
50
+ )
51
+ .catch(applicationStore.alertUnhandledError);
52
+ };
53
+
54
+ return (
55
+ <div className="data-space__viewer__panel">
56
+ <div className="data-space__viewer__info">
57
+ <div className="data-space__viewer__info__section">
58
+ <div className="data-space__viewer__info__section__entry">
59
+ <div className="data-space__viewer__info__project-info__label">
60
+ Project
61
+ </div>
62
+ <button
63
+ className="data-space__viewer__info__project-info__value"
64
+ tabIndex={-1}
65
+ title="Click to View Project"
66
+ onClick={viewProject}
67
+ >
68
+ {generateGAVCoordinates(
69
+ dataSpaceViewerState.groupId,
70
+ dataSpaceViewerState.artifactId,
71
+ dataSpaceViewerState.versionId,
72
+ )}
73
+ </button>
74
+ <button
75
+ className="data-space__viewer__info__project-info__link"
76
+ tabIndex={-1}
77
+ title="View Project"
78
+ onClick={viewProject}
79
+ >
80
+ <ExternalLinkIcon />
81
+ </button>
82
+ </div>
83
+ <div className="data-space__viewer__info__section__entry">
84
+ <div className="data-space__viewer__info__project-info__label">
85
+ Data Space
86
+ </div>
87
+ <button
88
+ className="data-space__viewer__info__project-info__value"
89
+ tabIndex={-1}
90
+ title="Click to View Data Space"
91
+ onClick={viewDataSpaceInProject}
92
+ >
93
+ {analysisResult.path}
94
+ </button>
95
+ <button
96
+ className="data-space__viewer__info__project-info__link"
97
+ tabIndex={-1}
98
+ title="Edit Data Space"
99
+ onClick={viewDataSpaceInSDLCProject}
100
+ >
101
+ <PencilIcon />
102
+ </button>
103
+ <button
104
+ className="data-space__viewer__info__project-info__link"
105
+ tabIndex={-1}
106
+ title="View Data Space"
107
+ onClick={viewDataSpaceInProject}
108
+ >
109
+ <ExternalLinkIcon />
110
+ </button>
111
+ </div>
112
+ </div>
113
+ <div className="data-space__viewer__info__section">
114
+ <div className="data-space__viewer__info__section__title">
115
+ Tagged Values
116
+ </div>
117
+ {analysisResult.taggedValues.length !== 0 &&
118
+ analysisResult.taggedValues.map((taggedValue) => (
119
+ <div
120
+ key={taggedValue._UUID}
121
+ className="data-space__viewer__info__section__entry"
122
+ >
123
+ <div
124
+ className="data-space__viewer__info__tagged-value__tag"
125
+ title={`${taggedValue.profile}.${taggedValue.tag}`}
126
+ >
127
+ {`${extractElementNameFromPath(taggedValue.profile)}.${
128
+ taggedValue.tag
129
+ }`}
130
+ </div>
131
+ <div className="data-space__viewer__info__tagged-value__value">
132
+ {taggedValue.value}
133
+ </div>
134
+ </div>
135
+ ))}
136
+ {analysisResult.taggedValues.length === 0 && (
137
+ <div className="data-space__viewer__info__section__placeholder">
138
+ (empty)
139
+ </div>
140
+ )}
141
+ </div>
142
+ <div className="data-space__viewer__info__section">
143
+ <div className="data-space__viewer__info__section__title">
144
+ Stereotypes
145
+ </div>
146
+ {analysisResult.stereotypes.length !== 0 &&
147
+ analysisResult.stereotypes.map((stereotype) => (
148
+ <div
149
+ key={stereotype._UUID}
150
+ className="data-space__viewer__info__section__entry"
151
+ title={`${stereotype.profile}.${stereotype.value}`}
152
+ >
153
+ <div className="data-space__viewer__info__steoreotype">
154
+ {`${extractElementNameFromPath(stereotype.profile)}.${
155
+ stereotype.value
156
+ }`}
157
+ </div>
158
+ </div>
159
+ ))}
160
+ {analysisResult.stereotypes.length === 0 && (
161
+ <div className="data-space__viewer__info__section__placeholder">
162
+ (empty)
163
+ </div>
164
+ )}
165
+ </div>
166
+ </div>
167
+ </div>
168
+ );
169
+ },
170
+ );
@@ -0,0 +1,33 @@
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 { MarkdownTextViewer } from '@finos/legend-art';
18
+
19
+ export const DataSpaceMarkdownTextViewer: React.FC<{ value: string }> = (
20
+ props,
21
+ ) => (
22
+ <MarkdownTextViewer
23
+ className="data-space__viewer__markdown-text-viewer"
24
+ value={{
25
+ value: props.value,
26
+ }}
27
+ components={{
28
+ h1: 'h2',
29
+ h2: 'h3',
30
+ h3: 'h4',
31
+ }}
32
+ />
33
+ );
@@ -0,0 +1,99 @@
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 { observer } from 'mobx-react-lite';
18
+ import { AnchorLinkIcon, SearchIcon } from '@finos/legend-art';
19
+ import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
20
+ import { AgGridReact } from '@ag-grid-community/react';
21
+ import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
22
+ import { DataSpaceWikiPlaceholder } from './DataSpacePlaceholder.js';
23
+
24
+ export const DataSpaceModelsDocumentation = observer(
25
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
26
+ const { dataSpaceViewerState } = props;
27
+ const documentationEntries =
28
+ dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
29
+
30
+ return (
31
+ <div className="data-space__viewer__wiki__section">
32
+ <div className="data-space__viewer__wiki__section__header">
33
+ <div className="data-space__viewer__wiki__section__header__label">
34
+ Models Documentation
35
+ <div className="data-space__viewer__wiki__section__header__anchor">
36
+ <AnchorLinkIcon />
37
+ </div>
38
+ </div>
39
+ </div>
40
+ <div className="data-space__viewer__wiki__section__content">
41
+ {documentationEntries.length > 0 && (
42
+ <div className="data-space__viewer__models-documentation">
43
+ <div className="data-space__viewer__models-documentation__search">
44
+ <div className="data-space__viewer__models-documentation__search__input-group">
45
+ <input className="data-space__viewer__models-documentation__search__input-group__input input" />
46
+ <div className="data-space__viewer__models-documentation__search__input-group__icon">
47
+ <SearchIcon />
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <div className="data-space__viewer__models-documentation__grid data-space__viewer__grid ag-theme-balham-dark">
52
+ <AgGridReact
53
+ rowData={documentationEntries}
54
+ gridOptions={{
55
+ suppressScrollOnNewData: true,
56
+ getRowId: (rowData) => rowData.data.uuid,
57
+ }}
58
+ modules={[ClientSideRowModelModule]}
59
+ suppressFieldDotNotation={true}
60
+ columnDefs={[
61
+ {
62
+ minWidth: 50,
63
+ sortable: true,
64
+ resizable: true,
65
+ field: 'elementPath',
66
+ headerName: 'Model',
67
+ flex: 1,
68
+ },
69
+ {
70
+ minWidth: 50,
71
+ sortable: false,
72
+ resizable: true,
73
+ field: 'subElementText',
74
+ headerName: '',
75
+ flex: 1,
76
+ },
77
+ {
78
+ minWidth: 50,
79
+ sortable: false,
80
+ resizable: true,
81
+ field: 'doc',
82
+ headerName: 'Documentation',
83
+ flex: 1,
84
+ wrapText: true,
85
+ autoHeight: true,
86
+ },
87
+ ]}
88
+ />
89
+ </div>
90
+ </div>
91
+ )}
92
+ {documentationEntries.length === 0 && (
93
+ <DataSpaceWikiPlaceholder message="No documentation provided" />
94
+ )}
95
+ </div>
96
+ </div>
97
+ );
98
+ },
99
+ );
@@ -0,0 +1,21 @@
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
+ export const DataSpaceWikiPlaceholder: React.FC<{ message: string }> = (
18
+ props,
19
+ ) => (
20
+ <div className="data-space__viewer__wiki__placeholder">{props.message}</div>
21
+ );