Show an error if not all repos completed successfully
This commit is contained in:
@@ -53,6 +53,13 @@ StartedWithSkippedRepositories.args = {
|
|||||||
skippedRepositoryCount: 3,
|
skippedRepositoryCount: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const StartedWithFailedAnalyses = Template.bind({});
|
||||||
|
StartedWithFailedAnalyses.args = {
|
||||||
|
...Starting.args,
|
||||||
|
completedRepositoryCount: 5,
|
||||||
|
successfulRepositoryCount: 3,
|
||||||
|
};
|
||||||
|
|
||||||
export const Succeeded = Template.bind({});
|
export const Succeeded = Template.bind({});
|
||||||
Succeeded.args = {
|
Succeeded.args = {
|
||||||
...Started.args,
|
...Started.args,
|
||||||
@@ -73,6 +80,22 @@ SucceededWithSkippedRepositories.args = {
|
|||||||
skippedRepositoryCount: 6,
|
skippedRepositoryCount: 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const SucceededWithFailedAnalyses = Template.bind({});
|
||||||
|
SucceededWithFailedAnalyses.args = {
|
||||||
|
...Succeeded.args,
|
||||||
|
totalRepositoryCount: 10,
|
||||||
|
completedRepositoryCount: 10,
|
||||||
|
successfulRepositoryCount: 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SucceededWithFailedAnalysesAndSkippedRepositories = Template.bind(
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
SucceededWithFailedAnalysesAndSkippedRepositories.args = {
|
||||||
|
...SucceededWithFailedAnalyses.args,
|
||||||
|
skippedRepositoryCount: 6,
|
||||||
|
};
|
||||||
|
|
||||||
export const Failed = Template.bind({});
|
export const Failed = Template.bind({});
|
||||||
Failed.args = {
|
Failed.args = {
|
||||||
...Starting.args,
|
...Starting.args,
|
||||||
|
|||||||
@@ -33,19 +33,27 @@ export const VariantAnalysisRepositoriesStats = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showError = successfulRepositoryCount < completedRepositoryCount;
|
||||||
const showWarning = skippedRepositoryCount > 0;
|
const showWarning = skippedRepositoryCount > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{formatDecimal(successfulRepositoryCount)}/
|
{formatDecimal(successfulRepositoryCount)}/
|
||||||
{formatDecimal(totalRepositoryCount)}
|
{formatDecimal(totalRepositoryCount)}
|
||||||
{showWarning && (
|
{showError && (
|
||||||
|
<>
|
||||||
|
<HorizontalSpace size={2} />
|
||||||
|
<ErrorIcon />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{showWarning && !showError && (
|
||||||
<>
|
<>
|
||||||
<HorizontalSpace size={2} />
|
<HorizontalSpace size={2} />
|
||||||
<WarningIcon />
|
<WarningIcon />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{!showWarning &&
|
{!showError &&
|
||||||
|
!showWarning &&
|
||||||
variantAnalysisStatus === VariantAnalysisStatus.Succeeded && (
|
variantAnalysisStatus === VariantAnalysisStatus.Succeeded && (
|
||||||
<>
|
<>
|
||||||
<HorizontalSpace size={2} />
|
<HorizontalSpace size={2} />
|
||||||
|
|||||||
@@ -53,8 +53,19 @@ export const VariantAnalysisStats = ({
|
|||||||
return "Stopped";
|
return "Stopped";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
variantAnalysisStatus === VariantAnalysisStatus.Succeeded &&
|
||||||
|
successfulRepositoryCount < completedRepositoryCount
|
||||||
|
) {
|
||||||
|
return "Some analyses failed";
|
||||||
|
}
|
||||||
|
|
||||||
return "Succeeded";
|
return "Succeeded";
|
||||||
}, [variantAnalysisStatus]);
|
}, [
|
||||||
|
variantAnalysisStatus,
|
||||||
|
successfulRepositoryCount,
|
||||||
|
completedRepositoryCount,
|
||||||
|
]);
|
||||||
|
|
||||||
const duration = useMemo(() => {
|
const duration = useMemo(() => {
|
||||||
if (!completedAt) {
|
if (!completedAt) {
|
||||||
|
|||||||
@@ -80,6 +80,53 @@ describe(VariantAnalysisStats.name, () => {
|
|||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders an error icon when the overall variant analysis status is in progress but some analyses failed", () => {
|
||||||
|
render({
|
||||||
|
variantAnalysisStatus: VariantAnalysisStatus.InProgress,
|
||||||
|
completedRepositoryCount: 10,
|
||||||
|
successfulRepositoryCount: 5,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen.getByRole("img", {
|
||||||
|
name: "Error",
|
||||||
|
}),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders an error icon when the overall variant analysis status is succeeded but some analyses failed", () => {
|
||||||
|
render({
|
||||||
|
variantAnalysisStatus: VariantAnalysisStatus.Succeeded,
|
||||||
|
completedRepositoryCount: 10,
|
||||||
|
successfulRepositoryCount: 5,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen.getByRole("img", {
|
||||||
|
name: "Error",
|
||||||
|
}),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders an error icon when some analyses failed but also some repositories were skipped", () => {
|
||||||
|
render({
|
||||||
|
completedRepositoryCount: 10,
|
||||||
|
successfulRepositoryCount: 5,
|
||||||
|
skippedRepositoryCount: 2,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen.getByRole("img", {
|
||||||
|
name: "Error",
|
||||||
|
}),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.queryByRole("img", {
|
||||||
|
name: "Warning",
|
||||||
|
}),
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it("renders a view logs link when the variant analysis status is succeeded", () => {
|
it("renders a view logs link when the variant analysis status is succeeded", () => {
|
||||||
render({
|
render({
|
||||||
variantAnalysisStatus: VariantAnalysisStatus.Succeeded,
|
variantAnalysisStatus: VariantAnalysisStatus.Succeeded,
|
||||||
@@ -108,12 +155,32 @@ describe(VariantAnalysisStats.name, () => {
|
|||||||
expect(screen.getByText("Stopped")).toBeInTheDocument();
|
expect(screen.getByText("Stopped")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders a succeeded text when the variant analysis status is succeeded", () => {
|
it("renders a some analyses failed text when the overall variant analysis status is succeeded but not all analyses successful", () => {
|
||||||
|
render({
|
||||||
|
variantAnalysisStatus: VariantAnalysisStatus.Succeeded,
|
||||||
|
completedRepositoryCount: 10,
|
||||||
|
successfulRepositoryCount: 5,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(screen.getByText("Some analyses failed")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders a succeeded text when the variant analysis status is succeeded and successful repository count omitted", () => {
|
||||||
render({ variantAnalysisStatus: VariantAnalysisStatus.Succeeded });
|
render({ variantAnalysisStatus: VariantAnalysisStatus.Succeeded });
|
||||||
|
|
||||||
expect(screen.getByText("Succeeded")).toBeInTheDocument();
|
expect(screen.getByText("Succeeded")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders a succeeded text when the variant analysis status is succeeded and successful repository count equals total repository count", () => {
|
||||||
|
render({
|
||||||
|
variantAnalysisStatus: VariantAnalysisStatus.Succeeded,
|
||||||
|
completedRepositoryCount: 10,
|
||||||
|
successfulRepositoryCount: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(screen.getByText("Succeeded")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
it("does not render the duration when the completedAt is not set", () => {
|
it("does not render the duration when the completedAt is not set", () => {
|
||||||
render({ createdAt: new Date("2021-05-01T00:00:00Z") });
|
render({ createdAt: new Date("2021-05-01T00:00:00Z") });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user