feat: add gpu options

This commit is contained in:
BennyKok
2024-01-11 21:57:30 +08:00
parent 6e3b7f0435
commit 29bf7636b1
10 changed files with 792 additions and 5 deletions
+20 -1
View File
@@ -23,6 +23,7 @@ import {
TableRow,
} from "@/components/ui/table";
import { type MachineType } from "@/db/schema";
import type { AccessType } from "@/lib/AccessType";
import {
addCustomMachineSchema,
addMachineSchema,
@@ -53,6 +54,7 @@ import {
import { ArrowUpDown, MoreHorizontal } from "lucide-react";
import * as React from "react";
import { useState } from "react";
import type { z } from "zod";
export type Machine = MachineType;
@@ -237,6 +239,9 @@ export const columns: ColumnDef<Machine>[] = [
models: {
fieldType: "models",
},
gpu: {
inputProps: {},
},
}}
/>
) : (
@@ -263,7 +268,13 @@ export const columns: ColumnDef<Machine>[] = [
},
];
export function MachineList({ data }: { data: Machine[] }) {
export function MachineList({
data,
userMetadata,
}: {
data: Machine[];
userMetadata: z.infer<typeof AccessType>;
}) {
const [sorting, setSorting] = React.useState<SortingState>([]);
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
[]
@@ -332,6 +343,14 @@ export function MachineList({ data }: { data: Machine[] }) {
models: {
fieldType: "models",
},
gpu: {
fieldType: !userMetadata.betaFeaturesAccess
? "fallback"
: "select",
inputProps: {
disabled: !userMetadata.betaFeaturesAccess,
},
},
}}
/>
<InsertModal