@finos/legend-application-studio 28.19.113 → 28.19.115

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.
Files changed (59) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +1 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +11 -1
  6. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioTelemetryHelper.js +23 -0
  8. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  9. package/lib/components/editor/editor-group/{database/IsolatedQueryDatabase.d.ts → accessor/AccessorQueryBuilderHelper.d.ts} +4 -3
  10. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.d.ts.map +1 -0
  11. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.js +41 -0
  12. package/lib/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.js.map +1 -0
  13. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.d.ts.map +1 -1
  14. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js +24 -7
  15. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js.map +1 -1
  16. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  17. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +20 -5
  18. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  19. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js +2 -2
  20. package/lib/components/editor/editor-group/uml-editor/ClassQueryBuilder.js.map +1 -1
  21. package/lib/components/editor/side-bar/Explorer.js +8 -8
  22. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  23. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
  24. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +13 -1
  25. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/package.json +1 -1
  29. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  30. package/lib/stores/ShowcaseManagerState.js +1 -0
  31. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  32. package/lib/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.js +1 -1
  33. package/lib/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.js.map +1 -1
  34. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts +1 -0
  35. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts.map +1 -1
  36. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js +4 -0
  37. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js.map +1 -1
  38. package/package.json +11 -11
  39. package/src/__lib__/LegendStudioEvent.ts +1 -0
  40. package/src/__lib__/LegendStudioTelemetryHelper.ts +65 -1
  41. package/src/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.ts +68 -0
  42. package/src/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.ts +54 -8
  43. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +48 -1
  44. package/src/components/editor/editor-group/uml-editor/ClassQueryBuilder.tsx +2 -2
  45. package/src/components/editor/side-bar/Explorer.tsx +16 -16
  46. package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +35 -4
  47. package/src/stores/ShowcaseManagerState.ts +5 -0
  48. package/src/stores/editor/editor-state/end-to-end-workflow-state/QueryConnectionEndToEndWorkflowEditorState.ts +1 -1
  49. package/src/stores/graph-modifier/DSL_Service_GraphModifierHelper.ts +7 -0
  50. package/tsconfig.json +1 -2
  51. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.d.ts.map +0 -1
  52. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.js +0 -58
  53. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.js.map +0 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.d.ts +0 -37
  55. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.d.ts.map +0 -1
  56. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js +0 -127
  57. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js.map +0 -1
  58. package/src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx +0 -142
  59. package/src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts +0 -240
@@ -1 +0,0 @@
1
- {"version":3,"file":"IsolatedQueryDatabase.js","sourceRoot":"","sources":["../../../../../src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,4CAA4C,GAAG,QAAQ,CAC3D,CAAC,KAA0D,EAAE,EAAE;IAC7D,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,uBAAuB,CAAC;IAC1E,MAAM,kBAAkB,GAAG,CACzB,GAAW,EACwB,EAAE,CACrC,kBAAkB,CAAC,GAAG,EAAE,CACtB,uBAAuB,CAAC,KAAK,CAAC,aAAa,CAAC,G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A4C,IAC3C,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CAAC"}
@@ -1,37 +0,0 @@
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
- import { EngineRuntime, Database, RelationalDatabaseConnection, GraphManagerState } from '@finos/legend-graph';
17
- import type { EditorStore } from '../../../EditorStore.js';
18
- import { type GeneratorFn } from '@finos/legend-shared';
19
- import { QueryBuilderConfig, QueryBuilderState } from '@finos/legend-query-builder';
20
- import { type GenericLegendApplicationStore } from '@finos/legend-application';
21
- export declare class IsolatedDatabaseBuilderState extends QueryBuilderState {
22
- readonly database: Database;
23
- globalGraphManagerState: GraphManagerState;
24
- engineRuntime: EngineRuntime;
25
- connectionKey: string;
26
- compatibleConnections: Map<string, RelationalDatabaseConnection>;
27
- TEMPORARY__setupPanelContentRenderer: () => React.ReactNode;
28
- constructor(applicationStore: GenericLegendApplicationStore, isolatedGraphManagerState: GraphManagerState, globalGraphManagerState: GraphManagerState, database: Database, connectionKey: string, runtime: EngineRuntime, compatibleConnections: Map<string, RelationalDatabaseConnection>, acceptedElementPaths?: string[], config?: QueryBuilderConfig | undefined);
29
- changeConnection(key: string): void;
30
- }
31
- export declare class QueryDatabaseState {
32
- editorStore: EditorStore;
33
- database: Database;
34
- constructor(database: Database, editorStore: EditorStore);
35
- init(): GeneratorFn<void>;
36
- }
37
- //# sourceMappingURL=QueryDatabaseState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryDatabaseState.d.ts","sourceRoot":"","sources":["../../../../../../src/stores/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WAAW,CAAC,IAAI,CAAC;CA0F3B"}
@@ -1,127 +0,0 @@
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
- import { DEFAULT_GENERATION_PACKAGE, EngineRuntime, Database, RelationalDatabaseConnection, PackageableElementExplicitReference, StoreConnections, IdentifiedConnection, GraphManagerState, getMappingCompatibleClasses, } from '@finos/legend-graph';
17
- import { ActionState, assertErrorThrown, guaranteeNonNullable, assertTrue, } from '@finos/legend-shared';
18
- import { action, flow, flowResult, makeObservable, observable } from 'mobx';
19
- import { QueryBuilderAdvancedWorkflowState, QueryBuilderConfig, QueryBuilderState, } from '@finos/legend-query-builder';
20
- import { DEFAULT_TAB_SIZE, } from '@finos/legend-application';
21
- import { payloadDebugger } from '../../../panel-group/DevToolPanelState.js';
22
- import { renderDatabaseQueryBuilderSetupPanelContent } from '../../../../../components/editor/editor-group/database/IsolatedQueryDatabase.js';
23
- const replaceConnectionInEngineRuntime = (engineRuntime, connection, databse) => {
24
- const _storeConnection = new StoreConnections(PackageableElementExplicitReference.create(databse));
25
- const newconnection = new RelationalDatabaseConnection(PackageableElementExplicitReference.create(databse), connection.type, connection.datasourceSpecification, connection.authenticationStrategy);
26
- newconnection.localMode = connection.localMode;
27
- newconnection.timeZone = connection.timeZone;
28
- _storeConnection.storeConnections = [
29
- new IdentifiedConnection('connection1', newconnection),
30
- ];
31
- engineRuntime.connections = [_storeConnection];
32
- };
33
- export class IsolatedDatabaseBuilderState extends QueryBuilderState {
34
- database;
35
- globalGraphManagerState;
36
- engineRuntime;
37
- connectionKey;
38
- compatibleConnections;
39
- TEMPORARY__setupPanelContentRenderer = () => renderDatabaseQueryBuilderSetupPanelContent(this);
40
- constructor(applicationStore, isolatedGraphManagerState, globalGraphManagerState, database, connectionKey, runtime, compatibleConnections, acceptedElementPaths, config) {
41
- super(applicationStore, isolatedGraphManagerState, QueryBuilderAdvancedWorkflowState.INSTANCE, config);
42
- makeObservable(this, {
43
- connectionKey: observable,
44
- engineRuntime: observable,
45
- changeConnection: action,
46
- });
47
- this.database = database;
48
- this.globalGraphManagerState = globalGraphManagerState;
49
- this.engineRuntime = runtime;
50
- this.compatibleConnections = compatibleConnections;
51
- this.connectionKey = connectionKey;
52
- const classes = isolatedGraphManagerState.usableClasses;
53
- const electedMapping = guaranteeNonNullable(isolatedGraphManagerState.graph.mappings.filter((m) => acceptedElementPaths ? acceptedElementPaths.includes(m.path) : true)[0], 'Compatible mapping expected');
54
- this.class = guaranteeNonNullable(getMappingCompatibleClasses(electedMapping, classes)[0], 'Compatible class expected for mapping');
55
- this.executionContextState.mapping = electedMapping;
56
- this.executionContextState.runtimeValue = runtime;
57
- }
58
- changeConnection(key) {
59
- const connection = this.compatibleConnections.get(key);
60
- if (connection) {
61
- replaceConnectionInEngineRuntime(this.engineRuntime, connection, this.database);
62
- this.connectionKey = key;
63
- }
64
- }
65
- }
66
- export class QueryDatabaseState {
67
- editorStore;
68
- database;
69
- constructor(database, editorStore) {
70
- this.database = database;
71
- this.editorStore = editorStore;
72
- makeObservable(this, {
73
- init: flow,
74
- });
75
- }
76
- *init() {
77
- try {
78
- const compConnections = new Map();
79
- this.editorStore.graphManagerState.usableConnections.forEach((conn) => {
80
- const val = conn.connectionValue;
81
- if (val instanceof RelationalDatabaseConnection) {
82
- compConnections.set(conn.path, val);
83
- }
84
- });
85
- assertTrue(compConnections.size > 0, `No compatible connections found for database ${this.database.path}`);
86
- const embeddedQueryBuilderState = this.editorStore.embeddedQueryBuilderState;
87
- const databaseGraphManagerState = new GraphManagerState(this.editorStore.applicationStore.pluginManager, this.editorStore.applicationStore.logService);
88
- yield databaseGraphManagerState.graphManager.initialize({
89
- env: this.editorStore.applicationStore.config.env,
90
- tabSize: DEFAULT_TAB_SIZE,
91
- clientConfig: {
92
- baseUrl: this.editorStore.applicationStore.config.engineServerUrl,
93
- queryBaseUrl: this.editorStore.applicationStore.config.engineQueryServerUrl,
94
- enableCompression: true,
95
- payloadDebugger,
96
- },
97
- }, {
98
- tracerService: this.editorStore.applicationStore.tracerService,
99
- });
100
- databaseGraphManagerState.graph =
101
- this.editorStore.graphManagerState.createNewGraph();
102
- const copiedDb = new Database(this.database.name);
103
- databaseGraphManagerState.graph.addElement(copiedDb, guaranteeNonNullable(this.database.package?.path));
104
- copiedDb.schemas = this.database.schemas;
105
- copiedDb.joins = this.database.joins;
106
- copiedDb.filters = this.database.filters;
107
- const entities = (yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(this.database.path, DEFAULT_GENERATION_PACKAGE, this.editorStore.graphManagerState.graph));
108
- yield this.editorStore.graphManagerState.graphManager.buildGraph(databaseGraphManagerState.graph, entities, ActionState.create());
109
- const engineRuntime = new EngineRuntime();
110
- engineRuntime.mappings = databaseGraphManagerState.graph.mappings.map((e) => PackageableElementExplicitReference.create(e));
111
- const connectionEntry = guaranteeNonNullable(Array.from(compConnections.entries())[0]);
112
- const connection = connectionEntry[1];
113
- replaceConnectionInEngineRuntime(engineRuntime, connection, copiedDb);
114
- const config = new QueryBuilderConfig();
115
- const queryBuilderState = new IsolatedDatabaseBuilderState(this.editorStore.applicationStore, databaseGraphManagerState, this.editorStore.graphManagerState, copiedDb, connectionEntry[0], engineRuntime, compConnections, entities.map((e) => e.path), config);
116
- yield flowResult(embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
117
- setupQueryBuilderState: async () => queryBuilderState,
118
- actionConfigs: [],
119
- }));
120
- }
121
- catch (error) {
122
- assertErrorThrown(error);
123
- this.editorStore.applicationStore.notificationService.notifyError(`Unable to query database: ${error.message}`);
124
- }
125
- }
126
- }
127
- //# sourceMappingURL=QueryDatabaseState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryDatabaseState.js","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,QAAQ,EACR,4BAA4B,EAC5B,mCAAmC,EACnC,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EAEpB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE5E,OAAO,EACL,iCAAiC,EACjC,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,2CAA2C,EAAE,MAAM,iFAAiF,CAAC;AAE9I,MAAM,gCAAgC,GAAG,CACvC,aAA4B,EAC5B,UAAwC,EACxC,OAAiB,EACX,EAAE;IACR,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAC3C,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,CACpD,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,4BAA4B,CACpD,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,EACnD,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,uBAAuB,EAClC,UAAU,CAAC,sBAAsB,CAClC,CAAC;IACF,aAAa,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IAC/C,aAAa,CAAC,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,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAC3B,MAAM,CACP,CAAC;YACF,MAAM,UAAU,CACd,yBAAyB,CAAC,oCAAoC,CAAC;gBAC7D,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,iBAAiB;gBACrD,aAAa,EAAE,EAAE;aAClB,CAAC,CACH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAC/D,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAC7C,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1,142 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import {
18
- type Database,
19
- type PackageableConnection,
20
- getMappingCompatibleClasses,
21
- } from '@finos/legend-graph';
22
- import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
23
- import type { IsolatedDatabaseBuilderState } from '../../../../stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js';
24
- import { observer } from 'mobx-react-lite';
25
- import {
26
- CustomSelectorInput,
27
- PanelHeader,
28
- compareLabelFn,
29
- } from '@finos/legend-art';
30
- import { returnUndefOnError } from '@finos/legend-shared';
31
-
32
- const IsolatedDatabseQueryBuilderSetupPanelContext = observer(
33
- (props: { queryBuilderState: IsolatedDatabaseBuilderState }) => {
34
- const { queryBuilderState } = props;
35
- const globalGraphManagerState = queryBuilderState.globalGraphManagerState;
36
- const getConnectionValue = (
37
- val: string,
38
- ): PackageableConnection | undefined =>
39
- returnUndefOnError(() =>
40
- globalGraphManagerState.graph.getConnection(val),
41
- );
42
- const database = queryBuilderState.database;
43
- const compConnections = queryBuilderState.compatibleConnections;
44
- const compConnectionsOptions = Array.from(compConnections.keys())
45
- .map((e) => ({ value: e, label: getConnectionValue(e)?.name ?? e }))
46
- .sort(compareLabelFn);
47
- const changeConnection = (
48
- val: { value: string; label: string } | null,
49
- ): void => {
50
- if (val) {
51
- queryBuilderState.changeConnection(val.value);
52
- }
53
- };
54
- const connection = compConnections.get(queryBuilderState.connectionKey);
55
- const selectedConnection = connection
56
- ? {
57
- label: queryBuilderState.connectionKey,
58
- value:
59
- getConnectionValue(queryBuilderState.connectionKey)?.name ??
60
- queryBuilderState.connectionKey,
61
- }
62
- : undefined;
63
- const databaseOption = {
64
- value: database,
65
- label: database.path,
66
- };
67
- const classes = queryBuilderState.executionContextState.mapping
68
- ? getMappingCompatibleClasses(
69
- queryBuilderState.executionContextState.mapping,
70
- queryBuilderState.graphManagerState.usableClasses,
71
- )
72
- : [];
73
- return (
74
- <div className="query-builder__setup__config-group">
75
- <PanelHeader title="properties" />
76
- <div className="query-builder__setup__config-group__content">
77
- <div className="query-builder__setup__config-group__item">
78
- <label
79
- className="btn--sm query-builder__setup__config-group__item__label"
80
- title="store"
81
- htmlFor="query-builder__setup__store-selector"
82
- >
83
- Store
84
- </label>
85
- <CustomSelectorInput
86
- inputId="query-builder__setup__store-selector"
87
- className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
88
- noMatchMessage="No compatible mapping found for specified class"
89
- disabled={true}
90
- options={[] as { label: string; value: Database }[]}
91
- onChange={() => {
92
- // do nothing
93
- }}
94
- value={databaseOption}
95
- darkMode={
96
- !queryBuilderState.applicationStore.layoutService
97
- .TEMPORARY__isLightColorThemeEnabled
98
- }
99
- />
100
- </div>
101
- <div className="query-builder__setup__config-group__item">
102
- <label
103
- className="btn--sm query-builder__setup__config-group__item__label"
104
- title="connection"
105
- htmlFor="query-builder__setup__connection-selector"
106
- >
107
- Connection
108
- </label>
109
- <CustomSelectorInput
110
- inputId="query-builder__setup__connection-selector"
111
- className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
112
- noMatchMessage="No compatible mapping found for specified class"
113
- disabled={compConnectionsOptions.length < 2}
114
- options={compConnectionsOptions}
115
- onChange={changeConnection}
116
- value={selectedConnection}
117
- darkMode={
118
- !queryBuilderState.applicationStore.layoutService
119
- .TEMPORARY__isLightColorThemeEnabled
120
- }
121
- />
122
- </div>
123
- <div className="query-builder__setup__config-group__item">
124
- <QueryBuilderClassSelector
125
- queryBuilderState={queryBuilderState}
126
- classes={classes}
127
- noMatchMessage="No entities selected from"
128
- />
129
- </div>
130
- </div>
131
- </div>
132
- );
133
- },
134
- );
135
-
136
- export const renderDatabaseQueryBuilderSetupPanelContent = (
137
- queryBuilderState: IsolatedDatabaseBuilderState,
138
- ): React.ReactNode => (
139
- <IsolatedDatabseQueryBuilderSetupPanelContext
140
- queryBuilderState={queryBuilderState}
141
- />
142
- );
@@ -1,240 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import {
18
- DEFAULT_GENERATION_PACKAGE,
19
- EngineRuntime,
20
- Database,
21
- RelationalDatabaseConnection,
22
- PackageableElementExplicitReference,
23
- StoreConnections,
24
- IdentifiedConnection,
25
- GraphManagerState,
26
- getMappingCompatibleClasses,
27
- } from '@finos/legend-graph';
28
- import type { EditorStore } from '../../../EditorStore.js';
29
- import {
30
- ActionState,
31
- assertErrorThrown,
32
- guaranteeNonNullable,
33
- type GeneratorFn,
34
- assertTrue,
35
- } from '@finos/legend-shared';
36
- import { action, flow, flowResult, makeObservable, observable } from 'mobx';
37
- import type { Entity } from '@finos/legend-storage';
38
- import {
39
- QueryBuilderAdvancedWorkflowState,
40
- QueryBuilderConfig,
41
- QueryBuilderState,
42
- } from '@finos/legend-query-builder';
43
- import {
44
- DEFAULT_TAB_SIZE,
45
- type GenericLegendApplicationStore,
46
- } from '@finos/legend-application';
47
- import { payloadDebugger } from '../../../panel-group/DevToolPanelState.js';
48
- import { renderDatabaseQueryBuilderSetupPanelContent } from '../../../../../components/editor/editor-group/database/IsolatedQueryDatabase.js';
49
-
50
- const replaceConnectionInEngineRuntime = (
51
- engineRuntime: EngineRuntime,
52
- connection: RelationalDatabaseConnection,
53
- databse: Database,
54
- ): void => {
55
- const _storeConnection = new StoreConnections(
56
- PackageableElementExplicitReference.create(databse),
57
- );
58
- const newconnection = new RelationalDatabaseConnection(
59
- PackageableElementExplicitReference.create(databse),
60
- connection.type,
61
- connection.datasourceSpecification,
62
- connection.authenticationStrategy,
63
- );
64
- newconnection.localMode = connection.localMode;
65
- newconnection.timeZone = connection.timeZone;
66
- _storeConnection.storeConnections = [
67
- new IdentifiedConnection('connection1', newconnection),
68
- ];
69
- engineRuntime.connections = [_storeConnection];
70
- };
71
- export class IsolatedDatabaseBuilderState extends QueryBuilderState {
72
- readonly database: Database;
73
- globalGraphManagerState: GraphManagerState;
74
- engineRuntime: EngineRuntime;
75
- connectionKey: string;
76
- compatibleConnections: Map<string, RelationalDatabaseConnection>;
77
-
78
- override TEMPORARY__setupPanelContentRenderer = (): React.ReactNode =>
79
- renderDatabaseQueryBuilderSetupPanelContent(this);
80
-
81
- constructor(
82
- applicationStore: GenericLegendApplicationStore,
83
- isolatedGraphManagerState: GraphManagerState,
84
- globalGraphManagerState: GraphManagerState,
85
- database: Database,
86
- connectionKey: string,
87
- runtime: EngineRuntime,
88
- compatibleConnections: Map<string, RelationalDatabaseConnection>,
89
- acceptedElementPaths?: string[],
90
- config?: QueryBuilderConfig | undefined,
91
- ) {
92
- super(
93
- applicationStore,
94
- isolatedGraphManagerState,
95
- QueryBuilderAdvancedWorkflowState.INSTANCE,
96
- config,
97
- );
98
- makeObservable(this, {
99
- connectionKey: observable,
100
- engineRuntime: observable,
101
- changeConnection: action,
102
- });
103
- this.database = database;
104
- this.globalGraphManagerState = globalGraphManagerState;
105
- this.engineRuntime = runtime;
106
- this.compatibleConnections = compatibleConnections;
107
- this.connectionKey = connectionKey;
108
- const classes = isolatedGraphManagerState.usableClasses;
109
- const electedMapping = guaranteeNonNullable(
110
- isolatedGraphManagerState.graph.mappings.filter((m) =>
111
- acceptedElementPaths ? acceptedElementPaths.includes(m.path) : true,
112
- )[0],
113
- 'Compatible mapping expected',
114
- );
115
-
116
- this.class = guaranteeNonNullable(
117
- getMappingCompatibleClasses(electedMapping, classes)[0],
118
- 'Compatible class expected for mapping',
119
- );
120
-
121
- this.executionContextState.mapping = electedMapping;
122
- this.executionContextState.runtimeValue = runtime;
123
- }
124
-
125
- changeConnection(key: string): void {
126
- const connection = this.compatibleConnections.get(key);
127
- if (connection) {
128
- replaceConnectionInEngineRuntime(
129
- this.engineRuntime,
130
- connection,
131
- this.database,
132
- );
133
- this.connectionKey = key;
134
- }
135
- }
136
- }
137
-
138
- export class QueryDatabaseState {
139
- editorStore: EditorStore;
140
- database: Database;
141
-
142
- constructor(database: Database, editorStore: EditorStore) {
143
- this.database = database;
144
- this.editorStore = editorStore;
145
-
146
- makeObservable(this, {
147
- init: flow,
148
- });
149
- }
150
- *init(): GeneratorFn<void> {
151
- try {
152
- const compConnections = new Map<string, RelationalDatabaseConnection>();
153
- this.editorStore.graphManagerState.usableConnections.forEach((conn) => {
154
- const val = conn.connectionValue;
155
- if (val instanceof RelationalDatabaseConnection) {
156
- compConnections.set(conn.path, val);
157
- }
158
- });
159
- assertTrue(
160
- compConnections.size > 0,
161
- `No compatible connections found for database ${this.database.path}`,
162
- );
163
- const embeddedQueryBuilderState =
164
- this.editorStore.embeddedQueryBuilderState;
165
- const databaseGraphManagerState = new GraphManagerState(
166
- this.editorStore.applicationStore.pluginManager,
167
- this.editorStore.applicationStore.logService,
168
- );
169
- yield databaseGraphManagerState.graphManager.initialize(
170
- {
171
- env: this.editorStore.applicationStore.config.env,
172
- tabSize: DEFAULT_TAB_SIZE,
173
- clientConfig: {
174
- baseUrl: this.editorStore.applicationStore.config.engineServerUrl,
175
- queryBaseUrl:
176
- this.editorStore.applicationStore.config.engineQueryServerUrl,
177
- enableCompression: true,
178
- payloadDebugger,
179
- },
180
- },
181
- {
182
- tracerService: this.editorStore.applicationStore.tracerService,
183
- },
184
- );
185
- databaseGraphManagerState.graph =
186
- this.editorStore.graphManagerState.createNewGraph();
187
- const copiedDb = new Database(this.database.name);
188
- databaseGraphManagerState.graph.addElement(
189
- copiedDb,
190
- guaranteeNonNullable(this.database.package?.path),
191
- );
192
- copiedDb.schemas = this.database.schemas;
193
- copiedDb.joins = this.database.joins;
194
- copiedDb.filters = this.database.filters;
195
- const entities =
196
- (yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(
197
- this.database.path,
198
- DEFAULT_GENERATION_PACKAGE,
199
- this.editorStore.graphManagerState.graph,
200
- )) as Entity[];
201
- yield this.editorStore.graphManagerState.graphManager.buildGraph(
202
- databaseGraphManagerState.graph,
203
- entities,
204
- ActionState.create(),
205
- );
206
- const engineRuntime = new EngineRuntime();
207
- engineRuntime.mappings = databaseGraphManagerState.graph.mappings.map(
208
- (e) => PackageableElementExplicitReference.create(e),
209
- );
210
- const connectionEntry = guaranteeNonNullable(
211
- Array.from(compConnections.entries())[0],
212
- );
213
- const connection = connectionEntry[1];
214
- replaceConnectionInEngineRuntime(engineRuntime, connection, copiedDb);
215
- const config = new QueryBuilderConfig();
216
- const queryBuilderState = new IsolatedDatabaseBuilderState(
217
- this.editorStore.applicationStore,
218
- databaseGraphManagerState,
219
- this.editorStore.graphManagerState,
220
- copiedDb,
221
- connectionEntry[0],
222
- engineRuntime,
223
- compConnections,
224
- entities.map((e) => e.path),
225
- config,
226
- );
227
- yield flowResult(
228
- embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
229
- setupQueryBuilderState: async () => queryBuilderState,
230
- actionConfigs: [],
231
- }),
232
- );
233
- } catch (error) {
234
- assertErrorThrown(error);
235
- this.editorStore.applicationStore.notificationService.notifyError(
236
- `Unable to query database: ${error.message}`,
237
- );
238
- }
239
- }
240
- }