@finos/legend-extension-dsl-data-space-studio 0.1.152 → 0.1.154
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/DSL_DataProduct_ElementDriver.d.ts +27 -0
- package/lib/components/DSL_DataProduct_ElementDriver.d.ts.map +1 -0
- package/lib/components/DSL_DataProduct_ElementDriver.js +60 -0
- package/lib/components/DSL_DataProduct_ElementDriver.js.map +1 -0
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +3 -1
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.js +30 -15
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/components/DSL_NewDataProductEditor.d.ts +19 -0
- package/lib/components/DSL_NewDataProductEditor.d.ts.map +1 -0
- package/lib/components/DSL_NewDataProductEditor.js +32 -0
- package/lib/components/DSL_NewDataProductEditor.js.map +1 -0
- package/lib/components/DataSpaceEditor.d.ts +1 -1
- package/lib/components/DataSpaceEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceEditor.js +18 -9
- package/lib/components/DataSpaceEditor.js.map +1 -1
- package/lib/components/DataSpaceExecutionContextEditor.d.ts +37 -0
- package/lib/components/DataSpaceExecutionContextEditor.d.ts.map +1 -0
- package/lib/components/DataSpaceExecutionContextEditor.js +170 -0
- package/lib/components/DataSpaceExecutionContextEditor.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.d.ts +19 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.js +138 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.d.ts +19 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.js +63 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.d.ts +19 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.js +58 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceElementsSection.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.d.ts +19 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.js +56 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.d.ts +19 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js +40 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.d.ts +19 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.js +120 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +3 -2
- package/lib/stores/DataSpaceEditorState.d.ts +18 -2
- package/lib/stores/DataSpaceEditorState.d.ts.map +1 -1
- package/lib/stores/DataSpaceEditorState.js +55 -3
- package/lib/stores/DataSpaceEditorState.js.map +1 -1
- package/lib/stores/DataSpaceExecutionContextState.d.ts +37 -0
- package/lib/stores/DataSpaceExecutionContextState.d.ts.map +1 -0
- package/lib/stores/DataSpaceExecutionContextState.js +87 -0
- package/lib/stores/DataSpaceExecutionContextState.js.map +1 -0
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.d.ts +34 -3
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.js +128 -2
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.js.map +1 -1
- package/package.json +10 -9
- package/src/components/DSL_DataProduct_ElementDriver.tsx +82 -0
- package/src/components/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +35 -19
- package/src/components/DSL_NewDataProductEditor.tsx +57 -0
- package/src/components/DataSpaceEditor.tsx +54 -33
- package/src/components/DataSpaceExecutionContextEditor.tsx +692 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.tsx +393 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.tsx +144 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceElementsSection.tsx +128 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.tsx +108 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.tsx +76 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.tsx +276 -0
- package/src/stores/DataSpaceEditorState.ts +92 -4
- package/src/stores/DataSpaceExecutionContextState.ts +135 -0
- package/src/stores/studio/DSL_DataSpace_GraphModifierHelper.ts +278 -3
- package/tsconfig.json +11 -1
@@ -0,0 +1,108 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
type DataSpaceExecutable,
|
19
|
+
DataSpacePackageableElementExecutable,
|
20
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
21
|
+
import { observer } from 'mobx-react-lite';
|
22
|
+
import {
|
23
|
+
dataSpace_addExecutable,
|
24
|
+
dataSpace_removeExecutable,
|
25
|
+
} from '../../stores/studio/DSL_DataSpace_GraphModifierHelper.js';
|
26
|
+
import { useEditorStore } from '@finos/legend-application-studio';
|
27
|
+
import { DataSpaceEditorState } from '../../stores/DataSpaceEditorState.js';
|
28
|
+
import { CustomSelectorInput, ListEditor } from '@finos/legend-art';
|
29
|
+
import {
|
30
|
+
type PackageableElement,
|
31
|
+
PackageableElementExplicitReference,
|
32
|
+
} from '@finos/legend-graph';
|
33
|
+
|
34
|
+
export const DataspaceExecutablesSection = observer(() => {
|
35
|
+
const editorStore = useEditorStore();
|
36
|
+
|
37
|
+
const dataSpaceState =
|
38
|
+
editorStore.tabManagerState.getCurrentEditorState(DataSpaceEditorState);
|
39
|
+
const dataSpace = dataSpaceState.dataSpace;
|
40
|
+
|
41
|
+
// Event handlers
|
42
|
+
const handleAddExecutable = (option: {
|
43
|
+
label: string;
|
44
|
+
value: PackageableElement;
|
45
|
+
}): void => {
|
46
|
+
if (typeof option.value === 'object') {
|
47
|
+
const element = option.value;
|
48
|
+
const executablePointer = new DataSpacePackageableElementExecutable();
|
49
|
+
executablePointer.executable =
|
50
|
+
PackageableElementExplicitReference.create(element);
|
51
|
+
executablePointer.title = element.name;
|
52
|
+
dataSpace_addExecutable(dataSpace, executablePointer);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
const handleRemoveExecutable = (executable: DataSpaceExecutable): void => {
|
57
|
+
dataSpace_removeExecutable(dataSpace, executable);
|
58
|
+
};
|
59
|
+
|
60
|
+
// ListEditor component renderers
|
61
|
+
const ExecutableComponent = observer(
|
62
|
+
(props: { item: DataSpaceExecutable }): React.ReactElement => {
|
63
|
+
const { item } = props;
|
64
|
+
|
65
|
+
return (
|
66
|
+
<div className="panel__content__form__section__list__item__content">
|
67
|
+
<div className="panel__content__form__section__list__item__content__label">
|
68
|
+
{item.title}
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
);
|
72
|
+
},
|
73
|
+
);
|
74
|
+
|
75
|
+
const NewExecutableComponent = observer(
|
76
|
+
(props: { onFinishEditing: () => void }) => {
|
77
|
+
const { onFinishEditing } = props;
|
78
|
+
|
79
|
+
return (
|
80
|
+
<div className="panel__content__form__section__list__new-item__input">
|
81
|
+
<CustomSelectorInput
|
82
|
+
options={dataSpaceState.getDataSpaceExecutableOptions()}
|
83
|
+
onChange={(event: { label: string; value: PackageableElement }) => {
|
84
|
+
onFinishEditing();
|
85
|
+
handleAddExecutable(event);
|
86
|
+
}}
|
87
|
+
placeholder="Select an element to add..."
|
88
|
+
darkMode={true}
|
89
|
+
/>
|
90
|
+
</div>
|
91
|
+
);
|
92
|
+
},
|
93
|
+
);
|
94
|
+
|
95
|
+
return (
|
96
|
+
<ListEditor
|
97
|
+
title="Executables"
|
98
|
+
prompt="Add functions and services to display under Quick Start for users to see how this Data Product can be used."
|
99
|
+
items={dataSpace.executables}
|
100
|
+
keySelector={(element: DataSpaceExecutable) => element.hashCode}
|
101
|
+
ItemComponent={ExecutableComponent}
|
102
|
+
NewItemComponent={NewExecutableComponent}
|
103
|
+
handleRemoveItem={handleRemoveExecutable}
|
104
|
+
isReadOnly={dataSpaceState.isReadOnly}
|
105
|
+
emptyMessage="No executables specified"
|
106
|
+
/>
|
107
|
+
);
|
108
|
+
});
|
@@ -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 { useEditorStore } from '@finos/legend-application-studio';
|
18
|
+
import {
|
19
|
+
PanelContentLists,
|
20
|
+
PanelForm,
|
21
|
+
PanelFormTextField,
|
22
|
+
} from '@finos/legend-art';
|
23
|
+
import { observer } from 'mobx-react-lite';
|
24
|
+
import { DataSpaceEditorState } from '../../stores/DataSpaceEditorState.js';
|
25
|
+
import {
|
26
|
+
dataSpace_setDescription,
|
27
|
+
dataSpace_setTitle,
|
28
|
+
} from '../../stores/studio/DSL_DataSpace_GraphModifierHelper.js';
|
29
|
+
import { DataSpaceDefaultExecutionContextSection } from './DataSpaceDefaultExecutionContextSection.js';
|
30
|
+
import { DataSpaceDiagramsSection } from './DataSpaceDiagramsSection.js';
|
31
|
+
import { DataSpaceElementsSection } from './DataSpaceElementsSection.js';
|
32
|
+
import { DataspaceExecutablesSection } from './DataSpaceExecutablesSection.js';
|
33
|
+
import { DataSpaceSupportInfoSection } from './DataSpaceSupportInfoSection.js';
|
34
|
+
|
35
|
+
export const DataSpaceGeneralEditor = observer(() => {
|
36
|
+
const editorStore = useEditorStore();
|
37
|
+
|
38
|
+
const dataSpaceState =
|
39
|
+
editorStore.tabManagerState.getCurrentEditorState(DataSpaceEditorState);
|
40
|
+
const dataSpace = dataSpaceState.dataSpace;
|
41
|
+
|
42
|
+
// Basic properties handlers
|
43
|
+
const handleTitleChange = (value: string | undefined): void => {
|
44
|
+
dataSpace_setTitle(dataSpace, value);
|
45
|
+
};
|
46
|
+
|
47
|
+
const handleDescriptionChange = (value: string | undefined): void => {
|
48
|
+
dataSpace_setDescription(dataSpace, value);
|
49
|
+
};
|
50
|
+
|
51
|
+
return (
|
52
|
+
<PanelContentLists className="dataSpace-editor__general">
|
53
|
+
<PanelForm>
|
54
|
+
<PanelFormTextField
|
55
|
+
name="Title"
|
56
|
+
value={dataSpace.title ?? ''}
|
57
|
+
prompt="Provide a title for this Data Product."
|
58
|
+
update={handleTitleChange}
|
59
|
+
placeholder="Enter title"
|
60
|
+
/>
|
61
|
+
<PanelFormTextField
|
62
|
+
name="Description"
|
63
|
+
value={dataSpace.description ?? ''}
|
64
|
+
prompt="Provide a description for this Data Product."
|
65
|
+
update={handleDescriptionChange}
|
66
|
+
placeholder="Enter description"
|
67
|
+
/>
|
68
|
+
<DataSpaceDefaultExecutionContextSection />
|
69
|
+
<DataSpaceDiagramsSection />
|
70
|
+
<DataSpaceElementsSection />
|
71
|
+
<DataspaceExecutablesSection />
|
72
|
+
<DataSpaceSupportInfoSection />
|
73
|
+
</PanelForm>
|
74
|
+
</PanelContentLists>
|
75
|
+
);
|
76
|
+
});
|
@@ -0,0 +1,276 @@
|
|
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
|
+
PanelFormSection,
|
19
|
+
CustomSelectorInput,
|
20
|
+
PanelFormTextField,
|
21
|
+
ListEditor,
|
22
|
+
WarningIcon,
|
23
|
+
} from '@finos/legend-art';
|
24
|
+
import {
|
25
|
+
DataSpaceSupportEmail,
|
26
|
+
DataSpaceSupportCombinedInfo,
|
27
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
28
|
+
import { observer } from 'mobx-react-lite';
|
29
|
+
import {
|
30
|
+
dataSpace_email_setSupportInfoEmail,
|
31
|
+
dataSpace_setDocumentationUrl,
|
32
|
+
dataSpace_combined_setWebsite,
|
33
|
+
dataSpace_combined_setFaqUrl,
|
34
|
+
dataSpace_combined_addEmail,
|
35
|
+
dataSpace_combined_deleteEmail,
|
36
|
+
dataSpace_setSupportInfo,
|
37
|
+
} from '../../stores/studio/DSL_DataSpace_GraphModifierHelper.js';
|
38
|
+
import { useEditorStore } from '@finos/legend-application-studio';
|
39
|
+
import { DataSpaceEditorState } from '../../stores/DataSpaceEditorState.js';
|
40
|
+
import { useState } from 'react';
|
41
|
+
|
42
|
+
export const DataSpaceSupportInfoSection = observer(() => {
|
43
|
+
const editorStore = useEditorStore();
|
44
|
+
|
45
|
+
const dataSpaceState =
|
46
|
+
editorStore.tabManagerState.getCurrentEditorState(DataSpaceEditorState);
|
47
|
+
const dataSpace = dataSpaceState.dataSpace;
|
48
|
+
|
49
|
+
// Event handlers
|
50
|
+
const handleSupportInfoTypeChange = (option: { value: string }): void => {
|
51
|
+
if (typeof option !== 'object' || !('value' in option)) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
const type = option.value;
|
55
|
+
if (
|
56
|
+
type === 'email' &&
|
57
|
+
!(dataSpace.supportInfo instanceof DataSpaceSupportEmail)
|
58
|
+
) {
|
59
|
+
const supportInfo = new DataSpaceSupportEmail();
|
60
|
+
if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
61
|
+
supportInfo.address = dataSpace.supportInfo.emails?.[0] ?? '';
|
62
|
+
supportInfo.documentationUrl = dataSpace.supportInfo.documentationUrl;
|
63
|
+
}
|
64
|
+
dataSpace_setSupportInfo(dataSpace, supportInfo);
|
65
|
+
} else if (
|
66
|
+
type === 'combined' &&
|
67
|
+
!(dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo)
|
68
|
+
) {
|
69
|
+
const supportInfo = new DataSpaceSupportCombinedInfo();
|
70
|
+
if (
|
71
|
+
dataSpace.supportInfo instanceof DataSpaceSupportEmail &&
|
72
|
+
dataSpace.supportInfo.address
|
73
|
+
) {
|
74
|
+
supportInfo.emails = [dataSpace.supportInfo.address];
|
75
|
+
supportInfo.documentationUrl = dataSpace.supportInfo.documentationUrl;
|
76
|
+
}
|
77
|
+
dataSpace_setSupportInfo(dataSpace, supportInfo);
|
78
|
+
} else {
|
79
|
+
dataSpace_setSupportInfo(dataSpace, undefined);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
const handleSupportInfoEmailAdd = (email: string): void => {
|
84
|
+
if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
85
|
+
dataSpace_combined_addEmail(dataSpace.supportInfo, email);
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
const handleSupportInfoEmailRemove = (email: string): void => {
|
90
|
+
if (dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) {
|
91
|
+
dataSpace_combined_deleteEmail(dataSpace.supportInfo, email);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
// ListEditor component renderers
|
96
|
+
const SupportEmailComponent = observer(
|
97
|
+
(props: { item: string }): React.ReactElement => {
|
98
|
+
const { item } = props;
|
99
|
+
|
100
|
+
return (
|
101
|
+
<div className="panel__content__form__section__list__item__content">
|
102
|
+
<div className="panel__content__form__section__header__label">
|
103
|
+
{item}
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
);
|
107
|
+
},
|
108
|
+
);
|
109
|
+
|
110
|
+
const NewSupportEmailComponent = observer(
|
111
|
+
(props: { onFinishEditing: () => void }) => {
|
112
|
+
const { onFinishEditing } = props;
|
113
|
+
const [email, setEmail] = useState('');
|
114
|
+
|
115
|
+
return (
|
116
|
+
<div className="dataSpace-editor__general__support-info__new-email">
|
117
|
+
<div className="panel__content__form__section__list__new-item__input">
|
118
|
+
<input
|
119
|
+
className="input input-group__input panel__content__form__section__input input--dark"
|
120
|
+
type="email"
|
121
|
+
placeholder="Enter email"
|
122
|
+
value={email}
|
123
|
+
onChange={(event) => {
|
124
|
+
setEmail(event.target.value);
|
125
|
+
}}
|
126
|
+
/>
|
127
|
+
</div>
|
128
|
+
<button
|
129
|
+
className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
|
130
|
+
onClick={() => {
|
131
|
+
handleSupportInfoEmailAdd(email);
|
132
|
+
setEmail('');
|
133
|
+
onFinishEditing();
|
134
|
+
}}
|
135
|
+
>
|
136
|
+
Save
|
137
|
+
</button>
|
138
|
+
</div>
|
139
|
+
);
|
140
|
+
},
|
141
|
+
);
|
142
|
+
|
143
|
+
return (
|
144
|
+
<PanelFormSection className="dataSpace-editor__general__support-info">
|
145
|
+
<div className="panel__content__form__section__header__label">
|
146
|
+
Support Information
|
147
|
+
</div>
|
148
|
+
<div className="panel__content__form__section__header__prompt">
|
149
|
+
Configure support information for this Data Product.
|
150
|
+
</div>
|
151
|
+
{!(dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo) && (
|
152
|
+
<CustomSelectorInput
|
153
|
+
options={[
|
154
|
+
{ label: 'None', value: 'none' },
|
155
|
+
{ label: 'Combined', value: 'combined' },
|
156
|
+
]}
|
157
|
+
onChange={(option: { label: string; value: string }) =>
|
158
|
+
handleSupportInfoTypeChange(option)
|
159
|
+
}
|
160
|
+
value={{
|
161
|
+
label: dataSpace.supportInfo
|
162
|
+
? dataSpace.supportInfo instanceof DataSpaceSupportEmail
|
163
|
+
? 'Email'
|
164
|
+
: 'Combined'
|
165
|
+
: 'None',
|
166
|
+
value: dataSpace.supportInfo
|
167
|
+
? dataSpace.supportInfo instanceof DataSpaceSupportEmail
|
168
|
+
? 'email'
|
169
|
+
: 'combined'
|
170
|
+
: 'none',
|
171
|
+
}}
|
172
|
+
darkMode={true}
|
173
|
+
/>
|
174
|
+
)}
|
175
|
+
{dataSpace.supportInfo ? (
|
176
|
+
dataSpace.supportInfo instanceof DataSpaceSupportEmail ? (
|
177
|
+
<PanelFormSection className="dataSpace-editor__general__support-info__content">
|
178
|
+
<PanelFormTextField
|
179
|
+
name="Email Address"
|
180
|
+
value={dataSpace.supportInfo.address}
|
181
|
+
update={(value) => {
|
182
|
+
if (dataSpace.supportInfo instanceof DataSpaceSupportEmail) {
|
183
|
+
dataSpace_email_setSupportInfoEmail(
|
184
|
+
dataSpace.supportInfo,
|
185
|
+
value ?? '',
|
186
|
+
);
|
187
|
+
}
|
188
|
+
}}
|
189
|
+
placeholder="Enter email address"
|
190
|
+
/>
|
191
|
+
<PanelFormTextField
|
192
|
+
name="Documentation URL"
|
193
|
+
value={dataSpace.supportInfo.documentationUrl}
|
194
|
+
update={(value) => {
|
195
|
+
if (dataSpace.supportInfo) {
|
196
|
+
dataSpace_setDocumentationUrl(
|
197
|
+
dataSpace.supportInfo,
|
198
|
+
value ?? '',
|
199
|
+
);
|
200
|
+
}
|
201
|
+
}}
|
202
|
+
placeholder="Enter documentation URL"
|
203
|
+
/>
|
204
|
+
</PanelFormSection>
|
205
|
+
) : dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo ? (
|
206
|
+
<div>
|
207
|
+
<ListEditor
|
208
|
+
title="Emails"
|
209
|
+
items={dataSpace.supportInfo.emails}
|
210
|
+
keySelector={(element: string) => element}
|
211
|
+
ItemComponent={SupportEmailComponent}
|
212
|
+
NewItemComponent={NewSupportEmailComponent}
|
213
|
+
handleRemoveItem={handleSupportInfoEmailRemove}
|
214
|
+
isReadOnly={dataSpaceState.isReadOnly}
|
215
|
+
emptyMessage="No emails specified"
|
216
|
+
/>
|
217
|
+
{(dataSpace.supportInfo.emails === undefined ||
|
218
|
+
dataSpace.supportInfo.emails.length === 0) && (
|
219
|
+
<div className="service-editor__owner__validation">
|
220
|
+
<WarningIcon />
|
221
|
+
<div className="service-editor__owner__validation-label">
|
222
|
+
At least one email is required
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
)}
|
226
|
+
<PanelFormTextField
|
227
|
+
name="Documentation URL"
|
228
|
+
value={dataSpace.supportInfo.documentationUrl}
|
229
|
+
update={(value) => {
|
230
|
+
if (dataSpace.supportInfo) {
|
231
|
+
dataSpace_setDocumentationUrl(
|
232
|
+
dataSpace.supportInfo,
|
233
|
+
value ?? '',
|
234
|
+
);
|
235
|
+
}
|
236
|
+
}}
|
237
|
+
placeholder="Enter documentation URL"
|
238
|
+
/>
|
239
|
+
<PanelFormTextField
|
240
|
+
name="Website"
|
241
|
+
value={dataSpace.supportInfo.website}
|
242
|
+
update={(value) => {
|
243
|
+
if (
|
244
|
+
dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo
|
245
|
+
) {
|
246
|
+
dataSpace_combined_setWebsite(
|
247
|
+
dataSpace.supportInfo,
|
248
|
+
value ?? '',
|
249
|
+
);
|
250
|
+
}
|
251
|
+
}}
|
252
|
+
placeholder="Enter website URL"
|
253
|
+
/>
|
254
|
+
<PanelFormTextField
|
255
|
+
name="FAQ URL"
|
256
|
+
value={dataSpace.supportInfo.faqUrl}
|
257
|
+
update={(value) => {
|
258
|
+
if (
|
259
|
+
dataSpace.supportInfo instanceof DataSpaceSupportCombinedInfo
|
260
|
+
) {
|
261
|
+
dataSpace_combined_setFaqUrl(
|
262
|
+
dataSpace.supportInfo,
|
263
|
+
value ?? '',
|
264
|
+
);
|
265
|
+
}
|
266
|
+
}}
|
267
|
+
placeholder="Enter FAQ URL"
|
268
|
+
/>
|
269
|
+
</div>
|
270
|
+
) : (
|
271
|
+
<div>Unknown support info type</div>
|
272
|
+
)
|
273
|
+
) : null}
|
274
|
+
</PanelFormSection>
|
275
|
+
);
|
276
|
+
});
|
@@ -14,30 +14,118 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { action, computed, makeObservable } from 'mobx';
|
17
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
18
18
|
import {
|
19
19
|
type EditorStore,
|
20
20
|
ElementEditorState,
|
21
21
|
} from '@finos/legend-application-studio';
|
22
|
-
import
|
23
|
-
|
22
|
+
import {
|
23
|
+
type PackageableElement,
|
24
|
+
Package,
|
25
|
+
Class,
|
26
|
+
Enumeration,
|
27
|
+
Association,
|
28
|
+
Service,
|
29
|
+
ConcreteFunctionDefinition,
|
30
|
+
} from '@finos/legend-graph';
|
31
|
+
import { Diagram } from '@finos/legend-extension-dsl-diagram/graph';
|
32
|
+
import {
|
33
|
+
DataSpace,
|
34
|
+
DataSpacePackageableElementExecutable,
|
35
|
+
type DataSpaceElement,
|
36
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
24
37
|
import { guaranteeType } from '@finos/legend-shared';
|
38
|
+
import { DataSpaceExecutionContextState } from './DataSpaceExecutionContextState.js';
|
25
39
|
|
26
40
|
export class DataSpaceEditorState extends ElementEditorState {
|
41
|
+
executionContextState: DataSpaceExecutionContextState;
|
42
|
+
|
27
43
|
constructor(editorStore: EditorStore, element: PackageableElement) {
|
28
44
|
super(editorStore, element);
|
29
45
|
|
30
46
|
makeObservable(this, {
|
47
|
+
executionContextState: observable,
|
31
48
|
dataSpace: computed,
|
32
49
|
reprocess: action,
|
50
|
+
isValidDataSpaceElement: action,
|
51
|
+
getDataSpaceElementOptions: action,
|
52
|
+
getDiagramOptions: action,
|
53
|
+
getDataSpaceExecutableOptions: action,
|
33
54
|
});
|
55
|
+
|
56
|
+
this.executionContextState = new DataSpaceExecutionContextState(this);
|
57
|
+
}
|
58
|
+
|
59
|
+
isValidDataSpaceElement(
|
60
|
+
element: PackageableElement,
|
61
|
+
): element is DataSpaceElement {
|
62
|
+
return (
|
63
|
+
element instanceof Package ||
|
64
|
+
element instanceof Class ||
|
65
|
+
element instanceof Enumeration ||
|
66
|
+
element instanceof Association
|
67
|
+
);
|
68
|
+
}
|
69
|
+
|
70
|
+
getDataSpaceElementOptions(): { label: string; value: DataSpaceElement }[] {
|
71
|
+
const currentElements =
|
72
|
+
this.dataSpace.elements?.map(
|
73
|
+
(elementPointer) => elementPointer.element.value,
|
74
|
+
) ?? [];
|
75
|
+
return this.editorStore.graphManagerState.graph.allOwnElements
|
76
|
+
.filter((element) => this.isValidDataSpaceElement(element))
|
77
|
+
.filter((element) => !currentElements.includes(element))
|
78
|
+
.map((element) => ({
|
79
|
+
label: element.path,
|
80
|
+
value: element,
|
81
|
+
}));
|
82
|
+
}
|
83
|
+
|
84
|
+
getDataSpaceExecutableOptions(): {
|
85
|
+
label: string;
|
86
|
+
value: PackageableElement;
|
87
|
+
}[] {
|
88
|
+
const currentExecutables =
|
89
|
+
this.dataSpace.executables?.map((executablePointer) => {
|
90
|
+
if (
|
91
|
+
executablePointer instanceof DataSpacePackageableElementExecutable
|
92
|
+
) {
|
93
|
+
return executablePointer.executable.value;
|
94
|
+
}
|
95
|
+
return undefined;
|
96
|
+
}) ?? [];
|
97
|
+
return this.editorStore.graphManagerState.graph.allOwnElements
|
98
|
+
.filter(
|
99
|
+
(element) =>
|
100
|
+
element instanceof Service ||
|
101
|
+
element instanceof ConcreteFunctionDefinition,
|
102
|
+
)
|
103
|
+
.filter((executable) => !currentExecutables.includes(executable))
|
104
|
+
.map((executable) => ({
|
105
|
+
label: executable.path,
|
106
|
+
value: executable,
|
107
|
+
}));
|
108
|
+
}
|
109
|
+
|
110
|
+
getDiagramOptions(): { label: string; value: Diagram }[] {
|
111
|
+
const currentDiagrams =
|
112
|
+
this.dataSpace.diagrams?.map(
|
113
|
+
(diagramPointer) => diagramPointer.diagram.value,
|
114
|
+
) ?? [];
|
115
|
+
return this.editorStore.graphManagerState.graph.allOwnElements
|
116
|
+
.filter((element): element is Diagram => element instanceof Diagram)
|
117
|
+
.filter((diagram) => !currentDiagrams.includes(diagram))
|
118
|
+
.map((diagram) => ({
|
119
|
+
label: diagram.path,
|
120
|
+
value: diagram,
|
121
|
+
}));
|
34
122
|
}
|
35
123
|
|
36
124
|
get dataSpace(): DataSpace {
|
37
125
|
return guaranteeType(
|
38
126
|
this.element,
|
39
127
|
DataSpace,
|
40
|
-
'Element inside
|
128
|
+
'Element inside DataSpace editor state must be a DataSpace element',
|
41
129
|
);
|
42
130
|
}
|
43
131
|
|