Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
easyCZ committed Mar 14, 2022
1 parent bbd2fad commit 351002d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 12 deletions.
4 changes: 2 additions & 2 deletions components/dashboard/src/projects/Prebuild.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import PrebuildLogs from "../components/PrebuildLogs";
import Spinner from "../icons/Spinner.svg";
import { getGitpodService, gitpodHostUrl } from "../service/service";
import { TeamsContext, getCurrentTeam } from "../teams/teams-context";
import { PrebuildInstanceStatus } from "./Prebuilds";
import { PrebuildStatus } from "./Prebuilds";
import { shortCommitMessage } from "./render-utils";

export default function () {
Expand Down Expand Up @@ -167,7 +167,7 @@ export default function () {
/>
</div>
<div className="h-20 px-6 bg-gray-50 dark:bg-gray-800 border-t border-gray-200 dark:border-gray-600 flex space-x-2">
{prebuildInstance && <PrebuildInstanceStatus prebuildInstance={prebuildInstance} />}
{prebuildInstance && <PrebuildStatus prebuild={prebuild!} />}
<div className="flex-grow" />
{prebuild?.status === "aborted" || prebuild?.status === "timeout" || !!prebuild?.error ? (
<button
Expand Down
62 changes: 52 additions & 10 deletions components/dashboard/src/projects/Prebuilds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,24 +386,66 @@ export function PrebuildStatus(props: { prebuild: PrebuildWithStatus }) {
);
break;
case "building":
return <img alt="" className="h-4 w-4" src={StatusRunning} />;
details = (
<div className="flex space-x-1 items-center text-gray-400">
<img alt="" className="h-4 w-4 animate-spin" src={StatusRunning} />
<span>Prebuild is currently in progress.</span>
</div>
);
break;
case "aborted":
return <img alt="" className="h-4 w-4" src={StatusCanceled} />;
details = (
<div className="flex space-x-1 items-center text-gray-400">
<img alt="" className="h-4 w-4 animate-spin" src={StatusCanceled} />
<span>
Prebuild has been cancelled. Either a user cancelled it, or the prebuild rate limit has been
exceeded.
</span>
</div>
);
break;
case "failed":
return <img alt="" className="h-4 w-4" src={StatusFailed} />;
details = (
<div className="flex space-x-1 items-center text-gray-400">
<img alt="" className="h-4 w-4 animate-spin" src={StatusFailed} />
<span>Prebuild failed. Error: '${prebuild.error}'.</span>
</div>
);
break;
case "timeout":
return <img alt="" className="h-4 w-4" src={StatusFailed} />;
details = (
<div className="flex space-x-1 items-center text-gray-400">
<img alt="" className="h-4 w-4 animate-spin" src={StatusFailed} />
<span>Prebuild timed out. Error: '${prebuild.error}'.</span>
</div>
);
break;
case "available":
if (prebuild?.error) {
return <img alt="" className="h-4 w-4" src={StatusFailed} />;
details = (
<div className="flex space-x-1 items-center text-gray-400">
<img alt="" className="h-4 w-4 animate-spin" src={StatusFailed} />
<span>Prebuild failed. Error: '${prebuild.error}'.</span>
</div>
);
break;
}
return <img alt="" className="h-4 w-4" src={StatusDone} />;

details = (
<div className="flex space-x-1 items-center text-gray-400">
<img alt="" className="h-4 w-4 animate-spin" src={StatusFailed} />
<span>Prebuild failed. Error: '${prebuild.error}'.</span>
</div>
);
break;
}

<div className="flex flex-col space-y-1 justify-center text-sm font-semibold">
<div>{status}</div>
<div>{details}</div>
</div>;
return (
<div className="flex flex-col space-y-1 justify-center text-sm font-semibold">
<div>{status}</div>
<div>{details}</div>
</div>
);
}

export function PrebuildInstanceStatus(props: { prebuildInstance?: WorkspaceInstance; prebuild?: PrebuildWithStatus }) {
Expand Down

0 comments on commit 351002d

Please sign in to comment.