diff --git a/components/dashboard/src/projects/Projects.tsx b/components/dashboard/src/projects/Projects.tsx index 36986f48dd0585..1839f86837c3ef 100644 --- a/components/dashboard/src/projects/Projects.tsx +++ b/components/dashboard/src/projects/Projects.tsx @@ -14,9 +14,13 @@ import { useContext, useEffect, useState } from "react"; import { getGitpodService } from "../service/service"; import { getCurrentTeam, TeamsContext } from "../teams/teams-context"; import { ThemeContext } from "../theme-context"; -import { PrebuildInfo, Project } from "@gitpod/gitpod-protocol"; +import { PrebuildInfo, PrebuiltWorkspaceState, Project } from "@gitpod/gitpod-protocol"; import { toRemoteURL } from "./render-utils"; import ContextMenu from "../components/ContextMenu"; +import StatusDone from "../icons/StatusDone.svg"; +import StatusPaused from "../icons/StatusPaused.svg"; +import StatusRunning from "../icons/StatusRunning.svg"; +import StatusFailed from "../icons/StatusFailed.svg"; export default function () { const location = useLocation(); @@ -60,10 +64,6 @@ export default function () { history.push(newProjectUrl); } - const viewAllPrebuilds = (p: Project) => { - history.push(`/${!!team ? team.slug : 'projects'}/${p.name}/prebuilds`); - } - const onRemoveProject = async (p: Project) => { await getGitpodService().server.deleteProject(p.id); await updateProjects(); @@ -76,6 +76,23 @@ export default function () { return true; } + const teamOrUserSlug = !!team ? team.slug : 'projects'; + + const getPrebuildStatusIcon = (status: PrebuiltWorkspaceState) => { + switch (status) { + case undefined: // Fall through + case "queued": + return StatusPaused; + case "building": + return StatusRunning; + case "aborted": // Fall through + case "timeout": + return StatusFailed; + case "available": + return StatusDone; + } + } + return <>
{projects.length < 1 && ( @@ -106,10 +123,10 @@ export default function () {
- {projects.filter(filter).map(p => (
-
-
-
+ {projects.filter(filter).map(p => (
+
+
+
{p.name} @@ -122,19 +139,36 @@ export default function () { }]} />
-

{toRemoteURL(p.cloneUrl)}

+ +

{toRemoteURL(p.cloneUrl)}

+
+
+
+ + + Branches + + + · + + + Prebuilds + +
-

__ Active Branches

-
viewAllPrebuilds(p)}> +
{lastPrebuilds.get(p.id) - ? (
-
-   -
-
{lastPrebuilds.get(p.id)!.branch}
-
{moment(lastPrebuilds.get(p.id)!.startedAt, "YYYYMMDD").fromNow()}
-
View All ⟶
+ ? (
+ + +
{lastPrebuilds.get(p.id)!.branch}
+ · +
{moment(lastPrebuilds.get(p.id)!.startedAt, "YYYYMMDD").fromNow()}
+ + +
View All →
+
) : (

No recent prebuilds

@@ -143,10 +177,10 @@ export default function () {
))} {!searchFilter && (
+ className="h-52 border-dashed border-2 border-gray-100 dark:border-gray-800 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-xl focus:bg-gitpod-kumquat-light transition ease-in-out group">
-
New Project
+
New Project