@finos/legend-extension-dsl-data-space 0.1.0 → 1.0.2
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.
- package/CHANGELOG.md +28 -0
- package/lib/DSLDataSpace_Extension.d.ts +0 -10
- package/lib/DSLDataSpace_Extension.d.ts.map +1 -1
- package/lib/DSLDataSpace_Extension.js +0 -24
- package/lib/DSLDataSpace_Extension.js.map +1 -1
- package/lib/components/{query/DataSpaceViewer.d.ts → DataSpaceViewer.d.ts} +1 -1
- package/lib/components/DataSpaceViewer.d.ts.map +1 -0
- package/lib/components/DataSpaceViewer.js +186 -0
- package/lib/components/DataSpaceViewer.js.map +1 -0
- package/lib/components/query/{DSLDataSpace_QueryPlugin.d.ts → DSLDataSpace_LegendQueryPlugin.d.ts} +5 -5
- package/lib/components/query/DSLDataSpace_LegendQueryPlugin.d.ts.map +1 -0
- package/lib/components/query/{DSLDataSpace_QueryPlugin.js → DSLDataSpace_LegendQueryPlugin.js} +4 -4
- package/lib/components/query/DSLDataSpace_LegendQueryPlugin.js.map +1 -0
- package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/query/DataSpaceQuerySetup.js +15 -8
- package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/studio/{DSLDataSpace_StudioPlugin.d.ts → DSLDataSpace_LegendStudioPlugin.d.ts} +5 -5
- package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.d.ts.map +1 -0
- package/lib/components/studio/{DSLDataSpace_StudioPlugin.js → DSLDataSpace_LegendStudioPlugin.js} +6 -5
- package/lib/components/studio/DSLDataSpace_LegendStudioPlugin.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts +12 -0
- package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js +45 -2
- package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/stores/DataSpaceViewerState.d.ts +59 -0
- package/lib/stores/DataSpaceViewerState.d.ts.map +1 -0
- package/lib/stores/DataSpaceViewerState.js +137 -0
- package/lib/stores/DataSpaceViewerState.js.map +1 -0
- package/lib/stores/query/DataSpaceQuerySetupState.d.ts +7 -34
- package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupState.js +30 -136
- package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
- package/package.json +22 -20
- package/src/DSLDataSpace_Extension.ts +0 -30
- package/src/components/{query/DataSpaceViewer.tsx → DataSpaceViewer.tsx} +216 -121
- package/src/components/query/{DSLDataSpace_QueryPlugin.tsx → DSLDataSpace_LegendQueryPlugin.tsx} +4 -4
- package/src/components/query/DataSpaceQuerySetup.tsx +30 -5
- package/src/components/studio/{DSLDataSpace_StudioPlugin.tsx → DSLDataSpace_LegendStudioPlugin.tsx} +10 -9
- package/src/index.ts +12 -0
- package/src/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.ts +71 -0
- package/src/stores/DataSpaceViewerState.ts +202 -0
- package/src/stores/query/DataSpaceQuerySetupState.ts +70 -202
- package/tsconfig.json +5 -3
- package/tsconfig.package.json +1 -0
- package/lib/components/query/DSLDataSpace_QueryPlugin.d.ts.map +0 -1
- package/lib/components/query/DSLDataSpace_QueryPlugin.js.map +0 -1
- package/lib/components/query/DataSpaceViewer.d.ts.map +0 -1
- package/lib/components/query/DataSpaceViewer.js +0 -163
- package/lib/components/query/DataSpaceViewer.js.map +0 -1
- package/lib/components/studio/DSLDataSpace_StudioPlugin.d.ts.map +0 -1
- package/lib/components/studio/DSLDataSpace_StudioPlugin.js.map +0 -1
package/src/components/studio/{DSLDataSpace_StudioPlugin.tsx → DSLDataSpace_LegendStudioPlugin.tsx}
RENAMED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
import packageJson from '../../../package.json';
|
|
18
18
|
import type {
|
|
19
|
-
|
|
19
|
+
LegendStudioPluginManager,
|
|
20
20
|
NewElementFromStateCreator,
|
|
21
21
|
ElementTypeGetter,
|
|
22
22
|
ElementProjectExplorerDnDTypeGetter,
|
|
23
23
|
ElementIconGetter,
|
|
24
|
-
|
|
24
|
+
DSL_LegendStudioPlugin_Extension,
|
|
25
25
|
NewElementState,
|
|
26
26
|
ElementEditorStateCreator,
|
|
27
27
|
EditorStore,
|
|
@@ -29,7 +29,7 @@ import type {
|
|
|
29
29
|
} from '@finos/legend-studio';
|
|
30
30
|
import {
|
|
31
31
|
UnsupportedElementEditorState,
|
|
32
|
-
|
|
32
|
+
LegendStudioPlugin,
|
|
33
33
|
} from '@finos/legend-studio';
|
|
34
34
|
import { SquareIcon } from '@finos/legend-art';
|
|
35
35
|
import type { PackageableElement } from '@finos/legend-graph';
|
|
@@ -37,20 +37,21 @@ import {
|
|
|
37
37
|
DataSpace,
|
|
38
38
|
DataSpaceExecutionContext,
|
|
39
39
|
} from '../../models/metamodels/pure/model/packageableElements/dataSpace/DataSpace';
|
|
40
|
+
import { LATEST_VERSION_ALIAS } from '@finos/legend-server-depot';
|
|
40
41
|
|
|
41
42
|
const DATA_SPACE_ELEMENT_TYPE = 'DATA SPACE';
|
|
42
43
|
const DATA_SPACE_ELEMENT_PROJECT_EXPLORER_DND_TYPE =
|
|
43
44
|
'PROJECT_EXPLORER_DATA_SPACE';
|
|
44
45
|
|
|
45
|
-
export class
|
|
46
|
-
extends
|
|
47
|
-
implements
|
|
46
|
+
export class DSLDataSpace_LegendStudioPlugin
|
|
47
|
+
extends LegendStudioPlugin
|
|
48
|
+
implements DSL_LegendStudioPlugin_Extension
|
|
48
49
|
{
|
|
49
50
|
constructor() {
|
|
50
51
|
super(packageJson.extensions.studioPlugin, packageJson.version);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
install(pluginManager:
|
|
54
|
+
install(pluginManager: LegendStudioPluginManager): void {
|
|
54
55
|
pluginManager.registerStudioPlugin(this);
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -74,7 +75,7 @@ export class DSLDataSpace_StudioPlugin
|
|
|
74
75
|
(type: string): React.ReactNode | undefined => {
|
|
75
76
|
if (type === DATA_SPACE_ELEMENT_TYPE) {
|
|
76
77
|
return (
|
|
77
|
-
<div className="icon icon--
|
|
78
|
+
<div className="icon icon--data-space">
|
|
78
79
|
<SquareIcon />
|
|
79
80
|
</div>
|
|
80
81
|
);
|
|
@@ -97,7 +98,7 @@ export class DSLDataSpace_StudioPlugin
|
|
|
97
98
|
state.editorStore.projectConfigurationEditorState.currentProjectConfiguration.groupId;
|
|
98
99
|
dataSpace.artifactId =
|
|
99
100
|
state.editorStore.projectConfigurationEditorState.currentProjectConfiguration.artifactId;
|
|
100
|
-
dataSpace.versionId =
|
|
101
|
+
dataSpace.versionId = LATEST_VERSION_ALIAS;
|
|
101
102
|
const dataSpaceExecutionContext = new DataSpaceExecutionContext();
|
|
102
103
|
dataSpaceExecutionContext.name = 'dummyContext';
|
|
103
104
|
dataSpaceExecutionContext.mapping = 'dummyMapping';
|
package/src/index.ts
CHANGED
|
@@ -15,3 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export * from './DSLDataSpace_Extension';
|
|
18
|
+
export { DSLDataSpace_LegendStudioPlugin } from './components/studio/DSLDataSpace_LegendStudioPlugin';
|
|
19
|
+
export { DSLDataSpace_LegendQueryPlugin } from './components/query/DSLDataSpace_LegendQueryPlugin';
|
|
20
|
+
|
|
21
|
+
export { DataSpaceViewer } from './components/DataSpaceViewer';
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
25
|
+
extractDataSpaceTaxonomyNodes,
|
|
26
|
+
getResolvedDataSpace,
|
|
27
|
+
} from './models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin';
|
|
28
|
+
|
|
29
|
+
export { DataSpaceViewerState } from './stores/DataSpaceViewerState';
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from './v1/model/packageableElements/dataSpace/V1_DataSpace';
|
|
24
24
|
import type { PlainObject } from '@finos/legend-shared';
|
|
25
25
|
import {
|
|
26
|
+
uuid,
|
|
26
27
|
guaranteeNonEmptyString,
|
|
27
28
|
guaranteeNonNullable,
|
|
28
29
|
UnsupportedOperationError,
|
|
@@ -56,8 +57,10 @@ import type {
|
|
|
56
57
|
V1_GraphTransformerContext,
|
|
57
58
|
V1_PackageableElement,
|
|
58
59
|
V1_PureModelContextData,
|
|
60
|
+
V1_TaggedValue,
|
|
59
61
|
} from '@finos/legend-graph';
|
|
60
62
|
import {
|
|
63
|
+
V1_taggedValueSchema,
|
|
61
64
|
PackageableElementExplicitReference,
|
|
62
65
|
V1_PackageableElementPointer,
|
|
63
66
|
V1_PackageableElementPointerType,
|
|
@@ -67,6 +70,7 @@ import {
|
|
|
67
70
|
PureProtocolProcessorPlugin,
|
|
68
71
|
V1_ElementBuilder,
|
|
69
72
|
V1_initPackageableElement,
|
|
73
|
+
V1_StereotypePtr,
|
|
70
74
|
} from '@finos/legend-graph';
|
|
71
75
|
import {
|
|
72
76
|
Diagram,
|
|
@@ -317,6 +321,13 @@ export class ResolvedDataSpaceExecutionContext {
|
|
|
317
321
|
* element pointers to actual reference, hence this model.
|
|
318
322
|
*/
|
|
319
323
|
export class ResolvedDataSpace {
|
|
324
|
+
taggedValues: {
|
|
325
|
+
uuid: string;
|
|
326
|
+
profile: string;
|
|
327
|
+
tag: string;
|
|
328
|
+
value: string;
|
|
329
|
+
}[] = [];
|
|
330
|
+
stereotypes: { uuid: string; profile: string; stereotype: string }[] = [];
|
|
320
331
|
path!: string;
|
|
321
332
|
groupId!: string;
|
|
322
333
|
artifactId!: string;
|
|
@@ -336,6 +347,33 @@ export const getResolvedDataSpace = (
|
|
|
336
347
|
if (json._type === V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE) {
|
|
337
348
|
const protocol = deserialize(V1_dataSpaceModelSchema, json);
|
|
338
349
|
dataSpace.path = protocol.path;
|
|
350
|
+
if (Array.isArray(json.taggedValues)) {
|
|
351
|
+
dataSpace.taggedValues = (
|
|
352
|
+
json.taggedValues as PlainObject<V1_TaggedValue>[]
|
|
353
|
+
)
|
|
354
|
+
.map((taggedValueJson) =>
|
|
355
|
+
deserialize(V1_taggedValueSchema, taggedValueJson),
|
|
356
|
+
)
|
|
357
|
+
.map((taggedValue) => ({
|
|
358
|
+
uuid: uuid(),
|
|
359
|
+
profile: taggedValue.tag.profile,
|
|
360
|
+
tag: taggedValue.tag.value,
|
|
361
|
+
value: taggedValue.value,
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
if (Array.isArray(json.stereotypes)) {
|
|
365
|
+
dataSpace.stereotypes = (
|
|
366
|
+
json.stereotypes as PlainObject<V1_StereotypePtr>[]
|
|
367
|
+
)
|
|
368
|
+
.map((stereotypePtrJson) =>
|
|
369
|
+
deserialize(V1_StereotypePtr, stereotypePtrJson),
|
|
370
|
+
)
|
|
371
|
+
.map((stereotypePtr) => ({
|
|
372
|
+
uuid: uuid(),
|
|
373
|
+
profile: stereotypePtr.profile,
|
|
374
|
+
stereotype: stereotypePtr.value,
|
|
375
|
+
}));
|
|
376
|
+
}
|
|
339
377
|
dataSpace.groupId = guaranteeNonEmptyString(
|
|
340
378
|
protocol.groupId,
|
|
341
379
|
`Data space 'groupId' field is missing or empty`,
|
|
@@ -403,3 +441,36 @@ export const getResolvedDataSpace = (
|
|
|
403
441
|
}
|
|
404
442
|
throw new UnsupportedOperationError(`Can't resolve data space`, json);
|
|
405
443
|
};
|
|
444
|
+
|
|
445
|
+
export const extractDataSpaceTaxonomyNodes = (
|
|
446
|
+
json: PlainObject<V1_DataSpace>,
|
|
447
|
+
): string[] => {
|
|
448
|
+
const ENTERPRISE_PROFILE_PATH = `meta::pure::profiles::enterprise`;
|
|
449
|
+
const TAXONOMY_NODES_TAG = `taxonomyNodes`;
|
|
450
|
+
const TAXONOMY_NODES_TAG_VALUE_DELIMITER = `,`;
|
|
451
|
+
|
|
452
|
+
const taxonomyNodes = new Set<string>();
|
|
453
|
+
if (json._type === V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE) {
|
|
454
|
+
if (Array.isArray(json.taggedValues)) {
|
|
455
|
+
const taggedValues = (
|
|
456
|
+
json.taggedValues as PlainObject<V1_TaggedValue>[]
|
|
457
|
+
).map((taggedValueJson) =>
|
|
458
|
+
deserialize(V1_taggedValueSchema, taggedValueJson),
|
|
459
|
+
);
|
|
460
|
+
taggedValues
|
|
461
|
+
.filter(
|
|
462
|
+
(taggedValue) =>
|
|
463
|
+
taggedValue.tag.profile === ENTERPRISE_PROFILE_PATH &&
|
|
464
|
+
taggedValue.tag.value === TAXONOMY_NODES_TAG,
|
|
465
|
+
)
|
|
466
|
+
.forEach((taggedValue) => {
|
|
467
|
+
taggedValue.value
|
|
468
|
+
.split(TAXONOMY_NODES_TAG_VALUE_DELIMITER)
|
|
469
|
+
.map((value) => value.trim())
|
|
470
|
+
.filter((value) => Boolean(value))
|
|
471
|
+
.forEach((value) => taxonomyNodes.add(value));
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return Array.from(taxonomyNodes.values());
|
|
476
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
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 type {
|
|
18
|
+
ClassView,
|
|
19
|
+
DiagramRenderer,
|
|
20
|
+
} from '@finos/legend-extension-dsl-diagram';
|
|
21
|
+
import {
|
|
22
|
+
Diagram,
|
|
23
|
+
DIAGRAM_INTERACTION_MODE,
|
|
24
|
+
} from '@finos/legend-extension-dsl-diagram';
|
|
25
|
+
import type {
|
|
26
|
+
GraphManagerState,
|
|
27
|
+
PackageableElementReference,
|
|
28
|
+
PackageableRuntime,
|
|
29
|
+
} from '@finos/legend-graph';
|
|
30
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
31
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
32
|
+
import type {
|
|
33
|
+
ResolvedDataSpace,
|
|
34
|
+
ResolvedDataSpaceExecutionContext,
|
|
35
|
+
} from '../models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin';
|
|
36
|
+
|
|
37
|
+
export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
|
|
38
|
+
MODELS_OVERVIEW = 'MODELS_OVERVIEW',
|
|
39
|
+
EXECUTION = 'EXECUTION',
|
|
40
|
+
ENTITLEMENT = 'ENTITLEMENT',
|
|
41
|
+
TEST_DATA = 'TEST_DATA',
|
|
42
|
+
TEST_COVERAGE = 'TEST_COVERAGE',
|
|
43
|
+
TAGS = 'TAGS',
|
|
44
|
+
SUPPORT = 'SUPPORT',
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class DataSpaceViewerState {
|
|
48
|
+
graphManagerState: GraphManagerState;
|
|
49
|
+
dataSpaceGroupId: string;
|
|
50
|
+
dataSpaceArtifactId: string;
|
|
51
|
+
dataSpaceVersionId: string;
|
|
52
|
+
dataSpace: ResolvedDataSpace;
|
|
53
|
+
_renderer?: DiagramRenderer | undefined;
|
|
54
|
+
currentDiagram?: Diagram | undefined;
|
|
55
|
+
currentActivity = DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_OVERVIEW;
|
|
56
|
+
currentExecutionContext: ResolvedDataSpaceExecutionContext;
|
|
57
|
+
currentRuntime: PackageableRuntime;
|
|
58
|
+
viewProject?:
|
|
59
|
+
| ((
|
|
60
|
+
groupId: string,
|
|
61
|
+
artifactId: string,
|
|
62
|
+
versionId: string,
|
|
63
|
+
entityPath: string | undefined,
|
|
64
|
+
) => void)
|
|
65
|
+
| undefined;
|
|
66
|
+
onDiagramClassDoubleClick?: ((classView: ClassView) => void) | undefined;
|
|
67
|
+
|
|
68
|
+
constructor(
|
|
69
|
+
graphManagerState: GraphManagerState,
|
|
70
|
+
dataSpaceGroupId: string,
|
|
71
|
+
dataSpaceArtifactId: string,
|
|
72
|
+
dataSpaceVersionId: string,
|
|
73
|
+
dataSpace: ResolvedDataSpace,
|
|
74
|
+
options?: {
|
|
75
|
+
viewProject?: (
|
|
76
|
+
groupId: string,
|
|
77
|
+
artifactId: string,
|
|
78
|
+
versionId: string,
|
|
79
|
+
entityPath: string | undefined,
|
|
80
|
+
) => void;
|
|
81
|
+
onDiagramClassDoubleClick?: (classView: ClassView) => void;
|
|
82
|
+
},
|
|
83
|
+
) {
|
|
84
|
+
makeObservable(this, {
|
|
85
|
+
_renderer: observable,
|
|
86
|
+
currentDiagram: observable,
|
|
87
|
+
currentActivity: observable,
|
|
88
|
+
currentExecutionContext: observable,
|
|
89
|
+
currentRuntime: observable,
|
|
90
|
+
renderer: computed,
|
|
91
|
+
setRenderer: action,
|
|
92
|
+
setCurrentDiagram: action,
|
|
93
|
+
setCurrentActivity: action,
|
|
94
|
+
setCurrentExecutionContext: action,
|
|
95
|
+
setCurrentRuntime: action,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
this.graphManagerState = graphManagerState;
|
|
99
|
+
this.dataSpace = dataSpace;
|
|
100
|
+
this.dataSpaceGroupId = dataSpaceGroupId;
|
|
101
|
+
this.dataSpaceArtifactId = dataSpaceArtifactId;
|
|
102
|
+
this.dataSpaceVersionId = dataSpaceVersionId;
|
|
103
|
+
this.currentExecutionContext = this.dataSpace.defaultExecutionContext;
|
|
104
|
+
this.currentRuntime =
|
|
105
|
+
this.dataSpace.defaultExecutionContext.defaultRuntime.value;
|
|
106
|
+
this.currentDiagram = this.dataSpace.featuredDiagrams.length
|
|
107
|
+
? (
|
|
108
|
+
this.dataSpace
|
|
109
|
+
.featuredDiagrams[0] as PackageableElementReference<Diagram>
|
|
110
|
+
).value
|
|
111
|
+
: this.diagrams.length
|
|
112
|
+
? this.diagrams[0]
|
|
113
|
+
: undefined;
|
|
114
|
+
this.viewProject = options?.viewProject;
|
|
115
|
+
this.onDiagramClassDoubleClick = options?.onDiagramClassDoubleClick;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get renderer(): DiagramRenderer {
|
|
119
|
+
return guaranteeNonNullable(
|
|
120
|
+
this._renderer,
|
|
121
|
+
`Diagram renderer must be initialized (this is likely caused by calling this method at the wrong place)`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
get isDiagramRendererInitialized(): boolean {
|
|
126
|
+
return Boolean(this._renderer);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get featuredDiagrams(): Diagram[] {
|
|
130
|
+
return this.dataSpace.featuredDiagrams.map((ref) => ref.value);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
get diagrams(): Diagram[] {
|
|
134
|
+
return this.graphManagerState.graph
|
|
135
|
+
.getExtensionElements(Diagram)
|
|
136
|
+
.concat(
|
|
137
|
+
this.graphManagerState.graph.dependencyManager.getExtensionElements(
|
|
138
|
+
Diagram,
|
|
139
|
+
),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
get runtimes(): PackageableRuntime[] {
|
|
144
|
+
return this.graphManagerState.graph.ownRuntimes
|
|
145
|
+
.concat(this.graphManagerState.graph.dependencyManager.runtimes)
|
|
146
|
+
.filter((runtime) =>
|
|
147
|
+
runtime.runtimeValue.mappings
|
|
148
|
+
.map((mapping) => mapping.value)
|
|
149
|
+
.includes(this.currentExecutionContext.mapping.value),
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// NOTE: we have tried to use React to control the cursor and
|
|
154
|
+
// could not overcome the jank/lag problem, so we settle with CSS-based approach
|
|
155
|
+
// See https://css-tricks.com/using-css-cursors/
|
|
156
|
+
// See https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
|
|
157
|
+
get diagramCursorClass(): string {
|
|
158
|
+
if (!this.isDiagramRendererInitialized) {
|
|
159
|
+
return '';
|
|
160
|
+
}
|
|
161
|
+
if (this.renderer.middleClick || this.renderer.rightClick) {
|
|
162
|
+
return 'diagram-editor__cursor--grabbing';
|
|
163
|
+
}
|
|
164
|
+
switch (this.renderer.interactionMode) {
|
|
165
|
+
case DIAGRAM_INTERACTION_MODE.LAYOUT: {
|
|
166
|
+
if (this.renderer.mouseOverClassView) {
|
|
167
|
+
return 'diagram-editor__cursor--pointer';
|
|
168
|
+
}
|
|
169
|
+
return '';
|
|
170
|
+
}
|
|
171
|
+
default:
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setRenderer(val: DiagramRenderer): void {
|
|
177
|
+
this._renderer = val;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
setCurrentDiagram(val: Diagram): void {
|
|
181
|
+
this.currentDiagram = val;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
setCurrentActivity(val: DATA_SPACE_VIEWER_ACTIVITY_MODE): void {
|
|
185
|
+
this.currentActivity = val;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
setCurrentExecutionContext(val: ResolvedDataSpaceExecutionContext): void {
|
|
189
|
+
this.currentExecutionContext = val;
|
|
190
|
+
this.currentRuntime = val.defaultRuntime.value;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
setCurrentRuntime(val: PackageableRuntime): void {
|
|
194
|
+
this.currentRuntime = val;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
setupRenderer(): void {
|
|
198
|
+
this.renderer.setIsReadOnly(true);
|
|
199
|
+
this.renderer.onClassViewDoubleClick = (classView: ClassView): void =>
|
|
200
|
+
this.onDiagramClassDoubleClick?.(classView);
|
|
201
|
+
}
|
|
202
|
+
}
|