@finos/legend-application-studio 27.0.0 → 27.1.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__/LegendStudioApplicationNavigationContext.d.ts +9 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js +11 -1
- 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/application/LegendStudioApplicationConfig.d.ts +6 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +7 -0
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/ElementIconUtils.d.ts.map +1 -1
- package/lib/components/ElementIconUtils.js +3 -1
- package/lib/components/ElementIconUtils.js.map +1 -1
- package/lib/components/editor/editor-group/ModelImporter.d.ts.map +1 -1
- package/lib/components/editor/editor-group/ModelImporter.js +1 -0
- package/lib/components/editor/editor-group/ModelImporter.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js +8 -10
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js.map +1 -1
- package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js +10 -4
- package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +65 -12
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js +3 -0
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js +3 -0
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js +3 -0
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts +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 +101 -137
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/NewMappingElementModal.js +1 -2
- package/lib/components/editor/editor-group/mapping-editor/NewMappingElementModal.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +9 -4
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +11 -0
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +27 -2
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +38 -6
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts +3 -0
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +43 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +10 -0
- package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.js +1 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +10 -2
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts +0 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +43 -10
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +0 -1
- 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 +26 -30
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts +14 -19
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js +30 -65
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +4 -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 +5 -1
- 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 +56 -78
- 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 +285 -384
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +23 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +129 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +12 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js +15 -8
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts +7 -4
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js +53 -10
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +2 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +20 -16
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts +9 -0
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +1 -1
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js +149 -3
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js +3 -0
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
- package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/MockDataUtils.js +3 -0
- package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +2 -5
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +2 -6
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/lib/stores/editor/utils/TestableUtils.d.ts +11 -1
- package/lib/stores/editor/utils/TestableUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/TestableUtils.js +50 -1
- package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -4
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js +4 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
- package/package.json +6 -6
- package/src/__lib__/LegendStudioApplicationNavigationContext.ts +12 -1
- package/src/__lib__/LegendStudioEvent.ts +1 -1
- package/src/application/LegendStudioApplicationConfig.ts +8 -0
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/editor/editor-group/ModelImporter.tsx +4 -0
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilder.tsx +12 -13
- package/src/components/editor/editor-group/data-editor/EmbeddedDataEditor.tsx +45 -38
- package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +140 -31
- package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.tsx +7 -0
- package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.tsx +6 -0
- package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.tsx +6 -0
- package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +296 -414
- package/src/components/editor/editor-group/mapping-editor/NewMappingElementModal.tsx +1 -1
- package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +12 -7
- package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +88 -3
- package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +104 -18
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +111 -1
- package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +10 -0
- package/src/stores/editor/EditorGraphState.ts +1 -1
- package/src/stores/editor/EditorStore.ts +29 -17
- package/src/stores/editor/NewElementState.ts +109 -21
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +33 -40
- package/src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts +7 -1
- package/src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts +48 -77
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +5 -1
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +407 -617
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +243 -0
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +18 -1
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.ts +20 -12
- package/src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts +76 -18
- package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +29 -24
- package/src/stores/editor/panel-group/SQLPlaygroundPanelState.ts +224 -1
- package/src/stores/editor/sidebar-state/testable/GlobalTestRunnerState.ts +4 -1
- package/src/stores/editor/utils/MockDataUtils.ts +2 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +2 -6
- package/src/stores/editor/utils/TestableUtils.ts +73 -0
- package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +15 -12
- package/tsconfig.json +1 -0
@@ -74,6 +74,12 @@ import {
|
|
74
74
|
Multiplicity,
|
75
75
|
PrimitiveType,
|
76
76
|
LocalH2DatasourceSpecification,
|
77
|
+
SnowflakeDatasourceSpecification,
|
78
|
+
SnowflakePublicAuthenticationStrategy,
|
79
|
+
StoreConnections,
|
80
|
+
ConnectionPointer,
|
81
|
+
IdentifiedConnection,
|
82
|
+
generateIdentifiedConnectionId,
|
77
83
|
} from '@finos/legend-graph';
|
78
84
|
import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.js';
|
79
85
|
import {
|
@@ -613,7 +619,6 @@ export class NewDataElementDriver extends NewElementDriver<DataElement> {
|
|
613
619
|
createElement(name: string): DataElement {
|
614
620
|
const embeddedDataOption = guaranteeNonNullable(this.embeddedDataOption);
|
615
621
|
const dataElement = new DataElement(name);
|
616
|
-
|
617
622
|
const data = createEmbeddedData(embeddedDataOption.value, this.editorStore);
|
618
623
|
dataElement_setEmbeddedData(
|
619
624
|
dataElement,
|
@@ -646,7 +651,6 @@ export class NewElementState {
|
|
646
651
|
_package: observable,
|
647
652
|
name: observable,
|
648
653
|
newElementDriver: observable,
|
649
|
-
elementAndPackageName: computed,
|
650
654
|
selectedPackage: computed,
|
651
655
|
isValid: computed,
|
652
656
|
setShowModal: action,
|
@@ -665,14 +669,6 @@ export class NewElementState {
|
|
665
669
|
this.type = PACKAGEABLE_ELEMENT_TYPE.PACKAGE;
|
666
670
|
}
|
667
671
|
|
668
|
-
get elementAndPackageName(): [string, string] {
|
669
|
-
return resolvePackageAndElementName(
|
670
|
-
this.selectedPackage,
|
671
|
-
this._package === this.editorStore.graphManagerState.graph.root,
|
672
|
-
this.name,
|
673
|
-
);
|
674
|
-
}
|
675
|
-
|
676
672
|
get selectedPackage(): Package {
|
677
673
|
return this._package
|
678
674
|
? this._package
|
@@ -778,7 +774,11 @@ export class NewElementState {
|
|
778
774
|
|
779
775
|
*save(): GeneratorFn<void> {
|
780
776
|
if (this.name && this.isValid) {
|
781
|
-
const [packagePath, elementName] =
|
777
|
+
const [packagePath, elementName] = resolvePackageAndElementName(
|
778
|
+
this.selectedPackage,
|
779
|
+
this._package === this.editorStore.graphManagerState.graph.root,
|
780
|
+
this.name,
|
781
|
+
);
|
782
782
|
if (
|
783
783
|
this.editorStore.graphManagerState.graph.getNullablePackage(
|
784
784
|
packagePath,
|
@@ -789,17 +789,105 @@ export class NewElementState {
|
|
789
789
|
`Can't create elements for type other than 'package' in root package`,
|
790
790
|
);
|
791
791
|
} else {
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
792
|
+
if (
|
793
|
+
this.editorStore.applicationStore.config.options
|
794
|
+
.TEMPORARY__enableLocalConnectionBuilder &&
|
795
|
+
this.type === PACKAGEABLE_ELEMENT_TYPE.TEMPORARY__LOCAL_CONNECTION
|
796
|
+
) {
|
797
|
+
// NOTE: this is temporary until we have proper support for local connection
|
798
|
+
// For now, we aim to fulfill the PoC for SnowflakeApp use case and will generate
|
799
|
+
// everything: mapping, store, connection, runtime, etc.
|
800
|
+
const store = new Database(`${this.name}_Database`);
|
801
|
+
const mapping = new Mapping(`${this.name}_Mapping`);
|
802
|
+
// connection
|
803
|
+
const connection = new PackageableConnection(
|
804
|
+
`${this.name}_LocalConnection`,
|
805
|
+
);
|
806
|
+
const _suffix = `${packagePath.replaceAll(
|
807
|
+
ELEMENT_PATH_DELIMITER,
|
808
|
+
'-',
|
809
|
+
)}-${connection.name}`;
|
810
|
+
const datasourceSpecification = new SnowflakeDatasourceSpecification(
|
811
|
+
`legend-local-snowflake-accountName-${_suffix}`,
|
812
|
+
`legend-local-snowflake-region-${_suffix}`,
|
813
|
+
`legend-local-snowflake-warehouseName-${_suffix}`,
|
814
|
+
`legend-local-snowflake-databaseName-${_suffix}`,
|
815
|
+
);
|
816
|
+
datasourceSpecification.cloudType = `legend-local-snowflake-cloudType-${_suffix}`;
|
817
|
+
datasourceSpecification.role = `legend-local-snowflake-role-${_suffix}`;
|
818
|
+
const connectionValue = new RelationalDatabaseConnection(
|
819
|
+
PackageableElementExplicitReference.create(store),
|
820
|
+
DatabaseType.Snowflake,
|
821
|
+
datasourceSpecification,
|
822
|
+
new SnowflakePublicAuthenticationStrategy(
|
823
|
+
`legend-local-snowflake-privateKeyVaultReference-${_suffix}`,
|
824
|
+
`legend-local-snowflake-passphraseVaultReference-${_suffix}`,
|
825
|
+
`legend-local-snowflake-publicuserName-${_suffix}`,
|
826
|
+
),
|
827
|
+
);
|
828
|
+
connectionValue.localMode = true;
|
829
|
+
connection.connectionValue = connectionValue;
|
830
|
+
// runtime
|
831
|
+
const runtime = new PackageableRuntime(`${this.name}_Runtime`);
|
832
|
+
const engineRuntime = new EngineRuntime();
|
833
|
+
engineRuntime.mappings = [
|
834
|
+
PackageableElementExplicitReference.create(mapping),
|
835
|
+
];
|
836
|
+
const storeConnections = new StoreConnections(
|
837
|
+
PackageableElementExplicitReference.create(store),
|
838
|
+
);
|
839
|
+
storeConnections.storeConnections = [
|
840
|
+
new IdentifiedConnection(
|
841
|
+
generateIdentifiedConnectionId(engineRuntime),
|
842
|
+
new ConnectionPointer(
|
843
|
+
PackageableElementExplicitReference.create(connection),
|
844
|
+
),
|
845
|
+
),
|
846
|
+
];
|
847
|
+
engineRuntime.connections = [storeConnections];
|
848
|
+
runtime.runtimeValue = engineRuntime;
|
849
|
+
// add the elements
|
850
|
+
yield flowResult(
|
851
|
+
this.editorStore.graphEditorMode.addElement(
|
852
|
+
store,
|
853
|
+
packagePath,
|
854
|
+
false,
|
855
|
+
),
|
856
|
+
);
|
857
|
+
yield flowResult(
|
858
|
+
this.editorStore.graphEditorMode.addElement(
|
859
|
+
connection,
|
860
|
+
packagePath,
|
861
|
+
false,
|
862
|
+
),
|
863
|
+
);
|
864
|
+
yield flowResult(
|
865
|
+
this.editorStore.graphEditorMode.addElement(
|
866
|
+
mapping,
|
867
|
+
packagePath,
|
868
|
+
false,
|
869
|
+
),
|
870
|
+
);
|
871
|
+
yield flowResult(
|
872
|
+
this.editorStore.graphEditorMode.addElement(
|
873
|
+
runtime,
|
874
|
+
packagePath,
|
875
|
+
false,
|
876
|
+
),
|
877
|
+
);
|
878
|
+
} else {
|
879
|
+
const element = this.createElement(elementName);
|
880
|
+
yield flowResult(
|
881
|
+
this.editorStore.graphEditorMode.addElement(
|
882
|
+
element,
|
883
|
+
packagePath,
|
884
|
+
true,
|
885
|
+
),
|
886
|
+
);
|
800
887
|
|
801
|
-
|
802
|
-
|
888
|
+
// post creation handling
|
889
|
+
yield handlePostCreateAction(element, this.editorStore);
|
890
|
+
}
|
803
891
|
}
|
804
892
|
}
|
805
893
|
this.closeModal();
|
package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts
CHANGED
@@ -146,8 +146,8 @@ export class DatabaseBuilderState {
|
|
146
146
|
makeObservable<DatabaseBuilderState>(this, {
|
147
147
|
showModal: observable,
|
148
148
|
targetDatabasePath: observable,
|
149
|
-
isBuildingDatabase: observable,
|
150
149
|
databaseGrammarCode: observable,
|
150
|
+
isBuildingDatabase: observable,
|
151
151
|
isSavingDatabase: observable,
|
152
152
|
currentDatabase: computed,
|
153
153
|
setTargetDatabasePath: action,
|
@@ -219,7 +219,7 @@ export class DatabaseBuilderState {
|
|
219
219
|
treeData: DatabaseBuilderTreeData,
|
220
220
|
): DatabaseBuilderTreeNodeData[] | undefined {
|
221
221
|
return node.childrenIds
|
222
|
-
?.map((
|
222
|
+
?.map((childNode) => treeData.nodes.get(childNode))
|
223
223
|
.filter(isNonNullable);
|
224
224
|
}
|
225
225
|
|
@@ -245,7 +245,8 @@ export class DatabaseBuilderState {
|
|
245
245
|
}
|
246
246
|
}
|
247
247
|
}
|
248
|
-
|
248
|
+
|
249
|
+
// TODO: support toggling check for columns
|
249
250
|
this.setTreeData({ ...treeData });
|
250
251
|
}
|
251
252
|
|
@@ -279,6 +280,7 @@ export class DatabaseBuilderState {
|
|
279
280
|
schemaId,
|
280
281
|
schema,
|
281
282
|
);
|
283
|
+
nodes.set(schemaId, schemaNode);
|
282
284
|
|
283
285
|
schemaNode.setChecked(
|
284
286
|
Boolean(
|
@@ -287,7 +289,6 @@ export class DatabaseBuilderState {
|
|
287
289
|
),
|
288
290
|
),
|
289
291
|
);
|
290
|
-
nodes.set(schemaId, schemaNode);
|
291
292
|
});
|
292
293
|
const treeData = { rootIds, nodes, database };
|
293
294
|
this.setTreeData(treeData);
|
@@ -341,6 +342,8 @@ export class DatabaseBuilderState {
|
|
341
342
|
schema,
|
342
343
|
table,
|
343
344
|
);
|
345
|
+
treeData.nodes.set(tableId, tableNode);
|
346
|
+
addUniqueEntry(childrenIds, tableId);
|
344
347
|
|
345
348
|
if (this.currentDatabase) {
|
346
349
|
const matchingSchema = getNullableSchema(
|
@@ -357,9 +360,6 @@ export class DatabaseBuilderState {
|
|
357
360
|
} else {
|
358
361
|
tableNode.setChecked(false);
|
359
362
|
}
|
360
|
-
|
361
|
-
treeData.nodes.set(tableId, tableNode);
|
362
|
-
addUniqueEntry(childrenIds, tableId);
|
363
363
|
});
|
364
364
|
schemaNode.childrenIds = childrenIds;
|
365
365
|
this.setTreeData({ ...treeData });
|
@@ -605,6 +605,8 @@ export class DatabaseBuilderState {
|
|
605
605
|
} else {
|
606
606
|
currentDatabase = this.currentDatabase;
|
607
607
|
}
|
608
|
+
|
609
|
+
// remove undefined schemas
|
608
610
|
const schemas = Array.from(this.treeData.nodes.values())
|
609
611
|
.map((schemaNode) => {
|
610
612
|
if (schemaNode instanceof SchemaDatabaseBuilderTreeNodeData) {
|
@@ -613,11 +615,32 @@ export class DatabaseBuilderState {
|
|
613
615
|
return undefined;
|
614
616
|
})
|
615
617
|
.filter(isNonNullable);
|
616
|
-
|
618
|
+
currentDatabase.schemas = currentDatabase.schemas.filter((schema) => {
|
619
|
+
if (
|
620
|
+
schemas.find((item) => item.name === schema.name) &&
|
621
|
+
!database.schemas.find((s) => s.name === schema.name)
|
622
|
+
) {
|
623
|
+
return false;
|
624
|
+
}
|
625
|
+
return true;
|
626
|
+
});
|
627
|
+
|
628
|
+
// update existing schemas
|
629
|
+
database.schemas.forEach((schema) => {
|
630
|
+
(schema as Writable<Schema>)._OWNER = currentDatabase;
|
631
|
+
const currentSchemaIndex = currentDatabase.schemas.findIndex(
|
632
|
+
(item) => item.name === schema.name,
|
633
|
+
);
|
634
|
+
if (currentSchemaIndex !== -1) {
|
635
|
+
currentDatabase.schemas[currentSchemaIndex] = schema;
|
636
|
+
} else {
|
637
|
+
currentDatabase.schemas.push(schema);
|
638
|
+
}
|
639
|
+
});
|
640
|
+
|
617
641
|
this.editorStore.applicationStore.notificationService.notifySuccess(
|
618
|
-
`Database successfully '${isUpdating ? 'updated' : 'created'}
|
642
|
+
`Database successfully '${isUpdating ? 'updated' : 'created'}`,
|
619
643
|
);
|
620
|
-
this.fetchDatabaseMetadata();
|
621
644
|
if (isUpdating) {
|
622
645
|
yield flowResult(
|
623
646
|
this.editorStore
|
@@ -639,34 +662,4 @@ export class DatabaseBuilderState {
|
|
639
662
|
this.isSavingDatabase = false;
|
640
663
|
}
|
641
664
|
}
|
642
|
-
|
643
|
-
updateDatabase(
|
644
|
-
current: Database,
|
645
|
-
generatedDatabase: Database,
|
646
|
-
allSchemas: Schema[],
|
647
|
-
): void {
|
648
|
-
// remove undefined schemas
|
649
|
-
current.schemas = current.schemas.filter((schema) => {
|
650
|
-
if (
|
651
|
-
allSchemas.find((item) => item.name === schema.name) &&
|
652
|
-
!generatedDatabase.schemas.find((c) => c.name === schema.name)
|
653
|
-
) {
|
654
|
-
return false;
|
655
|
-
}
|
656
|
-
return true;
|
657
|
-
});
|
658
|
-
|
659
|
-
// update existing schemas
|
660
|
-
generatedDatabase.schemas.forEach((schema) => {
|
661
|
-
(schema as Writable<Schema>)._OWNER = current;
|
662
|
-
const currentSchemaIndex = current.schemas.findIndex(
|
663
|
-
(item) => item.name === schema.name,
|
664
|
-
);
|
665
|
-
if (currentSchemaIndex !== -1) {
|
666
|
-
current.schemas[currentSchemaIndex] = schema;
|
667
|
-
} else {
|
668
|
-
current.schemas.push(schema);
|
669
|
-
}
|
670
|
-
});
|
671
|
-
}
|
672
665
|
}
|
@@ -26,6 +26,7 @@ import { ElementEditorState } from '../ElementEditorState.js';
|
|
26
26
|
import {
|
27
27
|
type EmbeddedDataState,
|
28
28
|
buildEmbeddedDataEditorState,
|
29
|
+
type EmbeddedDataStateOption,
|
29
30
|
} from './EmbeddedDataState.js';
|
30
31
|
|
31
32
|
export enum DATA_TAB_TYPE {
|
@@ -45,12 +46,17 @@ export class EmbeddedDataEditorState {
|
|
45
46
|
readonly embeddedData: EmbeddedData;
|
46
47
|
readonly embeddedDataState: EmbeddedDataState;
|
47
48
|
|
48
|
-
constructor(
|
49
|
+
constructor(
|
50
|
+
editorStore: EditorStore,
|
51
|
+
embeddedData: EmbeddedData,
|
52
|
+
options?: EmbeddedDataStateOption,
|
53
|
+
) {
|
49
54
|
this.editorStore = editorStore;
|
50
55
|
this.embeddedData = embeddedData;
|
51
56
|
this.embeddedDataState = buildEmbeddedDataEditorState(
|
52
57
|
embeddedData,
|
53
58
|
editorStore,
|
59
|
+
options,
|
54
60
|
);
|
55
61
|
}
|
56
62
|
}
|
@@ -17,11 +17,12 @@ import {
|
|
17
17
|
type EmbeddedData,
|
18
18
|
type ModelData,
|
19
19
|
type DataElement,
|
20
|
+
RelationalCSVData,
|
21
|
+
type Database,
|
22
|
+
type RelationalCSVDataTable,
|
20
23
|
DataElementReference,
|
21
24
|
ExternalFormatData,
|
22
25
|
ModelStoreData,
|
23
|
-
RelationalCSVData,
|
24
|
-
RelationalCSVDataTable,
|
25
26
|
ModelEmbeddedData,
|
26
27
|
} from '@finos/legend-graph';
|
27
28
|
import {
|
@@ -40,8 +41,6 @@ import {
|
|
40
41
|
externalFormatData_setData,
|
41
42
|
relationalData_addTable,
|
42
43
|
relationalData_deleteData,
|
43
|
-
relationalData_setTableName,
|
44
|
-
relationalData_setTableSchemaName,
|
45
44
|
relationalData_setTableValues,
|
46
45
|
} from '../../../../graph-modifier/DSL_Data_GraphModifierHelper.js';
|
47
46
|
import { EmbeddedDataType } from '../../ExternalFormatState.js';
|
@@ -168,15 +167,26 @@ export class UnsupportedModelDataState extends ModelDataState {}
|
|
168
167
|
export class ModelStoreDataState extends EmbeddedDataState {
|
169
168
|
override embeddedData: ModelStoreData;
|
170
169
|
modelDataStates: ModelDataState[] = [];
|
170
|
+
hideClass = false;
|
171
171
|
|
172
|
-
constructor(
|
172
|
+
constructor(
|
173
|
+
editorStore: EditorStore,
|
174
|
+
embeddedData: ModelStoreData,
|
175
|
+
hideClass?: boolean,
|
176
|
+
) {
|
173
177
|
super(editorStore, embeddedData);
|
178
|
+
makeObservable(this, {
|
179
|
+
hideClass: observable,
|
180
|
+
modelDataStates: observable,
|
181
|
+
buildStates: action,
|
182
|
+
});
|
174
183
|
this.embeddedData = embeddedData;
|
175
184
|
this.modelDataStates = this.buildStates();
|
185
|
+
this.hideClass = Boolean(hideClass);
|
176
186
|
}
|
177
187
|
|
178
188
|
label(): string {
|
179
|
-
return '
|
189
|
+
return 'Model Store Data';
|
180
190
|
}
|
181
191
|
|
182
192
|
buildStates(): ModelDataState[] {
|
@@ -209,72 +219,15 @@ export class RelationalCSVDataTableState {
|
|
209
219
|
}
|
210
220
|
}
|
211
221
|
|
212
|
-
export class IdentifierTableState {
|
213
|
-
table: RelationalCSVDataTable | undefined;
|
214
|
-
dataState: RelationalCSVDataState;
|
215
|
-
schemaName = '';
|
216
|
-
tableName = '';
|
217
|
-
|
218
|
-
constructor(dataState: RelationalCSVDataState) {
|
219
|
-
this.dataState = dataState;
|
220
|
-
makeObservable(this, {
|
221
|
-
dataState: observable,
|
222
|
-
schemaName: observable,
|
223
|
-
tableName: observable,
|
224
|
-
table: observable,
|
225
|
-
setTableName: action,
|
226
|
-
setSchemaName: action,
|
227
|
-
setTable: action,
|
228
|
-
handleSubmit: action,
|
229
|
-
});
|
230
|
-
}
|
231
|
-
|
232
|
-
setTable(table: RelationalCSVDataTable | undefined): void {
|
233
|
-
this.table = table;
|
234
|
-
if (table) {
|
235
|
-
this.tableName = table.table;
|
236
|
-
this.schemaName = table.schema;
|
237
|
-
}
|
238
|
-
}
|
239
|
-
|
240
|
-
setTableName(val: string): void {
|
241
|
-
this.tableName = val;
|
242
|
-
}
|
243
|
-
|
244
|
-
setSchemaName(val: string): void {
|
245
|
-
this.schemaName = val;
|
246
|
-
}
|
247
|
-
|
248
|
-
get isEditingDisabled(): boolean {
|
249
|
-
if (!(this.tableName && this.schemaName)) {
|
250
|
-
return true;
|
251
|
-
}
|
252
|
-
return Boolean(
|
253
|
-
this.dataState.embeddedData.tables.find(
|
254
|
-
(t) =>
|
255
|
-
`${t.table}.${t.schema}` === `${this.tableName}.${this.schemaName}`,
|
256
|
-
),
|
257
|
-
);
|
258
|
-
}
|
259
|
-
|
260
|
-
handleSubmit(): void {
|
261
|
-
const table = this.table ?? new RelationalCSVDataTable();
|
262
|
-
relationalData_setTableSchemaName(table, this.schemaName);
|
263
|
-
relationalData_setTableName(table, this.tableName);
|
264
|
-
if (!this.table) {
|
265
|
-
table.values = '';
|
266
|
-
relationalData_addTable(this.dataState.embeddedData, table);
|
267
|
-
this.dataState.changeSelectedTable(table);
|
268
|
-
}
|
269
|
-
}
|
270
|
-
}
|
271
|
-
|
272
222
|
export class RelationalCSVDataState extends EmbeddedDataState {
|
273
223
|
override embeddedData: RelationalCSVData;
|
274
|
-
showTableIdentifierModal = false;
|
275
|
-
tableIdentifierState: IdentifierTableState;
|
276
224
|
selectedTable: RelationalCSVDataTableState | undefined;
|
277
225
|
showImportCSVModal = false;
|
226
|
+
database: Database | undefined;
|
227
|
+
|
228
|
+
//
|
229
|
+
showTableIdentifierModal = false;
|
230
|
+
tableToEdit: RelationalCSVDataTable | undefined;
|
278
231
|
|
279
232
|
constructor(editorStore: EditorStore, embeddedData: RelationalCSVData) {
|
280
233
|
super(editorStore, embeddedData);
|
@@ -282,10 +235,11 @@ export class RelationalCSVDataState extends EmbeddedDataState {
|
|
282
235
|
selectedTable: observable,
|
283
236
|
showTableIdentifierModal: observable,
|
284
237
|
deleteTable: observable,
|
285
|
-
tableIdentifierState: observable,
|
286
238
|
showImportCSVModal: observable,
|
239
|
+
database: observable,
|
287
240
|
resetSelectedTable: action,
|
288
241
|
changeSelectedTable: action,
|
242
|
+
setDatabase: action,
|
289
243
|
closeModal: action,
|
290
244
|
openIdentifierModal: action,
|
291
245
|
setShowImportCsvModal: action,
|
@@ -293,7 +247,6 @@ export class RelationalCSVDataState extends EmbeddedDataState {
|
|
293
247
|
importCSV: action,
|
294
248
|
});
|
295
249
|
this.embeddedData = embeddedData;
|
296
|
-
this.tableIdentifierState = new IdentifierTableState(this);
|
297
250
|
this.resetSelectedTable();
|
298
251
|
}
|
299
252
|
|
@@ -301,9 +254,13 @@ export class RelationalCSVDataState extends EmbeddedDataState {
|
|
301
254
|
this.showImportCSVModal = val;
|
302
255
|
}
|
303
256
|
|
257
|
+
setDatabase(val: Database | undefined): void {
|
258
|
+
this.database = val;
|
259
|
+
}
|
260
|
+
|
304
261
|
openIdentifierModal(renameTable?: RelationalCSVDataTable | undefined): void {
|
305
262
|
this.showTableIdentifierModal = true;
|
306
|
-
this.
|
263
|
+
this.tableToEdit = renameTable;
|
307
264
|
}
|
308
265
|
|
309
266
|
closeCSVModal(): void {
|
@@ -311,9 +268,8 @@ export class RelationalCSVDataState extends EmbeddedDataState {
|
|
311
268
|
}
|
312
269
|
|
313
270
|
closeModal(): void {
|
314
|
-
this.tableIdentifierState.setSchemaName('');
|
315
|
-
this.tableIdentifierState.setTableName('');
|
316
271
|
this.showTableIdentifierModal = false;
|
272
|
+
this.tableToEdit = undefined;
|
317
273
|
}
|
318
274
|
|
319
275
|
importCSV(val: string): void {
|
@@ -351,14 +307,23 @@ export class RelationalCSVDataState extends EmbeddedDataState {
|
|
351
307
|
return 'Relational Data';
|
352
308
|
}
|
353
309
|
}
|
310
|
+
export interface EmbeddedDataStateOption {
|
311
|
+
hideSource?: boolean;
|
312
|
+
}
|
354
313
|
|
355
314
|
export class DataElementReferenceState extends EmbeddedDataState {
|
356
315
|
override embeddedData: DataElementReference;
|
357
316
|
embeddedDataValueState: EmbeddedDataState;
|
317
|
+
options?: EmbeddedDataStateOption | undefined;
|
358
318
|
|
359
|
-
constructor(
|
319
|
+
constructor(
|
320
|
+
editorStore: EditorStore,
|
321
|
+
embeddedData: DataElementReference,
|
322
|
+
options?: EmbeddedDataStateOption,
|
323
|
+
) {
|
360
324
|
super(editorStore, embeddedData);
|
361
325
|
this.embeddedData = embeddedData;
|
326
|
+
this.options = options;
|
362
327
|
this.embeddedDataValueState = this.buildValueState();
|
363
328
|
}
|
364
329
|
|
@@ -375,10 +340,11 @@ export class DataElementReferenceState extends EmbeddedDataState {
|
|
375
340
|
this.embeddedDataValueState = this.buildValueState();
|
376
341
|
}
|
377
342
|
|
378
|
-
buildValueState(): EmbeddedDataState {
|
343
|
+
buildValueState(options?: EmbeddedDataStateOption): EmbeddedDataState {
|
379
344
|
return buildEmbeddedDataEditorState(
|
380
345
|
this.embeddedData.dataElement.value.data,
|
381
346
|
this.editorStore,
|
347
|
+
this.options,
|
382
348
|
);
|
383
349
|
}
|
384
350
|
}
|
@@ -392,16 +358,21 @@ export class UnsupportedDataState extends EmbeddedDataState {
|
|
392
358
|
export function buildEmbeddedDataEditorState(
|
393
359
|
_embeddedData: EmbeddedData,
|
394
360
|
editorStore: EditorStore,
|
361
|
+
options?: EmbeddedDataStateOption,
|
395
362
|
): EmbeddedDataState {
|
396
363
|
const embeddedData = _embeddedData;
|
397
364
|
if (embeddedData instanceof ExternalFormatData) {
|
398
365
|
return new ExternalFormatDataState(editorStore, embeddedData);
|
399
366
|
} else if (embeddedData instanceof ModelStoreData) {
|
400
|
-
return new ModelStoreDataState(
|
367
|
+
return new ModelStoreDataState(
|
368
|
+
editorStore,
|
369
|
+
embeddedData,
|
370
|
+
options?.hideSource,
|
371
|
+
);
|
401
372
|
} else if (embeddedData instanceof RelationalCSVData) {
|
402
373
|
return new RelationalCSVDataState(editorStore, embeddedData);
|
403
374
|
} else if (embeddedData instanceof DataElementReference) {
|
404
|
-
return new DataElementReferenceState(editorStore, embeddedData);
|
375
|
+
return new DataElementReferenceState(editorStore, embeddedData, options);
|
405
376
|
} else {
|
406
377
|
const extraEmbeddedDataEditorStateBuilders = editorStore.pluginManager
|
407
378
|
.getApplicationPlugins()
|
@@ -121,7 +121,6 @@ import {
|
|
121
121
|
setImpl_updateRootOnCreate,
|
122
122
|
setImpl_updateRootOnDelete,
|
123
123
|
} from '../../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
|
124
|
-
import { BASIC_SET_IMPLEMENTATION_TYPE } from '../../../utils/ModelClassifierUtils.js';
|
125
124
|
import { rootRelationalSetImp_setMainTableAlias } from '../../../../graph-modifier/STO_Relational_GraphModifierHelper.js';
|
126
125
|
import { LambdaEditorState } from '@finos/legend-query-builder';
|
127
126
|
import type { MappingEditorTabState } from './MappingTabManagerState.js';
|
@@ -163,6 +162,11 @@ export enum MAPPING_ELEMENT_TYPE {
|
|
163
162
|
ASSOCIATION = 'ASSOCIATION',
|
164
163
|
}
|
165
164
|
|
165
|
+
export enum BASIC_SET_IMPLEMENTATION_TYPE {
|
166
|
+
OPERATION = 'operation',
|
167
|
+
INSTANCE = 'instance',
|
168
|
+
}
|
169
|
+
|
166
170
|
export type MappingElement =
|
167
171
|
| EnumerationMapping
|
168
172
|
| SetImplementation
|