@finos/legend-application-studio 28.9.0 → 28.10.1
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__/LegendStudioCommand.d.ts +1 -0
- package/lib/__lib__/LegendStudioCommand.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioCommand.js +5 -0
- package/lib/__lib__/LegendStudioCommand.js.map +1 -1
- package/lib/components/ShowcaseManager.d.ts.map +1 -1
- package/lib/components/ShowcaseManager.js +5 -2
- package/lib/components/ShowcaseManager.js.map +1 -1
- package/lib/components/editor/ActivityBar.d.ts.map +1 -1
- package/lib/components/editor/ActivityBar.js +20 -17
- package/lib/components/editor/ActivityBar.js.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +7 -1
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts +5 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +29 -10
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts +11 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js +22 -10
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts +7 -0
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +3 -3
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/end-to-end-flow-editor/ConnectionToQueryWorkflowEditor.d.ts +52 -0
- package/lib/components/editor/editor-group/end-to-end-flow-editor/ConnectionToQueryWorkflowEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/end-to-end-flow-editor/ConnectionToQueryWorkflowEditor.js +150 -0
- package/lib/components/editor/editor-group/end-to-end-flow-editor/ConnectionToQueryWorkflowEditor.js.map +1 -0
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js +1 -1
- package/lib/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +6 -6
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/components/editor/side-bar/SideBar.d.ts.map +1 -1
- package/lib/components/editor/side-bar/SideBar.js +4 -1
- package/lib/components/editor/side-bar/SideBar.js.map +1 -1
- package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.d.ts +23 -0
- package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.d.ts.map +1 -0
- package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.js +43 -0
- package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/ShowcaseManagerState.d.ts +1 -0
- package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
- package/lib/stores/ShowcaseManagerState.js +11 -1
- package/lib/stores/ShowcaseManagerState.js.map +1 -1
- package/lib/stores/editor/EditorConfig.d.ts +3 -1
- package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
- package/lib/stores/editor/EditorConfig.js +4 -1
- package/lib/stores/editor/EditorConfig.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts +3 -0
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +17 -0
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
- package/lib/stores/editor/ExplorerTreeState.js +1 -1
- package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
- package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts +1 -0
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +1 -1
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js +2 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +6 -2
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +53 -34
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts +3 -2
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js +8 -5
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js.map +1 -1
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.d.ts +22 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js +23 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js.map +1 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.d.ts +111 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.js +453 -0
- package/lib/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.js.map +1 -0
- package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.d.ts +24 -0
- package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.d.ts.map +1 -0
- package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js +37 -0
- package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js.map +1 -0
- package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
- package/lib/stores/showcase/ShowcaseViewerStore.js +5 -1
- package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
- package/package.json +5 -5
- package/src/__lib__/LegendStudioCommand.ts +5 -0
- package/src/components/ShowcaseManager.tsx +18 -0
- package/src/components/editor/ActivityBar.tsx +56 -15
- package/src/components/editor/editor-group/EditorGroup.tsx +21 -1
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +136 -103
- package/src/components/editor/editor-group/connection-editor/DatabaseModelBuilder.tsx +97 -53
- package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +4 -3
- package/src/components/editor/editor-group/end-to-end-flow-editor/ConnectionToQueryWorkflowEditor.tsx +518 -0
- package/src/components/editor/editor-group/service-editor/ServiceExecutionQueryEditor.tsx +1 -1
- package/src/components/editor/side-bar/Explorer.tsx +7 -6
- package/src/components/editor/side-bar/SideBar.tsx +13 -1
- package/src/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.tsx +102 -0
- package/src/stores/ShowcaseManagerState.ts +19 -1
- package/src/stores/editor/EditorConfig.ts +3 -0
- package/src/stores/editor/EditorStore.ts +21 -0
- package/src/stores/editor/ExplorerTreeState.ts +1 -0
- package/src/stores/editor/GraphEditGrammarModeState.ts +3 -3
- package/src/stores/editor/NewElementState.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts +2 -1
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +77 -49
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +1 -2
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts +12 -8
- package/src/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.ts +23 -0
- package/src/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.ts +775 -0
- package/src/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.ts +43 -0
- package/src/stores/showcase/ShowcaseViewerStore.ts +4 -0
- package/tsconfig.json +5 -0
@@ -0,0 +1,102 @@
|
|
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
|
+
PanelContent,
|
19
|
+
PURE_ConnectionIcon,
|
20
|
+
PURE_UnknownElementTypeIcon,
|
21
|
+
} from '@finos/legend-art';
|
22
|
+
import { observer } from 'mobx-react-lite';
|
23
|
+
import { type GlobalEndToEndWorkflowState } from '../../../../stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
|
24
|
+
import { LEGEND_STUDIO_TEST_ID } from '../../../../__lib__/LegendStudioTesting.js';
|
25
|
+
import { END_TO_END_WORKFLOWS } from '../../../../stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js';
|
26
|
+
import { prettyCONSTName } from '@finos/legend-shared';
|
27
|
+
|
28
|
+
export const getWorkflowIcon = (currentFlow: string): React.ReactNode => {
|
29
|
+
if (currentFlow === END_TO_END_WORKFLOWS.CREATE_QUERY_FROM_CONNECTION) {
|
30
|
+
return (
|
31
|
+
<div
|
32
|
+
title="Create Query From Connection"
|
33
|
+
className="icon icon--connection color--connection"
|
34
|
+
>
|
35
|
+
<PURE_ConnectionIcon />
|
36
|
+
</div>
|
37
|
+
);
|
38
|
+
} else {
|
39
|
+
return (
|
40
|
+
<div title="Query From Workflow" className="icon">
|
41
|
+
<PURE_UnknownElementTypeIcon />
|
42
|
+
</div>
|
43
|
+
);
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
export const EndToEndWorkflow = observer(
|
48
|
+
(props: { globalEndToEndWorkflowState: GlobalEndToEndWorkflowState }) => {
|
49
|
+
const { globalEndToEndWorkflowState } = props;
|
50
|
+
|
51
|
+
const openWorkflow = (
|
52
|
+
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
53
|
+
flow: string,
|
54
|
+
): void => {
|
55
|
+
event.stopPropagation();
|
56
|
+
event.preventDefault();
|
57
|
+
globalEndToEndWorkflowState.visitWorkflow(flow);
|
58
|
+
};
|
59
|
+
|
60
|
+
const endToEndWorkflow = (): React.ReactNode => (
|
61
|
+
<>
|
62
|
+
{Object.values(END_TO_END_WORKFLOWS).map((flow) => (
|
63
|
+
<div className="side-bar__panel__item" key={flow}>
|
64
|
+
<div
|
65
|
+
className="end-to-end-workflow__container"
|
66
|
+
onClick={(event) => {
|
67
|
+
openWorkflow(event, flow);
|
68
|
+
}}
|
69
|
+
>
|
70
|
+
<div className="end-to-end-workflow__container__icon">
|
71
|
+
{getWorkflowIcon(flow)}
|
72
|
+
</div>
|
73
|
+
<div className="end-to-end-workflow__container__name">
|
74
|
+
{prettyCONSTName(flow)}
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
))}
|
79
|
+
</>
|
80
|
+
);
|
81
|
+
|
82
|
+
return (
|
83
|
+
<div
|
84
|
+
data-testid={LEGEND_STUDIO_TEST_ID.END_TO_END_WORKFLOW}
|
85
|
+
className="panel"
|
86
|
+
>
|
87
|
+
<div className="panel__header side-bar__header">
|
88
|
+
<div className="panel__header__title">
|
89
|
+
<div className="panel__header__title__content side-bar__header__title__content">
|
90
|
+
Guided End to End Workflows
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div className="panel__content side-bar__content">
|
95
|
+
<div className="panel side-bar__panel">
|
96
|
+
<PanelContent>{endToEndWorkflow()}</PanelContent>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
);
|
101
|
+
},
|
102
|
+
);
|
@@ -39,6 +39,7 @@ import {
|
|
39
39
|
} from '@finos/legend-application';
|
40
40
|
import type { TreeData, TreeNodeData } from '@finos/legend-art';
|
41
41
|
import { DIRECTORY_PATH_DELIMITER } from '@finos/legend-graph';
|
42
|
+
import { SHOWCASE_MANAGER_VIRTUAL_ASSISTANT_TAB_KEY } from '../components/extensions/Core_LegendStudioApplicationPlugin.js';
|
42
43
|
|
43
44
|
export enum SHOWCASE_MANAGER_VIEW {
|
44
45
|
EXPLORER = 'EXPLORER',
|
@@ -307,7 +308,9 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
307
308
|
this.initState.inProgress();
|
308
309
|
|
309
310
|
try {
|
310
|
-
this.showcases = (
|
311
|
+
this.showcases = (
|
312
|
+
(yield this.client.getShowcases()) as ShowcaseMetadata[]
|
313
|
+
).filter((showcase) => !showcase.development);
|
311
314
|
this.explorerTreeData = buildShowcasesExplorerTreeData(this.showcases);
|
312
315
|
// expand all the root nodes by default
|
313
316
|
this.explorerTreeData.rootIds.forEach((rootId) => {
|
@@ -372,3 +375,18 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
372
375
|
}
|
373
376
|
}
|
374
377
|
}
|
378
|
+
|
379
|
+
export const openShowcaseManager = (
|
380
|
+
applicationStore: LegendStudioApplicationStore,
|
381
|
+
): void => {
|
382
|
+
const showcaseManagerState =
|
383
|
+
ShowcaseManagerState.retrieveNullableState(applicationStore);
|
384
|
+
if (showcaseManagerState?.isEnabled) {
|
385
|
+
applicationStore.assistantService.setIsHidden(false);
|
386
|
+
applicationStore.assistantService.setIsOpen(true);
|
387
|
+
applicationStore.assistantService.setIsPanelMaximized(true);
|
388
|
+
applicationStore.assistantService.setSelectedTab(
|
389
|
+
SHOWCASE_MANAGER_VIRTUAL_ASSISTANT_TAB_KEY,
|
390
|
+
);
|
391
|
+
}
|
392
|
+
};
|
@@ -108,6 +108,8 @@ import { GraphEditGrammarModeState } from './GraphEditGrammarModeState.js';
|
|
108
108
|
import { GlobalBulkServiceRegistrationState } from './sidebar-state/BulkServiceRegistrationState.js';
|
109
109
|
import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.js';
|
110
110
|
import type { QuickInputState } from './QuickInputState.js';
|
111
|
+
import { GlobalEndToEndWorkflowState } from './sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
|
112
|
+
import { openShowcaseManager } from '../ShowcaseManagerState.js';
|
111
113
|
|
112
114
|
export abstract class EditorExtensionState {
|
113
115
|
/**
|
@@ -162,6 +164,7 @@ export class EditorStore implements CommandRegistrar {
|
|
162
164
|
localChangesState: LocalChangesState;
|
163
165
|
conflictResolutionState: WorkspaceUpdateConflictResolutionState;
|
164
166
|
globalBulkServiceRegistrationState: GlobalBulkServiceRegistrationState;
|
167
|
+
globalEndToEndWorkflowState: GlobalEndToEndWorkflowState;
|
165
168
|
devToolState: DevToolPanelState;
|
166
169
|
sqlPlaygroundState: SQLPlaygroundPanelState;
|
167
170
|
|
@@ -210,6 +213,7 @@ export class EditorStore implements CommandRegistrar {
|
|
210
213
|
quickInputState: observable,
|
211
214
|
|
212
215
|
isInViewerMode: computed,
|
216
|
+
disableGraphEditing: computed,
|
213
217
|
isInConflictResolutionMode: computed,
|
214
218
|
isInitialized: computed,
|
215
219
|
|
@@ -257,6 +261,7 @@ export class EditorStore implements CommandRegistrar {
|
|
257
261
|
this,
|
258
262
|
this.sdlcState,
|
259
263
|
);
|
264
|
+
this.globalEndToEndWorkflowState = new GlobalEndToEndWorkflowState(this);
|
260
265
|
this.workspaceWorkflowManagerState = new WorkspaceWorkflowManagerState(
|
261
266
|
this,
|
262
267
|
this.sdlcState,
|
@@ -314,6 +319,10 @@ export class EditorStore implements CommandRegistrar {
|
|
314
319
|
return this.mode === EDITOR_MODE.VIEWER;
|
315
320
|
}
|
316
321
|
|
322
|
+
get disableGraphEditing(): boolean {
|
323
|
+
return this.isInViewerMode && this.editorMode.disableEditing;
|
324
|
+
}
|
325
|
+
|
317
326
|
get isInConflictResolutionMode(): boolean {
|
318
327
|
return this.mode === EDITOR_MODE.CONFLICT_RESOLUTION;
|
319
328
|
}
|
@@ -413,6 +422,18 @@ export class EditorStore implements CommandRegistrar {
|
|
413
422
|
);
|
414
423
|
},
|
415
424
|
});
|
425
|
+
this.applicationStore.commandService.registerCommand({
|
426
|
+
key: LEGEND_STUDIO_COMMAND_KEY.OPEN_SHOWCASES,
|
427
|
+
trigger: this.createEditorCommandTrigger(
|
428
|
+
() =>
|
429
|
+
this.isInitialized &&
|
430
|
+
(!this.isInConflictResolutionMode ||
|
431
|
+
this.conflictResolutionState.hasResolvedAllConflicts),
|
432
|
+
),
|
433
|
+
action: () => {
|
434
|
+
openShowcaseManager(this.applicationStore);
|
435
|
+
},
|
436
|
+
});
|
416
437
|
this.applicationStore.commandService.registerCommand({
|
417
438
|
key: LEGEND_STUDIO_COMMAND_KEY.TOGGLE_MODEL_LOADER,
|
418
439
|
trigger: this.createEditorCommandTrigger(() => !this.isInViewerMode),
|
@@ -20,13 +20,13 @@ import {
|
|
20
20
|
} from '@finos/legend-application';
|
21
21
|
import {
|
22
22
|
type PackageableElement,
|
23
|
-
|
23
|
+
type SourceInformation,
|
24
24
|
type TextCompilationResult,
|
25
|
+
type GraphManagerOperationReport,
|
26
|
+
GRAPH_MANAGER_EVENT,
|
25
27
|
EngineError,
|
26
28
|
GraphBuilderError,
|
27
|
-
type GraphManagerOperationReport,
|
28
29
|
reportGraphAnalytics,
|
29
|
-
type SourceInformation,
|
30
30
|
} from '@finos/legend-graph';
|
31
31
|
import {
|
32
32
|
type GeneratorFn,
|
@@ -317,7 +317,7 @@ export class NewFlatDataConnectionDriver extends NewConnectionValueDriver<FlatDa
|
|
317
317
|
}
|
318
318
|
}
|
319
319
|
|
320
|
-
const DEFAULT_H2_SQL =
|
320
|
+
export const DEFAULT_H2_SQL =
|
321
321
|
'-- loads sample data for getting started. See https://github.com/pthom/northwind_psql for more info\n call loadNorthwindData()';
|
322
322
|
export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDriver<RelationalDatabaseConnection> {
|
323
323
|
constructor(editorStore: EditorStore) {
|
@@ -121,7 +121,8 @@ export abstract class ElementEditorState extends EditorState {
|
|
121
121
|
});
|
122
122
|
|
123
123
|
this.element = element;
|
124
|
-
this.isReadOnly =
|
124
|
+
this.isReadOnly =
|
125
|
+
isElementReadOnly(element) || editorStore.disableGraphEditing;
|
125
126
|
}
|
126
127
|
|
127
128
|
get label(): string {
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts
CHANGED
@@ -72,6 +72,9 @@ import {
|
|
72
72
|
EngineRuntime,
|
73
73
|
StoreConnections,
|
74
74
|
IdentifiedConnection,
|
75
|
+
getOrCreateGraphPackage,
|
76
|
+
extractElementNameFromPath,
|
77
|
+
extractPackagePathFromPath,
|
75
78
|
} from '@finos/legend-graph';
|
76
79
|
import { GraphEditFormModeState } from '../../../GraphEditFormModeState.js';
|
77
80
|
import { connection_setStore } from '../../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
|
@@ -301,13 +304,14 @@ export interface DatabaseExplorerTreeData
|
|
301
304
|
database: Database;
|
302
305
|
}
|
303
306
|
|
304
|
-
const DEFAULT_DATABASE_PATH = 'store::MyDatabase';
|
307
|
+
export const DEFAULT_DATABASE_PATH = 'store::MyDatabase';
|
305
308
|
|
306
309
|
export class DatabaseSchemaExplorerState {
|
307
310
|
readonly editorStore: EditorStore;
|
308
311
|
readonly connection: RelationalDatabaseConnection;
|
309
|
-
|
312
|
+
database: Database;
|
310
313
|
targetDatabasePath: string;
|
314
|
+
makeTargetDatabasePathEditable?: boolean;
|
311
315
|
|
312
316
|
isGeneratingDatabase = false;
|
313
317
|
isUpdatingDatabase = false;
|
@@ -322,20 +326,24 @@ export class DatabaseSchemaExplorerState {
|
|
322
326
|
makeObservable(this, {
|
323
327
|
isGeneratingDatabase: observable,
|
324
328
|
isUpdatingDatabase: observable,
|
329
|
+
database: observable,
|
325
330
|
treeData: observable,
|
326
331
|
targetDatabasePath: observable,
|
327
332
|
previewer: observable,
|
328
333
|
previewDataState: observable,
|
334
|
+
makeTargetDatabasePathEditable: observable,
|
329
335
|
isCreatingNewDatabase: computed,
|
330
336
|
resolveDatabasePackageAndName: computed,
|
331
337
|
setTreeData: action,
|
332
338
|
setTargetDatabasePath: action,
|
339
|
+
setMakeTargetDatabasePathEditable: action,
|
333
340
|
onNodeSelect: flow,
|
334
341
|
fetchDatabaseMetadata: flow,
|
335
342
|
fetchSchemaMetadata: flow,
|
336
343
|
fetchTableMetadata: flow,
|
337
344
|
generateDatabase: flow,
|
338
345
|
updateDatabase: flow,
|
346
|
+
updateDatabaseAndGraph: flow,
|
339
347
|
previewData: flow,
|
340
348
|
});
|
341
349
|
|
@@ -349,8 +357,12 @@ export class DatabaseSchemaExplorerState {
|
|
349
357
|
return isStubbed_PackageableElement(this.connection.store.value);
|
350
358
|
}
|
351
359
|
|
360
|
+
setMakeTargetDatabasePathEditable(val: boolean): void {
|
361
|
+
this.makeTargetDatabasePathEditable = val;
|
362
|
+
}
|
363
|
+
|
352
364
|
get resolveDatabasePackageAndName(): [string, string] {
|
353
|
-
if (!this.isCreatingNewDatabase) {
|
365
|
+
if (!this.isCreatingNewDatabase && !this.makeTargetDatabasePathEditable) {
|
354
366
|
return [
|
355
367
|
guaranteeNonNullable(this.database.package).path,
|
356
368
|
this.database.name,
|
@@ -799,61 +811,77 @@ export class DatabaseSchemaExplorerState {
|
|
799
811
|
}
|
800
812
|
}
|
801
813
|
|
802
|
-
|
814
|
+
// this method just updates database
|
815
|
+
*updateDatabase(): GeneratorFn<Database> {
|
816
|
+
this.isUpdatingDatabase = true;
|
817
|
+
const graph = this.editorStore.graphManagerState.createNewGraph();
|
818
|
+
(yield this.editorStore.graphManagerState.graphManager.buildGraph(
|
819
|
+
graph,
|
820
|
+
[(yield flowResult(this.generateDatabase())) as Entity],
|
821
|
+
ActionState.create(),
|
822
|
+
)) as Entity[];
|
823
|
+
const database = getNonNullableEntry(
|
824
|
+
graph.ownDatabases,
|
825
|
+
0,
|
826
|
+
'Expected one database to be generated from input',
|
827
|
+
);
|
828
|
+
// remove undefined schemas
|
829
|
+
const schemas = Array.from(
|
830
|
+
guaranteeNonNullable(this.treeData).nodes.values(),
|
831
|
+
)
|
832
|
+
.map((schemaNode) => {
|
833
|
+
if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
834
|
+
return schemaNode.schema;
|
835
|
+
}
|
836
|
+
return undefined;
|
837
|
+
})
|
838
|
+
.filter(isNonNullable);
|
839
|
+
|
840
|
+
// update this.database packge and name
|
841
|
+
this.database.package = getOrCreateGraphPackage(
|
842
|
+
graph,
|
843
|
+
extractPackagePathFromPath(this.targetDatabasePath),
|
844
|
+
undefined,
|
845
|
+
);
|
846
|
+
this.database.name = extractElementNameFromPath(this.targetDatabasePath);
|
847
|
+
this.database.schemas = this.database.schemas.filter((schema) => {
|
848
|
+
if (
|
849
|
+
schemas.find((item) => item.name === schema.name) &&
|
850
|
+
!database.schemas.find((s) => s.name === schema.name)
|
851
|
+
) {
|
852
|
+
return false;
|
853
|
+
}
|
854
|
+
return true;
|
855
|
+
});
|
856
|
+
// update existing schemas
|
857
|
+
database.schemas.forEach((schema) => {
|
858
|
+
(schema as Writable<Schema>)._OWNER = this.database;
|
859
|
+
const currentSchemaIndex = this.database.schemas.findIndex(
|
860
|
+
(item) => item.name === schema.name,
|
861
|
+
);
|
862
|
+
if (currentSchemaIndex !== -1) {
|
863
|
+
this.database.schemas[currentSchemaIndex] = schema;
|
864
|
+
} else {
|
865
|
+
this.database.schemas.push(schema);
|
866
|
+
}
|
867
|
+
});
|
868
|
+
this.isUpdatingDatabase = false;
|
869
|
+
return database;
|
870
|
+
}
|
871
|
+
|
872
|
+
// this method updates database and add database to the graph
|
873
|
+
*updateDatabaseAndGraph(): GeneratorFn<void> {
|
803
874
|
if (!this.treeData) {
|
804
875
|
return;
|
805
876
|
}
|
806
|
-
|
807
877
|
try {
|
808
|
-
this.isUpdatingDatabase = true;
|
809
878
|
const createDatabase =
|
810
879
|
this.isCreatingNewDatabase &&
|
811
880
|
!this.editorStore.graphManagerState.graph.databases.includes(
|
812
881
|
this.database,
|
813
882
|
);
|
814
|
-
|
815
|
-
(yield this.
|
816
|
-
graph,
|
817
|
-
[(yield flowResult(this.generateDatabase())) as Entity],
|
818
|
-
ActionState.create(),
|
819
|
-
)) as Entity[];
|
820
|
-
const database = getNonNullableEntry(
|
821
|
-
graph.ownDatabases,
|
822
|
-
0,
|
823
|
-
'Expected one database to be generated from input',
|
824
|
-
);
|
825
|
-
|
826
|
-
// remove undefined schemas
|
827
|
-
const schemas = Array.from(this.treeData.nodes.values())
|
828
|
-
.map((schemaNode) => {
|
829
|
-
if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
830
|
-
return schemaNode.schema;
|
831
|
-
}
|
832
|
-
return undefined;
|
833
|
-
})
|
834
|
-
.filter(isNonNullable);
|
835
|
-
this.database.schemas = this.database.schemas.filter((schema) => {
|
836
|
-
if (
|
837
|
-
schemas.find((item) => item.name === schema.name) &&
|
838
|
-
!database.schemas.find((s) => s.name === schema.name)
|
839
|
-
) {
|
840
|
-
return false;
|
841
|
-
}
|
842
|
-
return true;
|
843
|
-
});
|
844
|
-
|
845
|
-
// update existing schemas
|
846
|
-
database.schemas.forEach((schema) => {
|
847
|
-
(schema as Writable<Schema>)._OWNER = this.database;
|
848
|
-
const currentSchemaIndex = this.database.schemas.findIndex(
|
849
|
-
(item) => item.name === schema.name,
|
850
|
-
);
|
851
|
-
if (currentSchemaIndex !== -1) {
|
852
|
-
this.database.schemas[currentSchemaIndex] = schema;
|
853
|
-
} else {
|
854
|
-
this.database.schemas.push(schema);
|
855
|
-
}
|
856
|
-
});
|
883
|
+
this.isUpdatingDatabase = true;
|
884
|
+
const database = (yield flowResult(this.updateDatabase())) as Database;
|
857
885
|
if (createDatabase) {
|
858
886
|
connection_setStore(
|
859
887
|
this.connection,
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts
CHANGED
@@ -95,8 +95,7 @@ export class DatabaseBuilderWizardState {
|
|
95
95
|
if (!this.schemaExplorerState.treeData) {
|
96
96
|
return;
|
97
97
|
}
|
98
|
-
|
99
|
-
yield flowResult(this.schemaExplorerState.updateDatabase());
|
98
|
+
yield flowResult(this.schemaExplorerState.updateDatabaseAndGraph());
|
100
99
|
this.setShowModal(false);
|
101
100
|
}
|
102
101
|
}
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts
CHANGED
@@ -25,7 +25,11 @@ import {
|
|
25
25
|
import { observable, action, makeObservable, flow, flowResult } from 'mobx';
|
26
26
|
import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
|
27
27
|
import type { EditorStore } from '../../../EditorStore.js';
|
28
|
-
import {
|
28
|
+
import {
|
29
|
+
type Database,
|
30
|
+
type PureModel,
|
31
|
+
DEFAULT_GENERATION_PACKAGE,
|
32
|
+
} from '@finos/legend-graph';
|
29
33
|
import { EntityChangeType, type EntityChange } from '@finos/legend-server-sdlc';
|
30
34
|
|
31
35
|
export class DatabaseModelBuilderState {
|
@@ -39,16 +43,19 @@ export class DatabaseModelBuilderState {
|
|
39
43
|
generatedGrammarCode = '';
|
40
44
|
entities: Entity[] | undefined;
|
41
45
|
targetPackage: string;
|
46
|
+
graph: PureModel;
|
42
47
|
|
43
48
|
constructor(
|
44
49
|
editorStore: EditorStore,
|
45
50
|
database: Database,
|
46
51
|
isReadOnly: boolean,
|
52
|
+
graph: PureModel,
|
47
53
|
) {
|
48
54
|
makeObservable(this, {
|
49
55
|
showModal: observable,
|
50
56
|
generatedGrammarCode: observable,
|
51
57
|
generatingModelState: observable,
|
58
|
+
graph: observable,
|
52
59
|
saveModelState: observable,
|
53
60
|
targetPackage: observable,
|
54
61
|
close: action,
|
@@ -63,6 +70,7 @@ export class DatabaseModelBuilderState {
|
|
63
70
|
this.database = database;
|
64
71
|
this.isReadOnly = isReadOnly;
|
65
72
|
this.targetPackage = database.package?.path ?? DEFAULT_GENERATION_PACKAGE;
|
73
|
+
this.graph = graph;
|
66
74
|
}
|
67
75
|
|
68
76
|
setShowModal(val: boolean): void {
|
@@ -88,13 +96,13 @@ export class DatabaseModelBuilderState {
|
|
88
96
|
|
89
97
|
*previewDatabaseModels(): GeneratorFn<void> {
|
90
98
|
try {
|
91
|
-
this.generatingModelState.
|
99
|
+
this.generatingModelState.inProgress();
|
92
100
|
this.entities = [];
|
93
101
|
const entities =
|
94
102
|
(yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(
|
95
103
|
this.database.path,
|
96
104
|
this.targetPackage,
|
97
|
-
this.
|
105
|
+
this.graph,
|
98
106
|
)) as Entity[];
|
99
107
|
this.setEntities(entities);
|
100
108
|
this.setDatabaseGrammarCode(
|
@@ -122,11 +130,7 @@ export class DatabaseModelBuilderState {
|
|
122
130
|
const newEntities: EntityChange[] = [];
|
123
131
|
for (const entity of entities) {
|
124
132
|
let entityChangeType: EntityChangeType;
|
125
|
-
if (
|
126
|
-
this.editorStore.graphManagerState.graph.getNullableElement(
|
127
|
-
entity.path,
|
128
|
-
) === undefined
|
129
|
-
) {
|
133
|
+
if (this.graph.getNullableElement(entity.path) === undefined) {
|
130
134
|
entityChangeType = EntityChangeType.CREATE;
|
131
135
|
} else {
|
132
136
|
entityChangeType = EntityChangeType.MODIFY;
|
package/src/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.ts
ADDED
@@ -0,0 +1,23 @@
|
|
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 { EditorState } from '../../editor-state/EditorState.js';
|
18
|
+
|
19
|
+
export enum END_TO_END_WORKFLOWS {
|
20
|
+
CREATE_QUERY_FROM_CONNECTION = 'CREATE_QUERY_FROM_CONNECTION',
|
21
|
+
}
|
22
|
+
|
23
|
+
export abstract class EndToEndWorkflowEditorState extends EditorState {}
|