@finos/legend-extension-dsl-data-space-studio 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.d.ts +17 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.d.ts.map +1 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.js +54 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.js.map +1 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.d.ts +21 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.d.ts.map +1 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.js +22 -0
- package/lib/__lib__/DSL_DataSpace_LegendStudioDocumentation.js.map +1 -0
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +39 -0
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -0
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.js +206 -0
- package/lib/components/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -0
- package/lib/components/DataSpacePreviewAction.d.ts +25 -0
- package/lib/components/DataSpacePreviewAction.d.ts.map +1 -0
- package/lib/components/DataSpacePreviewAction.js +53 -0
- package/lib/components/DataSpacePreviewAction.js.map +1 -0
- package/lib/components/DataSpaceQueryAction.d.ts +24 -0
- package/lib/components/DataSpaceQueryAction.d.ts.map +1 -0
- package/lib/components/DataSpaceQueryAction.js +52 -0
- package/lib/components/DataSpaceQueryAction.js.map +1 -0
- package/lib/components/DataSpaceTemplateQueryPromoteReview.d.ts +19 -0
- package/lib/components/DataSpaceTemplateQueryPromoteReview.d.ts.map +1 -0
- package/lib/components/DataSpaceTemplateQueryPromoteReview.js +81 -0
- package/lib/components/DataSpaceTemplateQueryPromoteReview.js.map +1 -0
- package/lib/index.css +17 -0
- package/lib/index.css.map +1 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +17 -0
- package/lib/index.js.map +1 -0
- package/lib/package.json +75 -0
- package/lib/stores/DataSpacePreviewState.d.ts +33 -0
- package/lib/stores/DataSpacePreviewState.d.ts.map +1 -0
- package/lib/stores/DataSpacePreviewState.js +116 -0
- package/lib/stores/DataSpacePreviewState.js.map +1 -0
- package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +61 -0
- package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +1 -0
- package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.js +406 -0
- package/lib/stores/DataSpaceTemplateQueryPromotionReviewerStore.js.map +1 -0
- package/package.json +75 -0
- package/src/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.ts +54 -0
- package/src/__lib__/DSL_DataSpace_LegendStudioDocumentation.ts +21 -0
- package/src/components/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +299 -0
- package/src/components/DataSpacePreviewAction.tsx +136 -0
- package/src/components/DataSpaceQueryAction.tsx +100 -0
- package/src/components/DataSpaceTemplateQueryPromoteReview.tsx +292 -0
- package/src/index.ts +17 -0
- package/src/stores/DataSpacePreviewState.ts +199 -0
- package/src/stores/DataSpaceTemplateQueryPromotionReviewerStore.ts +636 -0
- package/tsconfig.json +54 -0
- package/tsconfig.package.json +37 -0
@@ -0,0 +1,292 @@
|
|
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 { BlankPanelContent, GitBranchIcon, clsx } from '@finos/legend-art';
|
18
|
+
import { observer, useLocalObservable } from 'mobx-react-lite';
|
19
|
+
import { useApplicationStore } from '@finos/legend-application';
|
20
|
+
import { useParams } from '@finos/legend-application/browser';
|
21
|
+
import {
|
22
|
+
ActivityBarMenu,
|
23
|
+
LEGEND_STUDIO_TEST_ID,
|
24
|
+
useLegendStudioApplicationStore,
|
25
|
+
useLegendStudioBaseStore,
|
26
|
+
} from '@finos/legend-application-studio';
|
27
|
+
import { createContext, useContext } from 'react';
|
28
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
29
|
+
import { flowResult } from 'mobx';
|
30
|
+
import { DocumentationLink } from '@finos/legend-lego/application';
|
31
|
+
import {
|
32
|
+
DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN,
|
33
|
+
type DataSpaceTemplateQueryPromotionReviewerPathParams,
|
34
|
+
} from '@finos/legend-extension-dsl-data-space/application';
|
35
|
+
import { DSL_DATA_SPACE_LEGEND_STUDIO_DOCUMENTATION_KEY } from '../__lib__/DSL_DataSpace_LegendStudioDocumentation.js';
|
36
|
+
import { DataSpaceTemplateQueryPromotionReviewerStore } from '../stores/DataSpaceTemplateQueryPromotionReviewerStore.js';
|
37
|
+
|
38
|
+
const TemplateQueryPromotionReviewerStoreContext = createContext<
|
39
|
+
DataSpaceTemplateQueryPromotionReviewerStore | undefined
|
40
|
+
>(undefined);
|
41
|
+
|
42
|
+
const DataSpaceTemplateQueryPromotionReviewerStoreProvider: React.FC<{
|
43
|
+
children: React.ReactNode;
|
44
|
+
dataSpacePath: string;
|
45
|
+
queryId: string;
|
46
|
+
}> = ({ children, dataSpacePath, queryId }) => {
|
47
|
+
const applicationStore = useLegendStudioApplicationStore();
|
48
|
+
const baseStore = useLegendStudioBaseStore();
|
49
|
+
const store = useLocalObservable(
|
50
|
+
() =>
|
51
|
+
new DataSpaceTemplateQueryPromotionReviewerStore(
|
52
|
+
applicationStore,
|
53
|
+
baseStore.sdlcServerClient,
|
54
|
+
baseStore.depotServerClient,
|
55
|
+
),
|
56
|
+
);
|
57
|
+
store.initialize(queryId, dataSpacePath);
|
58
|
+
return (
|
59
|
+
<TemplateQueryPromotionReviewerStoreContext.Provider value={store}>
|
60
|
+
{children}
|
61
|
+
</TemplateQueryPromotionReviewerStoreContext.Provider>
|
62
|
+
);
|
63
|
+
};
|
64
|
+
|
65
|
+
const useTemplateQueryPromotionReviewerStore =
|
66
|
+
(): DataSpaceTemplateQueryPromotionReviewerStore =>
|
67
|
+
guaranteeNonNullable(
|
68
|
+
useContext(TemplateQueryPromotionReviewerStoreContext),
|
69
|
+
`Can't find query productionizer store in context`,
|
70
|
+
);
|
71
|
+
|
72
|
+
const TemplateQueryPromotionReviewerContent = observer(() => {
|
73
|
+
const applicationStore = useApplicationStore();
|
74
|
+
const queryPromotionReviewerStore = useTemplateQueryPromotionReviewerStore();
|
75
|
+
const isLoadingEditor = !queryPromotionReviewerStore.initState.hasCompleted;
|
76
|
+
|
77
|
+
// workspace name
|
78
|
+
const changeWorkspaceName: React.ChangeEventHandler<HTMLInputElement> = (
|
79
|
+
event,
|
80
|
+
) => queryPromotionReviewerStore.setWorkspaceName(event.target.value);
|
81
|
+
|
82
|
+
// template query
|
83
|
+
const onChangeTemplateQueryId: React.ChangeEventHandler<HTMLInputElement> = (
|
84
|
+
event,
|
85
|
+
) => queryPromotionReviewerStore.setTemplateQueryId(event.target.value);
|
86
|
+
|
87
|
+
const onChangeTemplateQueryTitle: React.ChangeEventHandler<
|
88
|
+
HTMLInputElement
|
89
|
+
> = (event) =>
|
90
|
+
queryPromotionReviewerStore.setTemplateQueryTitle(event.target.value);
|
91
|
+
|
92
|
+
const onChangeTemplateQueryDescription: React.ChangeEventHandler<
|
93
|
+
HTMLInputElement
|
94
|
+
> = (event) =>
|
95
|
+
queryPromotionReviewerStore.setTemplateQueryDescription(event.target.value);
|
96
|
+
|
97
|
+
// actions
|
98
|
+
const promoteTemplateQuery = (): void => {
|
99
|
+
flowResult(queryPromotionReviewerStore.promoteAsTemplateQuery()).catch(
|
100
|
+
applicationStore.alertUnhandledError,
|
101
|
+
);
|
102
|
+
};
|
103
|
+
|
104
|
+
return (
|
105
|
+
<div className="app__page">
|
106
|
+
{isLoadingEditor && (
|
107
|
+
<BlankPanelContent>
|
108
|
+
{queryPromotionReviewerStore.initState.message ??
|
109
|
+
queryPromotionReviewerStore.graphManagerState.systemBuildState
|
110
|
+
.message ??
|
111
|
+
queryPromotionReviewerStore.graphManagerState.dependenciesBuildState
|
112
|
+
.message ??
|
113
|
+
queryPromotionReviewerStore.graphManagerState.generationsBuildState
|
114
|
+
.message ??
|
115
|
+
queryPromotionReviewerStore.graphManagerState.graphBuildState
|
116
|
+
.message}
|
117
|
+
</BlankPanelContent>
|
118
|
+
)}
|
119
|
+
<div className="template-query-promotor">
|
120
|
+
<div className="template-query-promotor__body">
|
121
|
+
<div className="activity-bar">
|
122
|
+
<ActivityBarMenu />
|
123
|
+
</div>
|
124
|
+
<div
|
125
|
+
className="template-query-promotor__content"
|
126
|
+
data-testid={LEGEND_STUDIO_TEST_ID.SETUP__CONTENT}
|
127
|
+
>
|
128
|
+
<div className="template-query-promotor__content__main">
|
129
|
+
<div className="template-query-promotor__title">
|
130
|
+
Promote as Curated Template Query
|
131
|
+
<DocumentationLink
|
132
|
+
documentationKey={
|
133
|
+
DSL_DATA_SPACE_LEGEND_STUDIO_DOCUMENTATION_KEY.CURATED_TEMPLATE_QUERY
|
134
|
+
}
|
135
|
+
/>
|
136
|
+
</div>
|
137
|
+
<div className="template-query-promotor__title__prompt">
|
138
|
+
We will promote this query as a curated template query in
|
139
|
+
dataspace. This automated process will generate a code review
|
140
|
+
and workspace. Please get the generated code review reviewed and
|
141
|
+
approved.
|
142
|
+
</div>
|
143
|
+
<div className="template-query-promotor__group template-query-promotor__group--workspace">
|
144
|
+
<div className="template-query-promotor__group__header">
|
145
|
+
workspace
|
146
|
+
</div>
|
147
|
+
<div className="template-query-promotor__group__content">
|
148
|
+
<div className="template-query-promotor__input">
|
149
|
+
<div
|
150
|
+
className="template-query-promotor__input__icon"
|
151
|
+
title="workspace"
|
152
|
+
>
|
153
|
+
<GitBranchIcon className="template-query-promotor__input__icon--workspce" />
|
154
|
+
</div>
|
155
|
+
<div className="input-group template-query-promotor__input__input">
|
156
|
+
<input
|
157
|
+
className={clsx(
|
158
|
+
'input input--dark input-group__input',
|
159
|
+
{
|
160
|
+
'input-group__input--error':
|
161
|
+
!queryPromotionReviewerStore.isWorkspaceNameValid,
|
162
|
+
},
|
163
|
+
)}
|
164
|
+
spellCheck={false}
|
165
|
+
value={queryPromotionReviewerStore.workspaceName}
|
166
|
+
placeholder="Enter a name for your workspace"
|
167
|
+
onChange={changeWorkspaceName}
|
168
|
+
/>
|
169
|
+
{!queryPromotionReviewerStore.isWorkspaceNameValid && (
|
170
|
+
<div className="input-group__error-message">
|
171
|
+
Workspace already existed
|
172
|
+
</div>
|
173
|
+
)}
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
<div className="template-query-promotor__group template-query-promotor__group--template">
|
179
|
+
<div className="template-query-promotor__group__header">
|
180
|
+
template query
|
181
|
+
</div>
|
182
|
+
<div className="template-query-promotor__group__content">
|
183
|
+
<div className="template-query-promotor__input">
|
184
|
+
<div className="template-query-promotor__input__label">
|
185
|
+
id
|
186
|
+
</div>
|
187
|
+
<div className="input-group template-query-promotor__input__input">
|
188
|
+
<input
|
189
|
+
className={clsx(
|
190
|
+
'input input--dark input-group__input',
|
191
|
+
{
|
192
|
+
'input-group__input--error':
|
193
|
+
!queryPromotionReviewerStore.isTemplateQueryIdValid,
|
194
|
+
},
|
195
|
+
)}
|
196
|
+
spellCheck={false}
|
197
|
+
placeholder="Create an id for your template query"
|
198
|
+
value={queryPromotionReviewerStore.templateQueryId}
|
199
|
+
onChange={onChangeTemplateQueryId}
|
200
|
+
/>
|
201
|
+
{!queryPromotionReviewerStore.isTemplateQueryIdValid && (
|
202
|
+
<div className="input-group__error-message">
|
203
|
+
Invalid template query id
|
204
|
+
</div>
|
205
|
+
)}
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
<div className="template-query-promotor__input">
|
209
|
+
<div className="template-query-promotor__input__label">
|
210
|
+
title
|
211
|
+
</div>
|
212
|
+
<div className="input-group template-query-promotor__input__input">
|
213
|
+
<input
|
214
|
+
className="input input--dark input-group__input"
|
215
|
+
spellCheck={false}
|
216
|
+
placeholder="Create a title for your template query"
|
217
|
+
value={queryPromotionReviewerStore.templateQueryTitle}
|
218
|
+
onChange={onChangeTemplateQueryTitle}
|
219
|
+
/>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
<div className="template-query-promotor__input">
|
223
|
+
<div className="template-query-promotor__input__label">
|
224
|
+
description
|
225
|
+
</div>
|
226
|
+
<div className="input-group template-query-promotor__input__input">
|
227
|
+
<input
|
228
|
+
className="input input--dark input-group__input"
|
229
|
+
spellCheck={false}
|
230
|
+
placeholder="Add some descriptions for your template query"
|
231
|
+
value={
|
232
|
+
queryPromotionReviewerStore.templateQueryDescription
|
233
|
+
}
|
234
|
+
onChange={onChangeTemplateQueryDescription}
|
235
|
+
/>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
<div className="template-query-promotor__actions">
|
241
|
+
<button
|
242
|
+
className="template-query-promotor__next-btn btn--dark"
|
243
|
+
onClick={promoteTemplateQuery}
|
244
|
+
disabled={
|
245
|
+
queryPromotionReviewerStore.promoteState.isInProgress ||
|
246
|
+
!queryPromotionReviewerStore.currentQuery ||
|
247
|
+
!queryPromotionReviewerStore.currentQueryInfo ||
|
248
|
+
!queryPromotionReviewerStore.currentProject ||
|
249
|
+
!queryPromotionReviewerStore
|
250
|
+
.currentProjectConfigurationStatus?.isConfigured ||
|
251
|
+
!queryPromotionReviewerStore.workspaceName ||
|
252
|
+
!queryPromotionReviewerStore.templateQueryTitle ||
|
253
|
+
!queryPromotionReviewerStore.isWorkspaceNameValid ||
|
254
|
+
!queryPromotionReviewerStore.isTemplateQueryIdValid
|
255
|
+
}
|
256
|
+
>
|
257
|
+
Promote Query
|
258
|
+
</button>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
<div
|
264
|
+
data-testid={LEGEND_STUDIO_TEST_ID.STATUS_BAR}
|
265
|
+
className="editor__status-bar"
|
266
|
+
/>
|
267
|
+
</div>
|
268
|
+
</div>
|
269
|
+
);
|
270
|
+
});
|
271
|
+
|
272
|
+
export const DataSpaceTemplateQueryPromotionReviewer = observer(() => {
|
273
|
+
const parameters =
|
274
|
+
useParams<DataSpaceTemplateQueryPromotionReviewerPathParams>();
|
275
|
+
const dataSpacePath =
|
276
|
+
parameters[
|
277
|
+
DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
|
278
|
+
];
|
279
|
+
const queryId =
|
280
|
+
parameters[
|
281
|
+
DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN.QUERY_ID
|
282
|
+
];
|
283
|
+
|
284
|
+
return (
|
285
|
+
<DataSpaceTemplateQueryPromotionReviewerStoreProvider
|
286
|
+
dataSpacePath={dataSpacePath}
|
287
|
+
queryId={queryId}
|
288
|
+
>
|
289
|
+
<TemplateQueryPromotionReviewerContent />
|
290
|
+
</DataSpaceTemplateQueryPromotionReviewerStoreProvider>
|
291
|
+
);
|
292
|
+
});
|
package/src/index.ts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
export { DSL_DataSpace_LegendStudioApplicationPlugin } from './components/DSL_DataSpace_LegendStudioApplicationPlugin.js';
|
@@ -0,0 +1,199 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import {
|
18
|
+
EditorExtensionState,
|
19
|
+
queryClass,
|
20
|
+
type EditorStore,
|
21
|
+
} from '@finos/legend-application-studio';
|
22
|
+
import {
|
23
|
+
DataSpaceViewerState,
|
24
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateServiceQueryCreatorUrl,
|
25
|
+
} from '@finos/legend-extension-dsl-data-space/application';
|
26
|
+
import {
|
27
|
+
DSL_DataSpace_getGraphManagerExtension,
|
28
|
+
type DataSpaceAnalysisResult,
|
29
|
+
type DataSpace,
|
30
|
+
} from '@finos/legend-extension-dsl-data-space/graph';
|
31
|
+
import { InMemoryGraphData, type Class } from '@finos/legend-graph';
|
32
|
+
import {
|
33
|
+
type GeneratorFn,
|
34
|
+
guaranteeNonNullable,
|
35
|
+
ActionState,
|
36
|
+
assertErrorThrown,
|
37
|
+
} from '@finos/legend-shared';
|
38
|
+
import { action, flow, makeObservable, observable } from 'mobx';
|
39
|
+
|
40
|
+
export class DataSpacePreviewState extends EditorExtensionState {
|
41
|
+
private static readonly IDENTIFIER = 'data-space-preview';
|
42
|
+
|
43
|
+
readonly editorStore: EditorStore;
|
44
|
+
readonly loadDataSpaceState = ActionState.create();
|
45
|
+
|
46
|
+
dataSpace?: DataSpace | undefined;
|
47
|
+
dataSpaceViewerState?: DataSpaceViewerState | undefined;
|
48
|
+
|
49
|
+
constructor(editorStore: EditorStore) {
|
50
|
+
super();
|
51
|
+
|
52
|
+
makeObservable(this, {
|
53
|
+
dataSpace: observable,
|
54
|
+
dataSpaceViewerState: observable,
|
55
|
+
setDataSpace: action,
|
56
|
+
previewDataSpace: flow,
|
57
|
+
});
|
58
|
+
|
59
|
+
this.editorStore = editorStore;
|
60
|
+
}
|
61
|
+
|
62
|
+
override get INTERNAL__identifierKey(): string {
|
63
|
+
return DataSpacePreviewState.IDENTIFIER;
|
64
|
+
}
|
65
|
+
|
66
|
+
static retrieveNullableState(
|
67
|
+
editorStore: EditorStore,
|
68
|
+
): DataSpacePreviewState | undefined {
|
69
|
+
return editorStore.extensionStates.find((extensionState) => {
|
70
|
+
if (
|
71
|
+
/**
|
72
|
+
* In development mode, when we make changes in certain areas like utils or base states, the following `instanceof`
|
73
|
+
* check will fail as if there were multiple copies of the classes with the same name, this could be caused by either
|
74
|
+
* React `fast-refresh` or `webpack HMR`; we didn't have time to really do a thorough debug here, as such,
|
75
|
+
* we will just do a simple key check to match the right state to bypass the problem for development mode.
|
76
|
+
*/
|
77
|
+
// eslint-disable-next-line no-process-env
|
78
|
+
process.env.NODE_ENV === 'development'
|
79
|
+
) {
|
80
|
+
return (
|
81
|
+
extensionState.INTERNAL__identifierKey ===
|
82
|
+
DataSpacePreviewState.IDENTIFIER
|
83
|
+
);
|
84
|
+
}
|
85
|
+
return extensionState instanceof DataSpacePreviewState;
|
86
|
+
}) as DataSpacePreviewState;
|
87
|
+
}
|
88
|
+
|
89
|
+
static retrieveState(editorStore: EditorStore): DataSpacePreviewState {
|
90
|
+
return guaranteeNonNullable(
|
91
|
+
DataSpacePreviewState.retrieveNullableState(editorStore),
|
92
|
+
`Can't find data space preview state: make sure it is added as an editor extension state`,
|
93
|
+
);
|
94
|
+
}
|
95
|
+
|
96
|
+
setDataSpace(val: DataSpace | undefined): void {
|
97
|
+
this.dataSpace = val;
|
98
|
+
if (val === undefined) {
|
99
|
+
this.dataSpaceViewerState = undefined;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
*previewDataSpace(dataSpace: DataSpace): GeneratorFn<void> {
|
104
|
+
this.setDataSpace(dataSpace);
|
105
|
+
this.loadDataSpaceState.inProgress();
|
106
|
+
this.loadDataSpaceState.setMessage(`Initializing...`);
|
107
|
+
|
108
|
+
try {
|
109
|
+
const groupId =
|
110
|
+
this.editorStore.projectConfigurationEditorState
|
111
|
+
.currentProjectConfiguration.groupId;
|
112
|
+
const artifactId =
|
113
|
+
this.editorStore.projectConfigurationEditorState
|
114
|
+
.currentProjectConfiguration.artifactId;
|
115
|
+
const versionId = 'LOCAL';
|
116
|
+
|
117
|
+
// analyze data space
|
118
|
+
const analysisResult = (yield DSL_DataSpace_getGraphManagerExtension(
|
119
|
+
this.editorStore.graphManagerState.graphManager,
|
120
|
+
).analyzeDataSpace(
|
121
|
+
dataSpace.path,
|
122
|
+
async () =>
|
123
|
+
this.editorStore.graphManagerState.graph.allOwnElements
|
124
|
+
.map((element) =>
|
125
|
+
this.editorStore.graphManagerState.graphManager.elementToEntity(
|
126
|
+
element,
|
127
|
+
),
|
128
|
+
)
|
129
|
+
.concat(
|
130
|
+
this.editorStore.graphManagerState.graph.dependencyManager.allOwnElements.map(
|
131
|
+
(element) =>
|
132
|
+
this.editorStore.graphManagerState.graphManager.elementToEntity(
|
133
|
+
element,
|
134
|
+
),
|
135
|
+
),
|
136
|
+
),
|
137
|
+
undefined,
|
138
|
+
this.loadDataSpaceState,
|
139
|
+
)) as DataSpaceAnalysisResult;
|
140
|
+
|
141
|
+
this.dataSpaceViewerState = new DataSpaceViewerState(
|
142
|
+
this.editorStore.applicationStore,
|
143
|
+
this.editorStore.graphManagerState,
|
144
|
+
groupId,
|
145
|
+
artifactId,
|
146
|
+
versionId,
|
147
|
+
analysisResult,
|
148
|
+
{
|
149
|
+
retrieveGraphData: () =>
|
150
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
151
|
+
queryDataSpace: () => {
|
152
|
+
this.editorStore.applicationStore.notificationService.notifyWarning(
|
153
|
+
'This feature is not supported in preview mode',
|
154
|
+
);
|
155
|
+
},
|
156
|
+
viewProject: () => {
|
157
|
+
this.editorStore.applicationStore.notificationService.notifyWarning(
|
158
|
+
'This feature is not supported in preview mode',
|
159
|
+
);
|
160
|
+
},
|
161
|
+
viewSDLCProject: async () => {
|
162
|
+
this.editorStore.applicationStore.notificationService.notifyWarning(
|
163
|
+
'This feature is not supported in preview mode',
|
164
|
+
);
|
165
|
+
},
|
166
|
+
queryClass: (_class: Class): void => {
|
167
|
+
queryClass(_class, this.editorStore).catch(
|
168
|
+
this.editorStore.applicationStore.alertUnhandledError,
|
169
|
+
);
|
170
|
+
},
|
171
|
+
openServiceQuery: (servicePath: string): void => {
|
172
|
+
if (this.editorStore.applicationStore.config.queryApplicationUrl) {
|
173
|
+
this.editorStore.applicationStore.navigationService.navigator.visitAddress(
|
174
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateServiceQueryCreatorUrl(
|
175
|
+
this.editorStore.applicationStore.config.queryApplicationUrl,
|
176
|
+
groupId,
|
177
|
+
artifactId,
|
178
|
+
versionId,
|
179
|
+
servicePath,
|
180
|
+
),
|
181
|
+
);
|
182
|
+
} else {
|
183
|
+
this.editorStore.applicationStore.notificationService.notifyWarning(
|
184
|
+
'Query application URL is not configured',
|
185
|
+
);
|
186
|
+
}
|
187
|
+
},
|
188
|
+
},
|
189
|
+
);
|
190
|
+
this.loadDataSpaceState.pass();
|
191
|
+
} catch (error) {
|
192
|
+
assertErrorThrown(error);
|
193
|
+
this.loadDataSpaceState.fail();
|
194
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
195
|
+
} finally {
|
196
|
+
this.loadDataSpaceState.setMessage(undefined);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|