Change routing rules in workflow pages (#882)

This commit is contained in:
Kerem Yilmaz
2024-09-25 07:15:02 -07:00
committed by GitHub
parent 8a93c08d67
commit dfc769f807
5 changed files with 22 additions and 9 deletions

View File

@@ -102,6 +102,10 @@ const router = createBrowserRouter([
children: [
{
index: true,
element: <Navigate to="runs" />,
},
{
path: "edit",
element: <WorkflowEditor />,
},
{

View File

@@ -3,7 +3,7 @@ import GitHubButton from "react-github-btn";
import { Link, useMatch } from "react-router-dom";
function Header() {
const match = useMatch("/workflows/:workflowPermanentId");
const match = useMatch("/workflows/:workflowPermanentId/edit");
if (match) {
return null;

View File

@@ -22,6 +22,7 @@ import {
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { basicTimeFormat } from "@/util/timeFormat";
import { cn } from "@/util/utils";
import { Pencil2Icon } from "@radix-ui/react-icons";
import { useQuery } from "@tanstack/react-query";
import {
Link,
@@ -84,11 +85,19 @@ function WorkflowPage() {
</>
)}
</div>
<Button asChild>
<Link to={`/workflows/${workflowPermanentId}/run`}>
Create New Run
</Link>
</Button>
<div className="flex gap-2">
<Button asChild variant="secondary">
<Link to={`/workflows/${workflowPermanentId}/edit`}>
<Pencil2Icon className="mr-2 h-4 w-4" />
Edit Workflow
</Link>
</Button>
<Button asChild>
<Link to={`/workflows/${workflowPermanentId}/run`}>
Create New Run
</Link>
</Button>
</div>
</header>
<div className="space-y-4">
<header>

View File

@@ -111,7 +111,7 @@ function Workflows() {
queryClient.invalidateQueries({
queryKey: ["workflows"],
});
navigate(`/workflows/${response.data.workflow_permanent_id}`);
navigate(`/workflows/${response.data.workflow_permanent_id}/edit`);
},
});
@@ -250,7 +250,7 @@ function Workflows() {
onClick={(event) => {
handleIconClick(
event,
`/workflows/${workflow.workflow_permanent_id}`,
`/workflows/${workflow.workflow_permanent_id}/edit`,
);
}}
>

View File

@@ -2,7 +2,7 @@ import { cn } from "@/util/utils";
import { Outlet, useMatch } from "react-router-dom";
function WorkflowsPageLayout() {
const match = useMatch("/workflows/:workflowPermanentId");
const match = useMatch("/workflows/:workflowPermanentId/edit");
return (
<main