diff --git a/src/common/models/Build.ts b/src/common/models/Build.ts index 97f31fd7..bfaf9c63 100644 --- a/src/common/models/Build.ts +++ b/src/common/models/Build.ts @@ -14,6 +14,7 @@ export type Build = { }; packages: BuildPackage[]; status: string; + status_info: string | null; size: number; scheduled_on: string; started_on: string; diff --git a/src/features/environmentCreate/components/EnvironmentCreate.tsx b/src/features/environmentCreate/components/EnvironmentCreate.tsx index 99feb5b3..d5127047 100644 --- a/src/features/environmentCreate/components/EnvironmentCreate.tsx +++ b/src/features/environmentCreate/components/EnvironmentCreate.tsx @@ -95,9 +95,9 @@ export const EnvironmentCreate = ({ environmentNotification }: IEnvCreate) => { description: createLabel(name, "create") } }); - } catch ({ data }) { + } catch (e) { setError({ - message: data.message, + message: e?.data?.message ?? createLabel(undefined, "error"), visible: true }); } diff --git a/src/features/metadata/components/EnvBuilds.tsx b/src/features/metadata/components/EnvBuilds.tsx index a0bff778..da85edcc 100644 --- a/src/features/metadata/components/EnvBuilds.tsx +++ b/src/features/metadata/components/EnvBuilds.tsx @@ -44,7 +44,13 @@ export const EnvBuilds = ({ > Status: {""} - {currentBuild.status} + {currentBuild.status_info ? ( + <> + {currentBuild.status} ({currentBuild.status_info}) + + ) : ( + <>{currentBuild.status} + )} {(currentBuild.status === "Building" || currentBuild.status === "Queued") && ( { }; export const buildMapper = (data: Build[], currentBuildId: number) => { - return data.map(({ id, status, ended_on, scheduled_on }: Build) => { - let duration = 0; - if (ended_on && scheduled_on) { - const startTime = new Date(scheduled_on); - const endTime = new Date(ended_on); - duration = (endTime.valueOf() - startTime.valueOf()) / 60000; - duration = Math.round(duration); - } - if (id === currentBuildId) { - return { - id, - name: `${dateToTimezone(ended_on ?? scheduled_on)} - Active`, - status: isCompleted(status, duration) - }; - } + 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); + const endTime = new Date(ended_on); + duration = (endTime.valueOf() - startTime.valueOf()) / 60000; + duration = Math.round(duration); + } + if (id === currentBuildId) { + return { + id, + name: `${dateToTimezone(ended_on ?? scheduled_on)} - Active`, + status: isCompleted(status, duration), + status_info + }; + } - if (isBuilding(status)) { - return { - id, - name: `${dateToTimezone(scheduled_on)} - Building`, - status: "Building" - }; - } + if (isBuilding(status)) { + return { + id, + name: `${dateToTimezone(scheduled_on)} - Building`, + status: "Building", + status_info + }; + } + + if (isQueued(status)) { + return { + id, + name: `${dateToTimezone(scheduled_on)} - Queued`, + status: "Building", + status_info + }; + } - if (isQueued(status)) { return { id, - name: `${dateToTimezone(scheduled_on)} - Queued`, - status: "Building" + name: `${dateToTimezone(ended_on ?? scheduled_on)} - ${ + STATUS_OPTIONS[status] + }`, + status: isCompleted(status, duration), + status_info }; } - - return { - id, - name: `${dateToTimezone(ended_on ?? scheduled_on)} - ${ - STATUS_OPTIONS[status] - }`, - status: isCompleted(status, duration) - }; - }); + ); };