Implement workflows tab, workflow runs view, ability to run workflows from UI (#582)

Co-authored-by: Muhammed Salih Altun <muhammedsalihaltun@gmail.com>
This commit is contained in:
Kerem Yilmaz
2024-07-11 03:08:52 -07:00
committed by GitHub
parent 0c36f75d62
commit 6d97634e1d
19 changed files with 1409 additions and 8 deletions

View File

@@ -0,0 +1,65 @@
import { WorkflowParameterType } from "@/api/types";
import { FileInputValue, FileUpload } from "@/components/FileUpload";
import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
type Props = {
type: WorkflowParameterType;
value: unknown;
onChange: (value: unknown) => void;
};
function WorkflowParameterInput({ type, value, onChange }: Props) {
if (type === "json" || type === "string") {
return (
<Textarea
value={value as string}
onChange={(e) => onChange(e.target.value)}
rows={5}
/>
);
}
if (type === "integer") {
return (
<Input
value={value as number}
onChange={(e) => onChange(parseInt(e.target.value))}
type="number"
/>
);
}
if (type === "float") {
return (
<Input
value={value as number}
onChange={(e) => onChange(parseFloat(e.target.value))}
type="number"
step="any"
/>
);
}
if (type === "boolean") {
return (
<Checkbox
checked={value as boolean}
onCheckedChange={(checked) => onChange(checked)}
className="block"
/>
);
}
if (type === "file_url") {
return (
<FileUpload
value={value as FileInputValue}
onChange={(value) => onChange(value)}
/>
);
}
}
export { WorkflowParameterInput };