Fetch less in workflows page (#1226)
This commit is contained in:
@@ -34,12 +34,11 @@ import { AxiosError } from "axios";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { stringify as convertToYAML } from "yaml";
|
import { stringify as convertToYAML } from "yaml";
|
||||||
import { convert } from "./editor/workflowEditorUtils";
|
import { convert } from "./editor/workflowEditorUtils";
|
||||||
import { useWorkflowQuery } from "./hooks/useWorkflowQuery";
|
|
||||||
import { WorkflowApiResponse } from "./types/workflowTypes";
|
import { WorkflowApiResponse } from "./types/workflowTypes";
|
||||||
import { WorkflowCreateYAMLRequest } from "./types/workflowYamlTypes";
|
import { WorkflowCreateYAMLRequest } from "./types/workflowYamlTypes";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: string;
|
workflow: WorkflowApiResponse;
|
||||||
};
|
};
|
||||||
|
|
||||||
function downloadFile(fileName: string, contents: string) {
|
function downloadFile(fileName: string, contents: string) {
|
||||||
@@ -58,10 +57,9 @@ function downloadFile(fileName: string, contents: string) {
|
|||||||
document.body.removeChild(element);
|
document.body.removeChild(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
function WorkflowActions({ id }: Props) {
|
function WorkflowActions({ workflow }: Props) {
|
||||||
const credentialGetter = useCredentialGetter();
|
const credentialGetter = useCredentialGetter();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { data: workflow } = useWorkflowQuery({ workflowPermanentId: id });
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
function handleExport(type: "json" | "yaml") {
|
function handleExport(type: "json" | "yaml") {
|
||||||
@@ -187,7 +185,7 @@ function WorkflowActions({ id }: Props) {
|
|||||||
<Button
|
<Button
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteWorkflowMutation.mutate(id);
|
deleteWorkflowMutation.mutate(workflow.workflow_permanent_id);
|
||||||
}}
|
}}
|
||||||
disabled={deleteWorkflowMutation.isPending}
|
disabled={deleteWorkflowMutation.isPending}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { WorkflowApiResponse, WorkflowRunApiResponse } from "@/api/types";
|
|
||||||
import { StatusBadge } from "@/components/StatusBadge";
|
import { StatusBadge } from "@/components/StatusBadge";
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
@@ -42,6 +41,8 @@ import { ImportWorkflowButton } from "./ImportWorkflowButton";
|
|||||||
import { WorkflowCreateYAMLRequest } from "./types/workflowYamlTypes";
|
import { WorkflowCreateYAMLRequest } from "./types/workflowYamlTypes";
|
||||||
import { WorkflowActions } from "./WorkflowActions";
|
import { WorkflowActions } from "./WorkflowActions";
|
||||||
import { WorkflowTitle } from "./WorkflowTitle";
|
import { WorkflowTitle } from "./WorkflowTitle";
|
||||||
|
import { WorkflowApiResponse } from "./types/workflowTypes";
|
||||||
|
import { WorkflowRunApiResponse } from "@/api/types";
|
||||||
|
|
||||||
const emptyWorkflowRequest: WorkflowCreateYAMLRequest = {
|
const emptyWorkflowRequest: WorkflowCreateYAMLRequest = {
|
||||||
title: "New Workflow",
|
title: "New Workflow",
|
||||||
@@ -285,7 +286,7 @@ function Workflows() {
|
|||||||
<TooltipContent>Create New Run</TooltipContent>
|
<TooltipContent>Create New Run</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
<WorkflowActions id={workflow.workflow_permanent_id} />
|
<WorkflowActions workflow={workflow} />
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user