@finos/legend-extension-dsl-data-space 10.2.4 → 10.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/{components → __lib__}/query/DSL_DataSpace_LegendQueryDocumentation.d.ts +1 -1
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryDocumentation.d.ts.map +1 -0
- package/lib/{components → __lib__}/query/DSL_DataSpace_LegendQueryDocumentation.js +4 -4
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryDocumentation.js.map +1 -0
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts +0 -12
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js +0 -12
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js.map +1 -1
- package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.d.ts +15 -0
- package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.d.ts.map +1 -0
- package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.js +32 -0
- package/lib/__lib__/shared/DSL_DataSpace_LegendNavigation.js.map +1 -0
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +1 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
- package/lib/components/index.d.ts +4 -2
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +4 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +3 -2
- package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/query/DataSpaceQueryBuilder.d.ts +2 -5
- package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/query/DataSpaceQueryBuilder.js +5 -24
- package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -1
- package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts +1 -1
- package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +1 -1
- package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js +2 -2
- package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
- package/lib/components/query/DataSpaceQuerySetup.js +1 -1
- package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/shared/DSL_DataSpace_Icon.d.ts.map +1 -0
- package/lib/components/shared/DSL_DataSpace_Icon.js.map +1 -0
- package/lib/graph-manager/index.d.ts +3 -0
- package/lib/graph-manager/index.d.ts.map +1 -1
- package/lib/graph-manager/index.js +4 -0
- package/lib/graph-manager/index.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -4
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.js +1 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.js +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.js.map +1 -1
- package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +1 -1
- package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/{query → query-builder}/DataSpaceQueryBuilderState.d.ts +2 -2
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/{query → query-builder}/DataSpaceQueryBuilderState.js +2 -2
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -0
- package/lib/stores/shared/DataSpaceInfo.d.ts.map +1 -0
- package/lib/stores/shared/DataSpaceInfo.js.map +1 -0
- package/package.json +1 -4
- package/src/{components → __lib__}/query/DSL_DataSpace_LegendQueryDocumentation.ts +1 -1
- package/src/__lib__/query/DSL_DataSpace_LegendQueryNavigation.ts +0 -34
- package/src/__lib__/shared/DSL_DataSpace_LegendNavigation.ts +57 -0
- package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +1 -1
- package/src/components/index.ts +6 -2
- package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +3 -3
- package/src/components/query/DataSpaceAdvancedSearchModal.tsx +1 -1
- package/src/components/query/DataSpaceQueryBuilder.tsx +7 -68
- package/src/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +3 -3
- package/src/components/query/DataSpaceQuerySetup.tsx +1 -1
- package/src/graph-manager/index.ts +5 -0
- package/src/stores/query/DataSpaceAdvancedSearchState.ts +4 -1
- package/src/stores/query/DataSpaceQueryCreatorStore.ts +2 -2
- package/src/stores/query/DataSpaceQuerySetupStore.ts +4 -1
- package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +2 -2
- package/src/stores/{query → query-builder}/DataSpaceQueryBuilderState.ts +5 -2
- package/tsconfig.json +5 -13
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.d.ts +0 -17
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.js +0 -54
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.js.map +0 -1
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.d.ts +0 -20
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.js +0 -21
- package/lib/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.js.map +0 -1
- package/lib/components/DSL_DataSpace_Icon.d.ts.map +0 -1
- package/lib/components/DSL_DataSpace_Icon.js.map +0 -1
- package/lib/components/query/DSL_DataSpace_LegendQueryDocumentation.d.ts.map +0 -1
- package/lib/components/query/DSL_DataSpace_LegendQueryDocumentation.js.map +0 -1
- package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +0 -39
- package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +0 -1
- package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js +0 -207
- package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +0 -1
- package/lib/components/studio/DataSpacePreviewAction.d.ts +0 -25
- package/lib/components/studio/DataSpacePreviewAction.d.ts.map +0 -1
- package/lib/components/studio/DataSpacePreviewAction.js +0 -53
- package/lib/components/studio/DataSpacePreviewAction.js.map +0 -1
- package/lib/components/studio/DataSpaceQueryAction.d.ts +0 -22
- package/lib/components/studio/DataSpaceQueryAction.d.ts.map +0 -1
- package/lib/components/studio/DataSpaceQueryAction.js +0 -29
- package/lib/components/studio/DataSpaceQueryAction.js.map +0 -1
- package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts +0 -19
- package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts.map +0 -1
- package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js +0 -81
- package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js.map +0 -1
- package/lib/components/studio/index.d.ts +0 -17
- package/lib/components/studio/index.d.ts.map +0 -1
- package/lib/components/studio/index.js +0 -17
- package/lib/components/studio/index.js.map +0 -1
- package/lib/stores/query/DataSpaceInfo.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceInfo.js.map +0 -1
- package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceQueryBuilderState.js.map +0 -1
- package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +0 -61
- package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js +0 -407
- package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js.map +0 -1
- package/lib/stores/studio/DataSpacePreviewState.d.ts +0 -33
- package/lib/stores/studio/DataSpacePreviewState.d.ts.map +0 -1
- package/lib/stores/studio/DataSpacePreviewState.js +0 -117
- package/lib/stores/studio/DataSpacePreviewState.js.map +0 -1
- package/src/__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.ts +0 -54
- package/src/__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.ts +0 -20
- package/src/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +0 -297
- package/src/components/studio/DataSpacePreviewAction.tsx +0 -136
- package/src/components/studio/DataSpaceQueryAction.tsx +0 -34
- package/src/components/studio/DataSpaceTemplateQueryPromoteReview.tsx +0 -292
- package/src/components/studio/index.ts +0 -17
- package/src/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.ts +0 -636
- package/src/stores/studio/DataSpacePreviewState.ts +0 -195
- /package/lib/components/{DSL_DataSpace_Icon.d.ts → shared/DSL_DataSpace_Icon.d.ts} +0 -0
- /package/lib/components/{DSL_DataSpace_Icon.js → shared/DSL_DataSpace_Icon.js} +0 -0
- /package/lib/stores/{query → shared}/DataSpaceInfo.d.ts +0 -0
- /package/lib/stores/{query → shared}/DataSpaceInfo.js +0 -0
- /package/src/components/{DSL_DataSpace_Icon.tsx → shared/DSL_DataSpace_Icon.tsx} +0 -0
- /package/src/stores/{query → shared}/DataSpaceInfo.ts +0 -0
@@ -1,636 +0,0 @@
|
|
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 LightQuery,
|
19
|
-
type QueryInfo,
|
20
|
-
type RawLambda,
|
21
|
-
GraphManagerState,
|
22
|
-
} from '@finos/legend-graph';
|
23
|
-
import {
|
24
|
-
type DepotServerClient,
|
25
|
-
StoreProjectData,
|
26
|
-
ProjectDependencyCoordinates,
|
27
|
-
ProjectVersionEntities,
|
28
|
-
} from '@finos/legend-server-depot';
|
29
|
-
import {
|
30
|
-
ActionState,
|
31
|
-
assertErrorThrown,
|
32
|
-
guaranteeNonNullable,
|
33
|
-
LogEvent,
|
34
|
-
type GeneratorFn,
|
35
|
-
type PlainObject,
|
36
|
-
} from '@finos/legend-shared';
|
37
|
-
import {
|
38
|
-
generateDataSpaceQuerySetupRoute,
|
39
|
-
generateDataSpaceTemplateQueryPromotionRoute,
|
40
|
-
} from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
|
41
|
-
import { type Entity } from '@finos/legend-storage';
|
42
|
-
import {
|
43
|
-
type ProjectConfigurationStatus,
|
44
|
-
fetchProjectConfigurationStatus,
|
45
|
-
generateEditorRoute,
|
46
|
-
LEGEND_STUDIO_APP_EVENT,
|
47
|
-
type LegendStudioApplicationStore,
|
48
|
-
EditorStore,
|
49
|
-
generateReviewRoute,
|
50
|
-
} from '@finos/legend-application-studio';
|
51
|
-
import {
|
52
|
-
DEFAULT_TAB_SIZE,
|
53
|
-
ActionAlertType,
|
54
|
-
ActionAlertActionType,
|
55
|
-
} from '@finos/legend-application';
|
56
|
-
import {
|
57
|
-
makeObservable,
|
58
|
-
observable,
|
59
|
-
computed,
|
60
|
-
action,
|
61
|
-
flow,
|
62
|
-
flowResult,
|
63
|
-
} from 'mobx';
|
64
|
-
import {
|
65
|
-
type SDLCServerClient,
|
66
|
-
type ProjectDependency,
|
67
|
-
Project,
|
68
|
-
WorkspaceType,
|
69
|
-
Workspace,
|
70
|
-
ProjectConfiguration,
|
71
|
-
EntityChangeType,
|
72
|
-
} from '@finos/legend-server-sdlc';
|
73
|
-
import {
|
74
|
-
type DSL_DataSpace_PureGraphManagerExtension,
|
75
|
-
DSL_DataSpace_getGraphManagerExtension,
|
76
|
-
} from '../../graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js';
|
77
|
-
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
|
78
|
-
|
79
|
-
const projectDependencyToProjectCoordinates = (
|
80
|
-
projectDependency: ProjectDependency,
|
81
|
-
): ProjectDependencyCoordinates =>
|
82
|
-
new ProjectDependencyCoordinates(
|
83
|
-
guaranteeNonNullable(projectDependency.groupId),
|
84
|
-
guaranteeNonNullable(projectDependency.artifactId),
|
85
|
-
projectDependency.versionId,
|
86
|
-
);
|
87
|
-
|
88
|
-
const DEFAULT_WORKSPACE_NAME_PREFIX = 'promote-as-template-query';
|
89
|
-
|
90
|
-
export class DataSpaceTemplateQueryPromotionReviewerStore {
|
91
|
-
readonly applicationStore: LegendStudioApplicationStore;
|
92
|
-
readonly sdlcServerClient: SDLCServerClient;
|
93
|
-
readonly depotServerClient: DepotServerClient;
|
94
|
-
readonly graphManagerState: GraphManagerState;
|
95
|
-
readonly initState = ActionState.create();
|
96
|
-
readonly promoteState = ActionState.create();
|
97
|
-
readonly loadQueryState = ActionState.create();
|
98
|
-
readonly loadWorkspacesState = ActionState.create();
|
99
|
-
editorStore: EditorStore;
|
100
|
-
graphManagerExtension: DSL_DataSpace_PureGraphManagerExtension;
|
101
|
-
currentQuery?: LightQuery | undefined;
|
102
|
-
currentQueryInfo?: QueryInfo | undefined;
|
103
|
-
currentQueryProject?: StoreProjectData | undefined;
|
104
|
-
currentProject?: Project | undefined;
|
105
|
-
currentProjectConfiguration?: ProjectConfiguration;
|
106
|
-
currentProjectConfigurationStatus?: ProjectConfigurationStatus | undefined;
|
107
|
-
currentProjectEntities: Entity[] = [];
|
108
|
-
dependencyEntities: Entity[] = [];
|
109
|
-
groupWorkspaces: Workspace[] = [];
|
110
|
-
workspaceName = '';
|
111
|
-
dataSpacePath!: string;
|
112
|
-
dataSpaceEntity: Entity | undefined;
|
113
|
-
templateQueryId = 'template_id';
|
114
|
-
templateQueryTitle = 'template_title';
|
115
|
-
templateQueryDescription = '';
|
116
|
-
|
117
|
-
constructor(
|
118
|
-
applicationStore: LegendStudioApplicationStore,
|
119
|
-
sdlcServerClient: SDLCServerClient,
|
120
|
-
depotServerClient: DepotServerClient,
|
121
|
-
) {
|
122
|
-
makeObservable(this, {
|
123
|
-
editorStore: observable,
|
124
|
-
graphManagerExtension: observable,
|
125
|
-
currentQuery: observable,
|
126
|
-
currentQueryInfo: observable,
|
127
|
-
currentQueryProject: observable,
|
128
|
-
currentProject: observable,
|
129
|
-
currentProjectConfiguration: observable,
|
130
|
-
currentProjectConfigurationStatus: observable,
|
131
|
-
currentProjectEntities: observable,
|
132
|
-
dataSpaceEntity: observable,
|
133
|
-
groupWorkspaces: observable,
|
134
|
-
workspaceName: observable,
|
135
|
-
templateQueryId: observable,
|
136
|
-
templateQueryTitle: observable,
|
137
|
-
templateQueryDescription: observable,
|
138
|
-
isWorkspaceNameValid: computed,
|
139
|
-
isTemplateQueryIdValid: computed,
|
140
|
-
setWorkspaceName: action,
|
141
|
-
setTemplateQueryId: action,
|
142
|
-
setTemplateQueryTitle: action,
|
143
|
-
setTemplateQueryDescription: action,
|
144
|
-
initialize: flow,
|
145
|
-
loadQuery: flow,
|
146
|
-
loadProject: flow,
|
147
|
-
promoteAsTemplateQuery: flow,
|
148
|
-
});
|
149
|
-
|
150
|
-
this.applicationStore = applicationStore;
|
151
|
-
this.sdlcServerClient = sdlcServerClient;
|
152
|
-
this.depotServerClient = depotServerClient;
|
153
|
-
this.graphManagerState = new GraphManagerState(
|
154
|
-
applicationStore.pluginManager,
|
155
|
-
applicationStore.logService,
|
156
|
-
);
|
157
|
-
this.editorStore = new EditorStore(
|
158
|
-
applicationStore,
|
159
|
-
sdlcServerClient,
|
160
|
-
depotServerClient,
|
161
|
-
);
|
162
|
-
this.graphManagerExtension = DSL_DataSpace_getGraphManagerExtension(
|
163
|
-
this.editorStore.graphManagerState.graphManager,
|
164
|
-
);
|
165
|
-
}
|
166
|
-
|
167
|
-
setWorkspaceName(val: string): void {
|
168
|
-
this.workspaceName = val;
|
169
|
-
}
|
170
|
-
|
171
|
-
setTemplateQueryId(val: string): void {
|
172
|
-
this.templateQueryId = val;
|
173
|
-
}
|
174
|
-
|
175
|
-
setTemplateQueryTitle(val: string): void {
|
176
|
-
this.templateQueryTitle = val;
|
177
|
-
}
|
178
|
-
|
179
|
-
setTemplateQueryDescription(val: string): void {
|
180
|
-
this.templateQueryDescription = val;
|
181
|
-
}
|
182
|
-
|
183
|
-
get isWorkspaceNameValid(): boolean {
|
184
|
-
return !this.groupWorkspaces.some(
|
185
|
-
(ws) => ws.workspaceId === this.workspaceName,
|
186
|
-
);
|
187
|
-
}
|
188
|
-
|
189
|
-
get isTemplateQueryIdValid(): boolean {
|
190
|
-
if (this.dataSpaceEntity) {
|
191
|
-
return this.graphManagerExtension.IsTemplateQueryIdValid(
|
192
|
-
this.dataSpaceEntity,
|
193
|
-
this.templateQueryId,
|
194
|
-
);
|
195
|
-
}
|
196
|
-
return false;
|
197
|
-
}
|
198
|
-
|
199
|
-
*initialize(
|
200
|
-
queryId: string | undefined,
|
201
|
-
dataSpacePath: string,
|
202
|
-
): GeneratorFn<void> {
|
203
|
-
if (!this.initState.isInInitialState) {
|
204
|
-
return;
|
205
|
-
}
|
206
|
-
try {
|
207
|
-
this.initState.inProgress();
|
208
|
-
yield this.graphManagerState.graphManager.initialize(
|
209
|
-
{
|
210
|
-
env: this.applicationStore.config.env,
|
211
|
-
tabSize: DEFAULT_TAB_SIZE,
|
212
|
-
clientConfig: {
|
213
|
-
baseUrl: this.applicationStore.config.engineServerUrl,
|
214
|
-
queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
|
215
|
-
enableCompression: true,
|
216
|
-
},
|
217
|
-
},
|
218
|
-
{
|
219
|
-
tracerService: this.applicationStore.tracerService,
|
220
|
-
},
|
221
|
-
);
|
222
|
-
this.dataSpacePath = dataSpacePath;
|
223
|
-
if (queryId) {
|
224
|
-
let query: LightQuery | undefined;
|
225
|
-
try {
|
226
|
-
query = (yield this.graphManagerState.graphManager.getLightQuery(
|
227
|
-
queryId,
|
228
|
-
)) as LightQuery;
|
229
|
-
} catch {
|
230
|
-
query = undefined;
|
231
|
-
}
|
232
|
-
if (query) {
|
233
|
-
yield flowResult(this.loadQuery(query));
|
234
|
-
} else {
|
235
|
-
this.applicationStore.navigationService.navigator.updateCurrentLocation(
|
236
|
-
generateDataSpaceQuerySetupRoute(),
|
237
|
-
);
|
238
|
-
}
|
239
|
-
}
|
240
|
-
if (this.currentQuery) {
|
241
|
-
this.currentQueryProject = StoreProjectData.serialization.fromJson(
|
242
|
-
(yield this.depotServerClient.getProject(
|
243
|
-
this.currentQuery.groupId,
|
244
|
-
this.currentQuery.artifactId,
|
245
|
-
)) as PlainObject<StoreProjectData>,
|
246
|
-
);
|
247
|
-
const projectData = (yield Promise.all([
|
248
|
-
this.depotServerClient.getVersionEntities(
|
249
|
-
this.currentQuery.groupId,
|
250
|
-
this.currentQuery.artifactId,
|
251
|
-
this.currentQuery.versionId,
|
252
|
-
),
|
253
|
-
this.sdlcServerClient.getConfiguration(
|
254
|
-
this.currentQueryProject.projectId,
|
255
|
-
undefined,
|
256
|
-
),
|
257
|
-
])) as [Entity[], PlainObject<ProjectConfiguration>];
|
258
|
-
|
259
|
-
const [currentProjectEntities, currentProjectConfiguration] = [
|
260
|
-
projectData[0],
|
261
|
-
ProjectConfiguration.serialization.fromJson(projectData[1]),
|
262
|
-
];
|
263
|
-
this.currentProjectConfiguration = currentProjectConfiguration;
|
264
|
-
const dependencyEntities = (
|
265
|
-
(yield this.depotServerClient.collectDependencyEntities(
|
266
|
-
(
|
267
|
-
[
|
268
|
-
...currentProjectConfiguration.projectDependencies,
|
269
|
-
] as ProjectDependency[]
|
270
|
-
)
|
271
|
-
.map(projectDependencyToProjectCoordinates)
|
272
|
-
.map((p) => ProjectDependencyCoordinates.serialization.toJson(p)),
|
273
|
-
true,
|
274
|
-
true,
|
275
|
-
)) as PlainObject<ProjectVersionEntities>[]
|
276
|
-
)
|
277
|
-
.map((p) => ProjectVersionEntities.serialization.fromJson(p))
|
278
|
-
.flatMap((info) => info.entities);
|
279
|
-
this.dependencyEntities = dependencyEntities;
|
280
|
-
this.currentProjectEntities = currentProjectEntities;
|
281
|
-
this.dataSpaceEntity = guaranteeNonNullable(
|
282
|
-
currentProjectEntities.filter(
|
283
|
-
(entity: Entity) =>
|
284
|
-
entity.path === dataSpacePath &&
|
285
|
-
entity.classifierPath === DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
286
|
-
)[0],
|
287
|
-
`Can't find dataSpace entity with path ${this.dataSpaceEntity}`,
|
288
|
-
);
|
289
|
-
this.initState.pass();
|
290
|
-
}
|
291
|
-
} catch (error) {
|
292
|
-
assertErrorThrown(error);
|
293
|
-
this.applicationStore.logService.error(
|
294
|
-
LogEvent.create(LEGEND_STUDIO_APP_EVENT.GENERIC_FAILURE),
|
295
|
-
error,
|
296
|
-
);
|
297
|
-
this.applicationStore.alertService.setBlockingAlert({
|
298
|
-
message: `Can't initialize template query promotion reviewer store`,
|
299
|
-
});
|
300
|
-
this.initState.fail();
|
301
|
-
}
|
302
|
-
}
|
303
|
-
|
304
|
-
*loadQuery(query: LightQuery): GeneratorFn<void> {
|
305
|
-
this.currentQuery = query;
|
306
|
-
this.templateQueryTitle = query.name;
|
307
|
-
|
308
|
-
try {
|
309
|
-
this.loadQueryState.inProgress();
|
310
|
-
this.currentQueryInfo =
|
311
|
-
(yield this.graphManagerState.graphManager.getQueryInfo(
|
312
|
-
query.id,
|
313
|
-
)) as QueryInfo;
|
314
|
-
this.currentQueryProject = StoreProjectData.serialization.fromJson(
|
315
|
-
(yield this.depotServerClient.getProject(
|
316
|
-
this.currentQuery.groupId,
|
317
|
-
this.currentQuery.artifactId,
|
318
|
-
)) as PlainObject<StoreProjectData>,
|
319
|
-
);
|
320
|
-
this.setWorkspaceName(`${DEFAULT_WORKSPACE_NAME_PREFIX}-${query.name}`);
|
321
|
-
this.applicationStore.navigationService.navigator.updateCurrentLocation(
|
322
|
-
generateDataSpaceTemplateQueryPromotionRoute(
|
323
|
-
this.currentQuery.groupId,
|
324
|
-
this.currentQuery.artifactId,
|
325
|
-
this.currentQuery.versionId,
|
326
|
-
this.dataSpacePath,
|
327
|
-
query.id,
|
328
|
-
),
|
329
|
-
);
|
330
|
-
const currentProject = Project.serialization.fromJson(
|
331
|
-
(yield this.sdlcServerClient.getProject(
|
332
|
-
this.currentQueryProject.projectId,
|
333
|
-
)) as PlainObject<Project>,
|
334
|
-
);
|
335
|
-
yield flowResult(this.loadProject(currentProject));
|
336
|
-
} catch (error) {
|
337
|
-
assertErrorThrown(error);
|
338
|
-
this.applicationStore.notificationService.notifyError(error);
|
339
|
-
} finally {
|
340
|
-
this.loadQueryState.complete();
|
341
|
-
}
|
342
|
-
}
|
343
|
-
|
344
|
-
*loadProject(project: Project): GeneratorFn<void> {
|
345
|
-
this.currentProject = project;
|
346
|
-
this.currentProjectConfigurationStatus = undefined;
|
347
|
-
this.loadWorkspacesState.inProgress();
|
348
|
-
try {
|
349
|
-
this.currentProjectConfigurationStatus =
|
350
|
-
(yield fetchProjectConfigurationStatus(
|
351
|
-
project.projectId,
|
352
|
-
undefined,
|
353
|
-
this.applicationStore,
|
354
|
-
this.sdlcServerClient,
|
355
|
-
)) as ProjectConfigurationStatus;
|
356
|
-
this.groupWorkspaces = (
|
357
|
-
(yield this.sdlcServerClient.getGroupWorkspaces(
|
358
|
-
project.projectId,
|
359
|
-
)) as PlainObject<Workspace>[]
|
360
|
-
)
|
361
|
-
.map((v) => Workspace.serialization.fromJson(v))
|
362
|
-
.filter((workspace) => workspace.workspaceType === WorkspaceType.GROUP);
|
363
|
-
this.loadWorkspacesState.pass();
|
364
|
-
} catch (error) {
|
365
|
-
assertErrorThrown(error);
|
366
|
-
this.applicationStore.logService.error(
|
367
|
-
LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
|
368
|
-
error,
|
369
|
-
);
|
370
|
-
this.applicationStore.notificationService.notifyError(error);
|
371
|
-
this.loadWorkspacesState.fail();
|
372
|
-
}
|
373
|
-
}
|
374
|
-
|
375
|
-
*promoteAsTemplateQuery(): GeneratorFn<void> {
|
376
|
-
const query = this.currentQuery;
|
377
|
-
const project = this.currentProject;
|
378
|
-
if (
|
379
|
-
this.promoteState.isInProgress ||
|
380
|
-
!query ||
|
381
|
-
!this.currentQueryInfo ||
|
382
|
-
!this.currentProjectConfiguration ||
|
383
|
-
!project ||
|
384
|
-
!this.workspaceName ||
|
385
|
-
!this.templateQueryTitle ||
|
386
|
-
!this.dataSpaceEntity ||
|
387
|
-
!this.isWorkspaceNameValid ||
|
388
|
-
!this.isTemplateQueryIdValid
|
389
|
-
) {
|
390
|
-
return;
|
391
|
-
}
|
392
|
-
|
393
|
-
try {
|
394
|
-
this.promoteState.inProgress();
|
395
|
-
// 1. prepare project entities
|
396
|
-
this.applicationStore.alertService.setBlockingAlert({
|
397
|
-
message: `Fetching and updating project...`,
|
398
|
-
prompt: 'Please do not close the application',
|
399
|
-
showLoading: true,
|
400
|
-
});
|
401
|
-
|
402
|
-
// update datasapce entity
|
403
|
-
const updatedDataSpaceEntity =
|
404
|
-
(yield this.graphManagerExtension.addNewExecutableToDataSpaceEntity(
|
405
|
-
this.dataSpaceEntity,
|
406
|
-
{
|
407
|
-
id: this.templateQueryId,
|
408
|
-
title: this.templateQueryTitle,
|
409
|
-
mapping: guaranteeNonNullable(this.currentQueryInfo).mapping,
|
410
|
-
runtime: guaranteeNonNullable(this.currentQueryInfo).runtime,
|
411
|
-
query: (yield this.graphManagerState.graphManager.pureCodeToLambda(
|
412
|
-
this.currentQueryInfo.content,
|
413
|
-
)) as RawLambda,
|
414
|
-
description: this.templateQueryDescription,
|
415
|
-
},
|
416
|
-
)) as Entity;
|
417
|
-
guaranteeNonNullable(
|
418
|
-
this.currentProjectEntities.filter(
|
419
|
-
(entity: Entity) =>
|
420
|
-
entity.path === this.dataSpacePath &&
|
421
|
-
entity.classifierPath === DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
422
|
-
)[0],
|
423
|
-
).content = updatedDataSpaceEntity.content;
|
424
|
-
|
425
|
-
// 2. check if the graph compiles properly
|
426
|
-
this.applicationStore.alertService.setBlockingAlert({
|
427
|
-
message: `Checking workspace compilation status...`,
|
428
|
-
prompt: 'Please do not close the application',
|
429
|
-
showLoading: true,
|
430
|
-
});
|
431
|
-
let compilationFailed = false;
|
432
|
-
try {
|
433
|
-
yield this.graphManagerState.graphManager.compileEntities([
|
434
|
-
...this.dependencyEntities,
|
435
|
-
...this.currentProjectEntities,
|
436
|
-
]);
|
437
|
-
} catch {
|
438
|
-
compilationFailed = true;
|
439
|
-
}
|
440
|
-
|
441
|
-
// 3. proceed to setup the workspace
|
442
|
-
const setupWorkspace = async (): Promise<void> => {
|
443
|
-
let workspace: Workspace | undefined;
|
444
|
-
try {
|
445
|
-
this.applicationStore.alertService.setBlockingAlert({
|
446
|
-
message: `Creating workspace...`,
|
447
|
-
prompt: 'Please do not close the application',
|
448
|
-
showLoading: true,
|
449
|
-
});
|
450
|
-
|
451
|
-
// i. create workspace
|
452
|
-
workspace = Workspace.serialization.fromJson(
|
453
|
-
await this.sdlcServerClient.createWorkspace(
|
454
|
-
project.projectId,
|
455
|
-
undefined,
|
456
|
-
this.workspaceName,
|
457
|
-
WorkspaceType.GROUP,
|
458
|
-
),
|
459
|
-
);
|
460
|
-
|
461
|
-
// ii. update dataspace
|
462
|
-
this.applicationStore.alertService.setBlockingAlert({
|
463
|
-
message: `Generating code commit...`,
|
464
|
-
prompt: 'Please do not close the application',
|
465
|
-
showLoading: true,
|
466
|
-
});
|
467
|
-
await this.sdlcServerClient.performEntityChanges(
|
468
|
-
project.projectId,
|
469
|
-
workspace,
|
470
|
-
{
|
471
|
-
message:
|
472
|
-
'promote-as-template-query: promote query as a template query to dataspace',
|
473
|
-
entityChanges: [
|
474
|
-
{
|
475
|
-
classifierPath: updatedDataSpaceEntity.classifierPath,
|
476
|
-
entityPath: updatedDataSpaceEntity.path,
|
477
|
-
content: updatedDataSpaceEntity.content,
|
478
|
-
type: EntityChangeType.MODIFY,
|
479
|
-
},
|
480
|
-
],
|
481
|
-
},
|
482
|
-
);
|
483
|
-
|
484
|
-
// iii create review
|
485
|
-
this.applicationStore.alertService.setBlockingAlert({
|
486
|
-
message: `Generating code review...`,
|
487
|
-
prompt: 'Please do not close the application',
|
488
|
-
showLoading: true,
|
489
|
-
});
|
490
|
-
await flowResult(
|
491
|
-
this.editorStore.initialize(
|
492
|
-
project.projectId,
|
493
|
-
undefined,
|
494
|
-
workspace.workspaceId,
|
495
|
-
workspace.workspaceType,
|
496
|
-
),
|
497
|
-
);
|
498
|
-
const workspaceReviewState = this.editorStore.workspaceReviewState;
|
499
|
-
const workspaceContainsSnapshotDependencies =
|
500
|
-
this.editorStore.projectConfigurationEditorState
|
501
|
-
.containsSnapshotDependencies;
|
502
|
-
const isCreateReviewDisabled =
|
503
|
-
Boolean(workspaceReviewState.workspaceReview) ||
|
504
|
-
workspaceContainsSnapshotDependencies ||
|
505
|
-
!workspaceReviewState.canCreateReview ||
|
506
|
-
workspaceReviewState.sdlcState.isActiveProjectSandbox;
|
507
|
-
workspaceReviewState.reviewTitle =
|
508
|
-
'code review - promote query as a template query to dataspace';
|
509
|
-
if (!isCreateReviewDisabled) {
|
510
|
-
await flowResult(
|
511
|
-
workspaceReviewState.createWorkspaceReview(
|
512
|
-
workspaceReviewState.reviewTitle,
|
513
|
-
),
|
514
|
-
);
|
515
|
-
} else {
|
516
|
-
this.applicationStore.notificationService.notifyError(
|
517
|
-
`Can't create code review`,
|
518
|
-
);
|
519
|
-
}
|
520
|
-
|
521
|
-
// iv. complete, redirect user to the service query editor screen
|
522
|
-
this.applicationStore.alertService.setBlockingAlert(undefined);
|
523
|
-
this.promoteState.pass();
|
524
|
-
this.applicationStore.alertService.setActionAlertInfo({
|
525
|
-
message: `Successfully promoted query into dataspace '${this.dataSpacePath}'. Now your template query can be found in workspace '${this.workspaceName}' of project '${project.name}' (${project.projectId})`,
|
526
|
-
prompt: compilationFailed
|
527
|
-
? `The workspace might not compile at the moment, please make sure to fix the issue and submit a review to make the dataspace part of the project to complete template query promotion`
|
528
|
-
: `Please make sure to get the generated code-review reviewed and approved`,
|
529
|
-
type: ActionAlertType.STANDARD,
|
530
|
-
actions: compilationFailed
|
531
|
-
? [
|
532
|
-
{
|
533
|
-
label: 'Open Workspace',
|
534
|
-
type: ActionAlertActionType.PROCEED,
|
535
|
-
handler: (): void => {
|
536
|
-
this.applicationStore.navigationService.navigator.goToLocation(
|
537
|
-
generateEditorRoute(
|
538
|
-
project.projectId,
|
539
|
-
undefined,
|
540
|
-
this.workspaceName,
|
541
|
-
WorkspaceType.GROUP,
|
542
|
-
),
|
543
|
-
);
|
544
|
-
},
|
545
|
-
default: true,
|
546
|
-
},
|
547
|
-
]
|
548
|
-
: [
|
549
|
-
{
|
550
|
-
label: 'Open Code Review',
|
551
|
-
type: ActionAlertActionType.PROCEED,
|
552
|
-
handler: (): void => {
|
553
|
-
if (workspaceReviewState.workspaceReview) {
|
554
|
-
this.applicationStore.navigationService.navigator.visitAddress(
|
555
|
-
this.applicationStore.navigationService.navigator.generateAddress(
|
556
|
-
generateReviewRoute(
|
557
|
-
workspaceReviewState.workspaceReview.projectId,
|
558
|
-
workspaceReviewState.workspaceReview.id,
|
559
|
-
),
|
560
|
-
),
|
561
|
-
);
|
562
|
-
}
|
563
|
-
},
|
564
|
-
default: true,
|
565
|
-
},
|
566
|
-
{
|
567
|
-
label: 'Open Workspace',
|
568
|
-
type: ActionAlertActionType.PROCEED,
|
569
|
-
handler: (): void => {
|
570
|
-
this.applicationStore.navigationService.navigator.goToLocation(
|
571
|
-
generateEditorRoute(
|
572
|
-
project.projectId,
|
573
|
-
undefined,
|
574
|
-
this.workspaceName,
|
575
|
-
WorkspaceType.GROUP,
|
576
|
-
),
|
577
|
-
);
|
578
|
-
},
|
579
|
-
},
|
580
|
-
],
|
581
|
-
});
|
582
|
-
} catch (error) {
|
583
|
-
assertErrorThrown(error);
|
584
|
-
this.applicationStore.alertService.setBlockingAlert(undefined);
|
585
|
-
this.applicationStore.notificationService.notifyError(
|
586
|
-
`Can't set up workspace: ${error.message}`,
|
587
|
-
);
|
588
|
-
if (workspace) {
|
589
|
-
await this.sdlcServerClient.deleteWorkspace(
|
590
|
-
project.projectId,
|
591
|
-
workspace,
|
592
|
-
);
|
593
|
-
}
|
594
|
-
this.promoteState.fail();
|
595
|
-
}
|
596
|
-
};
|
597
|
-
|
598
|
-
this.applicationStore.alertService.setBlockingAlert(undefined);
|
599
|
-
if (compilationFailed) {
|
600
|
-
this.applicationStore.alertService.setActionAlertInfo({
|
601
|
-
message: `We have found compilation issues with the workspace. Your query can still be promoted, but you would need to fix compilation issues afterwards`,
|
602
|
-
prompt: `Do you still want to proceed to promote the query as a template query?`,
|
603
|
-
type: ActionAlertType.STANDARD,
|
604
|
-
actions: [
|
605
|
-
{
|
606
|
-
label: `Proceed`,
|
607
|
-
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
608
|
-
handler: (): void => {
|
609
|
-
setupWorkspace().catch(
|
610
|
-
this.applicationStore.alertUnhandledError,
|
611
|
-
);
|
612
|
-
},
|
613
|
-
},
|
614
|
-
{
|
615
|
-
label: 'Abort',
|
616
|
-
type: ActionAlertActionType.PROCEED,
|
617
|
-
handler: (): void => {
|
618
|
-
this.promoteState.fail();
|
619
|
-
},
|
620
|
-
default: true,
|
621
|
-
},
|
622
|
-
],
|
623
|
-
});
|
624
|
-
} else {
|
625
|
-
yield setupWorkspace();
|
626
|
-
}
|
627
|
-
|
628
|
-
this.promoteState.pass();
|
629
|
-
} catch (error) {
|
630
|
-
assertErrorThrown(error);
|
631
|
-
this.applicationStore.alertService.setBlockingAlert(undefined);
|
632
|
-
this.applicationStore.notificationService.notifyError(error);
|
633
|
-
this.promoteState.fail();
|
634
|
-
}
|
635
|
-
}
|
636
|
-
}
|