feat: add s3 localstack, upload api

This commit is contained in:
BennyKok
2023-12-13 17:14:55 +08:00
parent f9ed8145d2
commit 0835d966f1
34 changed files with 1112 additions and 227 deletions
+16 -5
View File
@@ -56,6 +56,7 @@ import {
import { ArrowUpDown, MoreHorizontal } from "lucide-react";
import * as React from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";
export type Machine = {
@@ -159,9 +160,8 @@ export const columns: ColumnDef<Machine>[] = [
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="text-destructive"
onClick={() => {
deleteMachine(workflow.id);
// navigator.clipboard.writeText(payment.id)
onClick={async () => {
callServerWithToast(await deleteMachine(workflow.id));
}}
>
Delete Machine
@@ -176,6 +176,17 @@ export const columns: ColumnDef<Machine>[] = [
},
];
async function callServerWithToast(result: {
message: string;
error?: boolean;
}) {
if (result.error) {
toast.error(result.message);
} else {
toast.success(result.message);
}
}
export function MachineList({ data }: { data: Machine[] }) {
const [sorting, setSorting] = React.useState<SortingState>([]);
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
@@ -333,8 +344,8 @@ function AddMachinesDialog() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
name: "",
endpoint: "",
name: "My Local Machine",
endpoint: "http://127.0.0.1:8188",
},
});