@finos/legend-application-studio 28.11.3 → 28.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__lib__/LegendStudioUserDataHelper.d.ts +24 -0
- package/lib/__lib__/LegendStudioUserDataHelper.d.ts.map +1 -0
- package/lib/__lib__/LegendStudioUserDataHelper.js +29 -0
- package/lib/__lib__/LegendStudioUserDataHelper.js.map +1 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +0 -1
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts +6 -0
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.d.ts.map +1 -1
- package/lib/components/editor/side-bar/testable/GlobalTestRunner.js +87 -44
- 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/package.json +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts +17 -8
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js +70 -22
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
- package/package.json +4 -4
- package/src/__lib__/LegendStudioUserDataHelper.ts +43 -0
- package/src/application/LegendStudioApplicationConfig.ts +0 -1
- package/src/components/editor/side-bar/testable/GlobalTestRunner.tsx +278 -143
- package/src/stores/editor/sidebar-state/testable/GlobalTestRunnerState.ts +102 -28
- package/tsconfig.json +1 -0
@@ -53,6 +53,7 @@ import type {
|
|
53
53
|
TestableMetadataGetter,
|
54
54
|
} from '../../../LegendStudioApplicationPlugin.js';
|
55
55
|
import { ServiceEditorState } from '../../editor-state/element-editor-state/service/ServiceEditorState.js';
|
56
|
+
import { LegendStudioUserDataHelper } from '../../../../__lib__/LegendStudioUserDataHelper.js';
|
56
57
|
|
57
58
|
// Testable Metadata
|
58
59
|
export interface TestableMetadata {
|
@@ -553,11 +554,20 @@ export class TestableState {
|
|
553
554
|
}
|
554
555
|
|
555
556
|
export class GlobalTestRunnerState {
|
556
|
-
editorStore: EditorStore;
|
557
|
-
sdlcState: EditorSDLCState;
|
558
|
-
|
557
|
+
readonly editorStore: EditorStore;
|
558
|
+
readonly sdlcState: EditorSDLCState;
|
559
|
+
readonly extraTestableMetadataGetters: TestableMetadataGetter[] = [];
|
560
|
+
|
561
|
+
// current project
|
559
562
|
isRunningTests = ActionState.create();
|
560
|
-
|
563
|
+
testableStates: TestableState[] | undefined;
|
564
|
+
|
565
|
+
// dependencies
|
566
|
+
showDependencyPanel = false;
|
567
|
+
isRunningDependencyTests = ActionState.create();
|
568
|
+
dependencyTestableStates: TestableState[] | undefined;
|
569
|
+
|
570
|
+
// error
|
561
571
|
failureViewing: AssertFail | TestError | undefined;
|
562
572
|
|
563
573
|
constructor(editorStore: EditorStore, sdlcState: EditorSDLCState) {
|
@@ -565,10 +575,17 @@ export class GlobalTestRunnerState {
|
|
565
575
|
editorStore: false,
|
566
576
|
sdlcState: false,
|
567
577
|
testableStates: observable,
|
568
|
-
|
578
|
+
dependencyTestableStates: observable,
|
579
|
+
isRunningTests: observable,
|
580
|
+
isRunningDependencyTests: observable,
|
581
|
+
initOwnTestables: action,
|
569
582
|
runAllTests: flow,
|
583
|
+
runDependenciesTests: flow,
|
570
584
|
failureViewing: observable,
|
585
|
+
showDependencyPanel: observable,
|
571
586
|
setFailureViewing: action,
|
587
|
+
setShowDependencyPanel: action,
|
588
|
+
initDependency: action,
|
572
589
|
visitTestable: action,
|
573
590
|
});
|
574
591
|
this.editorStore = editorStore;
|
@@ -580,29 +597,52 @@ export class GlobalTestRunnerState {
|
|
580
597
|
plugin.getExtraTestableMetadata?.() ?? [],
|
581
598
|
)
|
582
599
|
.filter(isNonNullable);
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
if (!this.testableStates || force) {
|
587
|
-
const testables =
|
588
|
-
this.editorStore.graphManagerState.graph.allOwnTestables;
|
589
|
-
this.testableStates = testables.map(
|
590
|
-
(testable) => new TestableState(this.editorStore, this, testable),
|
600
|
+
const showDependencyPanelVal =
|
601
|
+
LegendStudioUserDataHelper.globalTestRunner_getShowDependencyPanel(
|
602
|
+
this.editorStore.applicationStore.userDataService,
|
591
603
|
);
|
604
|
+
if (showDependencyPanelVal !== undefined) {
|
605
|
+
this.showDependencyPanel = showDependencyPanelVal;
|
592
606
|
}
|
593
607
|
}
|
594
608
|
|
595
|
-
get
|
609
|
+
get ownTestableStates(): TestableState[] {
|
596
610
|
return this.testableStates ?? [];
|
597
611
|
}
|
598
612
|
|
599
|
-
get
|
613
|
+
get allDependencyTestablesStates(): TestableState[] {
|
614
|
+
return this.dependencyTestableStates ?? [];
|
615
|
+
}
|
616
|
+
|
617
|
+
get allTestableStates(): TestableState[] {
|
618
|
+
return [...this.ownTestableStates, ...this.allDependencyTestablesStates];
|
619
|
+
}
|
620
|
+
|
621
|
+
get isDispatchingOwnProjectAction(): boolean {
|
600
622
|
return (
|
601
623
|
this.isRunningTests.isInProgress ||
|
602
|
-
this.
|
624
|
+
this.ownTestableStates.some((s) => s.isRunningTests.isInProgress)
|
625
|
+
);
|
626
|
+
}
|
627
|
+
|
628
|
+
get isDispatchingDependencyAction(): boolean {
|
629
|
+
return (
|
630
|
+
this.isRunningDependencyTests.isInProgress ||
|
631
|
+
this.allDependencyTestablesStates.some(
|
632
|
+
(s) => s.isRunningTests.isInProgress,
|
633
|
+
)
|
603
634
|
);
|
604
635
|
}
|
605
636
|
|
637
|
+
initOwnTestables(force?: boolean): void {
|
638
|
+
if (!this.testableStates || force) {
|
639
|
+
const testables = this.editorStore.graphManagerState.graph.ownTestables;
|
640
|
+
this.testableStates = testables.map(
|
641
|
+
(testable) => new TestableState(this.editorStore, this, testable),
|
642
|
+
);
|
643
|
+
}
|
644
|
+
}
|
645
|
+
|
606
646
|
visitTestable(testable: Testable): void {
|
607
647
|
if (testable instanceof PackageableElement) {
|
608
648
|
this.editorStore.graphEditorMode.openElement(testable);
|
@@ -618,19 +658,12 @@ export class GlobalTestRunnerState {
|
|
618
658
|
this.failureViewing = val;
|
619
659
|
}
|
620
660
|
|
621
|
-
*runAllTests(
|
661
|
+
*runAllTests(): GeneratorFn<void> {
|
622
662
|
try {
|
623
663
|
this.isRunningTests.inProgress();
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
(e) => new RunTestsTestableInput(e.testableMetadata.testable),
|
628
|
-
);
|
629
|
-
} else {
|
630
|
-
inputs = [
|
631
|
-
new RunTestsTestableInput(testableState.testableMetadata.testable),
|
632
|
-
];
|
633
|
-
}
|
664
|
+
const inputs = this.ownTestableStates.map(
|
665
|
+
(e) => new RunTestsTestableInput(e.testableMetadata.testable),
|
666
|
+
);
|
634
667
|
const testResults =
|
635
668
|
(yield this.editorStore.graphManagerState.graphManager.runTests(
|
636
669
|
inputs,
|
@@ -647,7 +680,7 @@ export class GlobalTestRunnerState {
|
|
647
680
|
|
648
681
|
handleResults(testResults: TestResult[]): void {
|
649
682
|
testResults.forEach((testResult) => {
|
650
|
-
const testableState = this.
|
683
|
+
const testableState = this.allTestableStates.find(
|
651
684
|
(tState) => tState.testableMetadata.testable === testResult.testable,
|
652
685
|
);
|
653
686
|
if (testableState) {
|
@@ -655,4 +688,45 @@ export class GlobalTestRunnerState {
|
|
655
688
|
}
|
656
689
|
});
|
657
690
|
}
|
691
|
+
|
692
|
+
// dependency
|
693
|
+
setShowDependencyPanel(val: boolean): void {
|
694
|
+
this.showDependencyPanel = val;
|
695
|
+
if (this.showDependencyPanel) {
|
696
|
+
this.initDependency();
|
697
|
+
}
|
698
|
+
LegendStudioUserDataHelper.globalTestRunner_setShowDependencyPanel(
|
699
|
+
this.editorStore.applicationStore.userDataService,
|
700
|
+
val,
|
701
|
+
);
|
702
|
+
}
|
703
|
+
|
704
|
+
initDependency(): void {
|
705
|
+
if (!this.dependencyTestableStates) {
|
706
|
+
this.dependencyTestableStates =
|
707
|
+
this.editorStore.graphManagerState.graph.dependencyManager.testables.map(
|
708
|
+
(testable) => new TestableState(this.editorStore, this, testable),
|
709
|
+
);
|
710
|
+
}
|
711
|
+
}
|
712
|
+
|
713
|
+
*runDependenciesTests(): GeneratorFn<void> {
|
714
|
+
try {
|
715
|
+
this.isRunningDependencyTests.inProgress();
|
716
|
+
const inputs = this.allDependencyTestablesStates.map(
|
717
|
+
(e) => new RunTestsTestableInput(e.testableMetadata.testable),
|
718
|
+
);
|
719
|
+
const testResults =
|
720
|
+
(yield this.editorStore.graphManagerState.graphManager.runTests(
|
721
|
+
inputs,
|
722
|
+
this.editorStore.graphManagerState.graph,
|
723
|
+
)) as TestResult[];
|
724
|
+
this.handleResults(testResults);
|
725
|
+
this.isRunningDependencyTests.complete();
|
726
|
+
} catch (error) {
|
727
|
+
assertErrorThrown(error);
|
728
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
729
|
+
this.isRunningDependencyTests.fail();
|
730
|
+
}
|
731
|
+
}
|
658
732
|
}
|
package/tsconfig.json
CHANGED
@@ -46,6 +46,7 @@
|
|
46
46
|
"./src/__lib__/LegendStudioSetting.ts",
|
47
47
|
"./src/__lib__/LegendStudioTelemetryHelper.ts",
|
48
48
|
"./src/__lib__/LegendStudioTesting.ts",
|
49
|
+
"./src/__lib__/LegendStudioUserDataHelper.ts",
|
49
50
|
"./src/__lib__/STO_Relational_LegendStudioCommand.ts",
|
50
51
|
"./src/application/LegendStudioApplicationConfig.ts",
|
51
52
|
"./src/application/LegendStudioPluginManager.ts",
|