@finos/legend-extension-dsl-data-space-studio 0.2.1 → 0.2.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/lib/components/DataSpaceEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceEditor.js +34 -3
- package/lib/components/DataSpaceEditor.js.map +1 -1
- package/lib/components/DataSpaceExecutionContextEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceExecutionContextEditor.js +50 -6
- package/lib/components/DataSpaceExecutionContextEditor.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.js +26 -35
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.js +23 -29
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.js +16 -5
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js +13 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceHomeTab.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceHomeTab.js +6 -6
- package/lib/components/DataSpaceGeneralEditor/DataSpaceHomeTab.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceInfoTab.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceInfoTab.js +7 -3
- package/lib/components/DataSpaceGeneralEditor/DataSpaceInfoTab.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceRelatedDataSpacesSection.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceRelatedDataSpacesSection.js +14 -24
- package/lib/components/DataSpaceGeneralEditor/DataSpaceRelatedDataSpacesSection.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.d.ts +4 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.js +4 -2
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.js +49 -83
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +4 -1
- package/lib/stores/DataSpaceEditorState.d.ts.map +1 -1
- package/lib/stores/DataSpaceEditorState.js +3 -4
- package/lib/stores/DataSpaceEditorState.js.map +1 -1
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.js +6 -2
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.js.map +1 -1
- package/package.json +12 -9
- package/src/components/DataSpaceEditor.tsx +109 -23
- package/src/components/DataSpaceExecutionContextEditor.tsx +123 -57
- package/src/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.tsx +129 -100
- package/src/components/DataSpaceGeneralEditor/DataSpaceElementsSection.tsx +135 -78
- package/src/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.tsx +58 -31
- package/src/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.tsx +17 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceHomeTab.tsx +52 -51
- package/src/components/DataSpaceGeneralEditor/DataSpaceInfoTab.tsx +91 -36
- package/src/components/DataSpaceGeneralEditor/DataSpaceRelatedDataSpacesSection.tsx +67 -58
- package/src/components/DataSpaceGeneralEditor/DataSpaceSidebar.tsx +24 -2
- package/src/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.tsx +204 -214
- package/src/stores/DataSpaceEditorState.ts +3 -4
- package/src/stores/studio/DSL_DataSpace_GraphModifierHelper.ts +6 -2
|
@@ -14,14 +14,16 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { useEditorStore } from '@finos/legend-application-studio';
|
|
18
17
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from '@finos/legend-
|
|
18
|
+
EditorFormSection,
|
|
19
|
+
getElementIcon,
|
|
20
|
+
useEditorStore,
|
|
21
|
+
} from '@finos/legend-application-studio';
|
|
22
|
+
import { CustomSelectorInput, PlusIcon, TimesIcon } from '@finos/legend-art';
|
|
23
23
|
import { DataSpaceDiagram } from '@finos/legend-extension-dsl-data-space/graph';
|
|
24
24
|
import { observer } from 'mobx-react-lite';
|
|
25
|
+
import { useState } from 'react';
|
|
26
|
+
import { uuid } from '@finos/legend-shared';
|
|
25
27
|
import { DataSpaceEditorState } from '../../stores/DataSpaceEditorState.js';
|
|
26
28
|
import { PackageableElementExplicitReference } from '@finos/legend-graph';
|
|
27
29
|
import { type Diagram } from '@finos/legend-extension-dsl-diagram/graph';
|
|
@@ -32,113 +34,140 @@ import {
|
|
|
32
34
|
dataSpace_setDiagramDescription,
|
|
33
35
|
} from '../../stores/studio/DSL_DataSpace_GraphModifierHelper.js';
|
|
34
36
|
|
|
37
|
+
// the same diagram can be listed twice (with different titles), so rows are keyed by entry
|
|
38
|
+
const diagramRowKeys = new WeakMap<DataSpaceDiagram, string>();
|
|
39
|
+
const getDiagramRowKey = (diagram: DataSpaceDiagram): string => {
|
|
40
|
+
let key = diagramRowKeys.get(diagram);
|
|
41
|
+
if (!key) {
|
|
42
|
+
key = uuid();
|
|
43
|
+
diagramRowKeys.set(diagram, key);
|
|
44
|
+
}
|
|
45
|
+
return key;
|
|
46
|
+
};
|
|
47
|
+
|
|
35
48
|
export const DataSpaceDiagramsSection = observer(() => {
|
|
36
49
|
const editorStore = useEditorStore();
|
|
37
|
-
|
|
38
50
|
const dataSpaceState =
|
|
39
51
|
editorStore.tabManagerState.getCurrentEditorState(DataSpaceEditorState);
|
|
40
52
|
const dataSpace = dataSpaceState.dataSpace;
|
|
53
|
+
const isReadOnly = dataSpaceState.isReadOnly;
|
|
54
|
+
const diagrams = dataSpace.diagrams ?? [];
|
|
55
|
+
const [isAdding, setIsAdding] = useState(false);
|
|
41
56
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
newDiagram.title = diagramValue.name;
|
|
51
|
-
newDiagram.diagram =
|
|
52
|
-
PackageableElementExplicitReference.create(diagramValue);
|
|
53
|
-
dataSpace_addDiagram(dataSpace, newDiagram);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const handleRemoveDiagram = (diagram: DataSpaceDiagram): void => {
|
|
58
|
-
dataSpace_removeDiagram(dataSpace, diagram);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const handleDiagramTitleChange = (
|
|
62
|
-
diagram: DataSpaceDiagram,
|
|
63
|
-
value: string | undefined,
|
|
64
|
-
): void => {
|
|
65
|
-
dataSpace_setDiagramTitle(diagram, value ?? '');
|
|
57
|
+
const addDiagram = (option: { label: string; value: Diagram }): void => {
|
|
58
|
+
const newDiagram = new DataSpaceDiagram();
|
|
59
|
+
newDiagram.title = option.value.name;
|
|
60
|
+
newDiagram.diagram = PackageableElementExplicitReference.create(
|
|
61
|
+
option.value,
|
|
62
|
+
);
|
|
63
|
+
dataSpace_addDiagram(dataSpace, newDiagram);
|
|
64
|
+
setIsAdding(false);
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<>
|
|
82
|
-
<div className="panel__content__form__section__list__item__content">
|
|
83
|
-
<div className="panel__content__form__section__header__label">
|
|
84
|
-
Diagram
|
|
85
|
-
</div>
|
|
86
|
-
<div className="panel__content__form__section__list__item__content__title">
|
|
87
|
-
{item.diagram.value.path}
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
<div className="panel__content__form__section__list__item__form">
|
|
91
|
-
<PanelFormTextField
|
|
92
|
-
name="Title"
|
|
93
|
-
value={item.title}
|
|
94
|
-
update={(value) => handleDiagramTitleChange(item, value)}
|
|
95
|
-
placeholder="Enter title"
|
|
96
|
-
className="dataSpace-editor__general__diagrams__title"
|
|
97
|
-
/>
|
|
98
|
-
<PanelFormTextField
|
|
99
|
-
name="Description"
|
|
100
|
-
value={item.description ?? ''}
|
|
101
|
-
update={(value) => handleDiagramDescriptionChange(item, value)}
|
|
102
|
-
placeholder="Enter description"
|
|
103
|
-
className="dataSpace-editor__general__diagrams__description"
|
|
104
|
-
/>
|
|
67
|
+
return (
|
|
68
|
+
<EditorFormSection
|
|
69
|
+
title="Diagrams"
|
|
70
|
+
description="Diagrams shown when people browse this data space, each with a title and a description."
|
|
71
|
+
>
|
|
72
|
+
{diagrams.length ? (
|
|
73
|
+
<div className="dataSpace-editor-table dataSpace-editor-table--diagrams">
|
|
74
|
+
<div className="dataSpace-editor-table__row dataSpace-editor-table__row--header">
|
|
75
|
+
<div>Diagram</div>
|
|
76
|
+
<div>Title</div>
|
|
77
|
+
<div>Description</div>
|
|
78
|
+
<div />
|
|
105
79
|
</div>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
80
|
+
{diagrams.map((diagram) => (
|
|
81
|
+
<div
|
|
82
|
+
key={getDiagramRowKey(diagram)}
|
|
83
|
+
className="dataSpace-editor-table__row"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
className="dataSpace-editor-table__element"
|
|
87
|
+
title={diagram.diagram.value.path}
|
|
88
|
+
>
|
|
89
|
+
{getElementIcon(diagram.diagram.value, editorStore)}
|
|
90
|
+
<span className="dataSpace-editor-table__element__name">
|
|
91
|
+
{diagram.diagram.value.name}
|
|
92
|
+
</span>
|
|
93
|
+
<span className="dataSpace-editor-table__element__package">
|
|
94
|
+
{diagram.diagram.value.package?.path}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
<input
|
|
98
|
+
className="input input--dark dataSpace-editor-table__input"
|
|
99
|
+
spellCheck={false}
|
|
100
|
+
disabled={isReadOnly}
|
|
101
|
+
value={diagram.title}
|
|
102
|
+
onChange={(event): void =>
|
|
103
|
+
dataSpace_setDiagramTitle(diagram, event.target.value)
|
|
104
|
+
}
|
|
105
|
+
placeholder="Title"
|
|
106
|
+
title="Diagram title"
|
|
107
|
+
/>
|
|
108
|
+
<input
|
|
109
|
+
className="input input--dark dataSpace-editor-table__input"
|
|
110
|
+
spellCheck={false}
|
|
111
|
+
disabled={isReadOnly}
|
|
112
|
+
value={diagram.description ?? ''}
|
|
113
|
+
onChange={(event): void =>
|
|
114
|
+
dataSpace_setDiagramDescription(
|
|
115
|
+
diagram,
|
|
116
|
+
event.target.value || undefined,
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
placeholder="Add a description"
|
|
120
|
+
title="Diagram description"
|
|
121
|
+
/>
|
|
122
|
+
<button
|
|
123
|
+
className="dataSpace-editor-table__remove-btn"
|
|
124
|
+
disabled={isReadOnly}
|
|
125
|
+
onClick={(): void =>
|
|
126
|
+
dataSpace_removeDiagram(dataSpace, diagram)
|
|
127
|
+
}
|
|
128
|
+
title="Remove this diagram from the data space"
|
|
129
|
+
>
|
|
130
|
+
<TimesIcon />
|
|
131
|
+
</button>
|
|
132
|
+
</div>
|
|
133
|
+
))}
|
|
134
|
+
</div>
|
|
135
|
+
) : (
|
|
136
|
+
<div className="dataSpace-editor-table__empty">
|
|
137
|
+
No diagrams yet. A diagram helps people see the shape of the model
|
|
138
|
+
before they query it.
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
{isAdding ? (
|
|
142
|
+
<div className="dataSpace-editor-add-picker">
|
|
117
143
|
<CustomSelectorInput
|
|
118
144
|
options={dataSpaceState.getDiagramOptions()}
|
|
119
|
-
onChange={
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
145
|
+
onChange={addDiagram}
|
|
146
|
+
placeholder="Choose a diagram to add..."
|
|
147
|
+
darkMode={
|
|
148
|
+
!editorStore.applicationStore.layoutService
|
|
149
|
+
.TEMPORARY__isLightColorThemeEnabled
|
|
150
|
+
}
|
|
151
|
+
autoFocus={true}
|
|
152
|
+
openMenuOnFocus={true}
|
|
125
153
|
/>
|
|
154
|
+
<button
|
|
155
|
+
className="dataSpace-editor-add-picker__cancel"
|
|
156
|
+
onClick={(): void => setIsAdding(false)}
|
|
157
|
+
>
|
|
158
|
+
Cancel
|
|
159
|
+
</button>
|
|
126
160
|
</div>
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
NewItemComponent={NewDiagramComponent}
|
|
139
|
-
handleRemoveItem={handleRemoveDiagram}
|
|
140
|
-
isReadOnly={dataSpaceState.isReadOnly}
|
|
141
|
-
emptyMessage="No diagrams specified"
|
|
142
|
-
/>
|
|
161
|
+
) : (
|
|
162
|
+
<button
|
|
163
|
+
className="dataSpace-editor-add-btn"
|
|
164
|
+
disabled={isReadOnly}
|
|
165
|
+
onClick={(): void => setIsAdding(true)}
|
|
166
|
+
>
|
|
167
|
+
<PlusIcon />
|
|
168
|
+
Add diagram
|
|
169
|
+
</button>
|
|
170
|
+
)}
|
|
171
|
+
</EditorFormSection>
|
|
143
172
|
);
|
|
144
173
|
});
|
|
@@ -14,13 +14,24 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import {
|
|
18
|
+
EditorFormSection,
|
|
19
|
+
getElementIcon,
|
|
20
|
+
useEditorStore,
|
|
21
|
+
} from '@finos/legend-application-studio';
|
|
22
|
+
import {
|
|
23
|
+
clsx,
|
|
24
|
+
CustomSelectorInput,
|
|
25
|
+
PlusIcon,
|
|
26
|
+
TimesIcon,
|
|
27
|
+
} from '@finos/legend-art';
|
|
19
28
|
import {
|
|
20
29
|
type DataSpaceElement,
|
|
21
30
|
DataSpaceElementPointer,
|
|
22
31
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
23
32
|
import { observer } from 'mobx-react-lite';
|
|
33
|
+
import { useState } from 'react';
|
|
34
|
+
import { prettyCONSTName, returnUndefOnError } from '@finos/legend-shared';
|
|
24
35
|
import { DataSpaceEditorState } from '../../stores/DataSpaceEditorState.js';
|
|
25
36
|
import { PackageableElementExplicitReference } from '@finos/legend-graph';
|
|
26
37
|
import {
|
|
@@ -31,98 +42,144 @@ import {
|
|
|
31
42
|
|
|
32
43
|
export const DataSpaceElementsSection = observer(() => {
|
|
33
44
|
const editorStore = useEditorStore();
|
|
34
|
-
|
|
35
45
|
const dataSpaceState =
|
|
36
46
|
editorStore.tabManagerState.getCurrentEditorState(DataSpaceEditorState);
|
|
37
47
|
const dataSpace = dataSpaceState.dataSpace;
|
|
48
|
+
const isReadOnly = dataSpaceState.isReadOnly;
|
|
49
|
+
const elements = dataSpace.elements ?? [];
|
|
50
|
+
const [isAdding, setIsAdding] = useState(false);
|
|
38
51
|
|
|
39
|
-
|
|
40
|
-
const handleAddElement = (option: {
|
|
52
|
+
const addElement = (option: {
|
|
41
53
|
label: string;
|
|
42
54
|
value: DataSpaceElement;
|
|
43
55
|
}): void => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
56
|
+
const elementPointer = new DataSpaceElementPointer();
|
|
57
|
+
elementPointer.element = PackageableElementExplicitReference.create(
|
|
58
|
+
option.value,
|
|
59
|
+
);
|
|
60
|
+
dataSpace_addElement(dataSpace, elementPointer);
|
|
61
|
+
setIsAdding(false);
|
|
51
62
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
const getTypeLabel = (pointer: DataSpaceElementPointer): string => {
|
|
64
|
+
const type = returnUndefOnError(() =>
|
|
65
|
+
editorStore.graphState.getPackageableElementType(pointer.element.value),
|
|
66
|
+
);
|
|
67
|
+
return type ? prettyCONSTName(type) : '';
|
|
55
68
|
};
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div className="panel__content__form__section__list__item__content">
|
|
71
|
-
<div className="panel__content__form__section__list__item__content__label">
|
|
72
|
-
{item.element.value.path}
|
|
70
|
+
return (
|
|
71
|
+
<EditorFormSection
|
|
72
|
+
title="Elements"
|
|
73
|
+
description="The classes, enumerations, associations and packages listed under Models Documentation. Exclude an element to hide it from this data space altogether, even when its package is included."
|
|
74
|
+
>
|
|
75
|
+
{elements.length ? (
|
|
76
|
+
<div className="dataSpace-editor-table dataSpace-editor-table--elements">
|
|
77
|
+
<div className="dataSpace-editor-table__row dataSpace-editor-table__row--header">
|
|
78
|
+
<div>Element</div>
|
|
79
|
+
<div>Type</div>
|
|
80
|
+
<div>In this data space</div>
|
|
81
|
+
<div />
|
|
73
82
|
</div>
|
|
74
|
-
|
|
75
|
-
<div
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
{elements.map((pointer) => (
|
|
84
|
+
<div
|
|
85
|
+
key={pointer.element.value.path}
|
|
86
|
+
className={clsx('dataSpace-editor-table__row', {
|
|
87
|
+
'dataSpace-editor-table__row--excluded': pointer.exclude,
|
|
88
|
+
})}
|
|
89
|
+
>
|
|
90
|
+
<div
|
|
91
|
+
className="dataSpace-editor-table__element"
|
|
92
|
+
title={pointer.element.value.path}
|
|
93
|
+
>
|
|
94
|
+
{getElementIcon(pointer.element.value, editorStore)}
|
|
95
|
+
<span className="dataSpace-editor-table__element__name">
|
|
96
|
+
{pointer.element.value.name}
|
|
97
|
+
</span>
|
|
98
|
+
<span className="dataSpace-editor-table__element__package">
|
|
99
|
+
{pointer.element.value.package?.path}
|
|
100
|
+
</span>
|
|
101
|
+
</div>
|
|
102
|
+
<div className="dataSpace-editor-table__type">
|
|
103
|
+
{getTypeLabel(pointer)}
|
|
104
|
+
</div>
|
|
105
|
+
<div className="dataSpace-editor-segmented">
|
|
106
|
+
<button
|
|
107
|
+
className={clsx('dataSpace-editor-segmented__option', {
|
|
108
|
+
'dataSpace-editor-segmented__option--active':
|
|
109
|
+
!pointer.exclude,
|
|
110
|
+
})}
|
|
111
|
+
disabled={isReadOnly}
|
|
112
|
+
aria-pressed={!pointer.exclude}
|
|
113
|
+
onClick={(): void =>
|
|
114
|
+
dataSpace_setElementExclude(pointer, false)
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
Included
|
|
118
|
+
</button>
|
|
119
|
+
<button
|
|
120
|
+
className={clsx('dataSpace-editor-segmented__option', {
|
|
121
|
+
'dataSpace-editor-segmented__option--active': Boolean(
|
|
122
|
+
pointer.exclude,
|
|
123
|
+
),
|
|
124
|
+
})}
|
|
125
|
+
disabled={isReadOnly}
|
|
126
|
+
aria-pressed={Boolean(pointer.exclude)}
|
|
127
|
+
onClick={(): void =>
|
|
128
|
+
dataSpace_setElementExclude(pointer, true)
|
|
129
|
+
}
|
|
130
|
+
>
|
|
131
|
+
Excluded
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
134
|
+
<button
|
|
135
|
+
className="dataSpace-editor-table__remove-btn"
|
|
136
|
+
disabled={isReadOnly}
|
|
137
|
+
onClick={(): void =>
|
|
138
|
+
dataSpace_removeElement(dataSpace, pointer)
|
|
139
|
+
}
|
|
140
|
+
title="Remove this element from the list"
|
|
141
|
+
>
|
|
142
|
+
<TimesIcon />
|
|
143
|
+
</button>
|
|
86
144
|
</div>
|
|
87
|
-
|
|
145
|
+
))}
|
|
88
146
|
</div>
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<div className="panel__content__form__section__list__new-item__input">
|
|
147
|
+
) : (
|
|
148
|
+
<div className="dataSpace-editor-table__empty">
|
|
149
|
+
No elements listed yet. Add the classes, enumerations, associations or
|
|
150
|
+
packages people should find documented here.
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
{isAdding ? (
|
|
154
|
+
<div className="dataSpace-editor-add-picker">
|
|
99
155
|
<CustomSelectorInput
|
|
100
156
|
options={dataSpaceState.getDataSpaceElementOptions()}
|
|
101
|
-
onChange={
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
157
|
+
onChange={addElement}
|
|
158
|
+
placeholder="Choose a class, enumeration, association or package..."
|
|
159
|
+
darkMode={
|
|
160
|
+
!editorStore.applicationStore.layoutService
|
|
161
|
+
.TEMPORARY__isLightColorThemeEnabled
|
|
162
|
+
}
|
|
163
|
+
autoFocus={true}
|
|
164
|
+
openMenuOnFocus={true}
|
|
107
165
|
/>
|
|
166
|
+
<button
|
|
167
|
+
className="dataSpace-editor-add-picker__cancel"
|
|
168
|
+
onClick={(): void => setIsAdding(false)}
|
|
169
|
+
>
|
|
170
|
+
Cancel
|
|
171
|
+
</button>
|
|
108
172
|
</div>
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
ItemComponent={ElementComponent}
|
|
122
|
-
NewItemComponent={NewElementComponent}
|
|
123
|
-
handleRemoveItem={handleRemoveElement}
|
|
124
|
-
isReadOnly={dataSpaceState.isReadOnly}
|
|
125
|
-
emptyMessage="No elements specified"
|
|
126
|
-
/>
|
|
173
|
+
) : (
|
|
174
|
+
<button
|
|
175
|
+
className="dataSpace-editor-add-btn"
|
|
176
|
+
disabled={isReadOnly}
|
|
177
|
+
onClick={(): void => setIsAdding(true)}
|
|
178
|
+
>
|
|
179
|
+
<PlusIcon />
|
|
180
|
+
Add element
|
|
181
|
+
</button>
|
|
182
|
+
)}
|
|
183
|
+
</EditorFormSection>
|
|
127
184
|
);
|
|
128
185
|
});
|
|
@@ -30,9 +30,11 @@ import {
|
|
|
30
30
|
dataSpace_setExecutableTitle,
|
|
31
31
|
} from '../../stores/studio/DSL_DataSpace_GraphModifierHelper.js';
|
|
32
32
|
import {
|
|
33
|
+
getElementIcon,
|
|
33
34
|
RelationElementSampleValuesEditor,
|
|
34
35
|
useEditorStore,
|
|
35
36
|
} from '@finos/legend-application-studio';
|
|
37
|
+
import { prettyCONSTName, returnUndefOnError } from '@finos/legend-shared';
|
|
36
38
|
import { DataSpaceEditorState } from '../../stores/DataSpaceEditorState.js';
|
|
37
39
|
import {
|
|
38
40
|
BlankPanelPlaceholder,
|
|
@@ -380,39 +382,43 @@ const ExecutableConfigurationEditor = observer(
|
|
|
380
382
|
|
|
381
383
|
return (
|
|
382
384
|
<div className="dataSpace-editor__configuration">
|
|
383
|
-
<
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
prompt="Provide a title for this executable"
|
|
392
|
-
fullWidth={true}
|
|
393
|
-
/>
|
|
394
|
-
<PanelFormSection>
|
|
395
|
-
<div className="panel__content__form__section__header__label">
|
|
396
|
-
Description
|
|
397
|
-
</div>
|
|
398
|
-
<div className="panel__content__form__section__header__prompt">
|
|
399
|
-
Provide a description for this executable.
|
|
385
|
+
<div className="dataSpace-editor__configuration__section">
|
|
386
|
+
<div className="dataSpace-editor__configuration__section__header">
|
|
387
|
+
<div className="dataSpace-editor__configuration__section__title">
|
|
388
|
+
General
|
|
389
|
+
</div>
|
|
390
|
+
<div className="dataSpace-editor__configuration__section__hint">
|
|
391
|
+
How this executable is shown to people browsing the data space.
|
|
392
|
+
</div>
|
|
400
393
|
</div>
|
|
401
|
-
<
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
onChange={(event): void =>
|
|
407
|
-
dataSpace_setExecutableDescription(
|
|
408
|
-
executable,
|
|
409
|
-
event.target.value || undefined,
|
|
410
|
-
)
|
|
394
|
+
<PanelFormTextField
|
|
395
|
+
name="Title"
|
|
396
|
+
value={executable.title}
|
|
397
|
+
update={(value): void =>
|
|
398
|
+
dataSpace_setExecutableTitle(executable, value ?? '')
|
|
411
399
|
}
|
|
412
|
-
|
|
413
|
-
placeholder="Enter
|
|
400
|
+
isReadOnly={isReadOnly}
|
|
401
|
+
placeholder="Enter title"
|
|
402
|
+
fullWidth={true}
|
|
414
403
|
/>
|
|
415
|
-
|
|
404
|
+
<label className="dataSpace-editor-field">
|
|
405
|
+
<span className="dataSpace-editor-field__label">Description</span>
|
|
406
|
+
<textarea
|
|
407
|
+
className="input input--dark dataSpace-editor-field__textarea"
|
|
408
|
+
spellCheck={false}
|
|
409
|
+
disabled={isReadOnly}
|
|
410
|
+
value={executable.description ?? ''}
|
|
411
|
+
onChange={(event): void =>
|
|
412
|
+
dataSpace_setExecutableDescription(
|
|
413
|
+
executable,
|
|
414
|
+
event.target.value || undefined,
|
|
415
|
+
)
|
|
416
|
+
}
|
|
417
|
+
rows={3}
|
|
418
|
+
placeholder="What this executable returns, and when to use it"
|
|
419
|
+
/>
|
|
420
|
+
</label>
|
|
421
|
+
</div>
|
|
416
422
|
{executable instanceof DataSpacePackageableElementExecutable && (
|
|
417
423
|
<div className="dataSpace-editor__configuration__section">
|
|
418
424
|
<div className="dataSpace-editor__configuration__section__header">
|
|
@@ -421,6 +427,9 @@ const ExecutableConfigurationEditor = observer(
|
|
|
421
427
|
</div>
|
|
422
428
|
</div>
|
|
423
429
|
<div className="dataSpace-editor__configuration__row">
|
|
430
|
+
<span className="dataSpace-editor__configuration__row__icon">
|
|
431
|
+
{getElementIcon(executable.executable.value, editorStore)}
|
|
432
|
+
</span>
|
|
424
433
|
<span className="dataSpace-editor__executable__pointer__path">
|
|
425
434
|
{executable.executable.value.path}
|
|
426
435
|
</span>
|
|
@@ -491,12 +500,14 @@ const ExecutableConfigurationEditor = observer(
|
|
|
491
500
|
const ExecutableTab = observer(
|
|
492
501
|
(props: {
|
|
493
502
|
executable: DataSpaceExecutable;
|
|
503
|
+
kind: string;
|
|
494
504
|
isActive: boolean;
|
|
495
505
|
isReadOnly: boolean;
|
|
496
506
|
onSelect: () => void;
|
|
497
507
|
onDelete: () => void;
|
|
498
508
|
}) => {
|
|
499
|
-
const { executable, isActive, isReadOnly, onSelect, onDelete } =
|
|
509
|
+
const { executable, kind, isActive, isReadOnly, onSelect, onDelete } =
|
|
510
|
+
props;
|
|
500
511
|
|
|
501
512
|
const remove = (event: React.MouseEvent): void => {
|
|
502
513
|
event.stopPropagation();
|
|
@@ -511,6 +522,7 @@ const ExecutableTab = observer(
|
|
|
511
522
|
})}
|
|
512
523
|
role="tab"
|
|
513
524
|
>
|
|
525
|
+
<span className="dataSpace-editor__tab__kind">{kind}</span>
|
|
514
526
|
<span className="dataSpace-editor__tab__label">
|
|
515
527
|
{executable.title || '(untitled)'}
|
|
516
528
|
</span>
|
|
@@ -552,6 +564,20 @@ export const DataspaceExecutablesSection = observer(() => {
|
|
|
552
564
|
};
|
|
553
565
|
|
|
554
566
|
const addExecutable = (): void => setIsNewModalOpen(true);
|
|
567
|
+
const getKind = (executable: DataSpaceExecutable): string => {
|
|
568
|
+
if (executable instanceof DataSpaceExecutableTemplate) {
|
|
569
|
+
return 'Query';
|
|
570
|
+
}
|
|
571
|
+
if (executable instanceof DataSpacePackageableElementExecutable) {
|
|
572
|
+
const type = returnUndefOnError(() =>
|
|
573
|
+
editorStore.graphState.getPackageableElementType(
|
|
574
|
+
executable.executable.value,
|
|
575
|
+
),
|
|
576
|
+
);
|
|
577
|
+
return type ? prettyCONSTName(type) : 'Element';
|
|
578
|
+
}
|
|
579
|
+
return 'Executable';
|
|
580
|
+
};
|
|
555
581
|
|
|
556
582
|
return (
|
|
557
583
|
<div className="panel dataSpace-editor__tab-panel">
|
|
@@ -561,6 +587,7 @@ export const DataspaceExecutablesSection = observer(() => {
|
|
|
561
587
|
<ExecutableTab
|
|
562
588
|
key={executable.hashCode}
|
|
563
589
|
executable={executable}
|
|
590
|
+
kind={getKind(executable)}
|
|
564
591
|
isActive={executable === currentSelection}
|
|
565
592
|
isReadOnly={isReadOnly}
|
|
566
593
|
onSelect={(): void => setSelectedExecutable(executable)}
|