@finos/legend-application-studio 28.19.73 → 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 (53) 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/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  5. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +26 -338
  6. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  7. package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
  8. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +9 -298
  9. package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
  10. package/lib/components/editor/side-bar/Explorer.js +1 -1
  11. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  12. package/lib/index.css +2 -2
  13. package/lib/index.css.map +1 -1
  14. package/lib/package.json +1 -1
  15. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  16. package/lib/stores/editor/EditorGraphState.js +1 -7
  17. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  18. package/lib/stores/editor/EditorStore.d.ts +2 -2
  19. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  20. package/lib/stores/editor/EditorStore.js +3 -3
  21. package/lib/stores/editor/EditorStore.js.map +1 -1
  22. package/lib/stores/editor/GraphEditFormModeState.js +1 -1
  23. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  24. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.d.ts.map +1 -1
  25. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.js +4 -0
  26. package/lib/stores/editor/__test-utils__/EditorStoreTestUtils.js.map +1 -1
  27. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts +0 -2
  28. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.d.ts.map +1 -1
  29. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js +0 -19
  30. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js.map +1 -1
  31. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts +1 -16
  32. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.d.ts.map +1 -1
  33. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js +1 -112
  34. package/lib/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.js.map +1 -1
  35. package/lib/stores/editor/panel-group/{SQLPlaygroundPanelState.d.ts → StudioSQLPlaygroundPanelState.d.ts} +8 -15
  36. package/lib/stores/editor/panel-group/StudioSQLPlaygroundPanelState.d.ts.map +1 -0
  37. package/lib/stores/editor/panel-group/{SQLPlaygroundPanelState.js → StudioSQLPlaygroundPanelState.js} +29 -44
  38. package/lib/stores/editor/panel-group/StudioSQLPlaygroundPanelState.js.map +1 -0
  39. package/package.json +13 -13
  40. package/src/components/editor/__test-utils__/EditorComponentTestUtils.tsx +4 -0
  41. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +53 -599
  42. package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +12 -576
  43. package/src/components/editor/side-bar/Explorer.tsx +1 -1
  44. package/src/stores/editor/EditorGraphState.ts +4 -11
  45. package/src/stores/editor/EditorStore.ts +3 -3
  46. package/src/stores/editor/GraphEditFormModeState.ts +1 -1
  47. package/src/stores/editor/__test-utils__/EditorStoreTestUtils.ts +4 -1
  48. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts +0 -26
  49. package/src/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.ts +1 -178
  50. package/src/stores/editor/panel-group/{SQLPlaygroundPanelState.ts → StudioSQLPlaygroundPanelState.ts} +47 -60
  51. package/tsconfig.json +1 -1
  52. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +0 -1
  53. package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +0 -1
@@ -109,7 +109,7 @@ import { GraphEditFormModeState } from './GraphEditFormModeState.js';
109
109
  import type { GraphEditorMode } from './GraphEditorMode.js';
110
110
  import { GraphEditGrammarModeState } from './GraphEditGrammarModeState.js';
111
111
  import { GlobalBulkServiceRegistrationState } from './sidebar-state/BulkServiceRegistrationState.js';
112
- import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.js';
112
+ import { StudioSQLPlaygroundPanelState } from './panel-group/StudioSQLPlaygroundPanelState.js';
113
113
  import type { QuickInputState } from './QuickInputState.js';
114
114
  import { GlobalEndToEndWorkflowState } from './sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
115
115
  import {
@@ -183,7 +183,7 @@ export class EditorStore implements CommandRegistrar {
183
183
  globalEndToEndWorkflowState: GlobalEndToEndWorkflowState;
184
184
  devToolState: DevToolPanelState;
185
185
  devMetadataState: DevMetadataState;
186
- sqlPlaygroundState: SQLPlaygroundPanelState;
186
+ studioSqlPlaygroundState: StudioSQLPlaygroundPanelState;
187
187
 
188
188
  modelImporterState: ModelImporterState;
189
189
  projectConfigurationEditorState: ProjectConfigurationEditorState;
@@ -280,7 +280,7 @@ export class EditorStore implements CommandRegistrar {
280
280
  this.changeDetectionState = new ChangeDetectionState(this, this.graphState);
281
281
  this.devToolState = new DevToolPanelState(this);
282
282
  this.devMetadataState = new DevMetadataState(this);
283
- this.sqlPlaygroundState = new SQLPlaygroundPanelState(this);
283
+ this.studioSqlPlaygroundState = new StudioSQLPlaygroundPanelState(this);
284
284
  this.embeddedQueryBuilderState = new EmbeddedQueryBuilderState(this);
285
285
  // side bar panels
286
286
  this.explorerTreeState = new ExplorerTreeState(this);
@@ -556,7 +556,7 @@ export class GraphEditFormModeState extends GraphEditorMode {
556
556
  }
557
557
 
558
558
  *onLeave(): GeneratorFn<void> {
559
- this.editorStore.sqlPlaygroundState.setConnection(undefined);
559
+ this.editorStore.studioSqlPlaygroundState.setConnection(undefined);
560
560
  this.editorStore.tabManagerState.cacheAndClose();
561
561
  this.editorStore.applicationStore.layoutService.setShowBackdrop(false);
562
562
  }
@@ -20,6 +20,7 @@ import { SDLCServerClient } from '@finos/legend-server-sdlc';
20
20
  import { DepotServerClient } from '@finos/legend-server-depot';
21
21
  import { ApplicationStore } from '@finos/legend-application';
22
22
  import { TEST__getLegendStudioApplicationConfig } from '../../__test-utils__/LegendStudioApplicationTestUtils.js';
23
+ import { MockedMonacoEditorAPI } from '@finos/legend-lego/code-editor/test';
23
24
 
24
25
  export const TEST__getTestEditorStore = (
25
26
  pluginManager = LegendStudioPluginManager.create(),
@@ -28,7 +29,9 @@ export const TEST__getTestEditorStore = (
28
29
  TEST__getLegendStudioApplicationConfig(),
29
30
  pluginManager,
30
31
  );
31
-
32
+ MockedMonacoEditorAPI.createModel.mockReturnValue({
33
+ setValue(): void {},
34
+ });
32
35
  return new EditorStore(
33
36
  applicationStore,
34
37
  new SDLCServerClient({
@@ -106,8 +106,6 @@ export class ProjectConfigurationEditorState extends EditorState {
106
106
  setProjectConfiguration: action,
107
107
  setSelectedTab: action,
108
108
  setManualOverwrite: action,
109
- syncExclusionsToProjectDependencies: action,
110
- loadExclusionsFromProjectDependencies: action,
111
109
  fectchAssociatedProjectsAndVersions: flow,
112
110
  updateProjectConfiguration: flow,
113
111
  updateToLatestStructure: flow,
@@ -133,7 +131,6 @@ export class ProjectConfigurationEditorState extends EditorState {
133
131
 
134
132
  setProjectConfiguration(projectConfiguration: ProjectConfiguration): void {
135
133
  this.projectConfiguration = projectConfiguration;
136
- this.loadExclusionsFromProjectDependencies();
137
134
  }
138
135
 
139
136
  setSelectedTab(tab: CONFIGURATION_EDITOR_TAB): void {
@@ -194,24 +191,6 @@ export class ProjectConfigurationEditorState extends EditorState {
194
191
  );
195
192
  }
196
193
 
197
- syncExclusionsToProjectDependencies(): void {
198
- this.currentProjectConfiguration.projectDependencies.forEach((dep) => {
199
- const exclusions = this.projectDependencyEditorState.getExclusions(
200
- dep.projectId,
201
- );
202
- dep.setExclusions(exclusions);
203
- });
204
- }
205
-
206
- loadExclusionsFromProjectDependencies(): void {
207
- this.projectConfiguration?.projectDependencies.forEach((dep) => {
208
- if (dep.exclusions && dep.exclusions.length > 0) {
209
- this.projectDependencyEditorState.dependencyExclusions[dep.projectId] =
210
- [...dep.exclusions];
211
- }
212
- });
213
- }
214
-
215
194
  *fectchAssociatedProjectsAndVersions(): GeneratorFn<void> {
216
195
  this.fetchingProjectVersionsState.inProgress();
217
196
  try {
@@ -255,9 +234,6 @@ export class ProjectConfigurationEditorState extends EditorState {
255
234
  ): GeneratorFn<void> {
256
235
  try {
257
236
  this.updatingConfigurationState.inProgress();
258
-
259
- this.syncExclusionsToProjectDependencies();
260
-
261
237
  yield this.editorStore.sdlcServerClient.updateConfiguration(
262
238
  this.editorStore.sdlcState.activeProject.projectId,
263
239
  this.editorStore.sdlcState.activeWorkspace,
@@ -364,8 +340,6 @@ export class ProjectConfigurationEditorState extends EditorState {
364
340
  showLoading: true,
365
341
  });
366
342
  try {
367
- this.syncExclusionsToProjectDependencies();
368
-
369
343
  const updateProjectConfigurationCommand =
370
344
  new UpdateProjectConfigurationCommand(
371
345
  this.currentProjectConfiguration.groupId,
@@ -24,7 +24,6 @@ import {
24
24
  assertErrorThrown,
25
25
  LogEvent,
26
26
  isNonNullable,
27
- guaranteeNonNullable,
28
27
  uuid,
29
28
  } from '@finos/legend-shared';
30
29
  import {
@@ -40,11 +39,7 @@ import {
40
39
  } from '@finos/legend-server-depot';
41
40
  import type { TreeData, TreeNodeData } from '@finos/legend-art';
42
41
  import { LEGEND_STUDIO_APP_EVENT } from '../../../../__lib__/LegendStudioEvent.js';
43
- import {
44
- ProjectDependencyExclusion,
45
- type ProjectConfiguration,
46
- } from '@finos/legend-server-sdlc';
47
- import { generateGAVCoordinates } from '@finos/legend-storage';
42
+ import type { ProjectConfiguration } from '@finos/legend-server-sdlc';
48
43
 
49
44
  export abstract class ProjectDependencyConflictTreeNodeData
50
45
  implements TreeNodeData
@@ -304,12 +299,6 @@ export class ProjectDependencyEditorState {
304
299
  expandConflictsState = ActionState.create();
305
300
  buildConflictPathState = ActionState.create();
306
301
 
307
- // Exclusions management
308
- selectedDependencyForExclusions: ProjectDependencyVersionNode | undefined;
309
- dependencyExclusions: {
310
- [dependencyId: string]: ProjectDependencyExclusion[];
311
- } = {};
312
-
313
302
  constructor(
314
303
  configState: ProjectConfigurationEditorState,
315
304
  editorStore: EditorStore,
@@ -323,8 +312,6 @@ export class ProjectDependencyEditorState {
323
312
  reportTab: observable,
324
313
  expandConflictsState: observable,
325
314
  buildConflictPathState: observable,
326
- selectedDependencyForExclusions: observable,
327
- dependencyExclusions: observable,
328
315
  setReportTab: action,
329
316
  expandAllConflicts: action,
330
317
  setFlattenDependencyTreeData: action,
@@ -333,15 +320,6 @@ export class ProjectDependencyEditorState {
333
320
  setDependencyTreeData: action,
334
321
  buildConflictPaths: action,
335
322
  setConflictStates: action,
336
- setSelectedDependencyForExclusions: action,
337
- addExclusion: action,
338
- addExclusionByCoordinate: action,
339
- removeExclusion: action,
340
- removeExclusionByCoordinate: action,
341
- clearExclusions: action,
342
- getExclusions: action,
343
- getExclusionCoordinates: action,
344
- syncExclusionsToProjectDependency: action,
345
323
  fetchDependencyReport: flow,
346
324
  });
347
325
  this.configState = configState;
@@ -398,149 +376,6 @@ export class ProjectDependencyEditorState {
398
376
  return this.configState.projectConfiguration;
399
377
  }
400
378
 
401
- setSelectedDependencyForExclusions(
402
- dependency: ProjectDependencyVersionNode | undefined,
403
- ): void {
404
- this.selectedDependencyForExclusions = dependency;
405
- }
406
-
407
- addExclusion(
408
- dependencyId: string,
409
- exclusion: ProjectDependencyExclusion,
410
- ): void {
411
- if (!this.dependencyExclusions[dependencyId]) {
412
- this.dependencyExclusions[dependencyId] = [];
413
- }
414
- const existingExclusion = this.findExistingExclusion(
415
- dependencyId,
416
- generateGAVCoordinates(
417
- guaranteeNonNullable(exclusion.groupId),
418
- guaranteeNonNullable(exclusion.artifactId),
419
- undefined,
420
- ),
421
- );
422
- if (!existingExclusion) {
423
- this.dependencyExclusions[dependencyId].push(exclusion);
424
- this.syncExclusionsToProjectDependency(dependencyId);
425
- }
426
- }
427
-
428
- addExclusionByCoordinate(
429
- dependencyId: string,
430
- exclusionCoordinate: string,
431
- ): void {
432
- const exclusion =
433
- ProjectDependencyExclusion.fromCoordinate(exclusionCoordinate);
434
- this.addExclusion(dependencyId, exclusion);
435
- }
436
-
437
- removeExclusion(
438
- dependencyId: string,
439
- exclusion: ProjectDependencyExclusion,
440
- ): void {
441
- if (this.dependencyExclusions[dependencyId]) {
442
- const coordinate = generateGAVCoordinates(
443
- guaranteeNonNullable(exclusion.groupId),
444
- guaranteeNonNullable(exclusion.artifactId),
445
- undefined,
446
- );
447
- const index = this.findExclusionIndex(dependencyId, coordinate);
448
- if (index > -1) {
449
- this.dependencyExclusions[dependencyId].splice(index, 1);
450
- }
451
- if (this.dependencyExclusions[dependencyId].length === 0) {
452
- delete this.dependencyExclusions[dependencyId];
453
- }
454
- this.syncExclusionsToProjectDependency(dependencyId);
455
- }
456
- }
457
-
458
- removeExclusionByCoordinate(
459
- dependencyId: string,
460
- exclusionCoordinate: string,
461
- ): void {
462
- if (this.dependencyExclusions[dependencyId]) {
463
- const index = this.findExclusionIndex(dependencyId, exclusionCoordinate);
464
- if (index > -1) {
465
- this.dependencyExclusions[dependencyId].splice(index, 1);
466
- }
467
- if (this.dependencyExclusions[dependencyId].length === 0) {
468
- delete this.dependencyExclusions[dependencyId];
469
- }
470
- this.syncExclusionsToProjectDependency(dependencyId);
471
- }
472
- }
473
-
474
- clearExclusions(dependencyId?: string): void {
475
- if (dependencyId) {
476
- delete this.dependencyExclusions[dependencyId];
477
- this.syncExclusionsToProjectDependency(dependencyId);
478
- } else {
479
- this.dependencyExclusions = {};
480
- this.projectConfiguration?.projectDependencies.forEach((dep) => {
481
- this.syncExclusionsToProjectDependency(dep.projectId);
482
- });
483
- }
484
- }
485
-
486
- getExclusions(dependencyId: string): ProjectDependencyExclusion[] {
487
- return this.dependencyExclusions[dependencyId] ?? [];
488
- }
489
-
490
- getExclusionCoordinates(dependencyId: string): string[] {
491
- const exclusions = this.getExclusions(dependencyId);
492
- return exclusions.map((e) =>
493
- generateGAVCoordinates(
494
- guaranteeNonNullable(e.groupId),
495
- guaranteeNonNullable(e.artifactId),
496
- undefined,
497
- ),
498
- );
499
- }
500
-
501
- private findExistingExclusion(
502
- dependencyId: string,
503
- coordinate: string,
504
- ): ProjectDependencyExclusion | undefined {
505
- if (!this.dependencyExclusions[dependencyId]) {
506
- return undefined;
507
- }
508
- for (let i = 0; i < this.dependencyExclusions[dependencyId].length; i++) {
509
- const exclusion = guaranteeNonNullable(
510
- this.dependencyExclusions[dependencyId][i],
511
- );
512
- const exclusionCoordinate = generateGAVCoordinates(
513
- guaranteeNonNullable(exclusion.groupId),
514
- guaranteeNonNullable(exclusion.artifactId),
515
- undefined,
516
- );
517
- if (exclusionCoordinate === coordinate) {
518
- return this.dependencyExclusions[dependencyId][i];
519
- }
520
- }
521
- return undefined;
522
- }
523
-
524
- private findExclusionIndex(dependencyId: string, coordinate: string): number {
525
- if (!this.dependencyExclusions[dependencyId]) {
526
- return -1;
527
- }
528
- for (let i = 0; i < this.dependencyExclusions[dependencyId].length; i++) {
529
- const exclusion = guaranteeNonNullable(
530
- this.dependencyExclusions[dependencyId][i],
531
- );
532
- const exclusionCoordinate = generateGAVCoordinates(
533
- guaranteeNonNullable(exclusion.groupId),
534
- guaranteeNonNullable(exclusion.artifactId),
535
- undefined,
536
- );
537
- if (exclusionCoordinate === coordinate) {
538
- return i;
539
- }
540
- }
541
- return -1;
542
- }
543
-
544
379
  *fetchDependencyReport(): GeneratorFn<void> {
545
380
  try {
546
381
  this.fetchingDependencyInfoState.inProgress();
@@ -607,17 +442,5 @@ export class ProjectDependencyEditorState {
607
442
  clearTrees(): void {
608
443
  this.flattenDependencyTreeData = undefined;
609
444
  this.dependencyTreeData = undefined;
610
- this.selectedDependencyForExclusions = undefined;
611
- }
612
-
613
- syncExclusionsToProjectDependency(dependencyId: string): void {
614
- const projectDependency =
615
- this.projectConfiguration?.projectDependencies.find(
616
- (dep) => dep.projectId === dependencyId,
617
- );
618
- if (projectDependency) {
619
- const exclusions = this.getExclusions(dependencyId);
620
- projectDependency.setExclusions(exclusions);
621
- }
622
445
  }
623
446
  }
@@ -19,9 +19,10 @@ import {
19
19
  assertErrorThrown,
20
20
  LogEvent,
21
21
  ActionState,
22
+ uniqBy,
22
23
  } from '@finos/legend-shared';
23
24
  import { observable, makeObservable, flow, flowResult, action } from 'mobx';
24
- import { editor as monacoEditorAPI } from 'monaco-editor';
25
+ import { languages as monacoLanguagesAPI } from 'monaco-editor';
25
26
  import {
26
27
  type Database,
27
28
  type PackageableConnection,
@@ -29,14 +30,12 @@ import {
29
30
  GRAPH_MANAGER_EVENT,
30
31
  } from '@finos/legend-graph';
31
32
  import type { EditorStore } from '../EditorStore.js';
32
- import {
33
- CODE_EDITOR_LANGUAGE,
34
- moveCursorToPosition,
35
- } from '@finos/legend-code-editor';
33
+
36
34
  import type { CommandRegistrar } from '@finos/legend-application';
37
35
  import { STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY } from '../../../__lib__/STO_Relational_LegendStudioCommand.js';
38
36
  import { PANEL_MODE } from '../EditorConfig.js';
39
37
  import { DatabaseSchemaExplorerState } from '../editor-state/element-editor-state/connection/DatabaseBuilderState.js';
38
+ import { AbstractSQLPlaygroundState } from '@finos/legend-lego/sql-playground';
40
39
 
41
40
  const DEFAULT_SQL_TEXT = `--Start building your SQL. Note that you can also drag-and-drop nodes from schema explorer\n`;
42
41
 
@@ -45,50 +44,33 @@ export interface SQL_ExecutionResult {
45
44
  sqlDuration: number;
46
45
  }
47
46
 
48
- export class SQLPlaygroundPanelState implements CommandRegistrar {
47
+ export class StudioSQLPlaygroundPanelState
48
+ extends AbstractSQLPlaygroundState
49
+ implements CommandRegistrar
50
+ {
49
51
  readonly editorStore: EditorStore;
50
52
 
51
53
  isFetchingSchema = ActionState.create();
52
- executeRawSQLState = ActionState.create();
53
-
54
54
  connection?: PackageableConnection | undefined;
55
55
  database?: Database | undefined;
56
56
  schemaExplorerState?: DatabaseSchemaExplorerState | undefined;
57
-
58
- readonly sqlEditorTextModel: monacoEditorAPI.ITextModel;
59
- sqlEditor?: monacoEditorAPI.IStandaloneCodeEditor | undefined;
60
- sqlEditorViewState?: monacoEditorAPI.ICodeEditorViewState | undefined;
61
- sqlText = DEFAULT_SQL_TEXT;
62
- sqlExecutionResult?: SQL_ExecutionResult | undefined;
63
-
64
- isLocalModeEnabled = false;
57
+ databaseSchema: monacoLanguagesAPI.CompletionItem[];
65
58
 
66
59
  constructor(editorStore: EditorStore) {
60
+ super();
67
61
  makeObservable(this, {
68
62
  isFetchingSchema: observable,
69
- executeRawSQLState: observable,
70
63
  connection: observable,
71
64
  database: observable,
72
65
  schemaExplorerState: observable,
73
- sqlText: observable,
74
- isLocalModeEnabled: observable,
75
- sqlExecutionResult: observable,
76
- sqlEditor: observable.ref,
77
- sqlEditorViewState: observable.ref,
78
- stopExecuteSQL: action,
79
- toggleIsLocalModeEnabled: action,
66
+ databaseSchema: observable,
80
67
  setConnection: action,
81
- setSQLEditor: action,
82
- setSQLEditorViewState: action,
83
- setSQLText: action,
68
+ setDataBaseSchema: action,
84
69
  executeRawSQL: flow,
85
70
  });
86
-
71
+ this.sqlEditorTextModel.setValue(DEFAULT_SQL_TEXT);
87
72
  this.editorStore = editorStore;
88
- this.sqlEditorTextModel = monacoEditorAPI.createModel(
89
- this.sqlText,
90
- CODE_EDITOR_LANGUAGE.SQL,
91
- );
73
+ this.databaseSchema = [];
92
74
  }
93
75
 
94
76
  setConnection(val: PackageableConnection | undefined): void {
@@ -107,32 +89,42 @@ export class SQLPlaygroundPanelState implements CommandRegistrar {
107
89
  this.sqlEditorTextModel.setValue(DEFAULT_SQL_TEXT);
108
90
  }
109
91
 
110
- setSQLText(val: string): void {
111
- this.sqlText = val;
112
- }
113
-
114
- setSQLEditor(val: monacoEditorAPI.IStandaloneCodeEditor | undefined): void {
115
- this.sqlEditor = val;
116
- if (val) {
117
- const lines = this.sqlText.split('\n');
118
- moveCursorToPosition(val, {
119
- lineNumber: lines.length,
120
- column: lines.at(-1)?.length ?? 0,
121
- });
122
- }
92
+ setDataBaseSchema(val: monacoLanguagesAPI.CompletionItem[]): void {
93
+ this.databaseSchema = val;
123
94
  }
124
95
 
125
- stopExecuteSQL(): void {
126
- this.sqlExecutionResult = undefined;
96
+ fetchSchemaMetaData(): GeneratorFn<void> | undefined {
97
+ return this.schemaExplorerState?.fetchDatabaseMetadata();
127
98
  }
128
-
129
- setSQLEditorViewState(
130
- val: monacoEditorAPI.ICodeEditorViewState | undefined,
131
- ): void {
132
- this.sqlEditorViewState = val;
99
+ override getCodeCompletionSuggestions(): string[] {
100
+ const base = super.getCodeCompletionSuggestions();
101
+ if (this.schemaExplorerState?.treeData) {
102
+ const dbLabelText = uniqBy(
103
+ Array.from(this.schemaExplorerState.treeData.nodes.values()).map(
104
+ (value) => value.label,
105
+ ),
106
+ (label) => label,
107
+ );
108
+ const dbLabelsCompletionItem = uniqBy(
109
+ dbLabelText.map(
110
+ (value) =>
111
+ ({
112
+ label: value,
113
+ kind: monacoLanguagesAPI.CompletionItemKind.Field,
114
+ insertTextRules:
115
+ monacoLanguagesAPI.CompletionItemInsertTextRule.InsertAsSnippet,
116
+ insertText: `${value} `,
117
+ }) as monacoLanguagesAPI.CompletionItem,
118
+ ),
119
+ (val) => val.label,
120
+ );
121
+ this.setDataBaseSchema(dbLabelsCompletionItem);
122
+ return base.concat(dbLabelText);
123
+ }
124
+ return base;
133
125
  }
134
126
 
135
- registerCommands(): void {
127
+ override registerCommands(): void {
136
128
  this.editorStore.applicationStore.commandService.registerCommand({
137
129
  key: STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY.SQL_PLAYGROUND_EXECUTE,
138
130
  trigger: () =>
@@ -148,19 +140,14 @@ export class SQLPlaygroundPanelState implements CommandRegistrar {
148
140
  });
149
141
  }
150
142
 
151
- deregisterCommands(): void {
143
+ override deregisterCommands(): void {
152
144
  [STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY.SQL_PLAYGROUND_EXECUTE].forEach(
153
145
  (key) =>
154
146
  this.editorStore.applicationStore.commandService.deregisterCommand(key),
155
147
  );
156
148
  }
157
149
 
158
- toggleIsLocalModeEnabled(): void {
159
- this.isLocalModeEnabled = !this.isLocalModeEnabled;
160
- this.sqlExecutionResult = undefined;
161
- }
162
-
163
- *executeRawSQL(): GeneratorFn<void> {
150
+ override *executeRawSQL(): GeneratorFn<void> {
164
151
  if (!this.connection || this.executeRawSQLState.isInProgress) {
165
152
  return;
166
153
  }
package/tsconfig.json CHANGED
@@ -172,7 +172,7 @@
172
172
  "./src/stores/editor/editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.ts",
173
173
  "./src/stores/editor/editor-state/project-configuration-editor-state/ProjectDependencyEditorState.ts",
174
174
  "./src/stores/editor/panel-group/DevToolPanelState.ts",
175
- "./src/stores/editor/panel-group/SQLPlaygroundPanelState.ts",
175
+ "./src/stores/editor/panel-group/StudioSQLPlaygroundPanelState.ts",
176
176
  "./src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts",
177
177
  "./src/stores/editor/sidebar-state/LocalChangesState.ts",
178
178
  "./src/stores/editor/sidebar-state/ProjectOverviewState.ts",
@@ -1 +0,0 @@
1
- {"version":3,"file":"SQLPlaygroundPanelState.d.ts","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/SQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAE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,GAAG,IAAI;IAW1E,cAAc,IAAI,IAAI;IAItB,qBAAqB,CACnB,GAAG,EAAE,eAAe,CAAC,oBAAoB,GAAG,SAAS,GACpD,IAAI;IAIP,gBAAgB,IAAI,IAAI;IAgBxB,kBAAkB,IAAI,IAAI;IAO1B,wBAAwB,IAAI,IAAI;IAK/B,aAAa,IAAI,WAAW,CAAC,IAAI,CAAC;CAsCpC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SQLPlaygroundPanelState.js","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/SQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,iBAAiB,EACjB,QAAQ,EACR,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAGL,qCAAqC,EACrC,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,wCAAwC,EAAE,MAAM,wDAAwD,CAAC;AAClH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yEAAyE,CAAC;AAEtH,MAAM,gBAAgB,GAAG,8FAA8F,CAAC;AAOxH,MAAM,OAAO,uBAAuB;IACzB,WAAW,CAAc;IAElC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;IACxC,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;IAE1C,UAAU,CAAqC;IAC/C,QAAQ,CAAwB;IAChC,mBAAmB,CAA2C;IAErD,kBAAkB,CAA6B;IACxD,SAAS,CAAqD;IAC9D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