@finos/legend-application-studio 27.1.1 → 27.1.3
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__/LegendStudioApplicationNavigationContext.d.ts +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js.map +1 -1
- package/lib/__lib__/LegendStudioDocumentation.d.ts +3 -1
- package/lib/__lib__/LegendStudioDocumentation.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioDocumentation.js +3 -0
- package/lib/__lib__/LegendStudioDocumentation.js.map +1 -1
- package/lib/__lib__/LegendStudioTesting.d.ts +1 -0
- package/lib/__lib__/LegendStudioTesting.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioTesting.js +1 -0
- package/lib/__lib__/LegendStudioTesting.js.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +1 -1
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/FunctionEditor.js +29 -25
- package/lib/components/editor/editor-group/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/{DatabaseBuilder.d.ts → DatabaseBuilderWizard.d.ts} +4 -11
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +48 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts +32 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts.map +1 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js +99 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js.map +1 -0
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +1 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js +2 -2
- package/lib/components/editor/editor-group/mapping-editor/MappingEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +47 -12
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.js +61 -11
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.js.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +1 -1
- package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/ClassEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/ClassEditor.js +24 -25
- package/lib/components/editor/editor-group/uml-editor/ClassEditor.js.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/EnumerationEditor.js +2 -2
- package/lib/components/editor/editor-group/uml-editor/EnumerationEditor.js.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/ProfileEditor.js +3 -3
- package/lib/components/editor/editor-group/uml-editor/ProfileEditor.js.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/StereotypeSelector.js +2 -2
- package/lib/components/editor/editor-group/uml-editor/StereotypeSelector.js.map +1 -1
- package/lib/components/editor/editor-group/uml-editor/TaggedValueEditor.js +2 -2
- package/lib/components/editor/editor-group/uml-editor/TaggedValueEditor.js.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts +0 -7
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +20 -77
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +3 -3
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/components/editor/side-bar/ProjectOverview.d.ts.map +1 -1
- package/lib/components/editor/side-bar/ProjectOverview.js +7 -1
- package/lib/components/editor/side-bar/ProjectOverview.js.map +1 -1
- package/lib/components/editor/side-bar/WorkflowManager.d.ts.map +1 -1
- package/lib/components/editor/side-bar/WorkflowManager.js +6 -1
- package/lib/components/editor/side-bar/WorkflowManager.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +3 -3
- package/lib/stores/editor/ExplorerTreeState.d.ts +4 -4
- package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
- package/lib/stores/editor/ExplorerTreeState.js +4 -4
- package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +12 -12
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +46 -47
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +20 -29
- 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 +60 -141
- 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 +33 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +71 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts +6 -2
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +39 -3
- package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts +3 -48
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +1 -1
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js +12 -350
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +1 -1
- package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts +5 -0
- package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts.map +1 -1
- package/lib/stores/editor/sidebar-state/WorkflowManagerState.js +26 -0
- package/lib/stores/editor/sidebar-state/WorkflowManagerState.js.map +1 -1
- package/lib/stores/editor/utils/TestableUtils.js +2 -2
- package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
- package/package.json +10 -10
- package/src/__lib__/LegendStudioApplicationNavigationContext.ts +1 -1
- package/src/__lib__/LegendStudioDocumentation.ts +4 -0
- package/src/__lib__/LegendStudioTesting.ts +1 -0
- package/src/application/LegendStudioApplicationConfig.ts +1 -1
- package/src/components/editor/editor-group/FunctionEditor.tsx +137 -122
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +191 -0
- package/src/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.tsx +227 -0
- package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +1 -1
- package/src/components/editor/editor-group/mapping-editor/MappingEditor.tsx +5 -2
- package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +68 -17
- package/src/components/editor/editor-group/project-configuration-editor/ProjectConfigurationEditor.tsx +137 -12
- package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +0 -1
- package/src/components/editor/editor-group/uml-editor/ClassEditor.tsx +354 -362
- package/src/components/editor/editor-group/uml-editor/EnumerationEditor.tsx +4 -4
- package/src/components/editor/editor-group/uml-editor/ProfileEditor.tsx +7 -7
- package/src/components/editor/editor-group/uml-editor/StereotypeSelector.tsx +4 -4
- package/src/components/editor/editor-group/uml-editor/TaggedValueEditor.tsx +4 -4
- package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +47 -211
- package/src/components/editor/side-bar/Explorer.tsx +3 -3
- package/src/components/editor/side-bar/ProjectOverview.tsx +14 -3
- package/src/components/editor/side-bar/WorkflowManager.tsx +10 -0
- package/src/stores/editor/ExplorerTreeState.ts +6 -9
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +45 -51
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +88 -212
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +102 -0
- package/src/stores/editor/editor-state/element-editor-state/mapping/DEPRECATED__MappingTestState.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +2 -2
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -1
- package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +59 -2
- package/src/stores/editor/panel-group/SQLPlaygroundPanelState.ts +13 -533
- package/src/stores/editor/sidebar-state/WorkflowManagerState.ts +47 -0
- package/src/stores/editor/utils/TestableUtils.ts +2 -2
- package/tsconfig.json +3 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.d.ts.map +0 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js +0 -133
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js.map +0 -1
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilder.tsx +0 -397
@@ -15,8 +15,8 @@
|
|
15
15
|
*/
|
16
16
|
import { EditorState } from '../EditorState.js';
|
17
17
|
import { action, computed, flow, observable, makeObservable, flowResult, } from 'mobx';
|
18
|
-
import { LogEvent, assertErrorThrown, guaranteeNonNullable, hashArray, ActionState, } from '@finos/legend-shared';
|
19
|
-
import { ProjectStructureVersion, UpdateProjectConfigurationCommand, UpdatePlatformConfigurationsCommand, } from '@finos/legend-server-sdlc';
|
18
|
+
import { LogEvent, assertErrorThrown, guaranteeNonNullable, hashArray, ActionState, prettyCONSTName, } from '@finos/legend-shared';
|
19
|
+
import { ProjectStructureVersion, UpdateProjectConfigurationCommand, UpdatePlatformConfigurationsCommand, ProjectType, } from '@finos/legend-server-sdlc';
|
20
20
|
import { LEGEND_STUDIO_APP_EVENT } from '../../../../__lib__/LegendStudioEvent.js';
|
21
21
|
import { SNAPSHOT_ALIAS, StoreProjectData } from '@finos/legend-server-depot';
|
22
22
|
import { ProjectDependencyEditorState } from './ProjectDependencyEditorState.js';
|
@@ -25,7 +25,15 @@ export var CONFIGURATION_EDITOR_TAB;
|
|
25
25
|
CONFIGURATION_EDITOR_TAB["PROJECT_STRUCTURE"] = "PROJECT_STRUCTURE";
|
26
26
|
CONFIGURATION_EDITOR_TAB["PROJECT_DEPENDENCIES"] = "PROJECT_DEPENDENCIES";
|
27
27
|
CONFIGURATION_EDITOR_TAB["PLATFORM_CONFIGURATIONS"] = "PLATFORM_CONFIGURATIONS";
|
28
|
+
CONFIGURATION_EDITOR_TAB["ADVANCED"] = "ADVANCED";
|
28
29
|
})(CONFIGURATION_EDITOR_TAB || (CONFIGURATION_EDITOR_TAB = {}));
|
30
|
+
export const projectTypeTabFilter = (mode, tab) => {
|
31
|
+
if (mode === ProjectType.EMBEDDED &&
|
32
|
+
tab === CONFIGURATION_EDITOR_TAB.PLATFORM_CONFIGURATIONS) {
|
33
|
+
return false;
|
34
|
+
}
|
35
|
+
return true;
|
36
|
+
};
|
29
37
|
export class ProjectConfigurationEditorState extends EditorState {
|
30
38
|
sdlcState;
|
31
39
|
updatingConfigurationState = ActionState.create();
|
@@ -67,6 +75,7 @@ export class ProjectConfigurationEditorState extends EditorState {
|
|
67
75
|
updateToLatestStructure: flow,
|
68
76
|
updateConfigs: flow,
|
69
77
|
fetchLatestProjectStructureVersion: flow,
|
78
|
+
changeProjectType: flow,
|
70
79
|
});
|
71
80
|
this.projectDependencyEditorState = new ProjectDependencyEditorState(this, this.editorStore);
|
72
81
|
this.selectedTab = CONFIGURATION_EDITOR_TAB.PROJECT_STRUCTURE;
|
@@ -108,6 +117,9 @@ export class ProjectConfigurationEditorState extends EditorState {
|
|
108
117
|
get containsSnapshotDependencies() {
|
109
118
|
return Boolean(this.originalProjectConfiguration?.projectDependencies.some((dependency) => dependency.versionId.endsWith(SNAPSHOT_ALIAS)));
|
110
119
|
}
|
120
|
+
get isInEmbeddedMode() {
|
121
|
+
return (this.originalProjectConfiguration?.projectType === ProjectType.EMBEDDED);
|
122
|
+
}
|
111
123
|
*fectchAssociatedProjectsAndVersions() {
|
112
124
|
this.fetchingProjectVersionsState.inProgress();
|
113
125
|
try {
|
@@ -167,7 +179,16 @@ export class ProjectConfigurationEditorState extends EditorState {
|
|
167
179
|
*updateToLatestStructure() {
|
168
180
|
if (this.latestProjectStructureVersion) {
|
169
181
|
try {
|
170
|
-
|
182
|
+
let latestStructure = this.latestProjectStructureVersion;
|
183
|
+
if (this.isInEmbeddedMode) {
|
184
|
+
const projectStructureVersion = new ProjectStructureVersion();
|
185
|
+
projectStructureVersion.version =
|
186
|
+
this.latestProjectStructureVersion.version;
|
187
|
+
// extension version does not exists in embedded mode
|
188
|
+
projectStructureVersion.extensionVersion = undefined;
|
189
|
+
latestStructure = projectStructureVersion;
|
190
|
+
}
|
191
|
+
const updateCommand = new UpdateProjectConfigurationCommand(this.currentProjectConfiguration.groupId, this.currentProjectConfiguration.artifactId, latestStructure, `update project configuration from ${this.editorStore.applicationStore.config.appName}: update to latest project structure`);
|
171
192
|
yield flowResult(this.updateProjectConfiguration(updateCommand));
|
172
193
|
}
|
173
194
|
catch (error) {
|
@@ -177,6 +198,21 @@ export class ProjectConfigurationEditorState extends EditorState {
|
|
177
198
|
}
|
178
199
|
}
|
179
200
|
}
|
201
|
+
*changeProjectType() {
|
202
|
+
try {
|
203
|
+
const newProjectType = this.isInEmbeddedMode
|
204
|
+
? ProjectType.MANAGED
|
205
|
+
: ProjectType.EMBEDDED;
|
206
|
+
const updateCommand = new UpdateProjectConfigurationCommand(this.currentProjectConfiguration.groupId, this.currentProjectConfiguration.artifactId, undefined, `update project configuration from ${this.editorStore.applicationStore.config.appName}: changed project type to ${prettyCONSTName(newProjectType)}`);
|
207
|
+
updateCommand.projectType = newProjectType;
|
208
|
+
yield flowResult(this.updateProjectConfiguration(updateCommand));
|
209
|
+
}
|
210
|
+
catch (error) {
|
211
|
+
assertErrorThrown(error);
|
212
|
+
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE), error);
|
213
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
214
|
+
}
|
215
|
+
}
|
180
216
|
// TODO: we will probably need to remove this in the future when we have a better strategy for change detection and persistence of project config
|
181
217
|
// See https://github.com/finos/legend-studio/issues/952
|
182
218
|
*updateConfigs() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ProjectConfigurationEditorState.js","sourceRoot":"","sources":["../../../../../src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAGL,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,WAAW,
|
1
|
+
{"version":3,"file":"ProjectConfigurationEditorState.js","sourceRoot":"","sources":["../../../../../src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,cAAc,EACd,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAGL,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,uBAAuB,EACvB,iCAAiC,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AC;YACJ,MAAM,UAAU,CACd,IAAI,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,CACnE,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAChD,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,EAC7D,KAAK,CACN,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC1E;gBAAS;YACR,IAAI,CAAC,0BAA0B,CAAC,QAAQ,EAAE,CAAC;YAC3C,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAC7D,SAAS,CACV,CAAC;SACH;IACH,CAAC;IAED,CAAC,kCAAkC;QACjC,IAAI;YACF,IAAI,CAAC,6BAA6B;gBAChC,uBAAuB,CAAC,aAAa,CAAC,QAAQ,CAC5C,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,gCAAgC,EAAE,CAAyC,CACrH,CAAC;SACL;QAAC,OAAO,KAAK,EAAE;YACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAChD,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,EAC7D,KAAK,CACN,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC1E;IACH,CAAC;CACF"}
|
@@ -13,49 +13,19 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import type { TreeData, TreeNodeData } from '@finos/legend-art';
|
17
16
|
import { type GeneratorFn } from '@finos/legend-shared';
|
18
17
|
import { editor as monacoEditorAPI } from 'monaco-editor';
|
19
|
-
import { type
|
18
|
+
import { type Database, type PackageableConnection } from '@finos/legend-graph';
|
20
19
|
import type { EditorStore } from '../EditorStore.js';
|
21
20
|
import type { CommandRegistrar } from '@finos/legend-application';
|
22
|
-
import
|
23
|
-
export declare abstract class DatabaseSchemaExplorerTreeNodeData implements TreeNodeData {
|
24
|
-
isOpen?: boolean | undefined;
|
25
|
-
id: string;
|
26
|
-
label: string;
|
27
|
-
parentId?: string | undefined;
|
28
|
-
childrenIds?: string[] | undefined;
|
29
|
-
isChecked: boolean;
|
30
|
-
constructor(id: string, label: string, parentId: string | undefined);
|
31
|
-
setChecked(val: boolean): void;
|
32
|
-
}
|
33
|
-
export declare class DatabaseSchemaExplorerTreeSchemaNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
34
|
-
schema: Schema;
|
35
|
-
constructor(id: string, schema: Schema);
|
36
|
-
}
|
37
|
-
export declare class DatabaseSchemaExplorerTreeTableNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
38
|
-
parentId: string;
|
39
|
-
owner: Schema;
|
40
|
-
table: Table;
|
41
|
-
constructor(id: string, parentId: string, owner: Schema, table: Table);
|
42
|
-
}
|
43
|
-
export declare class DatabaseSchemaExplorerTreeColumnNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
44
|
-
parentId: string;
|
45
|
-
owner: Table;
|
46
|
-
column: Column;
|
47
|
-
constructor(id: string, parentId: string, owner: Table, column: Column);
|
48
|
-
}
|
49
|
-
export interface DatabaseSchemaExplorerTreeData extends TreeData<DatabaseSchemaExplorerTreeNodeData> {
|
50
|
-
database: Database;
|
51
|
-
}
|
21
|
+
import { DatabaseSchemaExplorerState } from '../editor-state/element-editor-state/connection/DatabaseBuilderState.js';
|
52
22
|
export declare class SQLPlaygroundPanelState implements CommandRegistrar {
|
53
23
|
readonly editorStore: EditorStore;
|
54
24
|
isFetchingSchema: boolean;
|
55
25
|
isExecutingRawSQL: boolean;
|
56
26
|
connection?: PackageableConnection | undefined;
|
57
27
|
database?: Database | undefined;
|
58
|
-
|
28
|
+
schemaExplorerState?: DatabaseSchemaExplorerState | undefined;
|
59
29
|
readonly sqlEditorTextModel: monacoEditorAPI.ITextModel;
|
60
30
|
sqlEditor?: monacoEditorAPI.IStandaloneCodeEditor | undefined;
|
61
31
|
sqlEditorViewState?: monacoEditorAPI.ICodeEditorViewState | undefined;
|
@@ -64,7 +34,6 @@ export declare class SQLPlaygroundPanelState implements CommandRegistrar {
|
|
64
34
|
isBuildingDatabase: boolean;
|
65
35
|
isUpdatingDatabase: boolean;
|
66
36
|
constructor(editorStore: EditorStore);
|
67
|
-
setTreeData(val?: DatabaseSchemaExplorerTreeData): void;
|
68
37
|
setConnection(val: PackageableConnection | undefined): void;
|
69
38
|
setSQLText(val: string): void;
|
70
39
|
setSQLEditor(val: monacoEditorAPI.IStandaloneCodeEditor | undefined): void;
|
@@ -72,20 +41,6 @@ export declare class SQLPlaygroundPanelState implements CommandRegistrar {
|
|
72
41
|
setSQLEditorViewState(val: monacoEditorAPI.ICodeEditorViewState | undefined): void;
|
73
42
|
registerCommands(): void;
|
74
43
|
deregisterCommands(): void;
|
75
|
-
onNodeSelect(node: DatabaseSchemaExplorerTreeNodeData, treeData: DatabaseSchemaExplorerTreeData): GeneratorFn<void>;
|
76
|
-
getChildNodes(node: DatabaseSchemaExplorerTreeNodeData, treeData: DatabaseSchemaExplorerTreeData): DatabaseSchemaExplorerTreeNodeData[] | undefined;
|
77
|
-
toggleCheckedNode(node: DatabaseSchemaExplorerTreeNodeData, treeData: DatabaseSchemaExplorerTreeData): void;
|
78
|
-
fetchDatabaseMetadata(): GeneratorFn<void>;
|
79
|
-
fetchSchemaMetadata(schemaNode: DatabaseSchemaExplorerTreeSchemaNodeData, treeData: DatabaseSchemaExplorerTreeData): GeneratorFn<void>;
|
80
|
-
fetchTableMetadata(tableNode: DatabaseSchemaExplorerTreeTableNodeData, treeData: DatabaseSchemaExplorerTreeData): GeneratorFn<void>;
|
81
|
-
/**
|
82
|
-
* This will build the intermediate database from the specified
|
83
|
-
* schema exploration input; this information can be further used
|
84
|
-
* to enrich the explorer tree
|
85
|
-
*/
|
86
|
-
private buildIntermediateDatabase;
|
87
44
|
executeRawSQL(): GeneratorFn<void>;
|
88
|
-
generateDatabase(): GeneratorFn<Entity>;
|
89
|
-
updateDatabase(): GeneratorFn<void>;
|
90
45
|
}
|
91
46
|
//# sourceMappingURL=SQLPlaygroundPanelState.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SQLPlaygroundPanelState.d.ts","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/SQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
1
|
+
{"version":3,"file":"SQLPlaygroundPanelState.d.ts","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/SQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAG3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yEAAyE,CAAC;AAItH,qBAAa,uBAAwB,YAAW,gBAAgB;IAC9D,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAElC,gBAAgB,UAAS;IACzB,iBAAiB,UAAS;IAE1B,UAAU,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,mBAAmB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAE9D,QAAQ,CAAC,kBAAkB,EAAE,eAAe,CAAC,UAAU,CAAC;IACxD,SAAS,CAAC,EAAE,eAAe,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAC9D,kBAAkB,CAAC,EAAE,eAAe,CAAC,oBAAoB,GAAG,SAAS,CAAC;IACtE,OAAO,SAAoB;IAC3B,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC,kBAAkB,UAAS;IAC3B,kBAAkB,UAAS;gBAEf,WAAW,EAAE,WAAW;IA0BpC,aAAa,CAAC,GAAG,EAAE,qBAAqB,GAAG,SAAS,GAAG,IAAI;IAgB3D,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,YAAY,CAAC,GAAG,EAAE,eAAe,CAAC,qBAAqB,GAAG,SAAS,GAAG,IAAI;IAW1E,QAAQ,IAAI,IAAI;IAMhB,qBAAqB,CACnB,GAAG,EAAE,eAAe,CAAC,oBAAoB,GAAG,SAAS,GACpD,IAAI;IAIP,gBAAgB,IAAI,IAAI;IAgBxB,kBAAkB,IAAI,IAAI;IAOzB,aAAa,IAAI,WAAW,CAAC,IAAI,CAAC;CAkCpC"}
|
@@ -13,66 +13,14 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { assertErrorThrown, LogEvent,
|
16
|
+
import { assertErrorThrown, LogEvent, getNullableLastEntry, } from '@finos/legend-shared';
|
17
17
|
import { observable, makeObservable, flow, flowResult, action } from 'mobx';
|
18
18
|
import { editor as monacoEditorAPI } from 'monaco-editor';
|
19
|
-
import {
|
20
|
-
import { LEGEND_STUDIO_APP_EVENT } from '../../../__lib__/LegendStudioEvent.js';
|
19
|
+
import { guaranteeRelationalDatabaseConnection, GRAPH_MANAGER_EVENT, } from '@finos/legend-graph';
|
21
20
|
import { CODE_EDITOR_LANGUAGE, moveCursorToPosition, } from '@finos/legend-lego/code-editor';
|
22
21
|
import { STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY } from '../../../__lib__/STO_Relational_LegendStudioCommand.js';
|
23
22
|
import { PANEL_MODE } from '../EditorConfig.js';
|
24
|
-
import {
|
25
|
-
export class DatabaseSchemaExplorerTreeNodeData {
|
26
|
-
isOpen;
|
27
|
-
id;
|
28
|
-
label;
|
29
|
-
parentId;
|
30
|
-
childrenIds;
|
31
|
-
isChecked = false;
|
32
|
-
constructor(id, label, parentId) {
|
33
|
-
makeObservable(this, {
|
34
|
-
isChecked: observable,
|
35
|
-
setChecked: action,
|
36
|
-
});
|
37
|
-
this.id = id;
|
38
|
-
this.label = label;
|
39
|
-
this.parentId = parentId;
|
40
|
-
}
|
41
|
-
setChecked(val) {
|
42
|
-
this.isChecked = val;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
export class DatabaseSchemaExplorerTreeSchemaNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
46
|
-
schema;
|
47
|
-
constructor(id, schema) {
|
48
|
-
super(id, schema.name, undefined);
|
49
|
-
this.schema = schema;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
export class DatabaseSchemaExplorerTreeTableNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
53
|
-
parentId;
|
54
|
-
owner;
|
55
|
-
table;
|
56
|
-
constructor(id, parentId, owner, table) {
|
57
|
-
super(id, table.name, parentId);
|
58
|
-
this.parentId = parentId;
|
59
|
-
this.owner = owner;
|
60
|
-
this.table = table;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
export class DatabaseSchemaExplorerTreeColumnNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
64
|
-
parentId;
|
65
|
-
owner;
|
66
|
-
column;
|
67
|
-
constructor(id, parentId, owner, column) {
|
68
|
-
super(id, column.name, parentId);
|
69
|
-
this.parentId = parentId;
|
70
|
-
this.owner = owner;
|
71
|
-
this.column = column;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
const DUMMY_DATABASE_PACKAGE = 'dummy';
|
75
|
-
const DUMMY_DATABASE_NAME = 'DummyDB';
|
23
|
+
import { DatabaseSchemaExplorerState } from '../editor-state/element-editor-state/connection/DatabaseBuilderState.js';
|
76
24
|
const DEFAULT_SQL_TEXT = `--Start building your SQL. Note that you can also drag-and-drop nodes from schema explorer\n`;
|
77
25
|
export class SQLPlaygroundPanelState {
|
78
26
|
editorStore;
|
@@ -80,7 +28,7 @@ export class SQLPlaygroundPanelState {
|
|
80
28
|
isExecutingRawSQL = false;
|
81
29
|
connection;
|
82
30
|
database;
|
83
|
-
|
31
|
+
schemaExplorerState;
|
84
32
|
sqlEditorTextModel;
|
85
33
|
sqlEditor;
|
86
34
|
sqlEditorViewState;
|
@@ -94,37 +42,31 @@ export class SQLPlaygroundPanelState {
|
|
94
42
|
isExecutingRawSQL: observable,
|
95
43
|
connection: observable,
|
96
44
|
database: observable,
|
97
|
-
|
45
|
+
schemaExplorerState: observable,
|
98
46
|
sqlText: observable,
|
99
47
|
resetSQL: action,
|
100
48
|
sqlExecutionResult: observable,
|
101
49
|
sqlEditor: observable.ref,
|
102
50
|
sqlEditorViewState: observable.ref,
|
103
|
-
isBuildingDatabase: observable,
|
104
|
-
isUpdatingDatabase: observable,
|
105
|
-
setTreeData: action,
|
106
51
|
setConnection: action,
|
107
52
|
setSQLEditor: action,
|
108
53
|
setSQLEditorViewState: action,
|
109
54
|
setSQLText: action,
|
110
|
-
onNodeSelect: flow,
|
111
|
-
fetchDatabaseMetadata: flow,
|
112
|
-
fetchSchemaMetadata: flow,
|
113
|
-
fetchTableMetadata: flow,
|
114
55
|
executeRawSQL: flow,
|
115
|
-
generateDatabase: flow,
|
116
|
-
updateDatabase: flow,
|
117
56
|
});
|
118
57
|
this.editorStore = editorStore;
|
119
58
|
this.sqlEditorTextModel = monacoEditorAPI.createModel(this.sqlText, CODE_EDITOR_LANGUAGE.SQL);
|
120
59
|
}
|
121
|
-
setTreeData(val) {
|
122
|
-
this.treeData = val;
|
123
|
-
}
|
124
60
|
setConnection(val) {
|
125
61
|
this.connection = val;
|
126
62
|
if (val) {
|
127
|
-
|
63
|
+
const connection = guaranteeRelationalDatabaseConnection(val);
|
64
|
+
this.database = connection.store.value;
|
65
|
+
this.schemaExplorerState = new DatabaseSchemaExplorerState(this.editorStore, connection);
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
this.database = undefined;
|
69
|
+
this.schemaExplorerState = undefined;
|
128
70
|
}
|
129
71
|
this.sqlEditorTextModel.setValue(DEFAULT_SQL_TEXT);
|
130
72
|
}
|
@@ -164,189 +106,6 @@ export class SQLPlaygroundPanelState {
|
|
164
106
|
deregisterCommands() {
|
165
107
|
[STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY.SQL_PLAYGROUND_EXECUTE].forEach((key) => this.editorStore.applicationStore.commandService.deregisterCommand(key));
|
166
108
|
}
|
167
|
-
*onNodeSelect(node, treeData) {
|
168
|
-
if (node instanceof DatabaseSchemaExplorerTreeSchemaNodeData &&
|
169
|
-
!node.childrenIds) {
|
170
|
-
yield flowResult(this.fetchSchemaMetadata(node, treeData));
|
171
|
-
}
|
172
|
-
else if (node instanceof DatabaseSchemaExplorerTreeTableNodeData &&
|
173
|
-
!node.childrenIds) {
|
174
|
-
yield flowResult(this.fetchTableMetadata(node, treeData));
|
175
|
-
}
|
176
|
-
node.isOpen = !node.isOpen;
|
177
|
-
this.setTreeData({ ...treeData });
|
178
|
-
}
|
179
|
-
getChildNodes(node, treeData) {
|
180
|
-
return node.childrenIds
|
181
|
-
?.map((childNode) => treeData.nodes.get(childNode))
|
182
|
-
.filter(isNonNullable);
|
183
|
-
}
|
184
|
-
toggleCheckedNode(node, treeData) {
|
185
|
-
node.setChecked(!node.isChecked);
|
186
|
-
if (node instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
187
|
-
this.getChildNodes(node, treeData)?.forEach((childNode) => {
|
188
|
-
childNode.setChecked(node.isChecked);
|
189
|
-
});
|
190
|
-
}
|
191
|
-
else if (node instanceof DatabaseSchemaExplorerTreeTableNodeData) {
|
192
|
-
if (node.parentId) {
|
193
|
-
const parent = treeData.nodes.get(node.parentId);
|
194
|
-
if (parent &&
|
195
|
-
this.getChildNodes(parent, treeData)?.every((e) => e.isChecked === node.isChecked)) {
|
196
|
-
parent.setChecked(node.isChecked);
|
197
|
-
}
|
198
|
-
}
|
199
|
-
}
|
200
|
-
// TODO: support toggling check for columns
|
201
|
-
this.setTreeData({ ...treeData });
|
202
|
-
}
|
203
|
-
*fetchDatabaseMetadata() {
|
204
|
-
if (!this.connection) {
|
205
|
-
return;
|
206
|
-
}
|
207
|
-
try {
|
208
|
-
this.isFetchingSchema = true;
|
209
|
-
const databaseBuilderInput = new DatabaseBuilderInput(guaranteeRelationalDatabaseConnection(this.connection));
|
210
|
-
databaseBuilderInput.targetDatabase = new TargetDatabase(DUMMY_DATABASE_PACKAGE, DUMMY_DATABASE_NAME);
|
211
|
-
databaseBuilderInput.config.maxTables = undefined;
|
212
|
-
databaseBuilderInput.config.enrichTables = false;
|
213
|
-
databaseBuilderInput.config.patterns = [
|
214
|
-
new DatabasePattern(undefined, undefined),
|
215
|
-
];
|
216
|
-
const database = (yield this.buildIntermediateDatabase(databaseBuilderInput));
|
217
|
-
const rootIds = [];
|
218
|
-
const nodes = new Map();
|
219
|
-
database.schemas
|
220
|
-
.slice()
|
221
|
-
.sort((schemaA, schemaB) => schemaA.name.localeCompare(schemaB.name))
|
222
|
-
.forEach((dbSchema) => {
|
223
|
-
const schemaId = dbSchema.name;
|
224
|
-
rootIds.push(schemaId);
|
225
|
-
const schemaNode = new DatabaseSchemaExplorerTreeSchemaNodeData(schemaId, dbSchema);
|
226
|
-
nodes.set(schemaId, schemaNode);
|
227
|
-
schemaNode.setChecked(Boolean(this.database?.schemas.find((schema) => schema.name === dbSchema.name)));
|
228
|
-
});
|
229
|
-
const treeData = { rootIds, nodes, database };
|
230
|
-
this.setTreeData(treeData);
|
231
|
-
}
|
232
|
-
catch (error) {
|
233
|
-
assertErrorThrown(error);
|
234
|
-
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_BUILDER_FAILURE), error);
|
235
|
-
this.editorStore.applicationStore.notificationService.notifyError(error);
|
236
|
-
}
|
237
|
-
finally {
|
238
|
-
this.isFetchingSchema = false;
|
239
|
-
}
|
240
|
-
}
|
241
|
-
*fetchSchemaMetadata(schemaNode, treeData) {
|
242
|
-
if (!this.connection) {
|
243
|
-
return;
|
244
|
-
}
|
245
|
-
try {
|
246
|
-
this.isFetchingSchema = true;
|
247
|
-
const schema = schemaNode.schema;
|
248
|
-
const databaseBuilderInput = new DatabaseBuilderInput(guaranteeRelationalDatabaseConnection(this.connection));
|
249
|
-
databaseBuilderInput.targetDatabase = new TargetDatabase(DUMMY_DATABASE_PACKAGE, DUMMY_DATABASE_NAME);
|
250
|
-
databaseBuilderInput.config.maxTables = undefined;
|
251
|
-
databaseBuilderInput.config.enrichTables = true;
|
252
|
-
databaseBuilderInput.config.patterns = [
|
253
|
-
new DatabasePattern(schema.name, undefined),
|
254
|
-
];
|
255
|
-
const database = (yield this.buildIntermediateDatabase(databaseBuilderInput));
|
256
|
-
const tables = getSchema(database, schema.name).tables;
|
257
|
-
const childrenIds = schemaNode.childrenIds ?? [];
|
258
|
-
schema.tables = tables;
|
259
|
-
tables
|
260
|
-
.slice()
|
261
|
-
.sort((tableA, tableB) => tableA.name.localeCompare(tableB.name))
|
262
|
-
.forEach((table) => {
|
263
|
-
table.schema = schema;
|
264
|
-
const tableId = `${schema.name}.${table.name}`;
|
265
|
-
const tableNode = new DatabaseSchemaExplorerTreeTableNodeData(tableId, schemaNode.id, schema, table);
|
266
|
-
treeData.nodes.set(tableId, tableNode);
|
267
|
-
addUniqueEntry(childrenIds, tableId);
|
268
|
-
if (this.database) {
|
269
|
-
const matchingSchema = getNullableSchema(this.database, schema.name);
|
270
|
-
tableNode.setChecked(Boolean(matchingSchema
|
271
|
-
? getNullableTable(matchingSchema, table.name)
|
272
|
-
: undefined));
|
273
|
-
}
|
274
|
-
else {
|
275
|
-
tableNode.setChecked(false);
|
276
|
-
}
|
277
|
-
});
|
278
|
-
schemaNode.childrenIds = childrenIds;
|
279
|
-
this.setTreeData({ ...treeData });
|
280
|
-
}
|
281
|
-
catch (error) {
|
282
|
-
assertErrorThrown(error);
|
283
|
-
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_BUILDER_FAILURE), error);
|
284
|
-
this.editorStore.applicationStore.notificationService.notifyError(error);
|
285
|
-
}
|
286
|
-
finally {
|
287
|
-
this.isFetchingSchema = false;
|
288
|
-
}
|
289
|
-
}
|
290
|
-
*fetchTableMetadata(tableNode, treeData) {
|
291
|
-
if (!this.connection) {
|
292
|
-
return;
|
293
|
-
}
|
294
|
-
try {
|
295
|
-
this.isFetchingSchema = true;
|
296
|
-
const table = tableNode.table;
|
297
|
-
const databaseBuilderInput = new DatabaseBuilderInput(guaranteeRelationalDatabaseConnection(this.connection));
|
298
|
-
databaseBuilderInput.targetDatabase = new TargetDatabase(DUMMY_DATABASE_PACKAGE, DUMMY_DATABASE_NAME);
|
299
|
-
const config = databaseBuilderInput.config;
|
300
|
-
config.maxTables = undefined;
|
301
|
-
config.enrichTables = true;
|
302
|
-
config.enrichColumns = true;
|
303
|
-
config.enrichPrimaryKeys = true;
|
304
|
-
config.patterns = [new DatabasePattern(table.schema.name, table.name)];
|
305
|
-
const database = (yield this.buildIntermediateDatabase(databaseBuilderInput));
|
306
|
-
const enrichedTable = database.schemas
|
307
|
-
.find((schema) => table.schema.name === schema.name)
|
308
|
-
?.tables.find((t) => t.name === table.name);
|
309
|
-
if (enrichedTable) {
|
310
|
-
table.primaryKey = enrichedTable.primaryKey;
|
311
|
-
const columns = enrichedTable.columns.filter(filterByType(Column));
|
312
|
-
tableNode.table.columns = columns;
|
313
|
-
tableNode.childrenIds?.forEach((c) => treeData.nodes.delete(c));
|
314
|
-
tableNode.childrenIds = undefined;
|
315
|
-
const childrenIds = [];
|
316
|
-
const tableId = tableNode.id;
|
317
|
-
columns
|
318
|
-
.slice()
|
319
|
-
.sort((colA, colB) => colA.name.localeCompare(colB.name))
|
320
|
-
.forEach((col) => {
|
321
|
-
const columnId = `${tableId}.${col.name}`;
|
322
|
-
const columnNode = new DatabaseSchemaExplorerTreeColumnNodeData(columnId, tableId, table, col);
|
323
|
-
col.owner = tableNode.table;
|
324
|
-
treeData.nodes.set(columnId, columnNode);
|
325
|
-
addUniqueEntry(childrenIds, columnId);
|
326
|
-
});
|
327
|
-
tableNode.childrenIds = childrenIds;
|
328
|
-
}
|
329
|
-
}
|
330
|
-
catch (error) {
|
331
|
-
assertErrorThrown(error);
|
332
|
-
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_BUILDER_FAILURE), error);
|
333
|
-
this.editorStore.applicationStore.notificationService.notifyError(error);
|
334
|
-
}
|
335
|
-
finally {
|
336
|
-
this.isFetchingSchema = false;
|
337
|
-
}
|
338
|
-
}
|
339
|
-
/**
|
340
|
-
* This will build the intermediate database from the specified
|
341
|
-
* schema exploration input; this information can be further used
|
342
|
-
* to enrich the explorer tree
|
343
|
-
*/
|
344
|
-
async buildIntermediateDatabase(input) {
|
345
|
-
const entities = await this.editorStore.graphManagerState.graphManager.buildDatabase(input);
|
346
|
-
const graph = this.editorStore.graphManagerState.createNewGraph();
|
347
|
-
await this.editorStore.graphManagerState.graphManager.buildGraph(graph, entities, ActionState.create());
|
348
|
-
return getNonNullableEntry(graph.ownDatabases, 0, 'Expected one database to be generated from input');
|
349
|
-
}
|
350
109
|
*executeRawSQL() {
|
351
110
|
if (!this.connection || this.isExecutingRawSQL) {
|
352
111
|
return;
|
@@ -373,102 +132,5 @@ export class SQLPlaygroundPanelState {
|
|
373
132
|
this.isExecutingRawSQL = false;
|
374
133
|
}
|
375
134
|
}
|
376
|
-
*generateDatabase() {
|
377
|
-
if (!this.database || !this.connection || !this.treeData) {
|
378
|
-
throw new IllegalStateError(`Can't build database: builder is not properly set up`);
|
379
|
-
}
|
380
|
-
try {
|
381
|
-
this.isBuildingDatabase = true;
|
382
|
-
const treeData = this.treeData;
|
383
|
-
const databaseBuilderInput = new DatabaseBuilderInput(guaranteeRelationalDatabaseConnection(this.connection));
|
384
|
-
const packagePath = guaranteeNonNullable(this.database.package).path;
|
385
|
-
const databaseName = this.database.name;
|
386
|
-
databaseBuilderInput.targetDatabase = new TargetDatabase(packagePath, databaseName);
|
387
|
-
const config = databaseBuilderInput.config;
|
388
|
-
config.maxTables = undefined;
|
389
|
-
config.enrichTables = true;
|
390
|
-
config.enrichColumns = true;
|
391
|
-
config.enrichPrimaryKeys = true;
|
392
|
-
treeData.rootIds
|
393
|
-
.map((e) => treeData.nodes.get(e))
|
394
|
-
.filter(isNonNullable)
|
395
|
-
.forEach((schemaNode) => {
|
396
|
-
if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
397
|
-
const tableNodes = this.getChildNodes(schemaNode, treeData);
|
398
|
-
const allChecked = tableNodes?.every((t) => t.isChecked === true);
|
399
|
-
if (allChecked ||
|
400
|
-
(schemaNode.isChecked && !schemaNode.childrenIds)) {
|
401
|
-
config.patterns.push(new DatabasePattern(schemaNode.schema.name, undefined));
|
402
|
-
}
|
403
|
-
else {
|
404
|
-
tableNodes?.forEach((t) => {
|
405
|
-
if (t instanceof DatabaseSchemaExplorerTreeTableNodeData &&
|
406
|
-
t.isChecked) {
|
407
|
-
config.patterns.push(new DatabasePattern(schemaNode.schema.name, t.table.name));
|
408
|
-
}
|
409
|
-
});
|
410
|
-
}
|
411
|
-
}
|
412
|
-
});
|
413
|
-
const entities = (yield this.editorStore.graphManagerState.graphManager.buildDatabase(databaseBuilderInput));
|
414
|
-
return getNonNullableEntry(entities, 0, 'Expected a database to be generated');
|
415
|
-
}
|
416
|
-
finally {
|
417
|
-
this.isBuildingDatabase = false;
|
418
|
-
}
|
419
|
-
}
|
420
|
-
*updateDatabase() {
|
421
|
-
if (!this.treeData || !this.database || !this.connection) {
|
422
|
-
return;
|
423
|
-
}
|
424
|
-
try {
|
425
|
-
this.isUpdatingDatabase = true;
|
426
|
-
const graph = this.editorStore.graphManagerState.createNewGraph();
|
427
|
-
(yield this.editorStore.graphManagerState.graphManager.buildGraph(graph, [(yield flowResult(this.generateDatabase()))], ActionState.create()));
|
428
|
-
const generatedDatabase = getNonNullableEntry(graph.ownDatabases, 0, 'Expected one database to be generated from input');
|
429
|
-
const currentDatabase = this.database;
|
430
|
-
// remove undefined schemas
|
431
|
-
const schemas = Array.from(this.treeData.nodes.values())
|
432
|
-
.map((schemaNode) => {
|
433
|
-
if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
434
|
-
return schemaNode.schema;
|
435
|
-
}
|
436
|
-
return undefined;
|
437
|
-
})
|
438
|
-
.filter(isNonNullable);
|
439
|
-
currentDatabase.schemas = currentDatabase.schemas.filter((schema) => {
|
440
|
-
if (schemas.find((item) => item.name === schema.name) &&
|
441
|
-
!generatedDatabase.schemas.find((s) => s.name === schema.name)) {
|
442
|
-
return false;
|
443
|
-
}
|
444
|
-
return true;
|
445
|
-
});
|
446
|
-
// update existing schemas
|
447
|
-
generatedDatabase.schemas.forEach((schema) => {
|
448
|
-
schema._OWNER = currentDatabase;
|
449
|
-
const currentSchemaIndex = currentDatabase.schemas.findIndex((item) => item.name === schema.name);
|
450
|
-
if (currentSchemaIndex !== -1) {
|
451
|
-
currentDatabase.schemas[currentSchemaIndex] = schema;
|
452
|
-
}
|
453
|
-
else {
|
454
|
-
currentDatabase.schemas.push(schema);
|
455
|
-
}
|
456
|
-
});
|
457
|
-
this.editorStore.applicationStore.notificationService.notifySuccess(`Database successfully updated`);
|
458
|
-
yield flowResult(this.editorStore
|
459
|
-
.getGraphEditorMode(GraphEditFormModeState)
|
460
|
-
.globalCompile({
|
461
|
-
message: `Can't compile graph after editing database. Redirecting you to text mode`,
|
462
|
-
}));
|
463
|
-
}
|
464
|
-
catch (error) {
|
465
|
-
assertErrorThrown(error);
|
466
|
-
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_BUILDER_FAILURE), error);
|
467
|
-
this.editorStore.applicationStore.notificationService.notifyError(error);
|
468
|
-
}
|
469
|
-
finally {
|
470
|
-
this.isUpdatingDatabase = false;
|
471
|
-
}
|
472
|
-
}
|
473
135
|
}
|
474
136
|
//# sourceMappingURL=SQLPlaygroundPanelState.js.map
|