@finos/legend-application-studio 28.13.13 → 28.13.15
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.
- package/lib/__lib__/LegendStudioEvent.d.ts +3 -0
- package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioEvent.js +4 -2
- package/lib/__lib__/LegendStudioEvent.js.map +1 -1
- package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
- package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioNavigation.js +2 -0
- package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
- package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +10 -0
- package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioTelemetryHelper.js +10 -0
- package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
- package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
- package/lib/components/LegendStudioWebApplication.js +7 -1
- package/lib/components/LegendStudioWebApplication.js.map +1 -1
- package/lib/components/editor/ActivityBar.d.ts.map +1 -1
- package/lib/components/editor/ActivityBar.js +23 -14
- package/lib/components/editor/ActivityBar.js.map +1 -1
- package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/GrammarTextEditor.js +11 -6
- package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
- package/lib/components/lazy-text-editor/LazyTextEditor.d.ts +18 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.d.ts.map +1 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.js +170 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -0
- package/lib/components/workspace-setup/WorkspaceSetup.js +13 -13
- package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/ShowcaseManagerState.d.ts +3 -1
- package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
- package/lib/stores/ShowcaseManagerState.js +29 -8
- package/lib/stores/ShowcaseManagerState.js.map +1 -1
- package/lib/stores/editor/EditorConfig.d.ts +2 -1
- package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
- package/lib/stores/editor/EditorConfig.js +1 -0
- package/lib/stores/editor/EditorConfig.js.map +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts +1 -0
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +17 -0
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts +4 -0
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +69 -6
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/GraphEditGrammarModeState.d.ts +6 -1
- package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditGrammarModeState.js +6 -1
- package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
- package/lib/stores/editor/GraphEditorMode.d.ts +6 -1
- package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditorMode.js +3 -0
- package/lib/stores/editor/GraphEditorMode.js.map +1 -1
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts +30 -0
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts.map +1 -0
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.js +66 -0
- package/lib/stores/lazy-text-editor/LazyTextEditorStore.js.map +1 -0
- package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
- package/lib/stores/showcase/ShowcaseViewerStore.js +3 -0
- package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
- package/package.json +6 -6
- package/src/__lib__/LegendStudioEvent.ts +4 -2
- package/src/__lib__/LegendStudioNavigation.ts +8 -0
- package/src/__lib__/LegendStudioTelemetryHelper.ts +32 -0
- package/src/components/LegendStudioWebApplication.tsx +13 -1
- package/src/components/editor/ActivityBar.tsx +118 -111
- package/src/components/editor/editor-group/GrammarTextEditor.tsx +14 -7
- package/src/components/lazy-text-editor/LazyTextEditor.tsx +458 -0
- package/src/components/workspace-setup/WorkspaceSetup.tsx +21 -21
- package/src/stores/ShowcaseManagerState.ts +41 -11
- package/src/stores/editor/EditorConfig.ts +1 -0
- package/src/stores/editor/EditorGraphState.ts +25 -0
- package/src/stores/editor/EditorStore.ts +123 -8
- package/src/stores/editor/GraphEditGrammarModeState.ts +14 -2
- package/src/stores/editor/GraphEditorMode.ts +9 -1
- package/src/stores/lazy-text-editor/LazyTextEditorStore.ts +99 -0
- package/src/stores/showcase/ShowcaseViewerStore.ts +6 -0
- package/tsconfig.json +2 -0
@@ -22,7 +22,7 @@ import {
|
|
22
22
|
guaranteeNonNullable,
|
23
23
|
isNonNullable,
|
24
24
|
} from '@finos/legend-shared';
|
25
|
-
import { action, flow, makeObservable, observable } from 'mobx';
|
25
|
+
import { action, computed, flow, makeObservable, observable } from 'mobx';
|
26
26
|
import { LEGEND_STUDIO_APP_EVENT } from '../__lib__/LegendStudioEvent.js';
|
27
27
|
import {
|
28
28
|
type Showcase,
|
@@ -40,6 +40,7 @@ import {
|
|
40
40
|
import type { TreeData, TreeNodeData } from '@finos/legend-art';
|
41
41
|
import { DIRECTORY_PATH_DELIMITER } from '@finos/legend-graph';
|
42
42
|
import { SHOWCASE_MANAGER_VIRTUAL_ASSISTANT_TAB_KEY } from '../components/extensions/Core_LegendStudioApplicationPlugin.js';
|
43
|
+
import { LegendStudioTelemetryHelper } from '../__lib__/LegendStudioTelemetryHelper.js';
|
43
44
|
|
44
45
|
export enum SHOWCASE_MANAGER_VIEW {
|
45
46
|
EXPLORER = 'EXPLORER',
|
@@ -160,7 +161,7 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
160
161
|
|
161
162
|
private readonly showcaseServerClient?: ShowcaseRegistryServerClient;
|
162
163
|
|
163
|
-
|
164
|
+
allShowcases: ShowcaseMetadata[] | undefined;
|
164
165
|
currentShowcase?: Showcase | undefined;
|
165
166
|
showcaseLineToScroll?: number | undefined;
|
166
167
|
|
@@ -176,7 +177,7 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
176
177
|
super();
|
177
178
|
|
178
179
|
makeObservable(this, {
|
179
|
-
|
180
|
+
allShowcases: observable,
|
180
181
|
currentShowcase: observable,
|
181
182
|
currentView: observable,
|
182
183
|
explorerTreeData: observable.ref,
|
@@ -185,6 +186,8 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
185
186
|
showcaseSearchResults: observable.ref,
|
186
187
|
currentSearchCaterogy: observable,
|
187
188
|
showcaseLineToScroll: observable,
|
189
|
+
nonDevShowcases: computed,
|
190
|
+
logOpenManager: action,
|
188
191
|
setCurrentView: action,
|
189
192
|
closeShowcase: action,
|
190
193
|
setExplorerTreeData: action,
|
@@ -209,6 +212,10 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
209
212
|
return ShowcaseManagerState.IDENTIFIER;
|
210
213
|
}
|
211
214
|
|
215
|
+
get nonDevShowcases(): ShowcaseMetadata[] {
|
216
|
+
return this.allShowcases?.filter((showcase) => !showcase.development) ?? [];
|
217
|
+
}
|
218
|
+
|
212
219
|
static retrieveNullableState(
|
213
220
|
applicationStore: GenericLegendApplicationStore,
|
214
221
|
): ShowcaseManagerState | undefined {
|
@@ -263,9 +270,16 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
263
270
|
this.fetchShowcaseState.inProgress();
|
264
271
|
|
265
272
|
try {
|
266
|
-
|
273
|
+
const showcase = (yield this.client.getShowcase(
|
267
274
|
metadata.path,
|
268
275
|
)) as Showcase;
|
276
|
+
this.currentShowcase = showcase;
|
277
|
+
LegendStudioTelemetryHelper.logEvent_ShowcaseManagerShowcaseProjectLaunch(
|
278
|
+
this.applicationStore.telemetryService,
|
279
|
+
{
|
280
|
+
showcasePath: showcase.path,
|
281
|
+
},
|
282
|
+
);
|
269
283
|
this.showcaseLineToScroll = showcaseLineToScroll;
|
270
284
|
this.fetchShowcaseState.pass();
|
271
285
|
} catch (error) {
|
@@ -278,6 +292,19 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
278
292
|
}
|
279
293
|
}
|
280
294
|
|
295
|
+
logOpenManager(): void {
|
296
|
+
if (this.allShowcases) {
|
297
|
+
const report = {
|
298
|
+
showcasesTotalCount: this.allShowcases.length,
|
299
|
+
showcasesDevelopmentCount: this.nonDevShowcases.length,
|
300
|
+
};
|
301
|
+
LegendStudioTelemetryHelper.logEvent_ShowcaseManagerLaunch(
|
302
|
+
this.applicationStore.telemetryService,
|
303
|
+
report,
|
304
|
+
);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
281
308
|
closeShowcase(): void {
|
282
309
|
this.currentShowcase = undefined;
|
283
310
|
this.showcaseLineToScroll = undefined;
|
@@ -308,10 +335,11 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
308
335
|
this.initState.inProgress();
|
309
336
|
|
310
337
|
try {
|
311
|
-
this.
|
312
|
-
(yield this.client.getShowcases()) as ShowcaseMetadata[]
|
313
|
-
|
314
|
-
|
338
|
+
this.allShowcases =
|
339
|
+
(yield this.client.getShowcases()) as ShowcaseMetadata[];
|
340
|
+
this.explorerTreeData = buildShowcasesExplorerTreeData(
|
341
|
+
this.nonDevShowcases,
|
342
|
+
);
|
315
343
|
// expand all the root nodes by default
|
316
344
|
this.explorerTreeData.rootIds.forEach((rootId) => {
|
317
345
|
const rootNode = this.explorerTreeData?.nodes.get(rootId);
|
@@ -320,7 +348,6 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
320
348
|
}
|
321
349
|
});
|
322
350
|
this.setExplorerTreeData({ ...this.explorerTreeData });
|
323
|
-
|
324
351
|
this.initState.pass();
|
325
352
|
} catch (error) {
|
326
353
|
assertErrorThrown(error);
|
@@ -347,7 +374,7 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
347
374
|
)) as ShowcaseTextSearchResult;
|
348
375
|
this.textSearchResults = result.textMatches
|
349
376
|
.map((match) => {
|
350
|
-
const matchingShowcase = this.
|
377
|
+
const matchingShowcase = this.nonDevShowcases.find(
|
351
378
|
(showcase) => showcase.path === match.path,
|
352
379
|
);
|
353
380
|
if (matchingShowcase) {
|
@@ -361,7 +388,9 @@ export class ShowcaseManagerState extends ApplicationExtensionState {
|
|
361
388
|
.filter(isNonNullable);
|
362
389
|
this.showcaseSearchResults = result.showcases
|
363
390
|
.map((showcasePath) =>
|
364
|
-
this.
|
391
|
+
this.nonDevShowcases.find(
|
392
|
+
(showcase) => showcase.path === showcasePath,
|
393
|
+
),
|
365
394
|
)
|
366
395
|
.filter(isNonNullable);
|
367
396
|
} catch (error) {
|
@@ -388,5 +417,6 @@ export const openShowcaseManager = (
|
|
388
417
|
applicationStore.assistantService.setSelectedTab(
|
389
418
|
SHOWCASE_MANAGER_VIRTUAL_ASSISTANT_TAB_KEY,
|
390
419
|
);
|
420
|
+
showcaseManagerState.logOpenManager();
|
391
421
|
}
|
392
422
|
};
|
@@ -491,6 +491,31 @@ export class EditorGraphState {
|
|
491
491
|
}
|
492
492
|
}
|
493
493
|
|
494
|
+
*buildGraphForLazyText(): GeneratorFn<void> {
|
495
|
+
this.isInitializingGraph = true;
|
496
|
+
const stopWatch = new StopWatch();
|
497
|
+
// reset
|
498
|
+
this.editorStore.graphManagerState.resetGraph();
|
499
|
+
// fetch and build dependencies
|
500
|
+
stopWatch.record();
|
501
|
+
const dependencyManager =
|
502
|
+
this.editorStore.graphManagerState.graphManager.createDependencyManager();
|
503
|
+
this.editorStore.graphManagerState.graph.dependencyManager =
|
504
|
+
dependencyManager;
|
505
|
+
this.editorStore.graphManagerState.dependenciesBuildState.setMessage(
|
506
|
+
`Fetching dependencies...`,
|
507
|
+
);
|
508
|
+
const dependencyEntitiesIndex = (yield flowResult(
|
509
|
+
this.getIndexedDependencyEntities(),
|
510
|
+
)) as Map<string, EntitiesWithOrigin>;
|
511
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
|
512
|
+
dependencyManager.initialize(dependencyEntitiesIndex);
|
513
|
+
this.isInitializingGraph = false;
|
514
|
+
this.editorStore.graphManagerState.dependenciesBuildState.sync(
|
515
|
+
ActionState.create().pass(),
|
516
|
+
);
|
517
|
+
}
|
518
|
+
|
494
519
|
private redirectToModelImporterForDebugging(error: Error): void {
|
495
520
|
if (this.editorStore.isInConflictResolutionMode) {
|
496
521
|
this.editorStore.applicationStore.alertService.setBlockingAlert({
|
@@ -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,99 @@ 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 (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);
|
822
|
+
return;
|
823
|
+
} finally {
|
824
|
+
this.initState.setMessage(undefined);
|
825
|
+
}
|
826
|
+
this.initState.setMessage('Building entities hash...');
|
827
|
+
yield flowResult(
|
828
|
+
this.changeDetectionState.workspaceLocalLatestRevisionState.buildEntityHashesIndex(
|
829
|
+
entities,
|
830
|
+
LogEvent.create(
|
831
|
+
LEGEND_STUDIO_APP_EVENT.CHANGE_DETECTION_BUILD_LOCAL_HASHES_INDEX__SUCCESS,
|
832
|
+
),
|
833
|
+
),
|
834
|
+
);
|
835
|
+
|
836
|
+
this.initState.setMessage('Building strict lazy graph...');
|
837
|
+
(yield flowResult(
|
838
|
+
this.graphState.buildGraphForLazyText(),
|
839
|
+
)) as GraphBuilderResult;
|
840
|
+
this.graphManagerState.graphBuildState.sync(ActionState.create().pass());
|
841
|
+
this.graphManagerState.generationsBuildState.sync(
|
842
|
+
ActionState.create().pass(),
|
843
|
+
);
|
844
|
+
this.initState.setMessage(undefined);
|
845
|
+
// switch to text mode
|
846
|
+
const graphEditorMode = new GraphEditLazyGrammarModeState(this);
|
847
|
+
try {
|
848
|
+
const editorGrammar =
|
849
|
+
(yield this.graphManagerState.graphManager.entitiesToPureCode(
|
850
|
+
this.changeDetectionState.workspaceLocalLatestRevisionState.entities,
|
851
|
+
{ pretty: true },
|
852
|
+
)) as string;
|
853
|
+
yield flowResult(
|
854
|
+
graphEditorMode.grammarTextEditorState.setGraphGrammarText(
|
855
|
+
editorGrammar,
|
856
|
+
),
|
857
|
+
);
|
858
|
+
this.graphEditorMode = graphEditorMode;
|
859
|
+
yield flowResult(
|
860
|
+
this.graphEditorMode.initialize({
|
861
|
+
useStoredEntities: true,
|
862
|
+
}),
|
863
|
+
);
|
864
|
+
} catch (error) {
|
865
|
+
assertErrorThrown(error);
|
866
|
+
this.applicationStore.notificationService.notifyWarning(
|
867
|
+
`Can't initialize strict text mode. Issue converting entities to grammar: ${error.message}`,
|
868
|
+
);
|
869
|
+
this.applicationStore.alertService.setBlockingAlert(undefined);
|
870
|
+
return;
|
871
|
+
}
|
872
|
+
}
|
873
|
+
|
769
874
|
private *initConflictResolutionMode(): GeneratorFn<void> {
|
770
875
|
yield flowResult(
|
771
876
|
this.conflictResolutionState.initProjectConfigurationInConflictResolutionMode(),
|
@@ -830,7 +935,14 @@ export class EditorStore implements CommandRegistrar {
|
|
830
935
|
Date.now() - startTime,
|
831
936
|
'ms',
|
832
937
|
);
|
833
|
-
} 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);
|
834
946
|
return;
|
835
947
|
} finally {
|
836
948
|
this.initState.setMessage(undefined);
|
@@ -946,11 +1058,15 @@ export class EditorStore implements CommandRegistrar {
|
|
946
1058
|
if (this.graphState.checkIfApplicationUpdateOperationIsRunning()) {
|
947
1059
|
return;
|
948
1060
|
}
|
949
|
-
this.
|
950
|
-
|
951
|
-
|
952
|
-
}
|
1061
|
+
if (this.graphEditorMode.disableLeaveMode) {
|
1062
|
+
this.graphEditorMode.onLeave();
|
1063
|
+
return;
|
1064
|
+
}
|
953
1065
|
if (this.graphEditorMode instanceof GraphEditFormModeState) {
|
1066
|
+
this.applicationStore.alertService.setBlockingAlert({
|
1067
|
+
message: 'Switching to text mode...',
|
1068
|
+
showLoading: true,
|
1069
|
+
});
|
954
1070
|
yield flowResult(this.switchModes(GRAPH_EDITOR_MODE.GRAMMAR_TEXT));
|
955
1071
|
} else if (this.graphEditorMode instanceof GraphEditGrammarModeState) {
|
956
1072
|
yield flowResult(this.switchModes(GRAPH_EDITOR_MODE.FORM));
|
@@ -1136,6 +1252,7 @@ export class EditorStore implements CommandRegistrar {
|
|
1136
1252
|
fallbackOptions?: {
|
1137
1253
|
isCompilationFailure?: boolean;
|
1138
1254
|
isGraphBuildFailure?: boolean;
|
1255
|
+
useStoredEntities?: boolean;
|
1139
1256
|
},
|
1140
1257
|
): GeneratorFn<void> {
|
1141
1258
|
switch (to) {
|
@@ -1147,9 +1264,7 @@ export class EditorStore implements CommandRegistrar {
|
|
1147
1264
|
graphEditorMode.cleanupBeforeEntering(fallbackOptions),
|
1148
1265
|
);
|
1149
1266
|
this.graphEditorMode = graphEditorMode;
|
1150
|
-
yield flowResult(
|
1151
|
-
this.graphEditorMode.initialize(Boolean(fallbackOptions)),
|
1152
|
-
);
|
1267
|
+
yield flowResult(this.graphEditorMode.initialize(fallbackOptions));
|
1153
1268
|
} catch (error) {
|
1154
1269
|
assertErrorThrown(error);
|
1155
1270
|
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
|
-
|
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 (
|
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
|
-
|
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",
|