Skip to content

Commit

Permalink
Expose status_info in the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Karetnikov committed Nov 8, 2023
1 parent 34903d4 commit 69d3673
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/common/models/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type Build = {
};
packages: BuildPackage[];
status: string;
status_info: string | null;
size: number;
scheduled_on: string;
started_on: string;
Expand Down
6 changes: 5 additions & 1 deletion src/features/metadata/components/EnvBuilds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export const EnvBuilds = ({
>
Status: {""}
<Typography component="span" sx={{ fontSize: "13px" }}>
{currentBuild.status}
{currentBuild.status_info ? (
<>{currentBuild.status} ({currentBuild.status_info})</>
) : (
<>{currentBuild.status}</>
)}
{(currentBuild.status === "Building" ||
currentBuild.status === "Queued") && (
<CircularProgress
Expand Down
14 changes: 9 additions & 5 deletions src/utils/helpers/buildMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const dateToTimezone = (date: string) => {
};

export const buildMapper = (data: Build[], currentBuildId: number) => {
return data.map(({ id, status, ended_on, scheduled_on }: Build) => {
return data.map(({ id, status, status_info, ended_on, scheduled_on }: Build) => {
let duration = 0;
if (ended_on && scheduled_on) {
const startTime = new Date(scheduled_on);
Expand All @@ -53,23 +53,26 @@ export const buildMapper = (data: Build[], currentBuildId: number) => {
return {
id,
name: `${dateToTimezone(ended_on ?? scheduled_on)} - Active`,
status: isCompleted(status, duration)
status: isCompleted(status, duration),
status_info,
};
}

if (isBuilding(status)) {
return {
id,
name: `${dateToTimezone(scheduled_on)} - Building`,
status: "Building"
status: "Building",
status_info,
};
}

if (isQueued(status)) {
return {
id,
name: `${dateToTimezone(scheduled_on)} - Queued`,
status: "Building"
status: "Building",
status_info,
};
}

Expand All @@ -78,7 +81,8 @@ export const buildMapper = (data: Build[], currentBuildId: number) => {
name: `${dateToTimezone(ended_on ?? scheduled_on)} - ${
STATUS_OPTIONS[status]
}`,
status: isCompleted(status, duration)
status: isCompleted(status, duration),
status_info,
};
});
};

0 comments on commit 69d3673

Please sign in to comment.