@finos/legend-application-studio 28.13.14 → 28.14.0

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 (40) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +4 -1
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +4 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/components/editor/editor-group/EditorGroup.js +1 -1
  6. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  7. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  8. package/lib/components/editor/editor-group/GrammarTextEditor.js +258 -215
  9. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  10. package/lib/components/workspace-setup/WorkspaceSetup.js +7 -7
  11. package/lib/components/workspace-setup/WorkspaceSetup.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 +8 -1
  17. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  18. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  19. package/lib/stores/editor/EditorStore.js +8 -2
  20. package/lib/stores/editor/EditorStore.js.map +1 -1
  21. package/lib/stores/editor/GraphEditFormModeState.js +1 -1
  22. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  23. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +4 -0
  24. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  25. package/lib/stores/editor/GraphEditGrammarModeState.js +29 -2
  26. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  27. package/lib/stores/editor/editor-state/GrammarTextEditorState.d.ts +2 -1
  28. package/lib/stores/editor/editor-state/GrammarTextEditorState.d.ts.map +1 -1
  29. package/lib/stores/editor/editor-state/GrammarTextEditorState.js +5 -2
  30. package/lib/stores/editor/editor-state/GrammarTextEditorState.js.map +1 -1
  31. package/package.json +4 -4
  32. package/src/__lib__/LegendStudioEvent.ts +5 -0
  33. package/src/components/editor/editor-group/EditorGroup.tsx +1 -1
  34. package/src/components/editor/editor-group/GrammarTextEditor.tsx +418 -351
  35. package/src/components/workspace-setup/WorkspaceSetup.tsx +15 -15
  36. package/src/stores/editor/EditorGraphState.ts +12 -0
  37. package/src/stores/editor/EditorStore.ts +16 -2
  38. package/src/stores/editor/GraphEditFormModeState.ts +1 -1
  39. package/src/stores/editor/GraphEditGrammarModeState.ts +49 -1
  40. package/src/stores/editor/editor-state/GrammarTextEditorState.ts +7 -2
@@ -443,7 +443,7 @@ export const WorkspaceSetup = withWorkspaceSetupStore(
443
443
  <div className="workspace-setup__selectors__container">
444
444
  <div className="workspace-setup__selector">
445
445
  <div className="workspace-setup__selector__header">
446
- Search for project
446
+ Search for an existing project
447
447
  </div>
448
448
  <div className="workspace-setup__selector__content">
449
449
  <div
@@ -478,7 +478,7 @@ export const WorkspaceSetup = withWorkspaceSetupStore(
478
478
  </div>
479
479
  <div className="workspace-setup__selector">
480
480
  <div className="workspace-setup__selector__header">
481
- Choose a workspace
481
+ Choose an existing workspace
482
482
  </div>
483
483
  <div className="workspace-setup__selector__content">
484
484
  <div
@@ -534,6 +534,19 @@ export const WorkspaceSetup = withWorkspaceSetupStore(
534
534
  </div>
535
535
  <div className="workspace-setup__actions-combo">
536
536
  <div className="workspace-setup__actions">
537
+ <button
538
+ className="workspace-setup__new-workspace-btn"
539
+ onClick={showCreateWorkspaceModal}
540
+ title="Create a Workspace after choosing one project"
541
+ disabled={
542
+ !setupStore.currentProject ||
543
+ !setupStore.currentProjectConfigurationStatus ||
544
+ !setupStore.currentProjectConfigurationStatus
545
+ .isConfigured
546
+ }
547
+ >
548
+ {`Need to create a new workspace?`}
549
+ </button>
537
550
  <div className="workspace-setup__actions__button">
538
551
  <button
539
552
  className="workspace-setup__go-btn btn--dark"
@@ -566,19 +579,6 @@ export const WorkspaceSetup = withWorkspaceSetupStore(
566
579
  >
567
580
  Create New Project
568
581
  </button>
569
- <button
570
- className="workspace-setup__new-btn btn--dark"
571
- onClick={showCreateWorkspaceModal}
572
- title="Create a Workspace after choosing one project"
573
- disabled={
574
- !setupStore.currentProject ||
575
- !setupStore.currentProjectConfigurationStatus ||
576
- !setupStore.currentProjectConfigurationStatus
577
- .isConfigured
578
- }
579
- >
580
- Create New Workspace
581
- </button>
582
582
  </div>
583
583
  </div>
584
584
  </div>
@@ -88,6 +88,7 @@ import {
88
88
  createGraphBuilderReport,
89
89
  ExecutionEnvironmentInstance,
90
90
  SnowflakeApp,
91
+ GraphEntities,
91
92
  } from '@finos/legend-graph';
92
93
  import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
93
94
  import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
@@ -169,6 +170,7 @@ export class EditorGraphState {
169
170
  loadEntityChangesToGraph: flow,
170
171
  updateGenerationGraphAndApplication: flow,
171
172
  rebuildDependencies: flow,
173
+ buildGraphForLazyText: flow,
172
174
  });
173
175
 
174
176
  this.editorStore = editorStore;
@@ -510,6 +512,16 @@ export class EditorGraphState {
510
512
  )) as Map<string, EntitiesWithOrigin>;
511
513
  stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
512
514
  dependencyManager.initialize(dependencyEntitiesIndex);
515
+ // set dependency manager graph origin to entities
516
+ if (dependencyManager.origin === undefined) {
517
+ dependencyManager.setOrigin(
518
+ new GraphEntities(
519
+ Array.from(dependencyEntitiesIndex.values())
520
+ .map((e) => e.entities)
521
+ .flat(),
522
+ ),
523
+ );
524
+ }
513
525
  this.isInitializingGraph = false;
514
526
  this.editorStore.graphManagerState.dependenciesBuildState.sync(
515
527
  ActionState.create().pass(),
@@ -811,7 +811,14 @@ export class EditorStore implements CommandRegistrar {
811
811
  Date.now() - startTime,
812
812
  'ms',
813
813
  );
814
- } catch {
814
+ } catch (error) {
815
+ assertErrorThrown(error);
816
+ this.applicationStore.logService.error(
817
+ LogEvent.create(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES_ERROR),
818
+ Date.now() - startTime,
819
+ 'ms',
820
+ );
821
+ this.applicationStore.notificationService.notifyError(error);
815
822
  return;
816
823
  } finally {
817
824
  this.initState.setMessage(undefined);
@@ -928,7 +935,14 @@ export class EditorStore implements CommandRegistrar {
928
935
  Date.now() - startTime,
929
936
  'ms',
930
937
  );
931
- } catch {
938
+ } catch (error) {
939
+ assertErrorThrown(error);
940
+ this.applicationStore.logService.error(
941
+ LogEvent.create(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES_ERROR),
942
+ Date.now() - startTime,
943
+ 'ms',
944
+ );
945
+ this.applicationStore.notificationService.notifyError(error);
932
946
  return;
933
947
  } finally {
934
948
  this.initState.setMessage(undefined);
@@ -475,7 +475,7 @@ export class GraphEditFormModeState extends GraphEditorMode {
475
475
  if (!options?.disableNotificationOnSuccess) {
476
476
  if (this.editorStore.graphState.warnings.length) {
477
477
  this.editorStore.applicationStore.notificationService.notifyWarning(
478
- `Compilation suceeded with warnings`,
478
+ `Compilation succeeded with warnings`,
479
479
  );
480
480
  } else {
481
481
  if (!options?.disableNotificationOnSuccess) {
@@ -34,6 +34,7 @@ import {
34
34
  LogEvent,
35
35
  ActionState,
36
36
  StopWatch,
37
+ assertNonNullable,
37
38
  } from '@finos/legend-shared';
38
39
  import type { Entity } from '@finos/legend-storage';
39
40
  import { makeObservable, flow, flowResult, observable } from 'mobx';
@@ -48,6 +49,11 @@ import { graph_dispose } from '../graph-modifier/GraphModifierHelper.js';
48
49
  import { LegendStudioTelemetryHelper } from '../../__lib__/LegendStudioTelemetryHelper.js';
49
50
  import { GraphEditorMode } from './GraphEditorMode.js';
50
51
  import { ElementEditorState } from './editor-state/element-editor-state/ElementEditorState.js';
52
+ import { LEGEND_STUDIO_APP_EVENT } from '../../__lib__/LegendStudioEvent.js';
53
+
54
+ export enum GRAMMAR_MODE_EDITOR_ACTION {
55
+ GO_TO_ELEMENT_DEFINITION = 'go-to-element-definition',
56
+ }
51
57
 
52
58
  export class GraphEditGrammarModeState extends GraphEditorMode {
53
59
  grammarTextEditorState: GrammarTextEditorState;
@@ -57,6 +63,7 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
57
63
  makeObservable(this, {
58
64
  grammarTextEditorState: observable,
59
65
  compileText: flow,
66
+ goToElement: flow,
60
67
  });
61
68
  this.grammarTextEditorState = new GrammarTextEditorState(this.editorStore);
62
69
  }
@@ -130,6 +137,47 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
130
137
  }
131
138
  }
132
139
 
140
+ *goToElement(elementPath: string): GeneratorFn<void> {
141
+ try {
142
+ const sourceInformationIndex = new Map<string, SourceInformation>();
143
+ (yield this.editorStore.graphManagerState.graphManager.pureCodeToEntities(
144
+ this.grammarTextEditorState.graphGrammarText,
145
+ {
146
+ sourceInformationIndex,
147
+ },
148
+ )) as Entity[];
149
+ this.grammarTextEditorState.setSourceInformationIndex(
150
+ sourceInformationIndex,
151
+ );
152
+ const sourceInformation =
153
+ this.grammarTextEditorState.sourceInformationIndex.get(elementPath);
154
+ assertNonNullable(
155
+ sourceInformation,
156
+ `No definition found for current element in current grammar. Element may not exist of be defined in dependencies`,
157
+ );
158
+ this.grammarTextEditorState.setForcedCursorPosition({
159
+ lineNumber: sourceInformation.startLine,
160
+ column: 0,
161
+ });
162
+ this.editorStore.applicationStore.logService.info(
163
+ LogEvent.create(
164
+ LEGEND_STUDIO_APP_EVENT.TEXT_MODE_ACTION_KEYBOARD_SHORTCUT_GO_TO_DEFINITION__SUCCESS,
165
+ ),
166
+ );
167
+ } catch (error) {
168
+ assertErrorThrown(error);
169
+ this.editorStore.applicationStore.notificationService.notifyError(
170
+ `Unable to go to element ${elementPath}: ${error.message}`,
171
+ );
172
+ this.editorStore.applicationStore.logService.error(
173
+ LogEvent.create(
174
+ LEGEND_STUDIO_APP_EVENT.TEXT_MODE_ACTION_KEYBOARD_SHORTCUT_GO_TO_DEFINITION__ERROR,
175
+ ),
176
+ error,
177
+ );
178
+ }
179
+ }
180
+
133
181
  *compileText(
134
182
  options?: {
135
183
  onError?: () => void;
@@ -318,7 +366,7 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
318
366
  if (!options?.disableNotificationOnSuccess) {
319
367
  if (this.editorStore.graphState.warnings.length) {
320
368
  this.editorStore.applicationStore.notificationService.notifyWarning(
321
- `Compilation suceeded with warnings`,
369
+ `Compilation succeeded with warnings`,
322
370
  );
323
371
  } else {
324
372
  if (!options?.disableNotificationOnSuccess) {
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import type { EditorStore } from '../EditorStore.js';
18
- import { action, makeObservable, observable } from 'mobx';
18
+ import { action, computed, makeObservable, observable } from 'mobx';
19
19
  import { hashValue } from '@finos/legend-shared';
20
- import { type SourceInformation } from '@finos/legend-graph';
20
+ import type { SourceInformation } from '@finos/legend-graph';
21
21
  import { LEGEND_STUDIO_SETTING_KEY } from '../../../__lib__/LegendStudioSetting.js';
22
22
  import type { CodeEditorPosition } from '@finos/legend-lego/code-editor';
23
23
 
@@ -38,6 +38,7 @@ export class GrammarTextEditorState {
38
38
  setGraphGrammarText: action,
39
39
  setWrapText: action,
40
40
  setForcedCursorPosition: action,
41
+ wordWrapOtion: computed,
41
42
  });
42
43
 
43
44
  this.editorStore = editorStore;
@@ -51,6 +52,10 @@ export class GrammarTextEditorState {
51
52
  return hashValue(this.graphGrammarText);
52
53
  }
53
54
 
55
+ get wordWrapOtion(): 'on' | 'off' {
56
+ return this.wrapText ? 'on' : 'off';
57
+ }
58
+
54
59
  setGraphGrammarText(code: string): void {
55
60
  this.graphGrammarText = code;
56
61
  }