Remove old workflow types (#1227)
This commit is contained in:
@@ -130,78 +130,6 @@ export type ApiKeyApiResponse = {
|
|||||||
valid: boolean;
|
valid: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WorkflowParameterValueType = {
|
|
||||||
String: "string",
|
|
||||||
Integer: "integer",
|
|
||||||
Float: "float",
|
|
||||||
Boolean: "boolean",
|
|
||||||
JSON: "json",
|
|
||||||
FileURL: "file_url",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type WorkflowParameterValueType =
|
|
||||||
(typeof WorkflowParameterValueType)[keyof typeof WorkflowParameterValueType];
|
|
||||||
|
|
||||||
export const WorkflowParameterType = {
|
|
||||||
Workflow: "workflow",
|
|
||||||
Context: "context",
|
|
||||||
Output: "output",
|
|
||||||
AWS_Secret: "aws_secret",
|
|
||||||
Bitwarden_Login_Credential: "bitwarden_login_credential",
|
|
||||||
Bitwarden_Sensitive_Information: "bitwarden_sensitive_information",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type WorkflowParameterType =
|
|
||||||
(typeof WorkflowParameterType)[keyof typeof WorkflowParameterType];
|
|
||||||
|
|
||||||
export type WorkflowParameter = {
|
|
||||||
key: string;
|
|
||||||
description: string | null;
|
|
||||||
workflow_parameter_id: string;
|
|
||||||
parameter_type: WorkflowParameterType;
|
|
||||||
workflow_parameter_type: WorkflowParameterValueType;
|
|
||||||
workflow_id: string;
|
|
||||||
default_value?: string;
|
|
||||||
created_at: string | null;
|
|
||||||
modified_at: string | null;
|
|
||||||
deleted_at: string | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkflowBlock = {
|
|
||||||
label: string;
|
|
||||||
block_type: string;
|
|
||||||
output_parameter?: null;
|
|
||||||
continue_on_failure: boolean;
|
|
||||||
url: string;
|
|
||||||
title: string;
|
|
||||||
navigation_goal: string;
|
|
||||||
data_extraction_goal: string;
|
|
||||||
data_schema: object | null;
|
|
||||||
error_code_mapping: null; // ?
|
|
||||||
max_retries: number | null;
|
|
||||||
max_steps_per_run: number | null;
|
|
||||||
parameters: []; // ?
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkflowApiResponse = {
|
|
||||||
workflow_id: string;
|
|
||||||
organization_id: string;
|
|
||||||
is_saved_task: boolean;
|
|
||||||
title: string;
|
|
||||||
workflow_permanent_id: string;
|
|
||||||
version: number;
|
|
||||||
description: string;
|
|
||||||
workflow_definition: {
|
|
||||||
parameters: Array<WorkflowParameter>;
|
|
||||||
blocks: Array<WorkflowBlock>;
|
|
||||||
};
|
|
||||||
proxy_location: ProxyLocation | null;
|
|
||||||
webhook_callback_url: string;
|
|
||||||
created_at: string;
|
|
||||||
modified_at: string;
|
|
||||||
deleted_at: string | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO complete this
|
// TODO complete this
|
||||||
export const ActionTypes = {
|
export const ActionTypes = {
|
||||||
InputText: "input_text",
|
InputText: "input_text",
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import { getSampleForInitialFormValues } from "../data/sampleTaskData";
|
|||||||
import { SampleCase, sampleCases } from "../types";
|
import { SampleCase, sampleCases } from "../types";
|
||||||
import { CreateNewTaskForm } from "./CreateNewTaskForm";
|
import { CreateNewTaskForm } from "./CreateNewTaskForm";
|
||||||
import { SavedTaskForm } from "./SavedTaskForm";
|
import { SavedTaskForm } from "./SavedTaskForm";
|
||||||
import { TaskGenerationApiResponse, WorkflowParameter } from "@/api/types";
|
import { TaskGenerationApiResponse } from "@/api/types";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
|
import { WorkflowParameter } from "@/routes/workflows/types/workflowTypes";
|
||||||
|
|
||||||
function CreateNewTaskFormPage() {
|
function CreateNewTaskFormPage() {
|
||||||
const { template } = useParams();
|
const { template } = useParams();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { queryClient } from "@/api/QueryClient";
|
import { queryClient } from "@/api/QueryClient";
|
||||||
import { WorkflowApiResponse } from "@/api/types";
|
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@@ -18,6 +17,10 @@ import { SavedTaskCard } from "./SavedTaskCard";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { cn } from "@/util/utils";
|
import { cn } from "@/util/utils";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
|
import {
|
||||||
|
TaskBlock,
|
||||||
|
WorkflowApiResponse,
|
||||||
|
} from "@/routes/workflows/types/workflowTypes";
|
||||||
|
|
||||||
function createEmptyTaskTemplate() {
|
function createEmptyTaskTemplate() {
|
||||||
return {
|
return {
|
||||||
@@ -148,13 +151,18 @@ function SavedTasks() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{data?.map((workflow) => {
|
{data?.map((workflow) => {
|
||||||
|
const firstBlock = workflow.workflow_definition.blocks[0];
|
||||||
|
if (!firstBlock || firstBlock.block_type !== "task") {
|
||||||
|
return null; // saved tasks have only one block and it's a task
|
||||||
|
}
|
||||||
|
const task = firstBlock as TaskBlock;
|
||||||
return (
|
return (
|
||||||
<SavedTaskCard
|
<SavedTaskCard
|
||||||
key={workflow.workflow_permanent_id}
|
key={workflow.workflow_permanent_id}
|
||||||
workflowId={workflow.workflow_permanent_id}
|
workflowId={workflow.workflow_permanent_id}
|
||||||
title={workflow.title}
|
title={workflow.title}
|
||||||
description={workflow.description}
|
description={workflow.description}
|
||||||
url={workflow.workflow_definition.blocks[0]?.url ?? ""}
|
url={task.url ?? ""}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { WorkflowApiResponse, WorkflowRunApiResponse } from "@/api/types";
|
import { WorkflowRunApiResponse } from "@/api/types";
|
||||||
import { StatusBadge } from "@/components/StatusBadge";
|
import { StatusBadge } from "@/components/StatusBadge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
useParams,
|
useParams,
|
||||||
useSearchParams,
|
useSearchParams,
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
|
import { WorkflowApiResponse } from "./types/workflowTypes";
|
||||||
|
|
||||||
function WorkflowPage() {
|
function WorkflowPage() {
|
||||||
const credentialGetter = useCredentialGetter();
|
const credentialGetter = useCredentialGetter();
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { WorkflowParameterValueType } from "@/api/types";
|
|
||||||
import { FileInputValue, FileUpload } from "@/components/FileUpload";
|
import { FileInputValue, FileUpload } from "@/components/FileUpload";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { CodeEditor } from "./components/CodeEditor";
|
import { CodeEditor } from "./components/CodeEditor";
|
||||||
import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";
|
import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
|
import { WorkflowParameterValueType } from "./types/workflowTypes";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
type: WorkflowParameterValueType;
|
type: WorkflowParameterValueType;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { WorkflowApiResponse } from "@/api/types";
|
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { WorkflowApiResponse } from "./types/workflowTypes";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
workflowPermanentId: string;
|
workflowPermanentId: string;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { getClient } from "@/api/AxiosClient";
|
import { getClient } from "@/api/AxiosClient";
|
||||||
import { WorkflowApiResponse } from "@/api/types";
|
|
||||||
import {
|
import {
|
||||||
Table,
|
Table,
|
||||||
TableBody,
|
TableBody,
|
||||||
@@ -24,6 +23,7 @@ import {
|
|||||||
import { cn } from "@/util/utils";
|
import { cn } from "@/util/utils";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { WorkflowApiResponse } from "../types/workflowTypes";
|
||||||
|
|
||||||
function WorkflowsTable() {
|
function WorkflowsTable() {
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user