@finos/legend-extension-dsl-data-space 0.0.6 → 1.0.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 (70) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/lib/DSLDataSpace_Extension.d.ts +0 -5
  3. package/lib/DSLDataSpace_Extension.d.ts.map +1 -1
  4. package/lib/DSLDataSpace_Extension.js +0 -12
  5. package/lib/DSLDataSpace_Extension.js.map +1 -1
  6. package/lib/components/{studio/DataSpaceEditor.d.ts → DataSpaceViewer.d.ts} +5 -2
  7. package/lib/components/DataSpaceViewer.d.ts.map +1 -0
  8. package/lib/components/DataSpaceViewer.js +186 -0
  9. package/lib/components/DataSpaceViewer.js.map +1 -0
  10. package/lib/components/query/DSLDataSpace_LegendQueryPlugin.d.ts +24 -0
  11. package/lib/components/query/DSLDataSpace_LegendQueryPlugin.d.ts.map +1 -0
  12. package/lib/components/query/DSLDataSpace_LegendQueryPlugin.js +51 -0
  13. package/lib/components/query/DSLDataSpace_LegendQueryPlugin.js.map +1 -0
  14. package/lib/components/query/DataSpaceQuerySetup.d.ts +22 -0
  15. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -0
  16. package/lib/components/query/DataSpaceQuerySetup.js +95 -0
  17. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -0
  18. package/lib/components/studio/{DSLDataSpace_StudioPlugin.d.ts → DSLDataSpace_LegendStudioPlugin.d.ts} +5 -6
  19. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.d.ts.map +1 -0
  20. package/lib/components/studio/{DSLDataSpace_StudioPlugin.js → DSLDataSpace_LegendStudioPlugin.js} +7 -18
  21. package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.js.map +1 -0
  22. package/lib/graph/DSLDataSpace_PureGraphPlugin.js +1 -1
  23. package/lib/graph/DSLDataSpace_PureGraphPlugin.js.map +1 -1
  24. package/lib/index.css +2 -2
  25. package/lib/index.css.map +1 -1
  26. package/lib/index.d.ts +5 -0
  27. package/lib/index.d.ts.map +1 -1
  28. package/lib/index.js +5 -0
  29. package/lib/index.js.map +1 -1
  30. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts +39 -1
  31. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  32. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js +110 -8
  33. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  34. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts +1 -0
  35. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts.map +1 -1
  36. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js +1 -1
  37. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js.map +1 -1
  38. package/lib/stores/DataSpaceViewerState.d.ts +59 -0
  39. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -0
  40. package/lib/stores/DataSpaceViewerState.js +137 -0
  41. package/lib/stores/DataSpaceViewerState.js.map +1 -0
  42. package/lib/stores/query/DataSpaceQuerySetupState.d.ts +49 -0
  43. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -0
  44. package/lib/stores/query/DataSpaceQuerySetupState.js +129 -0
  45. package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -0
  46. package/package.json +26 -21
  47. package/src/DSLDataSpace_Extension.ts +0 -15
  48. package/src/components/DataSpaceViewer.tsx +598 -0
  49. package/src/components/query/DSLDataSpace_LegendQueryPlugin.tsx +76 -0
  50. package/src/components/query/DataSpaceQuerySetup.tsx +234 -0
  51. package/src/components/studio/{DSLDataSpace_StudioPlugin.tsx → DSLDataSpace_LegendStudioPlugin.tsx} +17 -27
  52. package/src/graph/DSLDataSpace_PureGraphPlugin.ts +1 -1
  53. package/src/index.ts +12 -0
  54. package/src/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.ts +192 -6
  55. package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts +1 -1
  56. package/src/stores/DataSpaceViewerState.ts +202 -0
  57. package/src/stores/query/DataSpaceQuerySetupState.ts +235 -0
  58. package/tsconfig.json +7 -3
  59. package/tsconfig.package.json +1 -0
  60. package/lib/components/studio/DSLDataSpace_StudioPlugin.d.ts.map +0 -1
  61. package/lib/components/studio/DSLDataSpace_StudioPlugin.js.map +0 -1
  62. package/lib/components/studio/DataSpaceEditor.d.ts.map +0 -1
  63. package/lib/components/studio/DataSpaceEditor.js +0 -98
  64. package/lib/components/studio/DataSpaceEditor.js.map +0 -1
  65. package/lib/stores/studio/DataSpaceEditorState.d.ts +0 -42
  66. package/lib/stores/studio/DataSpaceEditorState.d.ts.map +0 -1
  67. package/lib/stores/studio/DataSpaceEditorState.js +0 -76
  68. package/lib/stores/studio/DataSpaceEditorState.js.map +0 -1
  69. package/src/components/studio/DataSpaceEditor.tsx +0 -272
  70. package/src/stores/studio/DataSpaceEditorState.ts +0 -108
@@ -0,0 +1,598 @@
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 { useRef, useEffect } from 'react';
18
+ import { observer } from 'mobx-react-lite';
19
+ import { useResizeDetector } from 'react-resize-detector';
20
+ import {
21
+ BlankPanelContent,
22
+ ShapesIcon,
23
+ PlayIcon,
24
+ QuestionCircleIcon,
25
+ EnvelopIcon,
26
+ clsx,
27
+ CustomSelectorInput,
28
+ MappingIcon,
29
+ RuntimeIcon,
30
+ CogIcon,
31
+ KeyIcon,
32
+ FlaskIcon,
33
+ ExternalLinkSquareIcon,
34
+ ExternalLinkIcon,
35
+ ShieldIcon,
36
+ TagsIcon,
37
+ } from '@finos/legend-art';
38
+ import type { Diagram } from '@finos/legend-extension-dsl-diagram';
39
+ import { DiagramRenderer } from '@finos/legend-extension-dsl-diagram';
40
+ import { DataSpaceSupportEmail } from '../models/metamodels/pure/model/packageableElements/dataSpace/DataSpace';
41
+ import type { DataSpaceSupportInfo } from '../models/metamodels/pure/model/packageableElements/dataSpace/DataSpace';
42
+ import type { ResolvedDataSpaceExecutionContext } from '../models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin';
43
+ import type { PackageableRuntime } from '@finos/legend-graph';
44
+ import type { DataSpaceViewerState } from '../stores/DataSpaceViewerState';
45
+ import { DATA_SPACE_VIEWER_ACTIVITY_MODE } from '../stores/DataSpaceViewerState';
46
+
47
+ interface DataSpaceViewerActivityConfig {
48
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE;
49
+ title: string;
50
+ icon: React.ReactElement;
51
+ }
52
+
53
+ const DataSpaceDiagramCanvas = observer(
54
+ (
55
+ props: {
56
+ dataSpaceViewerState: DataSpaceViewerState;
57
+ diagram: Diagram;
58
+ },
59
+ ref: React.Ref<HTMLDivElement>,
60
+ ) => {
61
+ const { dataSpaceViewerState, diagram } = props;
62
+ const diagramCanvasRef =
63
+ ref as React.MutableRefObject<HTMLDivElement | null>;
64
+
65
+ const { width, height } = useResizeDetector<HTMLDivElement>({
66
+ refreshMode: 'debounce',
67
+ refreshRate: 50,
68
+ targetRef: diagramCanvasRef,
69
+ });
70
+
71
+ useEffect(() => {
72
+ if (diagramCanvasRef.current) {
73
+ const renderer = new DiagramRenderer(diagramCanvasRef.current, diagram);
74
+ dataSpaceViewerState.setRenderer(renderer);
75
+ dataSpaceViewerState.setupRenderer();
76
+ renderer.render();
77
+ renderer.autoRecenter();
78
+ }
79
+ }, [diagramCanvasRef, dataSpaceViewerState, diagram]);
80
+
81
+ useEffect(() => {
82
+ if (dataSpaceViewerState.isDiagramRendererInitialized) {
83
+ dataSpaceViewerState.renderer.refresh();
84
+ }
85
+ }, [dataSpaceViewerState, width, height]);
86
+
87
+ return (
88
+ <div
89
+ ref={diagramCanvasRef}
90
+ className={clsx(
91
+ 'diagram-canvas ',
92
+ dataSpaceViewerState.diagramCursorClass,
93
+ )}
94
+ tabIndex={0}
95
+ onContextMenu={(event): void => event.preventDefault()}
96
+ />
97
+ );
98
+ },
99
+ { forwardRef: true },
100
+ );
101
+
102
+ type DiagramOption = { label: string; value: Diagram };
103
+ const buildDiagramOption = (diagram: Diagram): DiagramOption => ({
104
+ label: diagram.name,
105
+ value: diagram,
106
+ });
107
+
108
+ const DataSpaceModelsOverview = observer(
109
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
110
+ const { dataSpaceViewerState } = props;
111
+
112
+ // diagram selector
113
+ const diagramCanvasRef = useRef<HTMLDivElement>(null);
114
+ const diagramOptions = dataSpaceViewerState.featuredDiagrams
115
+ .concat(
116
+ dataSpaceViewerState.diagrams.filter(
117
+ (diagram) => !dataSpaceViewerState.featuredDiagrams.includes(diagram),
118
+ ),
119
+ )
120
+ .map(buildDiagramOption);
121
+ const selectedDiagramOption = dataSpaceViewerState.currentDiagram
122
+ ? buildDiagramOption(dataSpaceViewerState.currentDiagram)
123
+ : null;
124
+ const onDiagramOptionChange = (option: DiagramOption): void => {
125
+ if (option.value !== dataSpaceViewerState.currentDiagram) {
126
+ dataSpaceViewerState.setCurrentDiagram(option.value);
127
+ }
128
+ };
129
+ const formatDiagramOptionLabel = (
130
+ option: DiagramOption,
131
+ ): React.ReactNode => (
132
+ <div className="data-space__viewer__diagrams__dropdown__option">
133
+ <div className="data-space__viewer__diagrams__dropdown__option__label">
134
+ {option.label}
135
+ </div>
136
+ {dataSpaceViewerState.featuredDiagrams.includes(option.value) && (
137
+ <div className="data-space__viewer__diagrams__dropdown__option__tag">
138
+ featured
139
+ </div>
140
+ )}
141
+ </div>
142
+ );
143
+
144
+ if (dataSpaceViewerState.diagrams.length === 0) {
145
+ return <BlankPanelContent>No diagrams available</BlankPanelContent>;
146
+ }
147
+ return (
148
+ <div className="data-space__viewer__main-panel__content data-space__viewer__diagrams">
149
+ <div className="data-space__viewer__diagrams__header">
150
+ <CustomSelectorInput
151
+ className="data-space__viewer__diagrams__diagram-selector"
152
+ options={diagramOptions}
153
+ onChange={onDiagramOptionChange}
154
+ value={selectedDiagramOption}
155
+ placeholder="Search for a diagram"
156
+ darkMode={true}
157
+ formatOptionLabel={formatDiagramOptionLabel}
158
+ />
159
+ </div>
160
+ <div className="data-space__viewer__diagrams__content">
161
+ {dataSpaceViewerState.currentDiagram && (
162
+ <DataSpaceDiagramCanvas
163
+ dataSpaceViewerState={dataSpaceViewerState}
164
+ diagram={dataSpaceViewerState.currentDiagram}
165
+ ref={diagramCanvasRef}
166
+ />
167
+ )}
168
+ </div>
169
+ <div className="data-space__viewer__diagrams__footer"></div>
170
+ </div>
171
+ );
172
+ },
173
+ );
174
+
175
+ type ExecutionContextOption = {
176
+ label: string;
177
+ value: ResolvedDataSpaceExecutionContext;
178
+ };
179
+ const buildExecutionContextOption = (
180
+ value: ResolvedDataSpaceExecutionContext,
181
+ ): ExecutionContextOption => ({
182
+ label: value.name,
183
+ value: value,
184
+ });
185
+
186
+ type RuntimeOption = {
187
+ label: string;
188
+ value: PackageableRuntime;
189
+ };
190
+ const buildRuntimeOption = (value: PackageableRuntime): RuntimeOption => ({
191
+ label: value.name,
192
+ value: value,
193
+ });
194
+
195
+ const DataSpaceExecutionViewer = observer(
196
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
197
+ const { dataSpaceViewerState } = props;
198
+
199
+ // execution
200
+ const executionContextOptions =
201
+ dataSpaceViewerState.dataSpace.executionContexts.map(
202
+ buildExecutionContextOption,
203
+ );
204
+ const selectedExecutionContextOption = buildExecutionContextOption(
205
+ dataSpaceViewerState.currentExecutionContext,
206
+ );
207
+ const onExecutionContextOptionChange = (
208
+ option: ExecutionContextOption,
209
+ ): void => {
210
+ if (option.value !== dataSpaceViewerState.currentExecutionContext) {
211
+ dataSpaceViewerState.setCurrentExecutionContext(option.value);
212
+ }
213
+ };
214
+ const formatExecutionContextOptionLabel = (
215
+ option: ExecutionContextOption,
216
+ ): React.ReactNode => (
217
+ <div className="data-space__viewer__execution__entry__content__dropdown__option">
218
+ <div className="data-space__viewer__execution__entry__content__dropdown__option__label">
219
+ {option.label}
220
+ </div>
221
+ {option.value ===
222
+ dataSpaceViewerState.dataSpace.defaultExecutionContext && (
223
+ <div className="data-space__viewer__execution__entry__content__dropdown__option__tag">
224
+ default
225
+ </div>
226
+ )}
227
+ </div>
228
+ );
229
+
230
+ // runtime
231
+ const runtimeOptions =
232
+ dataSpaceViewerState.runtimes.map(buildRuntimeOption);
233
+ const selectedRuntimeOption = buildRuntimeOption(
234
+ dataSpaceViewerState.currentRuntime,
235
+ );
236
+ const onRuntimeOptionChange = (option: RuntimeOption): void => {
237
+ if (option.value !== dataSpaceViewerState.currentRuntime) {
238
+ dataSpaceViewerState.setCurrentRuntime(option.value);
239
+ }
240
+ };
241
+ const formatRuntimeOptionLabel = (
242
+ option: RuntimeOption,
243
+ ): React.ReactNode => (
244
+ <div className="data-space__viewer__execution__entry__content__dropdown__option">
245
+ <div className="data-space__viewer__execution__entry__content__dropdown__option__label">
246
+ {option.label}
247
+ </div>
248
+ {option.value ===
249
+ dataSpaceViewerState.currentExecutionContext.defaultRuntime.value && (
250
+ <div className="data-space__viewer__execution__entry__content__dropdown__option__tag">
251
+ default
252
+ </div>
253
+ )}
254
+ </div>
255
+ );
256
+
257
+ return (
258
+ <div className="data-space__viewer__main-panel__content data-space__viewer__execution">
259
+ <div className="data-space__viewer__execution__entry">
260
+ <div className="data-space__viewer__execution__entry__icon">
261
+ <CogIcon className="data-space__viewer__execution__context-icon" />
262
+ </div>
263
+ <div className="data-space__viewer__execution__entry__content data-space__viewer__execution__entry__content__dropdown__container">
264
+ <CustomSelectorInput
265
+ className="data-space__viewer__execution__entry__content__dropdown"
266
+ options={executionContextOptions}
267
+ onChange={onExecutionContextOptionChange}
268
+ value={selectedExecutionContextOption}
269
+ darkMode={true}
270
+ formatOptionLabel={formatExecutionContextOptionLabel}
271
+ />
272
+ </div>
273
+ </div>
274
+ <div
275
+ className={clsx('data-space__viewer__execution__description', {
276
+ 'data-space__viewer__execution__description--empty':
277
+ !dataSpaceViewerState.currentExecutionContext.description,
278
+ })}
279
+ >
280
+ {dataSpaceViewerState.currentExecutionContext.description
281
+ ? dataSpaceViewerState.currentExecutionContext.description
282
+ : 'No description'}
283
+ </div>
284
+ <div className="data-space__viewer__execution__entry data-space__viewer__execution__mapping">
285
+ <div className="data-space__viewer__execution__entry__icon">
286
+ <MappingIcon />
287
+ </div>
288
+ <div className="data-space__viewer__execution__entry__content data-space__viewer__execution__entry__content__text">
289
+ {dataSpaceViewerState.currentExecutionContext.mapping.value.path}
290
+ </div>
291
+ </div>
292
+ <div className="data-space__viewer__execution__entry">
293
+ <div className="data-space__viewer__execution__entry__icon">
294
+ <RuntimeIcon />
295
+ </div>
296
+ <div className="data-space__viewer__execution__entry__content data-space__viewer__execution__entry__content__dropdown__container">
297
+ <CustomSelectorInput
298
+ className="data-space__viewer__execution__entry__content__dropdown"
299
+ options={runtimeOptions}
300
+ onChange={onRuntimeOptionChange}
301
+ value={selectedRuntimeOption}
302
+ darkMode={true}
303
+ formatOptionLabel={formatRuntimeOptionLabel}
304
+ />
305
+ </div>
306
+ </div>
307
+ </div>
308
+ );
309
+ },
310
+ );
311
+
312
+ const DataSpaceTags = observer(
313
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
314
+ const { dataSpaceViewerState } = props;
315
+
316
+ const dataSpace = dataSpaceViewerState.dataSpace;
317
+
318
+ return (
319
+ <div className="data-space__viewer__tags">
320
+ <div className="data-space__viewer__tags__section">
321
+ <div className="data-space__viewer__tags__section__title">
322
+ Tagged Values
323
+ </div>
324
+ {dataSpace.taggedValues.length !== 0 &&
325
+ dataSpace.taggedValues.map((taggedValueData) => (
326
+ <div
327
+ key={taggedValueData.uuid}
328
+ className="data-space__viewer__tags__section__entry"
329
+ >
330
+ <div
331
+ className="data-space__viewer__tags__tagged-value__tag"
332
+ title={`${taggedValueData.profile}.${taggedValueData.tag}`}
333
+ >
334
+ {taggedValueData.tag}
335
+ </div>
336
+ <div className="data-space__viewer__tags__tagged-value__value">
337
+ {taggedValueData.value}
338
+ </div>
339
+ </div>
340
+ ))}
341
+ {dataSpace.taggedValues.length === 0 && (
342
+ <div className="data-space__viewer__tags__section__placeholder">
343
+ (empty)
344
+ </div>
345
+ )}
346
+ </div>
347
+ <div className="data-space__viewer__tags__section">
348
+ <div className="data-space__viewer__tags__section__title">
349
+ Stereotypes
350
+ </div>
351
+ {dataSpace.stereotypes.length !== 0 &&
352
+ dataSpace.stereotypes.map((stereotypeData) => (
353
+ <div
354
+ key={stereotypeData.uuid}
355
+ className="data-space__viewer__tags__section__entry"
356
+ title={`${stereotypeData.profile}.${stereotypeData.stereotype}`}
357
+ >
358
+ <div className="data-space__viewer__tags__steoreotype">
359
+ {stereotypeData.stereotype}
360
+ </div>
361
+ </div>
362
+ ))}
363
+ {dataSpace.stereotypes.length === 0 && (
364
+ <div className="data-space__viewer__tags__section__placeholder">
365
+ (empty)
366
+ </div>
367
+ )}
368
+ </div>
369
+ </div>
370
+ );
371
+ },
372
+ );
373
+
374
+ const DataSpaceSupportEmailViewer = observer(
375
+ (props: {
376
+ dataSpaceViewerState: DataSpaceViewerState;
377
+ dataSpaceSupportEmail: DataSpaceSupportEmail;
378
+ }) => {
379
+ const { dataSpaceSupportEmail } = props;
380
+
381
+ return (
382
+ <div className="data-space__viewer__support-email">
383
+ <div className="data-space__viewer__support-email__entry">
384
+ <div className="data-space__viewer__support-email__entry__icon">
385
+ <EnvelopIcon />
386
+ </div>
387
+ <a
388
+ href={`mailto:${dataSpaceSupportEmail.address}`}
389
+ className="data-space__viewer__support-email__entry__content"
390
+ >
391
+ {dataSpaceSupportEmail.address}
392
+ </a>
393
+ </div>
394
+ </div>
395
+ );
396
+ },
397
+ );
398
+
399
+ const DataSpaceSupportInfoViewerInner = observer(
400
+ (props: {
401
+ dataSpaceViewerState: DataSpaceViewerState;
402
+ dataSpaceSupportInfo: DataSpaceSupportInfo | undefined;
403
+ }) => {
404
+ const { dataSpaceViewerState, dataSpaceSupportInfo } = props;
405
+ if (dataSpaceSupportInfo === undefined) {
406
+ return <BlankPanelContent>No support info available</BlankPanelContent>;
407
+ } else if (dataSpaceSupportInfo instanceof DataSpaceSupportEmail) {
408
+ return (
409
+ <DataSpaceSupportEmailViewer
410
+ dataSpaceViewerState={dataSpaceViewerState}
411
+ dataSpaceSupportEmail={dataSpaceSupportInfo}
412
+ />
413
+ );
414
+ }
415
+ return (
416
+ <BlankPanelContent>Can&apos;t display support info</BlankPanelContent>
417
+ );
418
+ },
419
+ );
420
+
421
+ export const DataSpaceViewer = observer(
422
+ (props: { dataSpaceViewerState: DataSpaceViewerState }) => {
423
+ const { dataSpaceViewerState } = props;
424
+ const dataSpace = dataSpaceViewerState.dataSpace;
425
+ const changeActivity =
426
+ (activity: DATA_SPACE_VIEWER_ACTIVITY_MODE): (() => void) =>
427
+ (): void =>
428
+ dataSpaceViewerState.setCurrentActivity(activity);
429
+
430
+ const activities: DataSpaceViewerActivityConfig[] = [
431
+ {
432
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_OVERVIEW,
433
+ title: 'Models Overview',
434
+ icon: <ShapesIcon />,
435
+ },
436
+ {
437
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.EXECUTION,
438
+ title: 'Execution Context',
439
+ icon: <PlayIcon />,
440
+ },
441
+ {
442
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.ENTITLEMENT,
443
+ title: 'Entitlement',
444
+ icon: <KeyIcon />,
445
+ },
446
+ {
447
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.TEST_DATA,
448
+ title: 'Test Data',
449
+ icon: <FlaskIcon />,
450
+ },
451
+ {
452
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.TEST_COVERAGE,
453
+ title: 'Test Coverage',
454
+ icon: <ShieldIcon />,
455
+ },
456
+ {
457
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.TAGS,
458
+ title: 'Tags',
459
+ icon: <TagsIcon />,
460
+ },
461
+ {
462
+ mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.SUPPORT,
463
+ title: 'Support',
464
+ icon: <QuestionCircleIcon />,
465
+ },
466
+ ];
467
+
468
+ const viewDataSpaceProject = (): void =>
469
+ dataSpaceViewerState.viewProject?.(
470
+ dataSpaceViewerState.dataSpaceGroupId,
471
+ dataSpaceViewerState.dataSpaceArtifactId,
472
+ dataSpaceViewerState.dataSpaceVersionId,
473
+ dataSpace.path,
474
+ );
475
+ const viewProject = (): void =>
476
+ dataSpaceViewerState.viewProject?.(
477
+ dataSpace.groupId,
478
+ dataSpace.artifactId,
479
+ dataSpace.versionId,
480
+ undefined,
481
+ );
482
+
483
+ return (
484
+ <div className="data-space__viewer">
485
+ <div className="data-space__viewer__header">
486
+ <button
487
+ className="data-space__viewer__path"
488
+ tabIndex={-1}
489
+ title="View Data Space in Project"
490
+ onClick={viewDataSpaceProject}
491
+ >
492
+ <div className="data-space__viewer__path__label">
493
+ {dataSpace.path}
494
+ </div>
495
+ <div className="data-space__viewer__path__link">
496
+ <ExternalLinkSquareIcon />
497
+ </div>
498
+ </button>
499
+ <button
500
+ className="data-space__viewer__gav"
501
+ tabIndex={-1}
502
+ title="View Project"
503
+ onClick={viewProject}
504
+ >
505
+ <div className="data-space__viewer__gav__group-id">
506
+ {dataSpace.groupId}
507
+ </div>
508
+ <div className="data-space__viewer__gav__separator">:</div>
509
+ <div className="data-space__viewer__gav__artifact-id">
510
+ {dataSpace.artifactId}
511
+ </div>
512
+ <div className="data-space__viewer__gav__separator">:</div>
513
+ <div className="data-space__viewer__gav__version-id">
514
+ {dataSpace.versionId}
515
+ </div>
516
+ <div className="data-space__viewer__gav__link">
517
+ <ExternalLinkIcon />
518
+ </div>
519
+ </button>
520
+ <div
521
+ className={clsx('data-space__viewer__description', {
522
+ 'data-space__viewer__description--empty': !dataSpace.description,
523
+ })}
524
+ >
525
+ {dataSpace.description ? dataSpace.description : 'No description'}
526
+ </div>
527
+ </div>
528
+ <div className="data-space__viewer__content">
529
+ <div className="data-space__viewer__body">
530
+ <div className="data-space__viewer__activity-bar">
531
+ <div className="data-space__viewer__activity-bar__items">
532
+ {activities.map((activity) => (
533
+ <button
534
+ key={activity.mode}
535
+ className={clsx('data-space__viewer__activity-bar__item', {
536
+ 'data-space__viewer__activity-bar__item--active':
537
+ dataSpaceViewerState.currentActivity === activity.mode,
538
+ })}
539
+ onClick={changeActivity(activity.mode)}
540
+ tabIndex={-1}
541
+ title={activity.title}
542
+ >
543
+ {activity.icon}
544
+ </button>
545
+ ))}
546
+ </div>
547
+ </div>
548
+ <div className="data-space__viewer__main-panel">
549
+ {dataSpaceViewerState.currentActivity ===
550
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_OVERVIEW && (
551
+ <DataSpaceModelsOverview
552
+ dataSpaceViewerState={dataSpaceViewerState}
553
+ />
554
+ )}
555
+ {dataSpaceViewerState.currentActivity ===
556
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.EXECUTION && (
557
+ <DataSpaceExecutionViewer
558
+ dataSpaceViewerState={dataSpaceViewerState}
559
+ />
560
+ )}
561
+ {dataSpaceViewerState.currentActivity ===
562
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.ENTITLEMENT && (
563
+ <BlankPanelContent>
564
+ Request entitlement(s) (Work in Progress)
565
+ </BlankPanelContent>
566
+ )}
567
+ {dataSpaceViewerState.currentActivity ===
568
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.TEST_DATA && (
569
+ <BlankPanelContent>
570
+ View test data (Work in Progress)
571
+ </BlankPanelContent>
572
+ )}
573
+ {dataSpaceViewerState.currentActivity ===
574
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.TEST_COVERAGE && (
575
+ <BlankPanelContent>
576
+ View test coverage (Work in Progress)
577
+ </BlankPanelContent>
578
+ )}
579
+ {dataSpaceViewerState.currentActivity ===
580
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.TAGS && (
581
+ <DataSpaceTags dataSpaceViewerState={dataSpaceViewerState} />
582
+ )}
583
+ {dataSpaceViewerState.currentActivity ===
584
+ DATA_SPACE_VIEWER_ACTIVITY_MODE.SUPPORT && (
585
+ <div className="data-space__viewer__main-panel__content data-space__viewer__support-info">
586
+ <DataSpaceSupportInfoViewerInner
587
+ dataSpaceViewerState={dataSpaceViewerState}
588
+ dataSpaceSupportInfo={dataSpace.supportInfo}
589
+ />
590
+ </div>
591
+ )}
592
+ </div>
593
+ </div>
594
+ </div>
595
+ </div>
596
+ );
597
+ },
598
+ );
@@ -0,0 +1,76 @@
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 packageJson from '../../../package.json';
18
+ import type {
19
+ LegendQueryPluginManager,
20
+ QuerySetupOptionRendererConfiguration,
21
+ QuerySetupRenderer,
22
+ QuerySetupState,
23
+ QuerySetupStore,
24
+ } from '@finos/legend-query';
25
+ import { LegendQueryPlugin } from '@finos/legend-query';
26
+ import { SquareIcon } from '@finos/legend-art';
27
+ import { DataSpaceQuerySetupState } from '../../stores/query/DataSpaceQuerySetupState';
28
+ import { DataspaceQuerySetup } from './DataSpaceQuerySetup';
29
+
30
+ export class DSLDataSpace_LegendQueryPlugin extends LegendQueryPlugin {
31
+ constructor() {
32
+ super(packageJson.extensions.queryPlugin, packageJson.version);
33
+ }
34
+
35
+ install(pluginManager: LegendQueryPluginManager): void {
36
+ pluginManager.registerQueryPlugin(this);
37
+ }
38
+
39
+ override getExtraQuerySetupOptionRendererConfigurations(): QuerySetupOptionRendererConfiguration[] {
40
+ return [
41
+ {
42
+ key: 'data-space-query-option',
43
+ renderer: (
44
+ setupStore: QuerySetupStore,
45
+ ): React.ReactNode | undefined => {
46
+ const createQuery = (): void =>
47
+ setupStore.setSetupState(new DataSpaceQuerySetupState(setupStore));
48
+ return (
49
+ <button
50
+ className="query-setup__landing-page__option query-setup__landing-page__option--data-space"
51
+ onClick={createQuery}
52
+ >
53
+ <div className="query-setup__landing-page__option__icon">
54
+ <SquareIcon className="query-setup__landing-page__icon--data-space" />
55
+ </div>
56
+ <div className="query-setup__landing-page__option__label">
57
+ Create query from data space
58
+ </div>
59
+ </button>
60
+ );
61
+ },
62
+ },
63
+ ];
64
+ }
65
+
66
+ override getExtraQuerySetupRenderers(): QuerySetupRenderer[] {
67
+ return [
68
+ (querySetupState: QuerySetupState): React.ReactNode | undefined => {
69
+ if (querySetupState instanceof DataSpaceQuerySetupState) {
70
+ return <DataspaceQuerySetup querySetupState={querySetupState} />;
71
+ }
72
+ return undefined;
73
+ },
74
+ ];
75
+ }
76
+ }