@finos/legend-application-studio 28.14.2 → 28.14.4
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/__lib__/LegendStudioEvent.d.ts +1 -0
- package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioEvent.js +1 -0
- package/lib/__lib__/LegendStudioEvent.js.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.d.ts +5 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +6 -0
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +5 -2
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/side-bar/WorkspaceReview.d.ts.map +1 -1
- package/lib/components/editor/side-bar/WorkspaceReview.js +12 -7
- package/lib/components/editor/side-bar/WorkspaceReview.js.map +1 -1
- package/lib/components/workspace-setup/WorkspaceSetup.d.ts.map +1 -1
- package/lib/components/workspace-setup/WorkspaceSetup.js +10 -2
- package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorSDLCState.d.ts +1 -0
- package/lib/stores/editor/EditorSDLCState.d.ts.map +1 -1
- package/lib/stores/editor/EditorSDLCState.js +5 -1
- package/lib/stores/editor/EditorSDLCState.js.map +1 -1
- package/lib/stores/editor/sidebar-state/WorkspaceReviewState.d.ts.map +1 -1
- package/lib/stores/editor/sidebar-state/WorkspaceReviewState.js +5 -1
- package/lib/stores/editor/sidebar-state/WorkspaceReviewState.js.map +1 -1
- package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts +8 -1
- package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts.map +1 -1
- package/lib/stores/workspace-setup/WorkspaceSetupStore.js +103 -9
- package/lib/stores/workspace-setup/WorkspaceSetupStore.js.map +1 -1
- package/package.json +11 -11
- package/src/__lib__/LegendStudioEvent.ts +2 -0
- package/src/application/LegendStudioApplicationConfig.ts +7 -0
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +11 -2
- package/src/components/editor/side-bar/WorkspaceReview.tsx +6 -1
- package/src/components/workspace-setup/WorkspaceSetup.tsx +23 -1
- package/src/stores/editor/EditorSDLCState.ts +7 -0
- package/src/stores/editor/sidebar-state/WorkspaceReviewState.ts +7 -1
- package/src/stores/workspace-setup/WorkspaceSetupStore.ts +162 -21
@@ -23,26 +23,33 @@ import {
|
|
23
23
|
LogEvent,
|
24
24
|
ActionState,
|
25
25
|
IllegalStateError,
|
26
|
+
UnsupportedOperationError,
|
27
|
+
guaranteeNonNullable,
|
28
|
+
guaranteeType,
|
26
29
|
} from '@finos/legend-shared';
|
27
30
|
import { generateSetupRoute } from '../../__lib__/LegendStudioNavigation.js';
|
28
31
|
import {
|
29
32
|
type SDLCServerClient,
|
33
|
+
SANDBOX_SDLC_TAG,
|
30
34
|
WorkspaceType,
|
31
35
|
ImportReport,
|
32
36
|
Project,
|
33
37
|
Review,
|
34
38
|
Workspace,
|
35
39
|
Patch,
|
40
|
+
isProjectSandbox,
|
36
41
|
} from '@finos/legend-server-sdlc';
|
37
42
|
import type { LegendStudioApplicationStore } from '../LegendStudioBaseStore.js';
|
38
43
|
import {
|
44
|
+
DEFAULT_TAB_SIZE,
|
39
45
|
DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
40
46
|
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
41
47
|
} from '@finos/legend-application';
|
42
48
|
import {
|
43
49
|
fetchProjectConfigurationStatus,
|
44
|
-
|
50
|
+
ProjectConfigurationStatus,
|
45
51
|
} from './ProjectConfigurationStatus.js';
|
52
|
+
import { GraphManagerState } from '@finos/legend-graph';
|
46
53
|
|
47
54
|
interface ImportProjectSuccessReport {
|
48
55
|
projectId: string;
|
@@ -57,13 +64,17 @@ export class WorkspaceSetupStore {
|
|
57
64
|
readonly initState = ActionState.create();
|
58
65
|
|
59
66
|
projects: Project[] = [];
|
67
|
+
sandboxProject: Project | boolean = false;
|
60
68
|
currentProject?: Project | undefined;
|
61
69
|
currentProjectConfigurationStatus?: ProjectConfigurationStatus | undefined;
|
62
70
|
loadProjectsState = ActionState.create();
|
71
|
+
loadSandboxState = ActionState.create();
|
63
72
|
createOrImportProjectState = ActionState.create();
|
64
73
|
importProjectSuccessReport?: ImportProjectSuccessReport | undefined;
|
65
74
|
showCreateProjectModal = false;
|
66
75
|
|
76
|
+
createSandboxProjectState = ActionState.create();
|
77
|
+
|
67
78
|
patches: Patch[] = [];
|
68
79
|
loadPatchesState = ActionState.create();
|
69
80
|
|
@@ -74,6 +85,8 @@ export class WorkspaceSetupStore {
|
|
74
85
|
showCreateWorkspaceModal = false;
|
75
86
|
showAdvancedWorkspaceFilterOptions = false;
|
76
87
|
|
88
|
+
graphManagerState: GraphManagerState;
|
89
|
+
|
77
90
|
constructor(
|
78
91
|
applicationStore: LegendStudioApplicationStore,
|
79
92
|
sdlcServerClient: SDLCServerClient,
|
@@ -87,7 +100,10 @@ export class WorkspaceSetupStore {
|
|
87
100
|
workspaces: observable,
|
88
101
|
currentWorkspace: observable,
|
89
102
|
showAdvancedWorkspaceFilterOptions: observable,
|
103
|
+
loadSandboxState: observable,
|
90
104
|
showCreateWorkspaceModal: observable,
|
105
|
+
sandboxProject: observable,
|
106
|
+
createSandboxProjectState: observable,
|
91
107
|
setShowCreateProjectModal: action,
|
92
108
|
setShowCreateWorkspaceModal: action,
|
93
109
|
setShowAdvancedWorkspaceFilterOptions: action,
|
@@ -97,14 +113,20 @@ export class WorkspaceSetupStore {
|
|
97
113
|
resetWorkspace: action,
|
98
114
|
initialize: flow,
|
99
115
|
loadProjects: flow,
|
116
|
+
loadSandboxProject: flow,
|
100
117
|
changeProject: flow,
|
101
118
|
createProject: flow,
|
102
119
|
importProject: flow,
|
120
|
+
createSandboxProject: flow,
|
103
121
|
createWorkspace: flow,
|
104
122
|
});
|
105
123
|
|
106
124
|
this.applicationStore = applicationStore;
|
107
125
|
this.sdlcServerClient = sdlcServerClient;
|
126
|
+
this.graphManagerState = new GraphManagerState(
|
127
|
+
applicationStore.pluginManager,
|
128
|
+
applicationStore.logService,
|
129
|
+
);
|
108
130
|
}
|
109
131
|
|
110
132
|
setShowCreateProjectModal(val: boolean): void {
|
@@ -150,6 +172,59 @@ export class WorkspaceSetupStore {
|
|
150
172
|
}
|
151
173
|
}
|
152
174
|
|
175
|
+
*createSandboxProject(): GeneratorFn<void> {
|
176
|
+
try {
|
177
|
+
// create sandbox project and pilot workspace
|
178
|
+
this.applicationStore.alertService.setBlockingAlert({
|
179
|
+
message: 'Creating sandbox project...',
|
180
|
+
showLoading: true,
|
181
|
+
});
|
182
|
+
const sandboxProject =
|
183
|
+
(yield this.graphManagerState.graphManager.createSandboxProject()) as {
|
184
|
+
projectId: string;
|
185
|
+
webUrl: string | undefined;
|
186
|
+
owner: string;
|
187
|
+
};
|
188
|
+
this.applicationStore.alertService.setBlockingAlert({
|
189
|
+
message: `Sandbox project ${sandboxProject.projectId} created. Creating default workspace...`,
|
190
|
+
showLoading: true,
|
191
|
+
});
|
192
|
+
yield flowResult(this.loadSandboxProject());
|
193
|
+
const sandbox = guaranteeType(
|
194
|
+
this.sandboxProject,
|
195
|
+
Project,
|
196
|
+
'Error Retrieving sandbox project',
|
197
|
+
);
|
198
|
+
const pilotWorkspace = Workspace.serialization.fromJson(
|
199
|
+
(yield this.sdlcServerClient.createWorkspace(
|
200
|
+
sandbox.projectId,
|
201
|
+
undefined,
|
202
|
+
'pilotWorkspace',
|
203
|
+
WorkspaceType.GROUP,
|
204
|
+
)) as PlainObject<Workspace>,
|
205
|
+
);
|
206
|
+
yield flowResult(
|
207
|
+
this.changeProject(sandbox, {
|
208
|
+
workspaceId: pilotWorkspace.workspaceId,
|
209
|
+
workspaceType: WorkspaceType.GROUP,
|
210
|
+
}),
|
211
|
+
);
|
212
|
+
this.applicationStore.alertService.setBlockingAlert(undefined);
|
213
|
+
this.applicationStore.notificationService.notifySuccess(
|
214
|
+
`Sandbox Project with pilot workspace created`,
|
215
|
+
);
|
216
|
+
} catch (error) {
|
217
|
+
assertErrorThrown(error);
|
218
|
+
this.applicationStore.logService.error(
|
219
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.DEPOT_MANAGER_FAILURE),
|
220
|
+
error,
|
221
|
+
);
|
222
|
+
this.applicationStore.notificationService.notifyError(error);
|
223
|
+
} finally {
|
224
|
+
this.applicationStore.alertService.setBlockingAlert(undefined);
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
153
228
|
*initialize(
|
154
229
|
projectId: string | undefined,
|
155
230
|
workspaceId: string | undefined,
|
@@ -179,6 +254,31 @@ export class WorkspaceSetupStore {
|
|
179
254
|
this.initState.pass();
|
180
255
|
return;
|
181
256
|
}
|
257
|
+
|
258
|
+
try {
|
259
|
+
yield flowResult(
|
260
|
+
this.graphManagerState.graphManager.initialize(
|
261
|
+
{
|
262
|
+
env: this.applicationStore.config.env,
|
263
|
+
tabSize: DEFAULT_TAB_SIZE,
|
264
|
+
clientConfig: {
|
265
|
+
baseUrl: this.applicationStore.config.engineServerUrl,
|
266
|
+
},
|
267
|
+
},
|
268
|
+
{
|
269
|
+
tracerService: this.applicationStore.tracerService,
|
270
|
+
disableGraphConfiguration: true,
|
271
|
+
},
|
272
|
+
),
|
273
|
+
);
|
274
|
+
} catch (error) {
|
275
|
+
assertErrorThrown(error);
|
276
|
+
this.applicationStore.logService.error(
|
277
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.ENGINE_MANAGER_FAILURE),
|
278
|
+
error,
|
279
|
+
);
|
280
|
+
}
|
281
|
+
|
182
282
|
yield flowResult(
|
183
283
|
this.changeProject(
|
184
284
|
project,
|
@@ -198,7 +298,7 @@ export class WorkspaceSetupStore {
|
|
198
298
|
} catch (error) {
|
199
299
|
assertErrorThrown(error);
|
200
300
|
this.applicationStore.logService.error(
|
201
|
-
LogEvent.create(LEGEND_STUDIO_APP_EVENT.
|
301
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
|
202
302
|
error,
|
203
303
|
);
|
204
304
|
this.applicationStore.notificationService.notifyError(error);
|
@@ -227,6 +327,35 @@ export class WorkspaceSetupStore {
|
|
227
327
|
}
|
228
328
|
}
|
229
329
|
|
330
|
+
*loadSandboxProject(): GeneratorFn<void> {
|
331
|
+
this.sandboxProject = false;
|
332
|
+
this.loadSandboxState.inProgress();
|
333
|
+
try {
|
334
|
+
const sandboxProject = (
|
335
|
+
(yield this.sdlcServerClient.getProjects(
|
336
|
+
undefined,
|
337
|
+
this.sdlcServerClient.currentUser?.userId,
|
338
|
+
[SANDBOX_SDLC_TAG],
|
339
|
+
1,
|
340
|
+
)) as PlainObject<Project>[]
|
341
|
+
).map((v) => Project.serialization.fromJson(v));
|
342
|
+
this.sandboxProject = true;
|
343
|
+
if (sandboxProject.length > 1) {
|
344
|
+
throw new UnsupportedOperationError('Only one sandbox is supported., ');
|
345
|
+
} else if (sandboxProject.length === 1) {
|
346
|
+
this.sandboxProject = guaranteeNonNullable(sandboxProject[0]);
|
347
|
+
}
|
348
|
+
this.loadSandboxState.pass();
|
349
|
+
} catch (error) {
|
350
|
+
this.sandboxProject = true;
|
351
|
+
assertErrorThrown(error);
|
352
|
+
this.applicationStore.logService.error(
|
353
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.WORKSPACE_SETUP_FAILURE),
|
354
|
+
);
|
355
|
+
this.loadSandboxState.fail();
|
356
|
+
}
|
357
|
+
}
|
358
|
+
|
230
359
|
*changeProject(
|
231
360
|
project: Project,
|
232
361
|
workspaceInfo?:
|
@@ -240,11 +369,15 @@ export class WorkspaceSetupStore {
|
|
240
369
|
this.currentProjectConfigurationStatus = undefined;
|
241
370
|
this.loadPatchesState.inProgress();
|
242
371
|
try {
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
372
|
+
if (isProjectSandbox(project)) {
|
373
|
+
this.patches = [];
|
374
|
+
} else {
|
375
|
+
this.patches = (
|
376
|
+
(yield this.sdlcServerClient.getPatches(
|
377
|
+
project.projectId,
|
378
|
+
)) as PlainObject<Patch>[]
|
379
|
+
).map((v) => Patch.serialization.fromJson(v));
|
380
|
+
}
|
248
381
|
this.loadPatchesState.pass();
|
249
382
|
} catch (error) {
|
250
383
|
assertErrorThrown(error);
|
@@ -258,20 +391,28 @@ export class WorkspaceSetupStore {
|
|
258
391
|
|
259
392
|
this.loadWorkspacesState.inProgress();
|
260
393
|
try {
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
394
|
+
if (isProjectSandbox(project)) {
|
395
|
+
const result = new ProjectConfigurationStatus();
|
396
|
+
result.projectId = project.projectId;
|
397
|
+
result.isConfigured = true;
|
398
|
+
this.currentProjectConfigurationStatus = result;
|
399
|
+
} else {
|
400
|
+
this.currentProjectConfigurationStatus =
|
401
|
+
(yield fetchProjectConfigurationStatus(
|
402
|
+
project.projectId,
|
403
|
+
undefined,
|
404
|
+
this.applicationStore,
|
405
|
+
this.sdlcServerClient,
|
406
|
+
)) as ProjectConfigurationStatus;
|
407
|
+
}
|
408
|
+
const workspacesInConflictResolutionIds = isProjectSandbox(project)
|
409
|
+
? []
|
410
|
+
: (
|
411
|
+
(yield this.sdlcServerClient.getWorkspacesInConflictResolutionMode(
|
412
|
+
project.projectId,
|
413
|
+
undefined,
|
414
|
+
)) as Workspace[]
|
415
|
+
).map((workspace) => workspace.workspaceId);
|
275
416
|
|
276
417
|
this.workspaces = (
|
277
418
|
(yield this.sdlcServerClient.getWorkspaces(
|