-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: test run bug and feat: general UI/UX improvements (#2993)
- Loading branch information
Showing
33 changed files
with
563 additions
and
593 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 0 additions & 109 deletions
109
keep-ui/app/(keep)/workflows/[workflow_id]/side-nav-bar.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
keep-ui/app/(keep)/workflows/[workflow_id]/workflow-detail-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
"use client"; | ||
|
||
import { useApi } from "@/shared/lib/hooks/useApi"; | ||
import { Workflow } from "../models"; | ||
|
||
import useSWR from "swr"; | ||
import Skeleton from "react-loading-skeleton"; | ||
import { Button, Text } from "@tremor/react"; | ||
import { useWorkflowRun } from "@/utils/hooks/useWorkflowRun"; | ||
import AlertTriggerModal from "../workflow-run-with-alert-modal"; | ||
|
||
export default function WorkflowDetailHeader({ | ||
workflow_id, | ||
}: { | ||
workflow_id: string; | ||
}) { | ||
const api = useApi(); | ||
const { | ||
data: workflow, | ||
isLoading, | ||
error, | ||
} = useSWR<Partial<Workflow>>( | ||
api.isReady() ? `/workflows/${workflow_id}` : null, | ||
(url: string) => api.get(url) | ||
); | ||
|
||
|
||
const { | ||
isRunning, | ||
handleRunClick, | ||
getTriggerModalProps, | ||
isRunButtonDisabled, | ||
message, | ||
} = useWorkflowRun(workflow as Workflow); | ||
|
||
if (error) { | ||
return <div>Error loading workflow</div>; | ||
} | ||
|
||
if (isLoading || !workflow) { | ||
return ( | ||
<div> | ||
<h1 className="text-2xl line-clamp-2 font-extrabold"> | ||
<Skeleton className="w-1/2 h-4" /> | ||
</h1> | ||
<Skeleton className="w-3/4 h-4" /> | ||
<Skeleton className="w-1/2 h-4" /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div> | ||
<div className="flex justify-between items-end text-sm gap-2"> | ||
<div> | ||
<h1 className="text-2xl line-clamp-2 font-extrabold"> | ||
{workflow.name} | ||
</h1> | ||
{workflow.description && ( | ||
<Text className="line-clamp-5"> | ||
<span>{workflow.description}</span> | ||
</Text> | ||
)} | ||
</div> | ||
{!!workflow && ( | ||
<Button | ||
color="orange" | ||
disabled={isRunning || isRunButtonDisabled} | ||
className="p-2 px-4" | ||
onClick={(e: React.MouseEvent<HTMLButtonElement>) => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
handleRunClick?.(); | ||
}} | ||
tooltip={message} | ||
> | ||
{isRunning ? "Running..." : "Run now"} | ||
</Button> | ||
)} | ||
</div> | ||
|
||
{!!workflow && !!getTriggerModalProps && ( | ||
<AlertTriggerModal {...getTriggerModalProps()} /> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.