@finos/legend-application-studio 22.2.1 → 22.3.1
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/components/editor/StatusBar.js +1 -1
- package/lib/components/editor/StatusBar.js.map +1 -1
- package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
- package/lib/components/editor/command-center/ProjectSearchCommand.js +1 -0
- package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
- package/lib/components/editor/edit-panel/EditPanel.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/EditPanel.js +24 -11
- package/lib/components/editor/edit-panel/EditPanel.js.map +1 -1
- package/lib/components/editor/edit-panel/GenerationSpecificationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +2 -1
- package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js +1 -0
- package/lib/components/editor/edit-panel/connection-editor/ConnectionEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.js +4 -3
- package/lib/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.d.ts +32 -0
- package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.d.ts.map +1 -0
- package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.js +66 -0
- package/lib/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.js.map +1 -0
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts +0 -23
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js +6 -58
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.d.ts +41 -0
- package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.d.ts.map +1 -0
- package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.js +77 -0
- package/lib/components/editor/edit-panel/element-generation-editor/FileSystemViewer.js.map +1 -0
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.d.ts +7 -0
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js +19 -14
- package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +3 -1
- package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js +3 -1
- package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.js +3 -0
- package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +3 -1
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/ServiceEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js +51 -13
- package/lib/components/editor/edit-panel/service-editor/ServiceEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js +18 -10
- package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts +1 -3
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +2 -20
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +9 -3
- package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +1 -0
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +29 -8
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +17 -3
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/package.json +3 -3
- package/lib/stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.d.ts +2 -2
- package/lib/stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
- package/lib/stores/DependencyProjectViewerHelper.d.ts +19 -0
- package/lib/stores/DependencyProjectViewerHelper.d.ts.map +1 -0
- package/lib/stores/DependencyProjectViewerHelper.js +23 -0
- package/lib/stores/DependencyProjectViewerHelper.js.map +1 -0
- package/lib/stores/EditorGraphState.d.ts +9 -2
- package/lib/stores/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/EditorGraphState.js +35 -95
- package/lib/stores/EditorGraphState.js.map +1 -1
- package/lib/stores/EditorStore.d.ts.map +1 -1
- package/lib/stores/EditorStore.js +7 -1
- package/lib/stores/EditorStore.js.map +1 -1
- package/lib/stores/EditorTabManagerState.d.ts +1 -1
- package/lib/stores/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/EditorTabManagerState.js +11 -13
- package/lib/stores/EditorTabManagerState.js.map +1 -1
- package/lib/stores/ExplorerTreeState.d.ts +4 -4
- package/lib/stores/ExplorerTreeState.d.ts.map +1 -1
- package/lib/stores/ExplorerTreeState.js +12 -13
- package/lib/stores/ExplorerTreeState.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +0 -3
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor-state/ExternalFormatState.d.ts +2 -0
- package/lib/stores/editor-state/ExternalFormatState.d.ts.map +1 -1
- package/lib/stores/editor-state/ExternalFormatState.js +6 -0
- package/lib/stores/editor-state/ExternalFormatState.js.map +1 -1
- package/lib/stores/editor-state/FileGenerationState.d.ts +18 -18
- package/lib/stores/editor-state/FileGenerationState.d.ts.map +1 -1
- package/lib/stores/editor-state/FileGenerationState.js +86 -133
- package/lib/stores/editor-state/FileGenerationState.js.map +1 -1
- package/lib/stores/editor-state/FileGenerationViewerState.d.ts +3 -3
- package/lib/stores/editor-state/FileGenerationViewerState.d.ts.map +1 -1
- package/lib/stores/editor-state/FileGenerationViewerState.js.map +1 -1
- package/lib/stores/editor-state/FileSystemState.d.ts +30 -0
- package/lib/stores/editor-state/FileSystemState.d.ts.map +1 -0
- package/lib/stores/editor-state/FileSystemState.js +82 -0
- package/lib/stores/editor-state/FileSystemState.js.map +1 -0
- package/lib/stores/editor-state/GraphGenerationState.d.ts +9 -9
- package/lib/stores/editor-state/GraphGenerationState.d.ts.map +1 -1
- package/lib/stores/editor-state/GraphGenerationState.js +14 -15
- package/lib/stores/editor-state/GraphGenerationState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts +25 -2
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +50 -7
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.d.ts +44 -0
- package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.d.ts.map +1 -0
- package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.js +172 -0
- package/lib/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.js.map +1 -0
- package/lib/stores/editor-state/element-editor-state/RuntimeEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/RuntimeEditorState.js +7 -3
- package/lib/stores/editor-state/element-editor-state/RuntimeEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js +2 -2
- package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts +3 -0
- package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js +14 -2
- package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +9 -6
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +39 -29
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +2 -2
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +6 -3
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
- package/lib/stores/shared/FileSystemTreeUtils.d.ts +56 -0
- package/lib/stores/shared/FileSystemTreeUtils.d.ts.map +1 -0
- package/lib/stores/shared/{FileGenerationTreeUtils.js → FileSystemTreeUtils.js} +31 -32
- package/lib/stores/shared/FileSystemTreeUtils.js.map +1 -0
- package/lib/stores/shared/PackageTreeUtils.d.ts +6 -4
- package/lib/stores/shared/PackageTreeUtils.d.ts.map +1 -1
- package/lib/stores/shared/PackageTreeUtils.js +90 -11
- package/lib/stores/shared/PackageTreeUtils.js.map +1 -1
- package/lib/stores/shared/testable/TestableUtils.d.ts +1 -1
- package/lib/stores/shared/testable/TestableUtils.d.ts.map +1 -1
- package/lib/stores/shared/testable/TestableUtils.js +6 -4
- package/lib/stores/shared/testable/TestableUtils.js.map +1 -1
- package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts +3 -3
- package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
- package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js +37 -1
- package/lib/stores/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
- package/package.json +12 -12
- package/src/components/editor/StatusBar.tsx +1 -1
- package/src/components/editor/command-center/ProjectSearchCommand.tsx +1 -0
- package/src/components/editor/edit-panel/EditPanel.tsx +79 -25
- package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +2 -1
- package/src/components/editor/edit-panel/connection-editor/ConnectionEditor.tsx +1 -0
- package/src/components/editor/edit-panel/element-generation-editor/ElementGenerationEditor.tsx +5 -7
- package/src/components/editor/edit-panel/element-generation-editor/ElementXTGenerationEditor.tsx +194 -0
- package/src/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.tsx +6 -270
- package/src/components/editor/edit-panel/element-generation-editor/FileSystemViewer.tsx +296 -0
- package/src/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_BindingElementEditor.tsx +177 -155
- package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +3 -1
- package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationSourceSelectorModal.tsx +3 -3
- package/src/components/editor/edit-panel/mapping-editor/MappingExecutionQueryBuilder.tsx +3 -0
- package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +3 -1
- package/src/components/editor/edit-panel/service-editor/ServiceEditor.tsx +243 -184
- package/src/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.tsx +42 -15
- package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +2 -65
- package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +9 -3
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +1 -0
- package/src/components/editor/side-bar/Explorer.tsx +82 -13
- package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +31 -9
- package/src/index.ts +5 -2
- package/src/stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.ts +2 -2
- package/src/stores/DependencyProjectViewerHelper.ts +39 -0
- package/src/stores/EditorGraphState.ts +56 -153
- package/src/stores/EditorStore.ts +15 -5
- package/src/stores/EditorTabManagerState.ts +17 -20
- package/src/stores/ExplorerTreeState.ts +26 -18
- package/src/stores/editor/NewElementState.ts +0 -2
- package/src/stores/editor-state/ExternalFormatState.ts +9 -0
- package/src/stores/editor-state/FileGenerationState.ts +129 -180
- package/src/stores/editor-state/FileGenerationViewerState.ts +3 -3
- package/src/stores/editor-state/FileSystemState.ts +111 -0
- package/src/stores/editor-state/GraphGenerationState.ts +35 -31
- package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +91 -6
- package/src/stores/editor-state/element-editor-state/ElementExternalFormatGenerationState.ts +266 -0
- package/src/stores/editor-state/element-editor-state/RuntimeEditorState.ts +10 -8
- package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
- package/src/stores/editor-state/element-editor-state/mapping/MappingTestState.ts +2 -2
- package/src/stores/editor-state/element-editor-state/service/ServiceEditorState.ts +23 -2
- package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +61 -56
- package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +2 -2
- package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +6 -2
- package/src/stores/shared/{FileGenerationTreeUtils.ts → FileSystemTreeUtils.ts} +77 -76
- package/src/stores/shared/PackageTreeUtils.ts +144 -10
- package/src/stores/shared/testable/TestableUtils.ts +8 -4
- package/src/stores/sidebar-state/testable/GlobalTestRunnerState.ts +42 -3
- package/tsconfig.json +6 -1
- package/lib/stores/shared/FileGenerationTreeUtils.d.ts +0 -56
- package/lib/stores/shared/FileGenerationTreeUtils.d.ts.map +0 -1
- package/lib/stores/shared/FileGenerationTreeUtils.js.map +0 -1
|
@@ -17,25 +17,21 @@
|
|
|
17
17
|
import type { EditorStore } from '../EditorStore.js';
|
|
18
18
|
import { observable, action, makeObservable, flow } from 'mobx';
|
|
19
19
|
import { LEGEND_STUDIO_APP_EVENT } from '../LegendStudioAppEvent.js';
|
|
20
|
-
import type { TreeData } from '@finos/legend-art';
|
|
21
20
|
import {
|
|
22
|
-
type
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
GenerationDirectory,
|
|
21
|
+
type FileSystem_File,
|
|
22
|
+
type FileResult,
|
|
23
|
+
FileSystem_Directory,
|
|
26
24
|
GENERATION_FILE_ROOT_NAME,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
buildGenerationDirectory,
|
|
31
|
-
reprocessOpenNodes,
|
|
32
|
-
} from '../shared/FileGenerationTreeUtils.js';
|
|
25
|
+
getFileSystemTreeData,
|
|
26
|
+
buildFileSystemDirectory,
|
|
27
|
+
} from '../shared/FileSystemTreeUtils.js';
|
|
33
28
|
import {
|
|
34
29
|
type GeneratorFn,
|
|
35
30
|
assertErrorThrown,
|
|
36
31
|
deepEqual,
|
|
37
32
|
isEmpty,
|
|
38
33
|
LogEvent,
|
|
34
|
+
ActionState,
|
|
39
35
|
} from '@finos/legend-shared';
|
|
40
36
|
import {
|
|
41
37
|
type FileGenerationSpecification,
|
|
@@ -55,113 +51,40 @@ import {
|
|
|
55
51
|
fileGeneration_addScopeElement,
|
|
56
52
|
fileGeneration_deleteScopeElement,
|
|
57
53
|
} from '../shared/modifier/DSL_Generation_GraphModifierHelper.js';
|
|
54
|
+
import { FileSystemState } from './FileSystemState.js';
|
|
58
55
|
|
|
59
|
-
export class
|
|
56
|
+
export abstract class GeneratedFileStructureState {
|
|
60
57
|
readonly editorStore: EditorStore;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
root: GenerationDirectory;
|
|
65
|
-
directoryTreeData?: TreeData<GenerationTreeNodeData> | undefined;
|
|
66
|
-
selectedNode?: GenerationTreeNodeData | undefined;
|
|
67
|
-
filesIndex = new Map<string, GenerationFile>();
|
|
68
|
-
|
|
69
|
-
constructor(
|
|
70
|
-
editorStore: EditorStore,
|
|
71
|
-
fileGeneration: FileGenerationSpecification,
|
|
72
|
-
) {
|
|
73
|
-
makeObservable(this, {
|
|
74
|
-
isGenerating: observable,
|
|
75
|
-
root: observable,
|
|
76
|
-
directoryTreeData: observable.ref,
|
|
77
|
-
selectedNode: observable.ref,
|
|
78
|
-
filesIndex: observable,
|
|
79
|
-
resetFileGeneration: action,
|
|
80
|
-
setIsGeneration: action,
|
|
81
|
-
setDirectoryTreeData: action,
|
|
82
|
-
processGenerationResult: action,
|
|
83
|
-
reprocessNodeTree: action,
|
|
84
|
-
setSelectedNode: action,
|
|
85
|
-
onTreeNodeSelect: action,
|
|
86
|
-
addScopeElement: action,
|
|
87
|
-
deleteScopeElement: action,
|
|
88
|
-
updateFileGenerationParameters: action,
|
|
89
|
-
generate: flow,
|
|
90
|
-
});
|
|
58
|
+
fileSystemState: FileSystemState;
|
|
59
|
+
generatingAction = ActionState.create();
|
|
60
|
+
rootDirectoryName: string;
|
|
91
61
|
|
|
62
|
+
constructor(rootDirectory: string, editorStore: EditorStore) {
|
|
63
|
+
this.rootDirectoryName = rootDirectory;
|
|
64
|
+
this.fileSystemState = new FileSystemState(rootDirectory);
|
|
92
65
|
this.editorStore = editorStore;
|
|
93
|
-
this.fileGeneration = fileGeneration;
|
|
94
|
-
this.root = new GenerationDirectory(GENERATION_FILE_ROOT_NAME);
|
|
95
66
|
}
|
|
96
67
|
|
|
97
|
-
|
|
98
|
-
return GenerationDirectory.getOrCreateDirectory(
|
|
99
|
-
this.root,
|
|
100
|
-
directoryName,
|
|
101
|
-
true,
|
|
102
|
-
);
|
|
103
|
-
}
|
|
68
|
+
abstract resetGenerator(): void;
|
|
104
69
|
|
|
105
|
-
|
|
106
|
-
this.fileGeneration.configurationProperties = [];
|
|
107
|
-
}
|
|
70
|
+
abstract generate(): GeneratorFn<void>;
|
|
108
71
|
|
|
109
|
-
|
|
110
|
-
this.isGenerating = isGenerating;
|
|
111
|
-
}
|
|
72
|
+
abstract get rootFolder(): string;
|
|
112
73
|
|
|
113
|
-
|
|
114
|
-
directoryTreeData: TreeData<GenerationTreeNodeData>,
|
|
115
|
-
): void {
|
|
116
|
-
this.directoryTreeData = directoryTreeData;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
*generate(): GeneratorFn<void> {
|
|
120
|
-
this.isGenerating = true;
|
|
121
|
-
try {
|
|
122
|
-
// avoid wasting a network call when the scope is empty, we can short-circuit this
|
|
123
|
-
if (!this.fileGeneration.scopeElements.length) {
|
|
124
|
-
this.selectedNode = undefined;
|
|
125
|
-
this.processGenerationResult([]);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const mode =
|
|
129
|
-
this.editorStore.graphState.graphGenerationState.getFileGenerationConfiguration(
|
|
130
|
-
this.fileGeneration.type,
|
|
131
|
-
).generationMode;
|
|
132
|
-
const result =
|
|
133
|
-
(yield this.editorStore.graphManagerState.graphManager.generateFile(
|
|
134
|
-
this.fileGeneration,
|
|
135
|
-
mode,
|
|
136
|
-
this.editorStore.graphManagerState.graph,
|
|
137
|
-
)) as GenerationOutput[];
|
|
138
|
-
this.processGenerationResult(result);
|
|
139
|
-
} catch (error) {
|
|
140
|
-
assertErrorThrown(error);
|
|
141
|
-
this.selectedNode = undefined;
|
|
142
|
-
this.processGenerationResult([]);
|
|
143
|
-
this.editorStore.applicationStore.log.error(
|
|
144
|
-
LogEvent.create(LEGEND_STUDIO_APP_EVENT.GENERATION_FAILURE),
|
|
145
|
-
error,
|
|
146
|
-
);
|
|
147
|
-
this.editorStore.applicationStore.notifyError(error);
|
|
148
|
-
} finally {
|
|
149
|
-
this.isGenerating = false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
74
|
+
abstract get generationParentId(): string | undefined;
|
|
152
75
|
|
|
153
76
|
processGenerationResult(output: GenerationOutput[]): void {
|
|
154
|
-
this.root = new
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
77
|
+
this.fileSystemState.root = new FileSystem_Directory(
|
|
78
|
+
this.rootDirectoryName,
|
|
79
|
+
);
|
|
80
|
+
this.fileSystemState.filesIndex = new Map<string, FileSystem_File>();
|
|
81
|
+
const openedNodeIds = this.fileSystemState.directoryTreeData
|
|
82
|
+
? Array.from(this.fileSystemState.directoryTreeData.nodes.values())
|
|
158
83
|
.filter((node) => node.isOpen)
|
|
159
84
|
.map((node) => node.id)
|
|
160
85
|
: [];
|
|
161
|
-
const generationResultIndex = new Map<string,
|
|
162
|
-
const rootFolder =
|
|
163
|
-
this.fileGeneration.generationOutputPath ??
|
|
164
|
-
this.fileGeneration.path.split(ELEMENT_PATH_DELIMITER).join('_');
|
|
86
|
+
const generationResultIndex = new Map<string, FileResult>();
|
|
87
|
+
const rootFolder = this.rootFolder;
|
|
165
88
|
output.forEach((entry) => {
|
|
166
89
|
entry.cleanFileName(rootFolder);
|
|
167
90
|
if (generationResultIndex.has(entry.fileName)) {
|
|
@@ -171,98 +94,61 @@ export class FileGenerationState {
|
|
|
171
94
|
);
|
|
172
95
|
}
|
|
173
96
|
generationResultIndex.set(entry.fileName, {
|
|
174
|
-
|
|
175
|
-
parentId: this.
|
|
97
|
+
value: entry,
|
|
98
|
+
parentId: this.generationParentId,
|
|
176
99
|
});
|
|
177
100
|
});
|
|
178
101
|
// take generation outputs and put them into the root directory
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
102
|
+
buildFileSystemDirectory(
|
|
103
|
+
this.fileSystemState.root,
|
|
104
|
+
generationResultIndex,
|
|
105
|
+
this.fileSystemState.filesIndex,
|
|
106
|
+
);
|
|
107
|
+
this.fileSystemState.directoryTreeData = getFileSystemTreeData(
|
|
108
|
+
this.fileSystemState.root,
|
|
109
|
+
);
|
|
110
|
+
this.fileSystemState.reprocessNodeTree(
|
|
182
111
|
Array.from(generationResultIndex.values()),
|
|
183
|
-
this.directoryTreeData,
|
|
112
|
+
this.fileSystemState.directoryTreeData,
|
|
184
113
|
openedNodeIds,
|
|
185
114
|
);
|
|
186
115
|
}
|
|
116
|
+
}
|
|
187
117
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
treeData: TreeData<GenerationTreeNodeData>,
|
|
191
|
-
openedNodeIds: string[],
|
|
192
|
-
): void {
|
|
193
|
-
reprocessOpenNodes(treeData, this.filesIndex, this.root, openedNodeIds);
|
|
194
|
-
// select the current file node if available, else select the first output
|
|
195
|
-
const selectedFileNodePath =
|
|
196
|
-
generationResult.length === 1 ||
|
|
197
|
-
(this.selectedNode === undefined && generationResult.length !== 0)
|
|
198
|
-
? (generationResult[0] as GenerationOutputResult).generationOutput
|
|
199
|
-
.fileName
|
|
200
|
-
: this.selectedNode?.fileNode.path;
|
|
201
|
-
if (selectedFileNodePath) {
|
|
202
|
-
const file = this.filesIndex.get(selectedFileNodePath);
|
|
203
|
-
if (file) {
|
|
204
|
-
const node = openNode(file, treeData);
|
|
205
|
-
if (node) {
|
|
206
|
-
this.onTreeNodeSelect(node, treeData);
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
this.selectedNode = undefined;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
this.setDirectoryTreeData({ ...treeData });
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
setSelectedNode(node?: GenerationTreeNodeData): void {
|
|
216
|
-
if (this.selectedNode) {
|
|
217
|
-
this.selectedNode.isSelected = false;
|
|
218
|
-
}
|
|
219
|
-
if (node) {
|
|
220
|
-
node.isSelected = true;
|
|
221
|
-
}
|
|
222
|
-
this.selectedNode = node;
|
|
223
|
-
}
|
|
118
|
+
export class FileGenerationState extends GeneratedFileStructureState {
|
|
119
|
+
readonly fileGeneration: FileGenerationSpecification;
|
|
224
120
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
121
|
+
constructor(
|
|
122
|
+
editorStore: EditorStore,
|
|
123
|
+
fileGeneration: FileGenerationSpecification,
|
|
124
|
+
) {
|
|
125
|
+
super(GENERATION_FILE_ROOT_NAME, editorStore);
|
|
126
|
+
makeObservable(this, {
|
|
127
|
+
generatingAction: observable,
|
|
128
|
+
fileSystemState: observable,
|
|
129
|
+
resetGenerator: action,
|
|
130
|
+
processGenerationResult: action,
|
|
131
|
+
addScopeElement: action,
|
|
132
|
+
deleteScopeElement: action,
|
|
133
|
+
updateFileGenerationParameters: action,
|
|
134
|
+
generate: flow,
|
|
135
|
+
});
|
|
136
|
+
this.fileGeneration = fileGeneration;
|
|
237
137
|
}
|
|
238
138
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
el instanceof PackageableElementReference
|
|
244
|
-
? el.value === element
|
|
245
|
-
: element === el,
|
|
139
|
+
get rootFolder(): string {
|
|
140
|
+
return (
|
|
141
|
+
this.fileGeneration.generationOutputPath ??
|
|
142
|
+
this.fileGeneration.path.split(ELEMENT_PATH_DELIMITER).join('_')
|
|
246
143
|
);
|
|
247
144
|
}
|
|
248
145
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (!el) {
|
|
252
|
-
fileGeneration_addScopeElement(
|
|
253
|
-
this.fileGeneration,
|
|
254
|
-
element instanceof PackageableElement
|
|
255
|
-
? PackageableElementExplicitReference.create(element)
|
|
256
|
-
: element,
|
|
257
|
-
);
|
|
258
|
-
}
|
|
146
|
+
get generationParentId(): string | undefined {
|
|
147
|
+
return this.fileGeneration.path;
|
|
259
148
|
}
|
|
260
149
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (el) {
|
|
264
|
-
fileGeneration_deleteScopeElement(this.fileGeneration, el);
|
|
265
|
-
}
|
|
150
|
+
resetGenerator(): void {
|
|
151
|
+
this.fileGeneration.configurationProperties = [];
|
|
266
152
|
}
|
|
267
153
|
|
|
268
154
|
updateFileGenerationParameters(
|
|
@@ -333,4 +219,67 @@ export class FileGenerationState {
|
|
|
333
219
|
}
|
|
334
220
|
}
|
|
335
221
|
}
|
|
222
|
+
|
|
223
|
+
*generate(): GeneratorFn<void> {
|
|
224
|
+
this.generatingAction.inProgress();
|
|
225
|
+
try {
|
|
226
|
+
// avoid wasting a network call when the scope is empty, we can short-circuit this
|
|
227
|
+
if (!this.fileGeneration.scopeElements.length) {
|
|
228
|
+
this.fileSystemState.selectedNode = undefined;
|
|
229
|
+
this.processGenerationResult([]);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const mode =
|
|
233
|
+
this.editorStore.graphState.graphGenerationState.getFileGenerationConfiguration(
|
|
234
|
+
this.fileGeneration.type,
|
|
235
|
+
).generationMode;
|
|
236
|
+
const result =
|
|
237
|
+
(yield this.editorStore.graphManagerState.graphManager.generateFile(
|
|
238
|
+
this.fileGeneration,
|
|
239
|
+
mode,
|
|
240
|
+
this.editorStore.graphManagerState.graph,
|
|
241
|
+
)) as GenerationOutput[];
|
|
242
|
+
this.processGenerationResult(result);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
assertErrorThrown(error);
|
|
245
|
+
this.fileSystemState.selectedNode = undefined;
|
|
246
|
+
this.processGenerationResult([]);
|
|
247
|
+
this.editorStore.applicationStore.log.error(
|
|
248
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.GENERATION_FAILURE),
|
|
249
|
+
error,
|
|
250
|
+
);
|
|
251
|
+
this.editorStore.applicationStore.notifyError(error);
|
|
252
|
+
} finally {
|
|
253
|
+
this.generatingAction.complete();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
getScopeElement(
|
|
258
|
+
element: PackageableElement | string,
|
|
259
|
+
): PackageableElementReference<PackageableElement> | string | undefined {
|
|
260
|
+
return this.fileGeneration.scopeElements.find((el) =>
|
|
261
|
+
el instanceof PackageableElementReference
|
|
262
|
+
? el.value === element
|
|
263
|
+
: element === el,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
addScopeElement(element: PackageableElement | string): void {
|
|
268
|
+
const el = this.getScopeElement(element);
|
|
269
|
+
if (!el) {
|
|
270
|
+
fileGeneration_addScopeElement(
|
|
271
|
+
this.fileGeneration,
|
|
272
|
+
element instanceof PackageableElement
|
|
273
|
+
? PackageableElementExplicitReference.create(element)
|
|
274
|
+
: element,
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
deleteScopeElement(element: PackageableElement | string): void {
|
|
280
|
+
const el = this.getScopeElement(element);
|
|
281
|
+
if (el) {
|
|
282
|
+
fileGeneration_deleteScopeElement(this.fileGeneration, el);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
336
285
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import type { EditorStore } from '../EditorStore.js';
|
|
18
18
|
import { EditorState } from './EditorState.js';
|
|
19
19
|
import { observable, makeObservable, computed } from 'mobx';
|
|
20
|
-
import type {
|
|
20
|
+
import type { FileSystem_File } from '../shared/FileSystemTreeUtils.js';
|
|
21
21
|
import { EDITOR_LANGUAGE, TAB_SIZE } from '@finos/legend-application';
|
|
22
22
|
import { returnUndefOnError } from '@finos/legend-shared';
|
|
23
23
|
|
|
@@ -51,9 +51,9 @@ export const getEditorLanguageForFormat = (
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
export class FileGenerationViewerState extends EditorState {
|
|
54
|
-
file:
|
|
54
|
+
file: FileSystem_File;
|
|
55
55
|
|
|
56
|
-
constructor(editorStore: EditorStore, file:
|
|
56
|
+
constructor(editorStore: EditorStore, file: FileSystem_File) {
|
|
57
57
|
super(editorStore);
|
|
58
58
|
|
|
59
59
|
makeObservable(this, {
|
|
@@ -0,0 +1,111 @@
|
|
|
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 type { TreeData } from '@finos/legend-art';
|
|
18
|
+
import { action, makeObservable, observable } from 'mobx';
|
|
19
|
+
import {
|
|
20
|
+
type FileResult,
|
|
21
|
+
type FileSystemTreeNodeData,
|
|
22
|
+
type FileSystem_File,
|
|
23
|
+
FileSystem_Directory,
|
|
24
|
+
openNode,
|
|
25
|
+
populateDirectoryTreeNodeChildren,
|
|
26
|
+
reprocessOpenNodes,
|
|
27
|
+
} from '../shared/FileSystemTreeUtils.js';
|
|
28
|
+
|
|
29
|
+
export class FileSystemState {
|
|
30
|
+
root: FileSystem_Directory;
|
|
31
|
+
directoryTreeData?: TreeData<FileSystemTreeNodeData> | undefined;
|
|
32
|
+
selectedNode?: FileSystemTreeNodeData | undefined;
|
|
33
|
+
filesIndex = new Map<string, FileSystem_File>();
|
|
34
|
+
|
|
35
|
+
constructor(root: string) {
|
|
36
|
+
this.root = new FileSystem_Directory(root);
|
|
37
|
+
makeObservable(this, {
|
|
38
|
+
root: observable,
|
|
39
|
+
directoryTreeData: observable.ref,
|
|
40
|
+
selectedNode: observable.ref,
|
|
41
|
+
reprocessNodeTree: action,
|
|
42
|
+
setDirectoryTreeData: action,
|
|
43
|
+
onTreeNodeSelect: action,
|
|
44
|
+
setSelectedNode: action,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getOrCreateDirectory(directoryName: string): FileSystem_Directory {
|
|
49
|
+
return FileSystem_Directory.getOrCreateDirectory(
|
|
50
|
+
this.root,
|
|
51
|
+
directoryName,
|
|
52
|
+
true,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setDirectoryTreeData(
|
|
57
|
+
directoryTreeData: TreeData<FileSystemTreeNodeData>,
|
|
58
|
+
): void {
|
|
59
|
+
this.directoryTreeData = directoryTreeData;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
reprocessNodeTree(
|
|
63
|
+
generationResult: FileResult[],
|
|
64
|
+
treeData: TreeData<FileSystemTreeNodeData>,
|
|
65
|
+
openedNodeIds: string[],
|
|
66
|
+
): void {
|
|
67
|
+
reprocessOpenNodes(treeData, this.filesIndex, this.root, openedNodeIds);
|
|
68
|
+
// select the current file node if available, else select the first output
|
|
69
|
+
const selectedFileNodePath =
|
|
70
|
+
generationResult.length === 1 ||
|
|
71
|
+
(this.selectedNode === undefined && generationResult.length !== 0)
|
|
72
|
+
? (generationResult[0] as FileResult).value.fileName
|
|
73
|
+
: this.selectedNode?.fileNode.path;
|
|
74
|
+
if (selectedFileNodePath) {
|
|
75
|
+
const file = this.filesIndex.get(selectedFileNodePath);
|
|
76
|
+
if (file) {
|
|
77
|
+
const node = openNode(file, treeData);
|
|
78
|
+
if (node) {
|
|
79
|
+
this.onTreeNodeSelect(node, treeData);
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
this.selectedNode = undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.setDirectoryTreeData({ ...treeData });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onTreeNodeSelect(
|
|
89
|
+
node: FileSystemTreeNodeData,
|
|
90
|
+
treeData: TreeData<FileSystemTreeNodeData>,
|
|
91
|
+
): void {
|
|
92
|
+
if (node.childrenIds?.length) {
|
|
93
|
+
node.isOpen = !node.isOpen;
|
|
94
|
+
if (node.fileNode instanceof FileSystem_Directory) {
|
|
95
|
+
populateDirectoryTreeNodeChildren(node, treeData);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
this.setSelectedNode(node);
|
|
99
|
+
this.setDirectoryTreeData({ ...treeData });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setSelectedNode(node?: FileSystemTreeNodeData): void {
|
|
103
|
+
if (this.selectedNode) {
|
|
104
|
+
this.selectedNode.isSelected = false;
|
|
105
|
+
}
|
|
106
|
+
if (node) {
|
|
107
|
+
node.isSelected = true;
|
|
108
|
+
}
|
|
109
|
+
this.selectedNode = node;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -29,20 +29,21 @@ import {
|
|
|
29
29
|
assertErrorThrown,
|
|
30
30
|
guaranteeNonNullable,
|
|
31
31
|
isNonNullable,
|
|
32
|
+
ActionState,
|
|
32
33
|
} from '@finos/legend-shared';
|
|
33
34
|
import { LEGEND_STUDIO_APP_EVENT } from '../LegendStudioAppEvent.js';
|
|
34
35
|
import {
|
|
35
|
-
type
|
|
36
|
-
type
|
|
37
|
-
|
|
36
|
+
type FileSystemTreeNodeData,
|
|
37
|
+
type FileResult,
|
|
38
|
+
FileSystem_Directory,
|
|
38
39
|
GENERATION_FILE_ROOT_NAME,
|
|
39
|
-
|
|
40
|
+
FileSystem_File,
|
|
40
41
|
openNode,
|
|
41
42
|
populateDirectoryTreeNodeChildren,
|
|
42
|
-
|
|
43
|
+
buildFileSystemDirectory,
|
|
43
44
|
reprocessOpenNodes,
|
|
44
|
-
|
|
45
|
-
} from '../shared/
|
|
45
|
+
getFileSystemTreeData,
|
|
46
|
+
} from '../shared/FileSystemTreeUtils.js';
|
|
46
47
|
import type { TreeData } from '@finos/legend-art';
|
|
47
48
|
import type { EditorStore } from '../EditorStore.js';
|
|
48
49
|
import { FileGenerationViewerState } from './FileGenerationViewerState.js';
|
|
@@ -80,21 +81,21 @@ export class GraphGenerationState {
|
|
|
80
81
|
editorStore: EditorStore;
|
|
81
82
|
isRunningGlobalGenerate = false;
|
|
82
83
|
generatedEntities = new Map<string, Entity[]>();
|
|
83
|
-
|
|
84
|
+
clearingGenerationEntitiesState = ActionState.create();
|
|
84
85
|
externalFormatState: ExternalFormatState;
|
|
85
86
|
// NOTE: this will eventually be removed once we also do model/schema import using external format
|
|
86
87
|
// See https://github.com/finos/legend-studio/issues/866
|
|
87
88
|
fileGenerationConfigurations: GenerationConfigurationDescription[] = [];
|
|
88
89
|
// file generation output
|
|
89
|
-
rootFileDirectory:
|
|
90
|
-
filesIndex = new Map<string,
|
|
91
|
-
selectedNode?:
|
|
90
|
+
rootFileDirectory: FileSystem_Directory;
|
|
91
|
+
filesIndex = new Map<string, FileSystem_File>();
|
|
92
|
+
selectedNode?: FileSystemTreeNodeData | undefined;
|
|
92
93
|
|
|
93
94
|
constructor(editorStore: EditorStore) {
|
|
94
95
|
makeObservable<GraphGenerationState>(this, {
|
|
95
96
|
isRunningGlobalGenerate: observable,
|
|
96
97
|
generatedEntities: observable.shallow,
|
|
97
|
-
|
|
98
|
+
clearingGenerationEntitiesState: observable,
|
|
98
99
|
fileGenerationConfigurations: observable,
|
|
99
100
|
externalFormatState: observable,
|
|
100
101
|
rootFileDirectory: observable,
|
|
@@ -118,7 +119,9 @@ export class GraphGenerationState {
|
|
|
118
119
|
});
|
|
119
120
|
|
|
120
121
|
this.editorStore = editorStore;
|
|
121
|
-
this.rootFileDirectory = new
|
|
122
|
+
this.rootFileDirectory = new FileSystem_Directory(
|
|
123
|
+
GENERATION_FILE_ROOT_NAME,
|
|
124
|
+
);
|
|
122
125
|
this.externalFormatState = new ExternalFormatState(editorStore);
|
|
123
126
|
}
|
|
124
127
|
|
|
@@ -349,13 +352,13 @@ export class GraphGenerationState {
|
|
|
349
352
|
* Used to clear generation entities as well as the generation model
|
|
350
353
|
*/
|
|
351
354
|
*clearGenerations(): GeneratorFn<void> {
|
|
352
|
-
this.
|
|
355
|
+
this.clearingGenerationEntitiesState.inProgress();
|
|
353
356
|
this.generatedEntities = new Map<string, Entity[]>();
|
|
354
357
|
this.emptyFileGeneration();
|
|
355
358
|
yield flowResult(
|
|
356
359
|
this.editorStore.graphState.updateGenerationGraphAndApplication(),
|
|
357
360
|
);
|
|
358
|
-
this.
|
|
361
|
+
this.clearingGenerationEntitiesState.complete();
|
|
359
362
|
}
|
|
360
363
|
|
|
361
364
|
/**
|
|
@@ -416,7 +419,7 @@ export class GraphGenerationState {
|
|
|
416
419
|
.map((node) => node.id)
|
|
417
420
|
: [];
|
|
418
421
|
// we read the generation outputs and clean
|
|
419
|
-
const generationResultIndex = new Map<string,
|
|
422
|
+
const generationResultIndex = new Map<string, FileResult>();
|
|
420
423
|
Array.from(generationOutputIndex.entries()).forEach((entry) => {
|
|
421
424
|
const fileGeneration =
|
|
422
425
|
this.editorStore.graphManagerState.graph.getNullableFileGeneration(
|
|
@@ -435,20 +438,20 @@ export class GraphGenerationState {
|
|
|
435
438
|
);
|
|
436
439
|
}
|
|
437
440
|
generationResultIndex.set(genOutput.fileName, {
|
|
438
|
-
|
|
441
|
+
value: genOutput,
|
|
439
442
|
parentId: fileGeneration?.path,
|
|
440
443
|
});
|
|
441
444
|
});
|
|
442
445
|
});
|
|
443
446
|
// take generation outputs and put them into the root directory
|
|
444
|
-
|
|
447
|
+
buildFileSystemDirectory(
|
|
445
448
|
this.rootFileDirectory,
|
|
446
449
|
generationResultIndex,
|
|
447
450
|
this.filesIndex,
|
|
448
451
|
);
|
|
449
452
|
// after building root directory set the generation tree data
|
|
450
453
|
this.editorStore.graphState.editorStore.explorerTreeState.setFileGenerationTreeData(
|
|
451
|
-
|
|
454
|
+
getFileSystemTreeData(
|
|
452
455
|
this.editorStore.graphState.graphGenerationState.rootFileDirectory,
|
|
453
456
|
ExplorerTreeRootPackageLabel.FILE_GENERATION,
|
|
454
457
|
),
|
|
@@ -482,10 +485,10 @@ export class GraphGenerationState {
|
|
|
482
485
|
}
|
|
483
486
|
|
|
484
487
|
reprocessNodeTree(
|
|
485
|
-
generationResult:
|
|
486
|
-
treeData: TreeData<
|
|
488
|
+
generationResult: FileResult[],
|
|
489
|
+
treeData: TreeData<FileSystemTreeNodeData>,
|
|
487
490
|
openedNodeIds: string[],
|
|
488
|
-
): TreeData<
|
|
491
|
+
): TreeData<FileSystemTreeNodeData> {
|
|
489
492
|
reprocessOpenNodes(
|
|
490
493
|
treeData,
|
|
491
494
|
this.filesIndex,
|
|
@@ -496,8 +499,7 @@ export class GraphGenerationState {
|
|
|
496
499
|
const selectedFileNodePath =
|
|
497
500
|
this.selectedNode?.fileNode.path ??
|
|
498
501
|
(generationResult.length === 1
|
|
499
|
-
? (generationResult[0] as
|
|
500
|
-
.fileName
|
|
502
|
+
? (generationResult[0] as FileResult).value.fileName
|
|
501
503
|
: undefined);
|
|
502
504
|
if (selectedFileNodePath) {
|
|
503
505
|
const file = this.filesIndex.get(selectedFileNodePath);
|
|
@@ -514,17 +516,17 @@ export class GraphGenerationState {
|
|
|
514
516
|
}
|
|
515
517
|
|
|
516
518
|
onTreeNodeSelect(
|
|
517
|
-
node:
|
|
518
|
-
treeData: TreeData<
|
|
519
|
+
node: FileSystemTreeNodeData,
|
|
520
|
+
treeData: TreeData<FileSystemTreeNodeData>,
|
|
519
521
|
reprocess?: boolean,
|
|
520
522
|
): void {
|
|
521
523
|
if (node.childrenIds?.length) {
|
|
522
524
|
node.isOpen = !node.isOpen;
|
|
523
|
-
if (node.fileNode instanceof
|
|
525
|
+
if (node.fileNode instanceof FileSystem_Directory) {
|
|
524
526
|
populateDirectoryTreeNodeChildren(node, treeData);
|
|
525
527
|
}
|
|
526
528
|
}
|
|
527
|
-
if (!reprocess && node.fileNode instanceof
|
|
529
|
+
if (!reprocess && node.fileNode instanceof FileSystem_File) {
|
|
528
530
|
this.editorStore.tabManagerState.openTab(
|
|
529
531
|
new FileGenerationViewerState(this.editorStore, node.fileNode),
|
|
530
532
|
);
|
|
@@ -535,7 +537,7 @@ export class GraphGenerationState {
|
|
|
535
537
|
);
|
|
536
538
|
}
|
|
537
539
|
|
|
538
|
-
setSelectedNode(node?:
|
|
540
|
+
setSelectedNode(node?: FileSystemTreeNodeData): void {
|
|
539
541
|
if (this.selectedNode) {
|
|
540
542
|
this.selectedNode.isSelected = false;
|
|
541
543
|
}
|
|
@@ -546,7 +548,9 @@ export class GraphGenerationState {
|
|
|
546
548
|
}
|
|
547
549
|
|
|
548
550
|
emptyFileGeneration(): void {
|
|
549
|
-
this.filesIndex = new Map<string,
|
|
550
|
-
this.rootFileDirectory = new
|
|
551
|
+
this.filesIndex = new Map<string, FileSystem_File>();
|
|
552
|
+
this.rootFileDirectory = new FileSystem_Directory(
|
|
553
|
+
GENERATION_FILE_ROOT_NAME,
|
|
554
|
+
);
|
|
551
555
|
}
|
|
552
556
|
}
|