fix: machine list

This commit is contained in:
bennykok 2024-01-27 11:44:56 +08:00
parent 6aa9a44f4b
commit 18c410ba4e

View File

@ -219,23 +219,19 @@ export const columns: ColumnDef<Machine>[] = [
)} )}
{machine.type === "comfy-deploy-serverless" && ( {machine.type === "comfy-deploy-serverless" && (
<> <>
<DropdownMenuItem asChild> <DropdownMenuItem onClick={async () => {
<button const id = toast.loading("Getting machine url...")
onClick={async () => { const url = await callServerPromise(
const id = toast.loading("Getting machine url...") editWorkflowOnMachine(machine.id),
const url = await callServerPromise( );
editWorkflowOnMachine(machine.id), if (url && typeof url !== "object") {
); window.open(url, "_blank");
if (url && typeof url !== "object") { } else if (url && typeof url === "object" && url.error) {
window.open(url, "_blank"); console.error(url.error);
} else if (url && typeof url === "object" && url.error) { }
console.error(url.error); toast.dismiss(id)
} }}>
toast.dismiss(id) Open ComfyUI
}}
>
Open ComfyUI
</button>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem
onClick={() => { onClick={() => {
@ -252,55 +248,57 @@ export const columns: ColumnDef<Machine>[] = [
Edit Edit
</DropdownMenuItem> </DropdownMenuItem>
</DropdownMenuContent> </DropdownMenuContent>
{machine.type === "comfy-deploy-serverless" ? ( {
<UpdateModal machine.type === "comfy-deploy-serverless" ? (
dialogClassName="sm:max-w-[600px]" <UpdateModal
data={machine} dialogClassName="sm:max-w-[600px]"
open={open} data={machine}
setOpen={setOpen} open={open}
title="Edit" setOpen={setOpen}
description="Edit machines" title="Edit"
serverAction={updateCustomMachine} description="Edit machines"
formSchema={addCustomMachineSchema} serverAction={updateCustomMachine}
fieldConfig={{ formSchema={addCustomMachineSchema}
type: { fieldConfig={{
fieldType: "fallback", type: {
inputProps: { fieldType: "fallback",
disabled: true, inputProps: {
showLabel: false, disabled: true,
type: "hidden", showLabel: false,
type: "hidden",
},
}, },
}, snapshot: {
snapshot: { fieldType: "snapshot",
fieldType: "snapshot",
},
models: {
fieldType: "models",
},
gpu: {
inputProps: {},
},
}}
/>
) : (
<UpdateModal
data={machine}
open={open}
setOpen={setOpen}
title="Edit"
description="Edit machines"
serverAction={updateMachine}
formSchema={addMachineSchema}
fieldConfig={{
auth_token: {
inputProps: {
type: "password",
}, },
}, models: {
}} fieldType: "models",
/> },
)} gpu: {
</DropdownMenu> inputProps: {},
},
}}
/>
) : (
<UpdateModal
data={machine}
open={open}
setOpen={setOpen}
title="Edit"
description="Edit machines"
serverAction={updateMachine}
formSchema={addMachineSchema}
fieldConfig={{
auth_token: {
inputProps: {
type: "password",
},
},
}}
/>
)
}
</DropdownMenu >
); );
}, },
}, },