@finos/legend-application-studio 28.19.74 → 28.19.75

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 (34) hide show
  1. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.d.ts.map +1 -1
  2. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js +4 -0
  3. package/lib/components/editor/__test-utils__/EditorComponentTestUtils.js.map +1 -1
  4. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  5. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +9 -298
  6. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  7. package/lib/components/editor/side-bar/Explorer.js +1 -1
  8. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  9. package/lib/index.css +1 -1
  10. package/lib/package.json +1 -1
  11. package/lib/stores/editor/EditorStore.d.ts +2 -2
  12. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  13. package/lib/stores/editor/EditorStore.js +3 -3
  14. package/lib/stores/editor/EditorStore.js.map +1 -1
  15. package/lib/stores/editor/GraphEditFormModeState.js +1 -1
  16. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  17. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.d.ts.map +1 -1
  18. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.js +4 -0
  19. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.js.map +1 -1
  20. package/lib/stores/editor/panel-group/{SQLPlaygroundPanelState.d.ts → StudioSQLPlaygroundPanelState.d.ts} +8 -15
  21. package/lib/stores/editor/panel-group/StudioSQLPlaygroundPanelState.d.ts.map +1 -0
  22. package/lib/stores/editor/panel-group/{SQLPlaygroundPanelState.js → StudioSQLPlaygroundPanelState.js} +29 -44
  23. package/lib/stores/editor/panel-group/StudioSQLPlaygroundPanelState.js.map +1 -0
  24. package/package.json +11 -11
  25. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +4 -0
  26. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +12 -576
  27. package/src/components/editor/side-bar/Explorer.tsx +1 -1
  28. package/src/stores/editor/EditorStore.ts +3 -3
  29. package/src/stores/editor/GraphEditFormModeState.ts +1 -1
  30. package/src/stores/editor/__test-utils__/EditorStoreTestUtils.ts +4 -1
  31. package/src/stores/editor/panel-group/{SQLPlaygroundPanelState.ts → StudioSQLPlaygroundPanelState.ts} +47 -60
  32. package/tsconfig.json +1 -1
  33. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +0 -1
  34. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +0 -1
@@ -13,50 +13,37 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { assertErrorThrown, LogEvent, ActionState, } from '@finos/legend-shared';
16
+ import { assertErrorThrown, LogEvent, ActionState, uniqBy, } from '@finos/legend-shared';
17
17
  import { observable, makeObservable, flow, flowResult, action } from 'mobx';
18
- import { editor as monacoEditorAPI } from 'monaco-editor';
18
+ import { languages as monacoLanguagesAPI } from 'monaco-editor';
19
19
  import { guaranteeRelationalDatabaseConnection, GRAPH_MANAGER_EVENT, } from '@finos/legend-graph';
20
- import { CODE_EDITOR_LANGUAGE, moveCursorToPosition, } from '@finos/legend-code-editor';
21
20
  import { STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY } from '../../../__lib__/STO_Relational_LegendStudioCommand.js';
22
21
  import { PANEL_MODE } from '../EditorConfig.js';
23
22
  import { DatabaseSchemaExplorerState } from '../editor-state/element-editor-state/connection/DatabaseBuilderState.js';
23
+ import { AbstractSQLPlaygroundState } from '@finos/legend-lego/sql-playground';
24
24
  const DEFAULT_SQL_TEXT = `--Start building your SQL. Note that you can also drag-and-drop nodes from schema explorer\n`;
25
- export class SQLPlaygroundPanelState {
25
+ export class StudioSQLPlaygroundPanelState extends AbstractSQLPlaygroundState {
26
26
  editorStore;
27
27
  isFetchingSchema = ActionState.create();
28
- executeRawSQLState = ActionState.create();
29
28
  connection;
30
29
  database;
31
30
  schemaExplorerState;
32
- sqlEditorTextModel;
33
- sqlEditor;
34
- sqlEditorViewState;
35
- sqlText = DEFAULT_SQL_TEXT;
36
- sqlExecutionResult;
37
- isLocalModeEnabled = false;
31
+ databaseSchema;
38
32
  constructor(editorStore) {
33
+ super();
39
34
  makeObservable(this, {
40
35
  isFetchingSchema: observable,
41
- executeRawSQLState: observable,
42
36
  connection: observable,
43
37
  database: observable,
44
38
  schemaExplorerState: observable,
45
- sqlText: observable,
46
- isLocalModeEnabled: observable,
47
- sqlExecutionResult: observable,
48
- sqlEditor: observable.ref,
49
- sqlEditorViewState: observable.ref,
50
- stopExecuteSQL: action,
51
- toggleIsLocalModeEnabled: action,
39
+ databaseSchema: observable,
52
40
  setConnection: action,
53
- setSQLEditor: action,
54
- setSQLEditorViewState: action,
55
- setSQLText: action,
41
+ setDataBaseSchema: action,
56
42
  executeRawSQL: flow,
57
43
  });
44
+ this.sqlEditorTextModel.setValue(DEFAULT_SQL_TEXT);
58
45
  this.editorStore = editorStore;
59
- this.sqlEditorTextModel = monacoEditorAPI.createModel(this.sqlText, CODE_EDITOR_LANGUAGE.SQL);
46
+ this.databaseSchema = [];
60
47
  }
61
48
  setConnection(val) {
62
49
  this.connection = val;
@@ -71,24 +58,26 @@ export class SQLPlaygroundPanelState {
71
58
  }
72
59
  this.sqlEditorTextModel.setValue(DEFAULT_SQL_TEXT);
73
60
  }
74
- setSQLText(val) {
75
- this.sqlText = val;
76
- }
77
- setSQLEditor(val) {
78
- this.sqlEditor = val;
79
- if (val) {
80
- const lines = this.sqlText.split('\n');
81
- moveCursorToPosition(val, {
82
- lineNumber: lines.length,
83
- column: lines.at(-1)?.length ?? 0,
84
- });
85
- }
61
+ setDataBaseSchema(val) {
62
+ this.databaseSchema = val;
86
63
  }
87
- stopExecuteSQL() {
88
- this.sqlExecutionResult = undefined;
64
+ fetchSchemaMetaData() {
65
+ return this.schemaExplorerState?.fetchDatabaseMetadata();
89
66
  }
90
- setSQLEditorViewState(val) {
91
- this.sqlEditorViewState = val;
67
+ getCodeCompletionSuggestions() {
68
+ const base = super.getCodeCompletionSuggestions();
69
+ if (this.schemaExplorerState?.treeData) {
70
+ const dbLabelText = uniqBy(Array.from(this.schemaExplorerState.treeData.nodes.values()).map((value) => value.label), (label) => label);
71
+ const dbLabelsCompletionItem = uniqBy(dbLabelText.map((value) => ({
72
+ label: value,
73
+ kind: monacoLanguagesAPI.CompletionItemKind.Field,
74
+ insertTextRules: monacoLanguagesAPI.CompletionItemInsertTextRule.InsertAsSnippet,
75
+ insertText: `${value} `,
76
+ })), (val) => val.label);
77
+ this.setDataBaseSchema(dbLabelsCompletionItem);
78
+ return base.concat(dbLabelText);
79
+ }
80
+ return base;
92
81
  }
93
82
  registerCommands() {
94
83
  this.editorStore.applicationStore.commandService.registerCommand({
@@ -105,10 +94,6 @@ export class SQLPlaygroundPanelState {
105
94
  deregisterCommands() {
106
95
  [STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY.SQL_PLAYGROUND_EXECUTE].forEach((key) => this.editorStore.applicationStore.commandService.deregisterCommand(key));
107
96
  }
108
- toggleIsLocalModeEnabled() {
109
- this.isLocalModeEnabled = !this.isLocalModeEnabled;
110
- this.sqlExecutionResult = undefined;
111
- }
112
97
  *executeRawSQL() {
113
98
  if (!this.connection || this.executeRawSQLState.isInProgress) {
114
99
  return;
@@ -140,4 +125,4 @@ export class SQLPlaygroundPanelState {
140
125
  }
141
126
  }
142
127
  }
143
- //# sourceMappingURL=SQLPlaygroundPanelState.js.map
128
+ //# sourceMappingURL=StudioSQLPlaygroundPanelState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StudioSQLPlaygroundPanelState.js","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/StudioSQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,iBAAiB,EACj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
4
4
  "description": "Legend Studio application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -45,17 +45,17 @@
45
45
  "test:watch": "jest --watch"
46
46
  },
47
47
  "dependencies": {
48
- "@finos/legend-application": "16.0.83",
49
- "@finos/legend-art": "7.1.133",
50
- "@finos/legend-code-editor": "2.0.138",
51
- "@finos/legend-data-cube": "0.3.50",
52
- "@finos/legend-extension-dsl-data-product": "0.0.32",
53
- "@finos/legend-extension-dsl-diagram": "8.1.197",
54
- "@finos/legend-graph": "32.3.18",
55
- "@finos/legend-lego": "2.0.151",
56
- "@finos/legend-query-builder": "4.17.67",
48
+ "@finos/legend-application": "16.0.84",
49
+ "@finos/legend-art": "7.1.134",
50
+ "@finos/legend-code-editor": "2.0.139",
51
+ "@finos/legend-data-cube": "0.3.51",
52
+ "@finos/legend-extension-dsl-data-product": "0.0.33",
53
+ "@finos/legend-extension-dsl-diagram": "8.1.198",
54
+ "@finos/legend-graph": "32.3.19",
55
+ "@finos/legend-lego": "2.0.152",
56
+ "@finos/legend-query-builder": "4.17.68",
57
57
  "@finos/legend-server-depot": "6.1.5",
58
- "@finos/legend-server-lakehouse": "0.3.18",
58
+ "@finos/legend-server-lakehouse": "0.3.19",
59
59
  "@finos/legend-server-sdlc": "5.3.68",
60
60
  "@finos/legend-server-showcase": "0.2.62",
61
61
  "@finos/legend-shared": "11.0.21",
@@ -67,6 +67,7 @@ import { type LegendStudioApplicationStore } from '../../../stores/LegendStudioB
67
67
  import { TEST__getLegendStudioApplicationConfig } from '../../../stores/__test-utils__/LegendStudioApplicationTestUtils.js';
68
68
  import { Route, Routes } from '@finos/legend-application/browser';
69
69
  import { ProjectViewer } from '../../project-view/ProjectViewer.js';
70
+ import { MockedMonacoEditorAPI } from '@finos/legend-lego/code-editor/test';
70
71
 
71
72
  export const TEST_DATA__DefaultSDLCInfo = {
72
73
  project: {
@@ -145,6 +146,9 @@ export const TEST__provideMockedEditorStore = (customization?: {
145
146
  TEST__getLegendStudioApplicationConfig(),
146
147
  pluginManager,
147
148
  );
149
+ MockedMonacoEditorAPI.createModel.mockReturnValue({
150
+ setValue(): void {},
151
+ });
148
152
  const value =
149
153
  customization?.mock ??
150
154
  new EditorStore(