Skip to content

Commit b5ad37a

Browse files
Don't say analyses failed when the workflow was canceled
1 parent 7b03a6e commit b5ad37a

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

extensions/ql-vscode/src/stories/variant-analysis/VariantAnalysisStats.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,5 @@ export const Stopped = Template.bind({});
108108
Stopped.args = {
109109
...Started.args,
110110
variantAnalysisStatus: VariantAnalysisStatus.Canceled,
111+
completedRepositoryCount: 10,
111112
};

extensions/ql-vscode/src/view/variant-analysis/VariantAnalysisRepositoriesStats.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,21 @@ function getIcon(
2424
skippedRepositoryCount: number,
2525
) {
2626
if (successfulRepositoryCount < completedRepositoryCount) {
27-
return (
28-
<>
29-
<HorizontalSpace size={2} />
30-
<ErrorIcon label="Some analyses failed" />
31-
</>
32-
);
27+
if (variantAnalysisStatus === VariantAnalysisStatus.Canceled) {
28+
return (
29+
<>
30+
<HorizontalSpace size={2} />
31+
<ErrorIcon label="Some analyses were stopped" />
32+
</>
33+
);
34+
} else {
35+
return (
36+
<>
37+
<HorizontalSpace size={2} />
38+
<ErrorIcon label="Some analyses failed" />
39+
</>
40+
);
41+
}
3342
} else if (skippedRepositoryCount > 0) {
3443
return (
3544
<>

extensions/ql-vscode/src/view/variant-analysis/__tests__/VariantAnalysisStats.spec.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,20 @@ describe(VariantAnalysisStats.name, () => {
108108
).toBeInTheDocument();
109109
});
110110

111+
it("renders an error icon when the overall variant analysis status is canceled and some analyses failed", () => {
112+
render({
113+
variantAnalysisStatus: VariantAnalysisStatus.Canceled,
114+
completedRepositoryCount: 10,
115+
successfulRepositoryCount: 5,
116+
});
117+
118+
expect(
119+
screen.getByRole("img", {
120+
name: "Some analyses were stopped",
121+
}),
122+
).toBeInTheDocument();
123+
});
124+
111125
it("renders an error icon when some analyses failed but also some repositories were skipped", () => {
112126
render({
113127
completedRepositoryCount: 10,

0 commit comments

Comments
 (0)