@finos/legend-application-studio 28.2.5 → 28.2.7
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/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +2 -2
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +3 -1
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
- package/lib/components/editor/panel-group/DevToolPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/DevToolPanel.js +27 -3
- package/lib/components/editor/panel-group/DevToolPanel.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +7 -5
- package/lib/components/editor/side-bar/Explorer.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/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +3 -2
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js +3 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js.map +1 -1
- package/package.json +4 -4
- package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +5 -2
- package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +4 -4
- package/src/components/editor/panel-group/DevToolPanel.tsx +94 -1
- package/src/components/editor/side-bar/Explorer.tsx +9 -4
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +8 -1
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +4 -1
- package/src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts +2 -1
@@ -872,9 +872,12 @@ const MappingTestEditor = observer(
|
|
872
872
|
<textarea
|
873
873
|
className="panel__content__form__section__textarea mapping-testable-editor__doc__textarea"
|
874
874
|
spellCheck={false}
|
875
|
-
value={mappingTest.doc}
|
875
|
+
value={mappingTest.doc ?? ''}
|
876
876
|
onChange={(event) => {
|
877
|
-
atomicTest_setDoc(
|
877
|
+
atomicTest_setDoc(
|
878
|
+
mappingTest,
|
879
|
+
event.target.value ? event.target.value : undefined,
|
880
|
+
);
|
878
881
|
}}
|
879
882
|
/>
|
880
883
|
</div>
|
@@ -255,6 +255,9 @@ const EqualToJsonAssertFailViewer = observer(
|
|
255
255
|
const { equalToJsonAssertFailState } = props;
|
256
256
|
const open = (): void => equalToJsonAssertFailState.setDiffModal(true);
|
257
257
|
const close = (): void => equalToJsonAssertFailState.setDiffModal(false);
|
258
|
+
const expected = equalToJsonAssertFailState.status.expected;
|
259
|
+
const actual = equalToJsonAssertFailState.status.actual;
|
260
|
+
|
258
261
|
return (
|
259
262
|
<>
|
260
263
|
<div className="equal-to-json-editor__message" onClick={open}>
|
@@ -285,10 +288,7 @@ const EqualToJsonAssertFailViewer = observer(
|
|
285
288
|
</div>
|
286
289
|
</ModalHeader>
|
287
290
|
<ModalBody>
|
288
|
-
<JSONDiffView
|
289
|
-
from={equalToJsonAssertFailState.status.expected}
|
290
|
-
to={equalToJsonAssertFailState.status.actual}
|
291
|
-
/>
|
291
|
+
<JSONDiffView from={expected} to={actual} lossless={true} />
|
292
292
|
</ModalBody>
|
293
293
|
<ModalFooter>
|
294
294
|
<ModalFooterButton text="Close" onClick={close} />
|
@@ -20,10 +20,19 @@ import {
|
|
20
20
|
Panel,
|
21
21
|
PanelFormTextField,
|
22
22
|
PanelForm,
|
23
|
+
CloudDownloadIcon,
|
24
|
+
PanelFormListItems,
|
23
25
|
} from '@finos/legend-art';
|
24
|
-
import {
|
26
|
+
import {
|
27
|
+
ContentType,
|
28
|
+
downloadFileUsingDataURI,
|
29
|
+
getContentTypeFileExtension,
|
30
|
+
isValidUrl,
|
31
|
+
} from '@finos/legend-shared';
|
25
32
|
import { useEditorStore } from '../EditorStoreProvider.js';
|
26
33
|
import { LEGEND_STUDIO_SETTING_KEY } from '../../../__lib__/LegendStudioSetting.js';
|
34
|
+
import { flowResult } from 'mobx';
|
35
|
+
import type { PureModel } from '@finos/legend-graph';
|
27
36
|
|
28
37
|
export const DevToolPanel = observer(() => {
|
29
38
|
const editorStore = useEditorStore();
|
@@ -58,6 +67,52 @@ export const DevToolPanel = observer(() => {
|
|
58
67
|
);
|
59
68
|
};
|
60
69
|
|
70
|
+
const downloadDependencyProjectGrammars = async (): Promise<string> => {
|
71
|
+
const dependencyGrammars = await Promise.all(
|
72
|
+
Array.from(
|
73
|
+
editorStore.graphManagerState.graph.dependencyManager
|
74
|
+
.projectDependencyModelsIndex,
|
75
|
+
).map(
|
76
|
+
(graph) =>
|
77
|
+
flowResult(
|
78
|
+
editorStore.graphManagerState.graphManager.graphToPureCode(
|
79
|
+
graph[1] as PureModel,
|
80
|
+
{
|
81
|
+
pretty: true,
|
82
|
+
},
|
83
|
+
),
|
84
|
+
) as string,
|
85
|
+
),
|
86
|
+
);
|
87
|
+
return dependencyGrammars.join('\n');
|
88
|
+
};
|
89
|
+
|
90
|
+
const downloadProjectGrammar = async (
|
91
|
+
withDependency: boolean,
|
92
|
+
): Promise<void> => {
|
93
|
+
const graphGrammar = (await Promise.all([
|
94
|
+
flowResult(
|
95
|
+
editorStore.graphManagerState.graphManager.graphToPureCode(
|
96
|
+
editorStore.graphManagerState.graph,
|
97
|
+
{ pretty: true },
|
98
|
+
),
|
99
|
+
),
|
100
|
+
])) as unknown as string;
|
101
|
+
const dependencyGrammars = withDependency
|
102
|
+
? ((await Promise.all([
|
103
|
+
flowResult(downloadDependencyProjectGrammars()),
|
104
|
+
])) as unknown as string)
|
105
|
+
: '';
|
106
|
+
const fileName = `grammar.${getContentTypeFileExtension(
|
107
|
+
ContentType.TEXT_PLAIN,
|
108
|
+
)}`;
|
109
|
+
downloadFileUsingDataURI(
|
110
|
+
fileName,
|
111
|
+
`${graphGrammar}\n${dependencyGrammars}`,
|
112
|
+
ContentType.TEXT_PLAIN,
|
113
|
+
);
|
114
|
+
};
|
115
|
+
|
61
116
|
return (
|
62
117
|
<Panel>
|
63
118
|
<PanelForm>
|
@@ -130,6 +185,44 @@ export const DevToolPanel = observer(() => {
|
|
130
185
|
isReadOnly={false}
|
131
186
|
update={toggleArtifactGeneration}
|
132
187
|
/>
|
188
|
+
<PanelFormListItems title="Download Project Grammar">
|
189
|
+
<div className="developer-tools__action-groups">
|
190
|
+
<div className="developer-tools__action-group">
|
191
|
+
<button
|
192
|
+
className="developer-tools__action-group__btn"
|
193
|
+
onClick={() => {
|
194
|
+
downloadProjectGrammar(false).catch(
|
195
|
+
editorStore.applicationStore.alertUnhandledError,
|
196
|
+
);
|
197
|
+
}}
|
198
|
+
tabIndex={-1}
|
199
|
+
title="Download Project Grammar"
|
200
|
+
>
|
201
|
+
<CloudDownloadIcon />
|
202
|
+
</button>
|
203
|
+
<div className="developer-tools__action-group__prompt">
|
204
|
+
download grammar without dependency
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
<div className="developer-tools__action-group">
|
208
|
+
<button
|
209
|
+
className="developer-tools__action-group__btn"
|
210
|
+
onClick={() => {
|
211
|
+
downloadProjectGrammar(true).catch(
|
212
|
+
editorStore.applicationStore.alertUnhandledError,
|
213
|
+
);
|
214
|
+
}}
|
215
|
+
tabIndex={-1}
|
216
|
+
title="Download Project Grammar with Dependency"
|
217
|
+
>
|
218
|
+
<CloudDownloadIcon />
|
219
|
+
</button>
|
220
|
+
<div className="developer-tools__action-group__prompt">
|
221
|
+
download grammar with dependency
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
</PanelFormListItems>
|
133
226
|
</PanelForm>
|
134
227
|
</Panel>
|
135
228
|
);
|
@@ -112,6 +112,7 @@ import {
|
|
112
112
|
extractDependencyGACoordinateFromRootPackageName,
|
113
113
|
type FunctionActivatorConfiguration,
|
114
114
|
Database,
|
115
|
+
DEPENDENCY_ROOT_PACKAGE_PREFIX,
|
115
116
|
} from '@finos/legend-graph';
|
116
117
|
import {
|
117
118
|
ActionAlertActionType,
|
@@ -617,7 +618,7 @@ const ExplorerContextMenu = observer(
|
|
617
618
|
const dependency =
|
618
619
|
editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
|
619
620
|
(dep) =>
|
620
|
-
dep.projectId ===
|
621
|
+
DEPENDENCY_ROOT_PACKAGE_PREFIX + dep.projectId ===
|
621
622
|
getElementRootPackage(node.packageableElement).name,
|
622
623
|
);
|
623
624
|
if (dependency) {
|
@@ -659,7 +660,7 @@ const ExplorerContextMenu = observer(
|
|
659
660
|
const dependency =
|
660
661
|
editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
|
661
662
|
(dep) =>
|
662
|
-
dep.projectId ===
|
663
|
+
DEPENDENCY_ROOT_PACKAGE_PREFIX + dep.projectId ===
|
663
664
|
getElementRootPackage(node.packageableElement).name,
|
664
665
|
);
|
665
666
|
if (dependency) {
|
@@ -696,7 +697,9 @@ const ExplorerContextMenu = observer(
|
|
696
697
|
const viewProject = (): void => {
|
697
698
|
const projectDependency =
|
698
699
|
editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
|
699
|
-
(dep) =>
|
700
|
+
(dep) =>
|
701
|
+
DEPENDENCY_ROOT_PACKAGE_PREFIX + dep.projectId ===
|
702
|
+
node?.packageableElement.name,
|
700
703
|
);
|
701
704
|
if (projectDependency) {
|
702
705
|
applicationStore.navigationService.navigator.visitAddress(
|
@@ -715,7 +718,9 @@ const ExplorerContextMenu = observer(
|
|
715
718
|
const viewSDLCProject = (): void => {
|
716
719
|
const dependency =
|
717
720
|
editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
|
718
|
-
(dep) =>
|
721
|
+
(dep) =>
|
722
|
+
DEPENDENCY_ROOT_PACKAGE_PREFIX + dep.projectId ===
|
723
|
+
node?.packageableElement.name,
|
719
724
|
);
|
720
725
|
if (dependency) {
|
721
726
|
createViewSDLCProjectHandler(
|
package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts
CHANGED
@@ -428,6 +428,7 @@ export class MappingTestSuiteState extends TestableTestSuiteEditorState {
|
|
428
428
|
const test = createBareMappingTest(
|
429
429
|
id,
|
430
430
|
this.createStoreTestData(_class),
|
431
|
+
this.editorStore.changeDetectionState.observerContext,
|
431
432
|
this.suite,
|
432
433
|
);
|
433
434
|
testSuite_addTest(
|
@@ -521,7 +522,13 @@ export class CreateSuiteState {
|
|
521
522
|
? generateStoreTestDataFromSetImpl(rootSetImpl, this.editorStore)
|
522
523
|
: undefined;
|
523
524
|
|
524
|
-
createBareMappingTest(
|
525
|
+
createBareMappingTest(
|
526
|
+
testName,
|
527
|
+
storeTestData,
|
528
|
+
|
529
|
+
this.editorStore.changeDetectionState.observerContext,
|
530
|
+
mappingTestSuite,
|
531
|
+
);
|
525
532
|
// set test suite
|
526
533
|
mapping_addTestSuite(
|
527
534
|
this.mappingTestableState.mapping,
|
package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts
CHANGED
@@ -44,6 +44,7 @@ import {
|
|
44
44
|
getAllClassDerivedProperties,
|
45
45
|
PropertyGraphFetchTree,
|
46
46
|
PropertyExplicitReference,
|
47
|
+
type ObserverContext,
|
47
48
|
} from '@finos/legend-graph';
|
48
49
|
import {
|
49
50
|
buildGetAllFunction,
|
@@ -63,6 +64,7 @@ import {
|
|
63
64
|
guaranteeNonNullable,
|
64
65
|
} from '@finos/legend-shared';
|
65
66
|
import type { DSL_Data_LegendStudioApplicationPlugin_Extension } from '../../../../../extensions/DSL_Data_LegendStudioApplicationPlugin_Extension.js';
|
67
|
+
import { testSuite_addTest } from '../../../../../graph-modifier/Testable_GraphModifierHelper.js';
|
66
68
|
|
67
69
|
export const createGraphFetchRawLambda = (
|
68
70
|
mainClass: Class,
|
@@ -158,6 +160,7 @@ export const generateStoreTestDataFromSetImpl = (
|
|
158
160
|
export const createBareMappingTest = (
|
159
161
|
id: string,
|
160
162
|
storeTestData: StoreTestData | undefined,
|
163
|
+
observerContext: ObserverContext,
|
161
164
|
suite?: MappingTestSuite | undefined,
|
162
165
|
): MappingTest => {
|
163
166
|
const mappingTest = new MappingTest();
|
@@ -168,7 +171,7 @@ export const createBareMappingTest = (
|
|
168
171
|
];
|
169
172
|
if (suite) {
|
170
173
|
mappingTest.__parent = suite;
|
171
|
-
suite
|
174
|
+
testSuite_addTest(suite, mappingTest, observerContext);
|
172
175
|
}
|
173
176
|
const assertion = createDefaultEqualToJSONTestAssertion(`expectedAssertion`);
|
174
177
|
mappingTest.assertions = [assertion];
|
@@ -369,7 +369,6 @@ export class TestAssertionEditorState {
|
|
369
369
|
if (generated) {
|
370
370
|
this.setSelectedTab(TEST_ASSERTION_TAB.EXPECTED);
|
371
371
|
}
|
372
|
-
this.generatingExpectedAction.complete();
|
373
372
|
this.editorStore.applicationStore.notificationService.notifySuccess(
|
374
373
|
`Expected results generated!`,
|
375
374
|
);
|
@@ -380,6 +379,8 @@ export class TestAssertionEditorState {
|
|
380
379
|
);
|
381
380
|
this.setSelectedTab(TEST_ASSERTION_TAB.EXPECTED);
|
382
381
|
this.generatingExpectedAction.fail();
|
382
|
+
} finally {
|
383
|
+
this.generatingExpectedAction.complete();
|
383
384
|
}
|
384
385
|
}
|
385
386
|
|