@finos/legend-application-studio 28.13.13 → 28.13.14

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 (79) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +3 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +4 -2
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
  6. package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioNavigation.js +2 -0
  8. package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
  9. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +10 -0
  10. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendStudioTelemetryHelper.js +10 -0
  12. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  13. package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
  14. package/lib/components/LegendStudioWebApplication.js +7 -1
  15. package/lib/components/LegendStudioWebApplication.js.map +1 -1
  16. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  17. package/lib/components/editor/ActivityBar.js +23 -14
  18. package/lib/components/editor/ActivityBar.js.map +1 -1
  19. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  20. package/lib/components/editor/editor-group/GrammarTextEditor.js +3 -2
  21. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  22. package/lib/components/lazy-text-editor/LazyTextEditor.d.ts +18 -0
  23. package/lib/components/lazy-text-editor/LazyTextEditor.d.ts.map +1 -0
  24. package/lib/components/lazy-text-editor/LazyTextEditor.js +170 -0
  25. package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -0
  26. package/lib/components/workspace-setup/WorkspaceSetup.js +6 -6
  27. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  28. package/lib/index.css +2 -2
  29. package/lib/index.css.map +1 -1
  30. package/lib/package.json +1 -1
  31. package/lib/stores/ShowcaseManagerState.d.ts +3 -1
  32. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  33. package/lib/stores/ShowcaseManagerState.js +29 -8
  34. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  35. package/lib/stores/editor/EditorConfig.d.ts +2 -1
  36. package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
  37. package/lib/stores/editor/EditorConfig.js +1 -0
  38. package/lib/stores/editor/EditorConfig.js.map +1 -1
  39. package/lib/stores/editor/EditorGraphState.d.ts +1 -0
  40. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  41. package/lib/stores/editor/EditorGraphState.js +17 -0
  42. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  43. package/lib/stores/editor/EditorStore.d.ts +4 -0
  44. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  45. package/lib/stores/editor/EditorStore.js +62 -5
  46. package/lib/stores/editor/EditorStore.js.map +1 -1
  47. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +6 -1
  48. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  49. package/lib/stores/editor/GraphEditGrammarModeState.js +6 -1
  50. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  51. package/lib/stores/editor/GraphEditorMode.d.ts +6 -1
  52. package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
  53. package/lib/stores/editor/GraphEditorMode.js +3 -0
  54. package/lib/stores/editor/GraphEditorMode.js.map +1 -1
  55. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts +30 -0
  56. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts.map +1 -0
  57. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js +66 -0
  58. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js.map +1 -0
  59. package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
  60. package/lib/stores/showcase/ShowcaseViewerStore.js +3 -0
  61. package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
  62. package/package.json +6 -6
  63. package/src/__lib__/LegendStudioEvent.ts +4 -2
  64. package/src/__lib__/LegendStudioNavigation.ts +8 -0
  65. package/src/__lib__/LegendStudioTelemetryHelper.ts +32 -0
  66. package/src/components/LegendStudioWebApplication.tsx +13 -1
  67. package/src/components/editor/ActivityBar.tsx +118 -111
  68. package/src/components/editor/editor-group/GrammarTextEditor.tsx +6 -3
  69. package/src/components/lazy-text-editor/LazyTextEditor.tsx +458 -0
  70. package/src/components/workspace-setup/WorkspaceSetup.tsx +6 -6
  71. package/src/stores/ShowcaseManagerState.ts +41 -11
  72. package/src/stores/editor/EditorConfig.ts +1 -0
  73. package/src/stores/editor/EditorGraphState.ts +25 -0
  74. package/src/stores/editor/EditorStore.ts +108 -7
  75. package/src/stores/editor/GraphEditGrammarModeState.ts +14 -2
  76. package/src/stores/editor/GraphEditorMode.ts +9 -1
  77. package/src/stores/lazy-text-editor/LazyTextEditorStore.ts +99 -0
  78. package/src/stores/showcase/ShowcaseViewerStore.ts +6 -0
  79. package/tsconfig.json +2 -0
@@ -110,6 +110,10 @@ import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.j
110
110
  import type { QuickInputState } from './QuickInputState.js';
111
111
  import { GlobalEndToEndWorkflowState } from './sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
112
112
  import { openShowcaseManager } from '../ShowcaseManagerState.js';
113
+ import {
114
+ GraphEditLazyGrammarModeState,
115
+ LazyTextEditorStore,
116
+ } from '../lazy-text-editor/LazyTextEditorStore.js';
113
117
 
114
118
  export abstract class EditorExtensionState {
115
119
  /**
@@ -195,6 +199,8 @@ export class EditorStore implements CommandRegistrar {
195
199
  readonly tabManagerState = new EditorTabManagerState(this);
196
200
  supportedElementTypesWithCategory: Map<string, string[]>;
197
201
 
202
+ lazyTextEditorStore = new LazyTextEditorStore(this);
203
+
198
204
  constructor(
199
205
  applicationStore: LegendStudioApplicationStore,
200
206
  sdlcServerClient: SDLCServerClient,
@@ -211,6 +217,7 @@ export class EditorStore implements CommandRegistrar {
211
217
  graphEditorMode: observable,
212
218
  showSearchElementCommand: observable,
213
219
  quickInputState: observable,
220
+ lazyTextEditorStore: observable,
214
221
 
215
222
  isInViewerMode: computed,
216
223
  disableGraphEditing: computed,
@@ -230,6 +237,7 @@ export class EditorStore implements CommandRegistrar {
230
237
  initialize: flow,
231
238
  initMode: flow,
232
239
  initStandardMode: flow,
240
+ initializeLazyTextMode: flow,
233
241
  initConflictResolutionMode: flow,
234
242
  buildGraph: flow,
235
243
  toggleTextMode: flow,
@@ -715,6 +723,7 @@ export class EditorStore implements CommandRegistrar {
715
723
  ),
716
724
  ]);
717
725
  yield this.graphManagerState.initializeSystem();
726
+
718
727
  yield flowResult(this.initMode());
719
728
 
720
729
  onLeave(true);
@@ -728,6 +737,9 @@ export class EditorStore implements CommandRegistrar {
728
737
  case EDITOR_MODE.CONFLICT_RESOLUTION:
729
738
  yield flowResult(this.initConflictResolutionMode());
730
739
  return;
740
+ case EDITOR_MODE.LAZY_TEXT_EDITOR:
741
+ yield flowResult(this.initializeLazyTextMode());
742
+ return;
731
743
  default:
732
744
  throw new UnsupportedOperationError(
733
745
  `Can't initialize editor for unsupported mode '${this.mode}'`,
@@ -766,6 +778,92 @@ export class EditorStore implements CommandRegistrar {
766
778
  ]);
767
779
  }
768
780
 
781
+ *initializeLazyTextMode(): GeneratorFn<void> {
782
+ // set up
783
+ const projectId = this.sdlcState.activeProject.projectId;
784
+ const activeWorkspace = this.sdlcState.activeWorkspace;
785
+ const projectConfiguration = (yield this.sdlcServerClient.getConfiguration(
786
+ projectId,
787
+ activeWorkspace,
788
+ )) as PlainObject<ProjectConfiguration>;
789
+ this.projectConfigurationEditorState.setProjectConfiguration(
790
+ ProjectConfiguration.serialization.fromJson(projectConfiguration),
791
+ );
792
+ // make sure we set the original project configuration to a different object
793
+ this.projectConfigurationEditorState.setOriginalProjectConfiguration(
794
+ ProjectConfiguration.serialization.fromJson(projectConfiguration),
795
+ );
796
+
797
+ const startTime = Date.now();
798
+ let entities: Entity[];
799
+
800
+ this.initState.setMessage(`Fetching entities...`);
801
+ try {
802
+ entities = (yield this.sdlcServerClient.getEntities(
803
+ projectId,
804
+ activeWorkspace,
805
+ )) as Entity[];
806
+ this.changeDetectionState.workspaceLocalLatestRevisionState.setEntities(
807
+ entities,
808
+ );
809
+ this.applicationStore.logService.info(
810
+ LogEvent.create(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS),
811
+ Date.now() - startTime,
812
+ 'ms',
813
+ );
814
+ } catch {
815
+ return;
816
+ } finally {
817
+ this.initState.setMessage(undefined);
818
+ }
819
+ this.initState.setMessage('Building entities hash...');
820
+ yield flowResult(
821
+ this.changeDetectionState.workspaceLocalLatestRevisionState.buildEntityHashesIndex(
822
+ entities,
823
+ LogEvent.create(
824
+ LEGEND_STUDIO_APP_EVENT.CHANGE_DETECTION_BUILD_LOCAL_HASHES_INDEX__SUCCESS,
825
+ ),
826
+ ),
827
+ );
828
+
829
+ this.initState.setMessage('Building strict lazy graph...');
830
+ (yield flowResult(
831
+ this.graphState.buildGraphForLazyText(),
832
+ )) as GraphBuilderResult;
833
+ this.graphManagerState.graphBuildState.sync(ActionState.create().pass());
834
+ this.graphManagerState.generationsBuildState.sync(
835
+ ActionState.create().pass(),
836
+ );
837
+ this.initState.setMessage(undefined);
838
+ // switch to text mode
839
+ const graphEditorMode = new GraphEditLazyGrammarModeState(this);
840
+ try {
841
+ const editorGrammar =
842
+ (yield this.graphManagerState.graphManager.entitiesToPureCode(
843
+ this.changeDetectionState.workspaceLocalLatestRevisionState.entities,
844
+ { pretty: true },
845
+ )) as string;
846
+ yield flowResult(
847
+ graphEditorMode.grammarTextEditorState.setGraphGrammarText(
848
+ editorGrammar,
849
+ ),
850
+ );
851
+ this.graphEditorMode = graphEditorMode;
852
+ yield flowResult(
853
+ this.graphEditorMode.initialize({
854
+ useStoredEntities: true,
855
+ }),
856
+ );
857
+ } catch (error) {
858
+ assertErrorThrown(error);
859
+ this.applicationStore.notificationService.notifyWarning(
860
+ `Can't initialize strict text mode. Issue converting entities to grammar: ${error.message}`,
861
+ );
862
+ this.applicationStore.alertService.setBlockingAlert(undefined);
863
+ return;
864
+ }
865
+ }
866
+
769
867
  private *initConflictResolutionMode(): GeneratorFn<void> {
770
868
  yield flowResult(
771
869
  this.conflictResolutionState.initProjectConfigurationInConflictResolutionMode(),
@@ -946,11 +1044,15 @@ export class EditorStore implements CommandRegistrar {
946
1044
  if (this.graphState.checkIfApplicationUpdateOperationIsRunning()) {
947
1045
  return;
948
1046
  }
949
- this.applicationStore.alertService.setBlockingAlert({
950
- message: 'Switching to text mode...',
951
- showLoading: true,
952
- });
1047
+ if (this.graphEditorMode.disableLeaveMode) {
1048
+ this.graphEditorMode.onLeave();
1049
+ return;
1050
+ }
953
1051
  if (this.graphEditorMode instanceof GraphEditFormModeState) {
1052
+ this.applicationStore.alertService.setBlockingAlert({
1053
+ message: 'Switching to text mode...',
1054
+ showLoading: true,
1055
+ });
954
1056
  yield flowResult(this.switchModes(GRAPH_EDITOR_MODE.GRAMMAR_TEXT));
955
1057
  } else if (this.graphEditorMode instanceof GraphEditGrammarModeState) {
956
1058
  yield flowResult(this.switchModes(GRAPH_EDITOR_MODE.FORM));
@@ -1136,6 +1238,7 @@ export class EditorStore implements CommandRegistrar {
1136
1238
  fallbackOptions?: {
1137
1239
  isCompilationFailure?: boolean;
1138
1240
  isGraphBuildFailure?: boolean;
1241
+ useStoredEntities?: boolean;
1139
1242
  },
1140
1243
  ): GeneratorFn<void> {
1141
1244
  switch (to) {
@@ -1147,9 +1250,7 @@ export class EditorStore implements CommandRegistrar {
1147
1250
  graphEditorMode.cleanupBeforeEntering(fallbackOptions),
1148
1251
  );
1149
1252
  this.graphEditorMode = graphEditorMode;
1150
- yield flowResult(
1151
- this.graphEditorMode.initialize(Boolean(fallbackOptions)),
1152
- );
1253
+ yield flowResult(this.graphEditorMode.initialize(fallbackOptions));
1153
1254
  } catch (error) {
1154
1255
  assertErrorThrown(error);
1155
1256
  this.applicationStore.notificationService.notifyWarning(
@@ -61,7 +61,15 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
61
61
  this.grammarTextEditorState = new GrammarTextEditorState(this.editorStore);
62
62
  }
63
63
 
64
- *initialize(isFallback?: boolean): GeneratorFn<void> {
64
+ get headerLabel(): string {
65
+ return 'Text Mode';
66
+ }
67
+
68
+ *initialize(isFallback?: {
69
+ isCompilationFailure?: boolean;
70
+ isGraphBuildFailure?: boolean;
71
+ useStoredEntities?: boolean;
72
+ }): GeneratorFn<void> {
65
73
  this.editorStore.localChangesState = new TextLocalChangesState(
66
74
  this.editorStore,
67
75
  this.editorStore.sdlcState,
@@ -93,7 +101,11 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
93
101
  error,
94
102
  );
95
103
  }
96
- if (isFallback) {
104
+ if (
105
+ isFallback?.isCompilationFailure ||
106
+ isFallback?.isGraphBuildFailure ||
107
+ isFallback?.useStoredEntities
108
+ ) {
97
109
  yield flowResult(
98
110
  this.globalCompile({
99
111
  ignoreBlocking: true,
@@ -42,7 +42,15 @@ export abstract class GraphEditorMode {
42
42
  this.editorStore = editorStore;
43
43
  }
44
44
 
45
- abstract initialize(isFallback?: boolean): GeneratorFn<void>;
45
+ get disableLeaveMode(): boolean {
46
+ return false;
47
+ }
48
+
49
+ abstract initialize(options?: {
50
+ isCompilationFailure?: boolean;
51
+ isGraphBuildFailure?: boolean;
52
+ useStoredEntities?: boolean;
53
+ }): GeneratorFn<void>;
46
54
  abstract addElement(
47
55
  element: PackageableElement,
48
56
  packagePath: string | undefined,
@@ -0,0 +1,99 @@
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 { flow, flowResult, makeObservable } from 'mobx';
18
+ import type { EditorStore } from '../editor/EditorStore.js';
19
+ import { EDITOR_MODE } from '../editor/EditorConfig.js';
20
+ import type { WorkspaceType } from '@finos/legend-server-sdlc';
21
+ import type { GeneratorFn } from '@finos/legend-shared';
22
+ import {
23
+ ActionAlertActionType,
24
+ ActionAlertType,
25
+ } from '@finos/legend-application';
26
+ import { generateEditorRoute } from '../../__lib__/LegendStudioNavigation.js';
27
+ import { GraphEditGrammarModeState } from '../editor/GraphEditGrammarModeState.js';
28
+
29
+ export class LazyTextEditorStore {
30
+ readonly editorStore: EditorStore;
31
+
32
+ constructor(editorStore: EditorStore) {
33
+ this.editorStore = editorStore;
34
+ makeObservable(this, {
35
+ init: flow,
36
+ });
37
+ }
38
+
39
+ *init(
40
+ projectId: string,
41
+ patchReleaseVersionId: string | undefined,
42
+ workspaceId: string,
43
+ workspaceType: WorkspaceType,
44
+ ): GeneratorFn<void> {
45
+ this.editorStore.setMode(EDITOR_MODE.LAZY_TEXT_EDITOR);
46
+ yield flowResult(
47
+ this.editorStore.initialize(
48
+ projectId,
49
+ patchReleaseVersionId,
50
+ workspaceId,
51
+ workspaceType,
52
+ ),
53
+ );
54
+ }
55
+ }
56
+
57
+ export class GraphEditLazyGrammarModeState extends GraphEditGrammarModeState {
58
+ override get disableLeaveMode(): boolean {
59
+ return true;
60
+ }
61
+
62
+ override get headerLabel(): string {
63
+ return 'Strict Text Mode (BETA)';
64
+ }
65
+
66
+ override *onLeave(): GeneratorFn<void> {
67
+ this.editorStore.applicationStore.alertService.setBlockingAlert(undefined);
68
+ this.editorStore.applicationStore.alertService.setActionAlertInfo({
69
+ message: `Form Mode Not Supported in Text Studio`,
70
+ prompt: `Text Studio only provides a light weight editor for editing studio projects to improve performance. If you want to do more actions, please open full edit mode`,
71
+ type: ActionAlertType.CAUTION,
72
+ actions: [
73
+ {
74
+ label: 'Open Studio Full Edit Mode',
75
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
76
+ default: true,
77
+ handler: () => {
78
+ this.editorStore.applicationStore.navigationService.navigator.visitAddress(
79
+ this.editorStore.applicationStore.navigationService.navigator.generateAddress(
80
+ generateEditorRoute(
81
+ this.editorStore.sdlcState.activeProject.projectId,
82
+ this.editorStore.sdlcState.activePatch?.patchReleaseVersionId
83
+ .id,
84
+ this.editorStore.sdlcState.activeWorkspace.workspaceId,
85
+ this.editorStore.sdlcState.activeWorkspace.workspaceType,
86
+ ),
87
+ ),
88
+ );
89
+ },
90
+ },
91
+ {
92
+ label: 'Cancel',
93
+ type: ActionAlertActionType.PROCEED,
94
+ default: true,
95
+ },
96
+ ],
97
+ });
98
+ }
99
+ }
@@ -96,6 +96,12 @@ export class ShowcaseViewerStore {
96
96
  this._showcase = (yield this.client.getShowcase(
97
97
  showcasePath,
98
98
  )) as Showcase;
99
+ LegendStudioTelemetryHelper.logEvent_ShowcaseManagerShowcaseProjectLaunch(
100
+ this.editorStore.applicationStore.telemetryService,
101
+ {
102
+ showcasePath: showcasePath,
103
+ },
104
+ );
99
105
  // initialize graph manager
100
106
  yield this.editorStore.graphManagerState.graphManager.initialize(
101
107
  {
package/tsconfig.json CHANGED
@@ -174,6 +174,7 @@
174
174
  "./src/stores/graph-modifier/STO_FlatData_GraphModifierHelper.ts",
175
175
  "./src/stores/graph-modifier/STO_Relational_GraphModifierHelper.ts",
176
176
  "./src/stores/graph-modifier/Testable_GraphModifierHelper.ts",
177
+ "./src/stores/lazy-text-editor/LazyTextEditorStore.ts",
177
178
  "./src/stores/project-view/ProjectViewerEditorMode.ts",
178
179
  "./src/stores/project-view/ProjectViewerStore.ts",
179
180
  "./src/stores/showcase/ShowcaseViewerEditorMode.ts",
@@ -296,6 +297,7 @@
296
297
  "./src/components/editor/side-bar/testable/GlobalTestRunner.tsx",
297
298
  "./src/components/extensions/Core_LegendStudioApplicationPlugin.tsx",
298
299
  "./src/components/extensions/DSL_ExternalFormat_LegendStudioApplicationPlugin.tsx",
300
+ "./src/components/lazy-text-editor/LazyTextEditor.tsx",
299
301
  "./src/components/project-view/ProjectViewer.tsx",
300
302
  "./src/components/project-view/ProjectViewerStoreProvider.tsx",
301
303
  "./src/components/showcase/ShowcaseViewer.tsx",