From e721e2341d0d55b459bd29b9738aeb4bcb66ceb4 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Mon, 19 Dec 2022 16:34:15 +0000 Subject: [PATCH] Added more run states to the Runs page --- .../app/components/WorkflowNodeArrow.tsx | 4 +- apps/webapp/app/components/layout/Panel.tsx | 9 +- .../app/components/primitives/Spinner.tsx | 8 +- .../workflows/$workflowSlug/runs/$runId.tsx | 145 ++++++++++++------ 4 files changed, 105 insertions(+), 61 deletions(-) diff --git a/apps/webapp/app/components/WorkflowNodeArrow.tsx b/apps/webapp/app/components/WorkflowNodeArrow.tsx index ad8f713c9..3704c054f 100644 --- a/apps/webapp/app/components/WorkflowNodeArrow.tsx +++ b/apps/webapp/app/components/WorkflowNodeArrow.tsx @@ -2,8 +2,8 @@ import { ArrowDownIcon } from "@heroicons/react/24/solid"; export function WorkflowNodeArrow() { return ( -
- +
+
); } diff --git a/apps/webapp/app/components/layout/Panel.tsx b/apps/webapp/app/components/layout/Panel.tsx index d06296400..d67501251 100644 --- a/apps/webapp/app/components/layout/Panel.tsx +++ b/apps/webapp/app/components/layout/Panel.tsx @@ -1,5 +1,3 @@ -import classNames from "classnames"; - export type PanelProps = { children: React.ReactNode; className?: string; @@ -14,12 +12,7 @@ export function Panel({ }) { return (
{children}
diff --git a/apps/webapp/app/components/primitives/Spinner.tsx b/apps/webapp/app/components/primitives/Spinner.tsx index bfc074834..2b713269a 100644 --- a/apps/webapp/app/components/primitives/Spinner.tsx +++ b/apps/webapp/app/components/primitives/Spinner.tsx @@ -1,4 +1,4 @@ -export function Spinner() { +export function Spinner({ className }: { className?: string }) { return ( diff --git a/apps/webapp/app/routes/__app/orgs/$organizationSlug/workflows/$workflowSlug/runs/$runId.tsx b/apps/webapp/app/routes/__app/orgs/$organizationSlug/workflows/$workflowSlug/runs/$runId.tsx index f6be8ece5..c10d5573c 100644 --- a/apps/webapp/app/routes/__app/orgs/$organizationSlug/workflows/$workflowSlug/runs/$runId.tsx +++ b/apps/webapp/app/routes/__app/orgs/$organizationSlug/workflows/$workflowSlug/runs/$runId.tsx @@ -1,4 +1,8 @@ -import { ClockIcon, PlayCircleIcon } from "@heroicons/react/24/solid"; +import { + ClockIcon, + PlayCircleIcon, + XCircleIcon, +} from "@heroicons/react/24/solid"; import { ArrowPathRoundedSquareIcon, BeakerIcon, @@ -16,11 +20,12 @@ import { import CodeBlock from "~/components/code/CodeBlock"; import { CheckCircleIcon } from "@heroicons/react/24/solid"; import { WorkflowNodeArrow } from "~/components/WorkflowNodeArrow"; +import type { FC } from "react"; export default function Page() { return ( <> -
+
Run #1
- -
-
    -
  • - - Type: - - Trigger -
  • -
  • - - Step: - -
    - - Complete -
    -
  • -
  • - - Org: - - apihero-run -
  • -
  • - - Repo: - - jsonhero-web -
  • -
- -
- - GitHub new issue (Webhook) - - -
+ + + + + + ); } -const workflowNodeFlexClasses = "flex gap-1 items-baseline"; -const workflowNodeUppercaseClasses = "uppercase text-slate-400"; -const workflowNode1code = `{ +type WorkflowStepProps = { + status: "error" | "inProgress" | "complete" | "notStarted"; +}; + +const WorkflowStep: FC = (props) => { + const workflowNodeFlexClasses = "flex gap-1 items-baseline"; + const workflowNodeUppercaseClasses = "uppercase text-slate-400"; + const workflowNode1code = `{ "assignee": "samejr", "issueId: "uiydfgydfg7yt34" }`; + + let icon; + let statusText; + let borderColor; + + switch (props.status) { + case "error": + icon = ( + + ); + statusText = "Error"; + borderColor = "border-red-700"; + break; + case "inProgress": + icon = ; + statusText = "In progress"; + borderColor = "border-blue-700"; + break; + case "complete": + icon = ( + + ); + statusText = "Complete"; + borderColor = "border-slate-800"; + break; + default: + icon = ( + + ); + statusText = "Not started"; + borderColor = "border-slate-800"; + } + return ( + +
+
    +
  • + + Type: + + Trigger +
  • +
  • + + Step: + +
    + {icon} + {statusText} +
    +
  • +
  • + + Org: + + apihero-run +
  • +
  • + + Repo: + + jsonhero-web +
  • +
+ +
+ + GitHub new issue (Webhook) + + +
+ ); +};