@finos/legend-application-studio 28.1.2 → 28.1.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__/LegendStudioApplicationNavigationContext.d.ts +1 -0
- package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js +1 -0
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js.map +1 -1
- 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/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +16 -2
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts +23 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts.map +1 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js +45 -0
- package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js.map +1 -0
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js +9 -10
- package/lib/components/editor/editor-group/mapping-editor/MappingTestsExplorer.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +10 -10
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/ExplorerTreeState.d.ts +6 -3
- package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
- package/lib/stores/editor/ExplorerTreeState.js +13 -31
- package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +4 -0
- 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 +42 -7
- 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 +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 +0 -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 +37 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js +111 -0
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +2 -2
- 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 +16 -18
- 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/testable/MappingTestableState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +6 -4
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
- package/package.json +4 -4
- package/src/__lib__/LegendStudioApplicationNavigationContext.ts +1 -0
- package/src/__lib__/LegendStudioEvent.ts +1 -0
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +29 -5
- package/src/components/editor/editor-group/connection-editor/DatabaseModelBuilder.tsx +158 -0
- package/src/components/editor/editor-group/mapping-editor/MappingTestsExplorer.tsx +43 -34
- package/src/components/editor/side-bar/Explorer.tsx +24 -20
- package/src/stores/editor/ExplorerTreeState.ts +19 -50
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +80 -12
- 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 +156 -0
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +21 -20
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +6 -4
- package/tsconfig.json +2 -0
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts
CHANGED
@@ -28,8 +28,17 @@ import {
|
|
28
28
|
ActionState,
|
29
29
|
getNonNullableEntry,
|
30
30
|
guaranteeType,
|
31
|
+
assertNonEmptyString,
|
32
|
+
assertTrue,
|
31
33
|
} from '@finos/legend-shared';
|
32
|
-
import {
|
34
|
+
import {
|
35
|
+
observable,
|
36
|
+
action,
|
37
|
+
makeObservable,
|
38
|
+
flow,
|
39
|
+
flowResult,
|
40
|
+
computed,
|
41
|
+
} from 'mobx';
|
33
42
|
import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
|
34
43
|
import type { EditorStore } from '../../../EditorStore.js';
|
35
44
|
import {
|
@@ -45,8 +54,12 @@ import {
|
|
45
54
|
getSchema,
|
46
55
|
getNullableSchema,
|
47
56
|
getNullableTable,
|
57
|
+
isStubbed_PackageableElement,
|
58
|
+
isValidFullPath,
|
59
|
+
PackageableElementExplicitReference,
|
48
60
|
} from '@finos/legend-graph';
|
49
61
|
import { GraphEditFormModeState } from '../../../GraphEditFormModeState.js';
|
62
|
+
import { connection_setStore } from '../../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
|
50
63
|
|
51
64
|
export abstract class DatabaseSchemaExplorerTreeNodeData
|
52
65
|
implements TreeNodeData
|
@@ -114,10 +127,13 @@ export interface DatabaseExplorerTreeData
|
|
114
127
|
database: Database;
|
115
128
|
}
|
116
129
|
|
130
|
+
const DEFAULT_DATABASE_PATH = 'store::MyDatabase';
|
131
|
+
|
117
132
|
export class DatabaseSchemaExplorerState {
|
118
133
|
readonly editorStore: EditorStore;
|
119
134
|
readonly connection: RelationalDatabaseConnection;
|
120
135
|
readonly database: Database;
|
136
|
+
targetDatabasePath: string;
|
121
137
|
|
122
138
|
isGeneratingDatabase = false;
|
123
139
|
isUpdatingDatabase = false;
|
@@ -131,7 +147,11 @@ export class DatabaseSchemaExplorerState {
|
|
131
147
|
isGeneratingDatabase: observable,
|
132
148
|
isUpdatingDatabase: observable,
|
133
149
|
treeData: observable,
|
150
|
+
targetDatabasePath: observable,
|
151
|
+
isCreatingNewDatabase: computed,
|
152
|
+
resolveDatabasePackageAndName: computed,
|
134
153
|
setTreeData: action,
|
154
|
+
setTargetDatabasePath: action,
|
135
155
|
onNodeSelect: flow,
|
136
156
|
fetchDatabaseMetadata: flow,
|
137
157
|
fetchSchemaMetadata: flow,
|
@@ -143,6 +163,33 @@ export class DatabaseSchemaExplorerState {
|
|
143
163
|
this.connection = connection;
|
144
164
|
this.database = guaranteeType(connection.store.value, Database);
|
145
165
|
this.editorStore = editorStore;
|
166
|
+
this.targetDatabasePath = DEFAULT_DATABASE_PATH;
|
167
|
+
}
|
168
|
+
|
169
|
+
get isCreatingNewDatabase(): boolean {
|
170
|
+
return isStubbed_PackageableElement(this.connection.store.value);
|
171
|
+
}
|
172
|
+
|
173
|
+
get resolveDatabasePackageAndName(): [string, string] {
|
174
|
+
if (!this.isCreatingNewDatabase) {
|
175
|
+
return [
|
176
|
+
guaranteeNonNullable(this.database.package).path,
|
177
|
+
this.database.name,
|
178
|
+
];
|
179
|
+
}
|
180
|
+
assertNonEmptyString(this.targetDatabasePath, 'Must specify database path');
|
181
|
+
assertTrue(
|
182
|
+
isValidFullPath(this.targetDatabasePath),
|
183
|
+
'Invalid database path',
|
184
|
+
);
|
185
|
+
return resolvePackagePathAndElementName(
|
186
|
+
this.targetDatabasePath,
|
187
|
+
this.targetDatabasePath,
|
188
|
+
);
|
189
|
+
}
|
190
|
+
|
191
|
+
setTargetDatabasePath(val: string): void {
|
192
|
+
this.targetDatabasePath = val;
|
146
193
|
}
|
147
194
|
|
148
195
|
setTreeData(builderTreeData?: DatabaseExplorerTreeData): void {
|
@@ -208,9 +255,10 @@ export class DatabaseSchemaExplorerState {
|
|
208
255
|
try {
|
209
256
|
this.isGeneratingDatabase = true;
|
210
257
|
const databaseBuilderInput = new DatabaseBuilderInput(this.connection);
|
258
|
+
const [packagePath, name] = this.resolveDatabasePackageAndName;
|
211
259
|
databaseBuilderInput.targetDatabase = new TargetDatabase(
|
212
|
-
|
213
|
-
|
260
|
+
packagePath,
|
261
|
+
name,
|
214
262
|
);
|
215
263
|
databaseBuilderInput.config.maxTables = undefined;
|
216
264
|
databaseBuilderInput.config.enrichTables = false;
|
@@ -266,9 +314,10 @@ export class DatabaseSchemaExplorerState {
|
|
266
314
|
|
267
315
|
const schema = schemaNode.schema;
|
268
316
|
const databaseBuilderInput = new DatabaseBuilderInput(this.connection);
|
317
|
+
const [packagePath, name] = this.resolveDatabasePackageAndName;
|
269
318
|
databaseBuilderInput.targetDatabase = new TargetDatabase(
|
270
|
-
|
271
|
-
|
319
|
+
packagePath,
|
320
|
+
name,
|
272
321
|
);
|
273
322
|
databaseBuilderInput.config.maxTables = undefined;
|
274
323
|
databaseBuilderInput.config.enrichTables = true;
|
@@ -328,9 +377,7 @@ export class DatabaseSchemaExplorerState {
|
|
328
377
|
this.isGeneratingDatabase = true;
|
329
378
|
|
330
379
|
const databaseBuilderInput = new DatabaseBuilderInput(this.connection);
|
331
|
-
const [packagePath, name] =
|
332
|
-
this.database.path,
|
333
|
-
);
|
380
|
+
const [packagePath, name] = this.resolveDatabasePackageAndName;
|
334
381
|
databaseBuilderInput.targetDatabase = new TargetDatabase(
|
335
382
|
packagePath,
|
336
383
|
name,
|
@@ -414,9 +461,10 @@ export class DatabaseSchemaExplorerState {
|
|
414
461
|
|
415
462
|
const treeData = guaranteeNonNullable(this.treeData);
|
416
463
|
const databaseBuilderInput = new DatabaseBuilderInput(this.connection);
|
464
|
+
const [packagePath, name] = this.resolveDatabasePackageAndName;
|
417
465
|
databaseBuilderInput.targetDatabase = new TargetDatabase(
|
418
|
-
|
419
|
-
|
466
|
+
packagePath,
|
467
|
+
name,
|
420
468
|
);
|
421
469
|
const config = databaseBuilderInput.config;
|
422
470
|
config.maxTables = undefined;
|
@@ -472,7 +520,11 @@ export class DatabaseSchemaExplorerState {
|
|
472
520
|
|
473
521
|
try {
|
474
522
|
this.isUpdatingDatabase = true;
|
475
|
-
|
523
|
+
const createDatabase =
|
524
|
+
this.isCreatingNewDatabase &&
|
525
|
+
!this.editorStore.graphManagerState.graph.databases.includes(
|
526
|
+
this.database,
|
527
|
+
);
|
476
528
|
const graph = this.editorStore.graphManagerState.createNewGraph();
|
477
529
|
(yield this.editorStore.graphManagerState.graphManager.buildGraph(
|
478
530
|
graph,
|
@@ -516,7 +568,23 @@ export class DatabaseSchemaExplorerState {
|
|
516
568
|
this.database.schemas.push(schema);
|
517
569
|
}
|
518
570
|
});
|
519
|
-
|
571
|
+
if (createDatabase) {
|
572
|
+
connection_setStore(
|
573
|
+
this.connection,
|
574
|
+
PackageableElementExplicitReference.create(database),
|
575
|
+
);
|
576
|
+
const packagePath = guaranteeNonNullable(
|
577
|
+
database.package?.name,
|
578
|
+
'Database package is missing',
|
579
|
+
);
|
580
|
+
yield flowResult(
|
581
|
+
this.editorStore.graphEditorMode.addElement(
|
582
|
+
database,
|
583
|
+
packagePath,
|
584
|
+
false,
|
585
|
+
),
|
586
|
+
);
|
587
|
+
}
|
520
588
|
this.editorStore.applicationStore.notificationService.notifySuccess(
|
521
589
|
`Database successfully updated`,
|
522
590
|
);
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts
CHANGED
@@ -23,8 +23,8 @@ import {
|
|
23
23
|
import { observable, action, makeObservable, flow, flowResult } from 'mobx';
|
24
24
|
import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
|
25
25
|
import type { EditorStore } from '../../../EditorStore.js';
|
26
|
-
import { type RelationalDatabaseConnection } from '@finos/legend-graph';
|
27
26
|
import { DatabaseSchemaExplorerState } from './DatabaseBuilderState.js';
|
27
|
+
import type { RelationalDatabaseConnection } from '@finos/legend-graph';
|
28
28
|
|
29
29
|
export class DatabaseBuilderWizardState {
|
30
30
|
readonly editorStore: EditorStore;
|
@@ -70,7 +70,6 @@ export class DatabaseBuilderWizardState {
|
|
70
70
|
if (!this.schemaExplorerState.treeData) {
|
71
71
|
return;
|
72
72
|
}
|
73
|
-
|
74
73
|
try {
|
75
74
|
this.setDatabaseGrammarCode(
|
76
75
|
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts
ADDED
@@ -0,0 +1,156 @@
|
|
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 type { Entity } from '@finos/legend-storage';
|
18
|
+
import {
|
19
|
+
type GeneratorFn,
|
20
|
+
assertErrorThrown,
|
21
|
+
LogEvent,
|
22
|
+
guaranteeNonNullable,
|
23
|
+
ActionState,
|
24
|
+
} from '@finos/legend-shared';
|
25
|
+
import { observable, action, makeObservable, flow, flowResult } from 'mobx';
|
26
|
+
import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
|
27
|
+
import type { EditorStore } from '../../../EditorStore.js';
|
28
|
+
import type { Database } from '@finos/legend-graph';
|
29
|
+
import { EntityChangeType, type EntityChange } from '@finos/legend-server-sdlc';
|
30
|
+
|
31
|
+
export class DatabaseModelBuilderState {
|
32
|
+
readonly editorStore: EditorStore;
|
33
|
+
readonly database: Database;
|
34
|
+
readonly isReadOnly: boolean;
|
35
|
+
generatingModelState = ActionState.create();
|
36
|
+
saveModelState = ActionState.create();
|
37
|
+
|
38
|
+
showModal = false;
|
39
|
+
generatedGrammarCode = '';
|
40
|
+
entities: Entity[] | undefined;
|
41
|
+
|
42
|
+
constructor(
|
43
|
+
editorStore: EditorStore,
|
44
|
+
database: Database,
|
45
|
+
isReadOnly: boolean,
|
46
|
+
) {
|
47
|
+
makeObservable(this, {
|
48
|
+
showModal: observable,
|
49
|
+
generatedGrammarCode: observable,
|
50
|
+
generatingModelState: observable,
|
51
|
+
saveModelState: observable,
|
52
|
+
close: action,
|
53
|
+
setShowModal: action,
|
54
|
+
setEntities: action,
|
55
|
+
setDatabaseGrammarCode: action,
|
56
|
+
saveModels: flow,
|
57
|
+
previewDatabaseModels: flow,
|
58
|
+
});
|
59
|
+
this.editorStore = editorStore;
|
60
|
+
this.database = database;
|
61
|
+
this.isReadOnly = isReadOnly;
|
62
|
+
}
|
63
|
+
|
64
|
+
setShowModal(val: boolean): void {
|
65
|
+
this.showModal = val;
|
66
|
+
}
|
67
|
+
|
68
|
+
setDatabaseGrammarCode(val: string): void {
|
69
|
+
this.generatedGrammarCode = val;
|
70
|
+
}
|
71
|
+
|
72
|
+
setEntities(val: Entity[] | undefined): void {
|
73
|
+
this.entities = val;
|
74
|
+
}
|
75
|
+
|
76
|
+
close(): void {
|
77
|
+
this.setShowModal(false);
|
78
|
+
this.editorStore.explorerTreeState.setDatabaseModelBuilderState(undefined);
|
79
|
+
}
|
80
|
+
|
81
|
+
*previewDatabaseModels(): GeneratorFn<void> {
|
82
|
+
try {
|
83
|
+
this.generatingModelState.isInProgress;
|
84
|
+
this.entities = [];
|
85
|
+
this.setDatabaseGrammarCode('');
|
86
|
+
const entities =
|
87
|
+
(yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(
|
88
|
+
this.database.path,
|
89
|
+
this.editorStore.graphManagerState.graph,
|
90
|
+
)) as Entity[];
|
91
|
+
|
92
|
+
this.setEntities(entities);
|
93
|
+
this.setDatabaseGrammarCode(
|
94
|
+
(yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
|
95
|
+
entities,
|
96
|
+
)) as string,
|
97
|
+
);
|
98
|
+
} catch (error) {
|
99
|
+
assertErrorThrown(error);
|
100
|
+
this.editorStore.applicationStore.logService.error(
|
101
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_MODEL_BUILDER_FAILURE),
|
102
|
+
error,
|
103
|
+
);
|
104
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
105
|
+
} finally {
|
106
|
+
this.generatingModelState.complete();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
*saveModels(): GeneratorFn<void> {
|
111
|
+
try {
|
112
|
+
this.saveModelState.inProgress();
|
113
|
+
const entities = guaranteeNonNullable(this.entities);
|
114
|
+
const newEntities: EntityChange[] = [];
|
115
|
+
for (const entity of entities) {
|
116
|
+
let entityChangeType: EntityChangeType;
|
117
|
+
if (
|
118
|
+
this.editorStore.graphManagerState.graph.getNullableElement(
|
119
|
+
entity.path,
|
120
|
+
) === undefined
|
121
|
+
) {
|
122
|
+
entityChangeType = EntityChangeType.CREATE;
|
123
|
+
} else {
|
124
|
+
entityChangeType = EntityChangeType.MODIFY;
|
125
|
+
}
|
126
|
+
newEntities.push({
|
127
|
+
type: entityChangeType,
|
128
|
+
entityPath: entity.path,
|
129
|
+
content: entity.content,
|
130
|
+
});
|
131
|
+
}
|
132
|
+
this.editorStore.explorerTreeState.setDatabaseModelBuilderState(
|
133
|
+
undefined,
|
134
|
+
);
|
135
|
+
this.setShowModal(false);
|
136
|
+
yield flowResult(
|
137
|
+
this.editorStore.graphState.loadEntityChangesToGraph(
|
138
|
+
newEntities,
|
139
|
+
undefined,
|
140
|
+
),
|
141
|
+
);
|
142
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(
|
143
|
+
'Generated models successfully!',
|
144
|
+
);
|
145
|
+
} catch (error) {
|
146
|
+
assertErrorThrown(error);
|
147
|
+
this.editorStore.applicationStore.logService.error(
|
148
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_MODEL_BUILDER_FAILURE),
|
149
|
+
error,
|
150
|
+
);
|
151
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
152
|
+
} finally {
|
153
|
+
this.saveModelState.complete();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
@@ -622,12 +622,12 @@ export class MappingEditorState extends ElementEditorState {
|
|
622
622
|
mappingExplorerTreeData: TreeData<MappingExplorerTreeNodeData>;
|
623
623
|
newMappingElementSpec?: MappingElementSpec | undefined;
|
624
624
|
|
625
|
+
mappingTestableState: MappingTestableState;
|
626
|
+
|
625
627
|
// DEPREACTED legacy tests: TO REMOVE once mapping testable dev work is complete
|
626
|
-
|
628
|
+
DEPRECATED_mappingTestStates: DEPRECATED__MappingTestState[] = [];
|
627
629
|
isRunningAllTests = false;
|
628
630
|
allTestRunTime = 0;
|
629
|
-
//
|
630
|
-
mappingTestableState: MappingTestableState;
|
631
631
|
|
632
632
|
constructor(editorStore: EditorStore, element: PackageableElement) {
|
633
633
|
super(editorStore, element);
|
@@ -635,7 +635,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
635
635
|
makeObservable<MappingEditorState, 'closeMappingElementTabState'>(this, {
|
636
636
|
currentTabState: observable,
|
637
637
|
openedTabStates: observable,
|
638
|
-
|
638
|
+
DEPRECATED_mappingTestStates: observable,
|
639
639
|
newMappingElementSpec: observable,
|
640
640
|
isRunningAllTests: observable,
|
641
641
|
allTestRunTime: observable,
|
@@ -666,7 +666,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
666
666
|
deleteMappingElement: flow,
|
667
667
|
});
|
668
668
|
|
669
|
-
this.
|
669
|
+
this.DEPRECATED_mappingTestStates = this.mapping.test.map(
|
670
670
|
(t) => new DEPRECATED__MappingTestState(editorStore, t, this),
|
671
671
|
);
|
672
672
|
this.mappingExplorerTreeData = getMappingElementTreeData(
|
@@ -1238,7 +1238,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
1238
1238
|
);
|
1239
1239
|
return this.createMappingElementState(mappingElement);
|
1240
1240
|
} else if (tabState instanceof DEPRECATED__MappingTestState) {
|
1241
|
-
return mappingEditorState.
|
1241
|
+
return mappingEditorState.DEPRECATED_mappingTestStates.find(
|
1242
1242
|
(testState) => testState.test.name === tabState.test.name,
|
1243
1243
|
);
|
1244
1244
|
} else if (tabState instanceof MappingExecutionState) {
|
@@ -1264,7 +1264,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
1264
1264
|
);
|
1265
1265
|
} else if (this.currentTabState instanceof DEPRECATED__MappingTestState) {
|
1266
1266
|
const currentlyOpenedMappingTest =
|
1267
|
-
mappingEditorState.
|
1267
|
+
mappingEditorState.DEPRECATED_mappingTestStates.find(
|
1268
1268
|
(testState) =>
|
1269
1269
|
this.currentTabState instanceof DEPRECATED__MappingTestState &&
|
1270
1270
|
testState.test.name === this.currentTabState.test.name,
|
@@ -1407,7 +1407,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
1407
1407
|
tabState.test === test,
|
1408
1408
|
),
|
1409
1409
|
);
|
1410
|
-
const testState = this.
|
1410
|
+
const testState = this.DEPRECATED_mappingTestStates.find(
|
1411
1411
|
(mappingTestState) => mappingTestState.test === test,
|
1412
1412
|
);
|
1413
1413
|
assertNonNullable(
|
@@ -1442,10 +1442,10 @@ export class MappingEditorState extends ElementEditorState {
|
|
1442
1442
|
}
|
1443
1443
|
|
1444
1444
|
get testSuiteResult(): TEST_RESULT {
|
1445
|
-
const numberOfTestPassed = this.
|
1445
|
+
const numberOfTestPassed = this.DEPRECATED_mappingTestStates.filter(
|
1446
1446
|
(testState) => testState.result === TEST_RESULT.PASSED,
|
1447
1447
|
).length;
|
1448
|
-
const numberOfTestFailed = this.
|
1448
|
+
const numberOfTestFailed = this.DEPRECATED_mappingTestStates.filter(
|
1449
1449
|
(testState) =>
|
1450
1450
|
testState.result === TEST_RESULT.FAILED ||
|
1451
1451
|
testState.result === TEST_RESULT.ERROR,
|
@@ -1461,11 +1461,11 @@ export class MappingEditorState extends ElementEditorState {
|
|
1461
1461
|
try {
|
1462
1462
|
const startTime = Date.now();
|
1463
1463
|
this.isRunningAllTests = true;
|
1464
|
-
this.
|
1464
|
+
this.DEPRECATED_mappingTestStates.forEach((testState) =>
|
1465
1465
|
testState.resetTestRunStatus(),
|
1466
1466
|
);
|
1467
|
-
const input = this.
|
1468
|
-
|
1467
|
+
const input = this.DEPRECATED_mappingTestStates.map(
|
1468
|
+
(testState: DEPRECATED__MappingTestState) => {
|
1469
1469
|
// run non-skip tests, and reset all skipped tests
|
1470
1470
|
if (!testState.isSkipped) {
|
1471
1471
|
testState.setIsRunningTest(true);
|
@@ -1480,8 +1480,8 @@ export class MappingEditorState extends ElementEditorState {
|
|
1480
1480
|
}
|
1481
1481
|
testState.resetTestRunStatus();
|
1482
1482
|
return undefined;
|
1483
|
-
}
|
1484
|
-
|
1483
|
+
},
|
1484
|
+
).filter(isNonNullable);
|
1485
1485
|
yield this.editorStore.graphManagerState.graphManager.DEPRECATED__runLegacyMappingTests(
|
1486
1486
|
input,
|
1487
1487
|
this.mapping,
|
@@ -1505,7 +1505,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
1505
1505
|
}
|
1506
1506
|
|
1507
1507
|
*addTest(test: DEPRECATED__MappingTest): GeneratorFn<void> {
|
1508
|
-
this.
|
1508
|
+
this.DEPRECATED_mappingTestStates.push(
|
1509
1509
|
new DEPRECATED__MappingTestState(this.editorStore, test, this),
|
1510
1510
|
);
|
1511
1511
|
mapping_addDEPRECATEDTest(
|
@@ -1529,9 +1529,10 @@ export class MappingEditorState extends ElementEditorState {
|
|
1529
1529
|
this.openedTabStates = this.openedTabStates.filter(
|
1530
1530
|
(tabState) => !matchMappingTestState(tabState),
|
1531
1531
|
);
|
1532
|
-
this.
|
1533
|
-
(
|
1534
|
-
|
1532
|
+
this.DEPRECATED_mappingTestStates =
|
1533
|
+
this.DEPRECATED_mappingTestStates.filter(
|
1534
|
+
(tabState) => !matchMappingTestState(tabState),
|
1535
|
+
);
|
1535
1536
|
}
|
1536
1537
|
|
1537
1538
|
*createNewTest(setImplementation: SetImplementation): GeneratorFn<void> {
|
@@ -1588,7 +1589,7 @@ export class MappingEditorState extends ElementEditorState {
|
|
1588
1589
|
this.editorStore.changeDetectionState.observerContext,
|
1589
1590
|
);
|
1590
1591
|
// open the test
|
1591
|
-
this.
|
1592
|
+
this.DEPRECATED_mappingTestStates.push(
|
1592
1593
|
new DEPRECATED__MappingTestState(this.editorStore, newTest, this),
|
1593
1594
|
);
|
1594
1595
|
yield flowResult(this.openTest(newTest));
|
package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts
CHANGED
@@ -646,10 +646,12 @@ export class MappingTestableState {
|
|
646
646
|
}
|
647
647
|
|
648
648
|
init(): void {
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
649
|
+
if (!this.selectedTestSuite) {
|
650
|
+
const suite = this.mapping.tests[0];
|
651
|
+
this.selectedTestSuite = suite
|
652
|
+
? this.buildTestSuiteState(suite)
|
653
|
+
: undefined;
|
654
|
+
}
|
653
655
|
}
|
654
656
|
|
655
657
|
openCreateModal(): void {
|
package/tsconfig.json
CHANGED
@@ -97,6 +97,7 @@
|
|
97
97
|
"./src/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.ts",
|
98
98
|
"./src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts",
|
99
99
|
"./src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts",
|
100
|
+
"./src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts",
|
100
101
|
"./src/stores/editor/editor-state/element-editor-state/connection/PostProcessorEditorState.ts",
|
101
102
|
"./src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts",
|
102
103
|
"./src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts",
|
@@ -197,6 +198,7 @@
|
|
197
198
|
"./src/components/editor/editor-group/connection-editor/ConnectionEditor.tsx",
|
198
199
|
"./src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx",
|
199
200
|
"./src/components/editor/editor-group/connection-editor/DatabaseEditorHelper.tsx",
|
201
|
+
"./src/components/editor/editor-group/connection-editor/DatabaseModelBuilder.tsx",
|
200
202
|
"./src/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.tsx",
|
201
203
|
"./src/components/editor/editor-group/connection-editor/FlatDataConnectionEditor.tsx",
|
202
204
|
"./src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx",
|