Merge pull request #2758 from erictnilsson/master
#2534 Refactored WorkflowRunStatus to also account for the build run's conclusion
This commit is contained in:
@@ -60,7 +60,10 @@ const WidgetContent = ({
|
||||
metadata={{
|
||||
status: (
|
||||
<>
|
||||
<WorkflowRunStatus status={lastRun.status} />
|
||||
<WorkflowRunStatus
|
||||
status={lastRun.status}
|
||||
conclusion={lastRun.conclusion}
|
||||
/>
|
||||
</>
|
||||
),
|
||||
message: lastRun.message,
|
||||
|
||||
@@ -106,7 +106,10 @@ const StepView = ({ step }: { step: Step }) => {
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<WorkflowRunStatus status={step.status.toUpperCase()} />
|
||||
<WorkflowRunStatus
|
||||
status={step.status.toUpperCase()}
|
||||
conclusion={step.conclusion.toUpperCase()}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
@@ -204,7 +207,10 @@ export const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {
|
||||
<Typography noWrap>Status</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<WorkflowRunStatus status={details.value?.status} />
|
||||
<WorkflowRunStatus
|
||||
status={details.value?.status}
|
||||
conclusion={details.value?.conclusion}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
|
||||
@@ -14,13 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { StatusPending, StatusRunning, StatusOK } from '@backstage/core';
|
||||
import {
|
||||
StatusPending,
|
||||
StatusRunning,
|
||||
StatusOK,
|
||||
StatusWarning,
|
||||
StatusAborted,
|
||||
StatusError,
|
||||
} from '@backstage/core';
|
||||
import React from 'react';
|
||||
|
||||
export const WorkflowRunStatus = ({
|
||||
status,
|
||||
conclusion,
|
||||
}: {
|
||||
status: string | undefined;
|
||||
conclusion: string | undefined;
|
||||
}) => {
|
||||
if (status === undefined) return null;
|
||||
switch (status.toLowerCase()) {
|
||||
@@ -37,11 +46,32 @@ export const WorkflowRunStatus = ({
|
||||
</>
|
||||
);
|
||||
case 'completed':
|
||||
return (
|
||||
<>
|
||||
<StatusOK /> Completed
|
||||
</>
|
||||
);
|
||||
switch (conclusion?.toLowerCase()) {
|
||||
case 'skipped' || 'canceled':
|
||||
return (
|
||||
<>
|
||||
<StatusAborted /> Aborted
|
||||
</>
|
||||
);
|
||||
case 'timed_out':
|
||||
return (
|
||||
<>
|
||||
<StatusWarning /> Timed out
|
||||
</>
|
||||
);
|
||||
case 'failure':
|
||||
return (
|
||||
<>
|
||||
<StatusError /> Error
|
||||
</>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<>
|
||||
<StatusOK /> Completed
|
||||
</>
|
||||
);
|
||||
}
|
||||
default:
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -46,6 +46,7 @@ export type WorkflowRun = {
|
||||
};
|
||||
};
|
||||
status: string;
|
||||
conclusion: string;
|
||||
onReRunClick: () => void;
|
||||
};
|
||||
|
||||
@@ -84,7 +85,7 @@ const generatedColumns: TableColumn[] = [
|
||||
|
||||
render: (row: Partial<WorkflowRun>) => (
|
||||
<Box display="flex" alignItems="center">
|
||||
<WorkflowRunStatus status={row.status} />
|
||||
<WorkflowRunStatus status={row.status} conclusion={row.conclusion} />
|
||||
</Box>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -87,6 +87,7 @@ export function useWorkflowRuns({
|
||||
},
|
||||
},
|
||||
status: run.status,
|
||||
conclusion: run.conclusion,
|
||||
url: run.url,
|
||||
githubUrl: run.html_url,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user