diff --git a/package-lock.json b/package-lock.json index 22abb07..1933b13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ "swr": "^2.2.5", "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", + "vaul": "^1.1.1", "zod": "^3.23.8", "zustand": "^5.0.1" }, @@ -6355,6 +6356,19 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "license": "MIT" }, + "node_modules/vaul": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/vaul/-/vaul-1.1.1.tgz", + "integrity": "sha512-+ejzF6ffQKPcfgS7uOrGn017g39F8SO4yLPXbBhpC7a0H+oPqPna8f1BUfXaz8eU4+pxbQcmjxW+jWBSbxjaFg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-dialog": "^1.1.1" + }, + "peerDependencies": { + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0" + } + }, "node_modules/vite": { "version": "5.4.10", "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.10.tgz", diff --git a/package.json b/package.json index 75c422c..41ecd38 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "swr": "^2.2.5", "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", + "vaul": "^1.1.1", "zod": "^3.23.8", "zustand": "^5.0.1" }, diff --git a/src/components/alert-rule.tsx b/src/components/alert-rule.tsx index 7d03812..9330f46 100644 --- a/src/components/alert-rule.tsx +++ b/src/components/alert-rule.tsx @@ -40,6 +40,8 @@ import { asOptionalField } from "@/lib/utils" import { IconButton } from "@/components/xui/icon-button" import { triggerModes } from "@/types" import { Textarea } from "./ui/textarea" +import { useNotification } from "@/hooks/useNotfication" +import { Combobox } from "./ui/combobox" interface AlertRuleCardProps { data?: ModelAlertRule; @@ -108,12 +110,19 @@ export const AlertRuleCard: React.FC = ({ data, mutate }) => const onSubmit = async (values: z.infer) => { values.rules = JSON.parse(values.rules_raw); - data?.id ? await updateAlertRule(data.id, values) : await createAlertRule(values); + const { rules_raw, ...requiredFields } = values; + data?.id ? await updateAlertRule(data.id, requiredFields) : await createAlertRule(requiredFields); setOpen(false); await mutate(); form.reset(); } + const { notifierGroup } = useNotification(); + const ngroupList = notifierGroup?.map(ng => ({ + value: `${ng.group.id}`, + label: ng.group.name, + })) || [{ value: "", label: "" }]; + return ( @@ -169,12 +178,13 @@ export const AlertRuleCard: React.FC = ({ data, mutate }) => name="notification_group_id" render={({ field }) => ( - Notifier Group ID + Notifier Group - diff --git a/src/components/cron.tsx b/src/components/cron.tsx index be4cf57..0fe03d0 100644 --- a/src/components/cron.tsx +++ b/src/components/cron.tsx @@ -37,7 +37,10 @@ import { createCron, updateCron } from "@/api/cron" import { asOptionalField } from "@/lib/utils" import { cronTypes, cronCoverageTypes } from "@/types" import { Textarea } from "./ui/textarea" -import { conv } from "@/lib/utils" +import { useServer } from "@/hooks/useServer" +import { useNotification } from "@/hooks/useNotfication" +import { MultiSelect } from "./xui/multi-select" +import { Combobox } from "./ui/combobox" interface CronCardProps { data?: ModelCron; @@ -82,6 +85,18 @@ export const CronCard: React.FC = ({ data, mutate }) => { form.reset(); } + const { servers } = useServer(); + const serverList = servers?.map(s => ({ + value: `${s.id}`, + label: s.name, + })) || [{ value: "", label: "" }]; + + const { notifierGroup } = useNotification(); + const ngroupList = notifierGroup?.map(ng => ({ + value: `${ng.group.id}`, + label: ng.group.name, + })) || [{ value: "", label: "" }]; + return ( @@ -200,14 +215,10 @@ export const CronCard: React.FC = ({ data, mutate }) => { Specific Servers (Separate with comma) - { - const arr = conv.strToArr(e.target.value); - field.onChange(arr); - }} + @@ -221,10 +232,11 @@ export const CronCard: React.FC = ({ data, mutate }) => { Notifier Group ID - diff --git a/src/components/header.tsx b/src/components/header.tsx index cc5d0f8..4c67e1b 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -14,94 +14,198 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, import { User, LogOut } from "lucide-react"; import { useAuth } from "@/hooks/useAuth"; import { Link, useLocation } from "react-router-dom"; +import { useMediaQuery } from "@/hooks/useMediaQuery"; +import { + Drawer, + DrawerClose, + DrawerContent, + DrawerDescription, + DrawerFooter, + DrawerHeader, + DrawerTitle, + DrawerTrigger, +} from "@/components/ui/drawer" +import { Button } from "./ui/button"; +import { IconButton } from "./xui/icon-button"; +import { useState } from "react"; + +const pages = [ + { href: "/dashboard", label: "Server" }, + { href: "/dashboard/service", label: "Service" }, + { href: "/dashboard/cron", label: "Task" }, + { href: "/dashboard/notification", label: "Notification" }, + { href: "/dashboard/ddns", label: "Dynamic DNS" }, + { href: "/dashboard/nat", label: "NAT Traversal" }, + { href: "/dashboard/server-group", label: "Group" }, +] export default function Header() { const { logout } = useAuth(); const profile = useMainStore(store => store.profile); const location = useLocation(); + const isDesktop = useMediaQuery("(min-width: 890px)") - return
- - - - - 哪吒监控 - - + const [open, setOpen] = useState(false) - { - profile && <> - - - Server - - - - - Service - - - - - Task - - - - - Notification - - - - - Dynamic DNS - - - - - NAT Traversal - - - - - Group - - - - } - -
- - { - profile && <> - - - - - {profile.username} - - - - {profile.username} - - - - - Profile - ⇧⌘P - - - - - - Log out - ⇧⌘Q - - - - - } -
-
-
+ return ( + isDesktop ? ( +
+ + + + + 哪吒监控 + + + + { + profile && ( + <> + + + Server + + + + + Service + + + + + Task + + + + + Notification + + + + + Dynamic DNS + + + + + NAT Traversal + + + + + Group + + + + ) + } + +
+ + { + profile && <> + + + + + {profile.username} + + + + {profile.username} + + + + + Profile + ⇧⌘P + + + + + + Log out + ⇧⌘Q + + + + + } +
+
+
+ ) + : ( +
+
+ {profile && + + + + + + + Navigate to + Select a page to navigate to. + +
+ {pages.slice(0).map((item, index) => ( + { setOpen(false) }} + > + {item.label} + + ))} +
+ + + + + +
+
+ } +
+ + 哪吒监控 + +
+ + { + profile && <> + + + + + {profile.username} + + + + {profile.username} + + + + + Profile + ⇧⌘P + + + + + + Log out + ⇧⌘Q + + + + + } +
+
+ ) + ) } diff --git a/src/components/service.tsx b/src/components/service.tsx index bfbb8d6..5e99d05 100644 --- a/src/components/service.tsx +++ b/src/components/service.tsx @@ -39,6 +39,10 @@ import { KeyedMutator } from "swr" import { asOptionalField } from "@/lib/utils" import { IconButton } from "@/components/xui/icon-button" import { serviceTypes, serviceCoverageTypes } from "@/types" +import { MultiSelect } from "./xui/multi-select" +import { Combobox } from "./ui/combobox" +import { useServer } from "@/hooks/useServer" +import { useNotification } from "@/hooks/useNotfication" interface ServiceCardProps { data?: ModelService; @@ -63,6 +67,7 @@ const serviceFormSchema = z.object({ return v.filter(Boolean).map(Number); })), skip_servers: z.record(z.boolean()), + skip_servers_raw: z.array(z.string()), target: z.string().url(), type: z.coerce.number().int().min(0), }); @@ -70,7 +75,10 @@ const serviceFormSchema = z.object({ export const ServiceCard: React.FC = ({ data, mutate }) => { const form = useForm>({ resolver: zodResolver(serviceFormSchema), - defaultValues: data ? data : { + defaultValues: data ? { + ...data, + skip_servers_raw: conv.recordToStrArr(data.skip_servers), + } : { type: 1, cover: 0, name: "", @@ -82,6 +90,7 @@ export const ServiceCard: React.FC = ({ data, mutate }) => { fail_trigger_tasks: [], recover_trigger_tasks: [], skip_servers: {}, + skip_servers_raw: [], }, resetOptions: { keepDefaultValues: false, @@ -91,12 +100,26 @@ export const ServiceCard: React.FC = ({ data, mutate }) => { const [open, setOpen] = useState(false); const onSubmit = async (values: z.infer) => { - data?.id ? await updateService(data.id, values) : await createService(values); + values.skip_servers = conv.arrToRecord(values.skip_servers_raw); + const { skip_servers_raw, ...requiredFields } = values; + data?.id ? await updateService(data.id, requiredFields) : await createService(requiredFields); setOpen(false); await mutate(); form.reset(); } + const { servers } = useServer(); + const serverList = servers?.map(s => ({ + value: `${s.id}`, + label: s.name, + })) || [{ value: "", label: "" }]; + + const { notifierGroup } = useNotification(); + const ngroupList = notifierGroup?.map(ng => ({ + value: `${ng.group.id}`, + label: ng.group.name, + })) || [{ value: "", label: "" }]; + return ( @@ -229,19 +252,15 @@ export const ServiceCard: React.FC = ({ data, mutate }) => { /> ( - Specific Servers (separate with comma) + Specific Servers - { - const rec = conv.strToRecord(e.target.value); - field.onChange(rec); - }} + @@ -253,12 +272,13 @@ export const ServiceCard: React.FC = ({ data, mutate }) => { name="notification_group_id" render={({ field }) => ( - Notifier Group ID + Notifier Group - diff --git a/src/components/ui/combobox.tsx b/src/components/ui/combobox.tsx new file mode 100644 index 0000000..bef0fb0 --- /dev/null +++ b/src/components/ui/combobox.tsx @@ -0,0 +1,118 @@ +"use client" + +import * as React from "react" +import { Check, ChevronDown } from "lucide-react" + +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "@/components/ui/command" +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover" + +interface ComboboxProps + extends React.ButtonHTMLAttributes { + options: { + label: string, + value: string, + }[]; + + placeholder?: string; + defaultValue?: string; + className?: string; + onValueChange: (value: string) => void; +} + +export const Combobox = React.forwardRef< + HTMLButtonElement, + ComboboxProps +>(({ + options, + placeholder, + defaultValue, + className, + onValueChange, + ...props +}, ref) => { + const [open, setOpen] = React.useState(false) + const [value, setValue] = React.useState(defaultValue) + + return ( + + + + + + { + const extendValue = value + " " + keywords.join(" "); + if (extendValue.toLowerCase().includes(search.toLowerCase())) { + return 1; + } + return 0; + }} + > + + + No result found. + + {options.map((option) => ( + { + setValue(currentValue === value ? "" : currentValue) + onValueChange(currentValue === value ? "" : currentValue) + setOpen(false) + }} + > + + {option.label} + + ))} + + + + + + ) +}); diff --git a/src/components/ui/drawer.tsx b/src/components/ui/drawer.tsx new file mode 100644 index 0000000..c17b0cc --- /dev/null +++ b/src/components/ui/drawer.tsx @@ -0,0 +1,116 @@ +import * as React from "react" +import { Drawer as DrawerPrimitive } from "vaul" + +import { cn } from "@/lib/utils" + +const Drawer = ({ + shouldScaleBackground = true, + ...props +}: React.ComponentProps) => ( + +) +Drawer.displayName = "Drawer" + +const DrawerTrigger = DrawerPrimitive.Trigger + +const DrawerPortal = DrawerPrimitive.Portal + +const DrawerClose = DrawerPrimitive.Close + +const DrawerOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName + +const DrawerContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + +
+ {children} + + +)) +DrawerContent.displayName = "DrawerContent" + +const DrawerHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DrawerHeader.displayName = "DrawerHeader" + +const DrawerFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DrawerFooter.displayName = "DrawerFooter" + +const DrawerTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DrawerTitle.displayName = DrawerPrimitive.Title.displayName + +const DrawerDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DrawerDescription.displayName = DrawerPrimitive.Description.displayName + +export { + Drawer, + DrawerPortal, + DrawerOverlay, + DrawerTrigger, + DrawerClose, + DrawerContent, + DrawerHeader, + DrawerFooter, + DrawerTitle, + DrawerDescription, +} diff --git a/src/hooks/useMediaQuery.tsx b/src/hooks/useMediaQuery.tsx new file mode 100644 index 0000000..95e552c --- /dev/null +++ b/src/hooks/useMediaQuery.tsx @@ -0,0 +1,19 @@ +import * as React from "react" + +export function useMediaQuery(query: string) { + const [value, setValue] = React.useState(false) + + React.useEffect(() => { + function onChange(event: MediaQueryListEvent) { + setValue(event.matches) + } + + const result = matchMedia(query) + result.addEventListener("change", onChange) + setValue(result.matches) + + return () => result.removeEventListener("change", onChange) + }, [query]) + + return value +} diff --git a/src/hooks/useNotfication.tsx b/src/hooks/useNotfication.tsx index ea9c0bf..3bfd914 100644 --- a/src/hooks/useNotfication.tsx +++ b/src/hooks/useNotfication.tsx @@ -33,7 +33,8 @@ export const NotificationProvider: React.FC = ({ chil (async () => { try { const n = await getNotification(); - setNotifier(n); + const nData = n.map(({ id, name }) => ({ id, name })); + setNotifier(nData); } catch (error) { setNotifier(undefined); } diff --git a/src/hooks/useServer.tsx b/src/hooks/useServer.tsx index 731afca..84fff9d 100644 --- a/src/hooks/useServer.tsx +++ b/src/hooks/useServer.tsx @@ -33,7 +33,8 @@ export const ServerProvider: React.FC = ({ children, withSe (async () => { try { const s = await getServers(); - setServer(s); + const serverData = s.map(({ id, name }) => ({ id, name })); + setServer(serverData); } catch (error) { setServer(undefined); } diff --git a/src/index.css b/src/index.css index fa233fe..4b135d5 100644 --- a/src/index.css +++ b/src/index.css @@ -73,4 +73,17 @@ html, body, #root { height: 100%; -} \ No newline at end of file +} + +::-webkit-scrollbar { + @apply w-2.5 h-2.5; + +} + +::-webkit-scrollbar-track { + @apply bg-transparent +} + +::-webkit-scrollbar-thumb { + @apply rounded-full bg-border border-[1px] border-transparent border-solid bg-clip-padding; +} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 0519c7e..ecfb83d 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -43,6 +43,20 @@ export const conv = { } return arr; }, + recordToStrArr: (rec: Record) => { + const arr: string[] = []; + for (const val of Object.keys(rec)) { + arr.push(val); + } + return arr; + }, + arrToRecord: (arr: string[]) => { + const rec: Record = {}; + for (const val of arr) { + rec[val] = true; + } + return rec; + } } export const sleep = (ms: number) => { diff --git a/src/main.tsx b/src/main.tsx index e49b2bd..b404b29 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -41,11 +41,23 @@ const router = createBrowserRouter([ }, { path: "/dashboard/service", - element: , + element: ( + + + + + + ), }, { path: "/dashboard/cron", - element: , + element: ( + + + + + + ), }, { path: "/dashboard/notification", @@ -53,7 +65,7 @@ const router = createBrowserRouter([ }, { path: "/dashboard/alert-rule", - element: , + element: , }, { path: "/dashboard/ddns", diff --git a/src/routes/alert-rule.tsx b/src/routes/alert-rule.tsx index 17d55a8..d82f252 100644 --- a/src/routes/alert-rule.tsx +++ b/src/routes/alert-rule.tsx @@ -54,6 +54,7 @@ export default function AlertRulePage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.name, cell: ({ row }) => { const s = row.original; return ( @@ -121,8 +122,8 @@ export default function AlertRulePage() { return (
-
- +
+ r.original.id), diff --git a/src/routes/cron.tsx b/src/routes/cron.tsx index 4c8b8c9..8b07ddd 100644 --- a/src/routes/cron.tsx +++ b/src/routes/cron.tsx @@ -99,19 +99,27 @@ export default function CronPage() { { header: "Coverage", accessorKey: "cover", - accessorFn: row => { - switch (row.cover) { - case 0: { - return "Ignore All" - } - case 1: { - return "Cover All" - } - case 2: { - return "On alert" - } - } - }, + accessorFn: row => row.cover, + cell: ({ row }) => { + const s = row.original; + return ( +
+ {(() => { + switch (s.cover) { + case 0: { + return Ignore All + } + case 1: { + return Cover All + } + case 2: { + return On alert + } + } + })()} +
+ ) + } }, { header: "Specific Servers", @@ -121,7 +129,15 @@ export default function CronPage() { { header: "Last Execution", accessorKey: "lastExecution", - accessorFn: row => row.last_executed_at + accessorFn: row => row.last_executed_at, + cell: ({ row }) => { + const s = row.original; + return ( +
+ {s.last_executed_at} +
+ ) + } }, { header: "Last Result", diff --git a/src/routes/ddns.tsx b/src/routes/ddns.tsx index ac1edd4..6a6603f 100644 --- a/src/routes/ddns.tsx +++ b/src/routes/ddns.tsx @@ -62,6 +62,7 @@ export default function DDNSPage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.name, cell: ({ row }) => { const s = row.original; return ( @@ -89,6 +90,7 @@ export default function DDNSPage() { { header: "Domains", accessorKey: "domains", + accessorFn: row => row.domains, cell: ({ row }) => { const s = row.original; return ( diff --git a/src/routes/login.tsx b/src/routes/login.tsx index 2573b2a..0f5c2fb 100644 --- a/src/routes/login.tsx +++ b/src/routes/login.tsx @@ -50,7 +50,7 @@ export default () => { Username - + This is your public display name. @@ -66,7 +66,7 @@ export default () => { Password - + This is your public display name. diff --git a/src/routes/nat.tsx b/src/routes/nat.tsx index 239431c..4fdb378 100644 --- a/src/routes/nat.tsx +++ b/src/routes/nat.tsx @@ -53,6 +53,7 @@ export default function NATPage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.name, cell: ({ row }) => { const s = row.original; return ( @@ -70,6 +71,7 @@ export default function NATPage() { { header: "Local service", accessorKey: "host", + accessorFn: row => row.host, cell: ({ row }) => { const s = row.original; return ( @@ -82,6 +84,7 @@ export default function NATPage() { { header: "Bind hostname", accessorKey: "domain", + accessorFn: row => row.domain, cell: ({ row }) => { const s = row.original; return ( diff --git a/src/routes/notification-group.tsx b/src/routes/notification-group.tsx index 3008b43..a3faf38 100644 --- a/src/routes/notification-group.tsx +++ b/src/routes/notification-group.tsx @@ -54,6 +54,7 @@ export default function NotificationGroupPage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.group.name, cell: ({ row }) => { const s = row.original; return ( @@ -96,8 +97,8 @@ export default function NotificationGroupPage() { return (
-
- +
+ r.original.group.id), diff --git a/src/routes/notification.tsx b/src/routes/notification.tsx index ed6d58a..d431eff 100644 --- a/src/routes/notification.tsx +++ b/src/routes/notification.tsx @@ -56,6 +56,7 @@ export default function NotificationPage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.name, cell: ({ row }) => { const s = row.original; return ( @@ -77,6 +78,7 @@ export default function NotificationPage() { { header: "URL", accessorKey: "url", + accessorFn: row => row.url, cell: ({ row }) => { const s = row.original; return ( @@ -119,8 +121,8 @@ export default function NotificationPage() { return (
-
- +
+ r.original.id), diff --git a/src/routes/server-group.tsx b/src/routes/server-group.tsx index a5e1f62..8ac8ed0 100644 --- a/src/routes/server-group.tsx +++ b/src/routes/server-group.tsx @@ -54,6 +54,7 @@ export default function ServerGroupPage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.group.name, cell: ({ row }) => { const s = row.original; return ( @@ -96,8 +97,8 @@ export default function ServerGroupPage() { return (
-
- +
+ r.original.group.id), diff --git a/src/routes/server.tsx b/src/routes/server.tsx index 7064f7c..615f9af 100644 --- a/src/routes/server.tsx +++ b/src/routes/server.tsx @@ -59,6 +59,7 @@ export default function ServerPage() { { header: "Name", accessorKey: "name", + accessorFn: row => row.name, cell: ({ row }) => { const s = row.original; return ( @@ -81,6 +82,7 @@ export default function ServerPage() { id: "ip", header: "IP", accessorKey: "host.ip", + accessorFn: row => row.host?.ip, cell: ({ row }) => { const s = row.original; return ( diff --git a/src/routes/service.tsx b/src/routes/service.tsx index 7fb129e..59f4674 100644 --- a/src/routes/service.tsx +++ b/src/routes/service.tsx @@ -54,6 +54,7 @@ export default function ServicePage() { }, { header: "Name", + accessorFn: row => row.service.name, accessorKey: "service.name", cell: ({ row }) => { const s = row.original; @@ -66,6 +67,7 @@ export default function ServicePage() { }, { header: "Target", + accessorFn: row => row.service.target, accessorKey: "service.target", cell: ({ row }) => { const s = row.original; @@ -79,15 +81,23 @@ export default function ServicePage() { { header: "Coverage", accessorKey: "service.cover", - accessorFn: row => { - switch (row.service.cover) { - case 0: { - return "Cover All" - } - case 1: { - return "Ignore All" - } - } + accessorFn: row => row.service.cover, + cell: ({ row }) => { + const s = row.original.service; + return ( +
+ {(() => { + switch (s.cover) { + case 0: { + return Cover All + } + case 1: { + return Ignore All + } + } + })()} +
+ ) } }, { @@ -98,7 +108,8 @@ export default function ServicePage() { { header: "Type", accessorKey: "service.type", - accessorFn: row => serviceTypes[row.service.type] || '', + accessorFn: row => row.service.type, + cell: ({ row }) => serviceTypes[row.original.service.type] || '', }, { header: "Interval", diff --git a/src/types/notificationContext.ts b/src/types/notificationContext.ts index 73e3da0..9165472 100644 --- a/src/types/notificationContext.ts +++ b/src/types/notificationContext.ts @@ -1,6 +1,6 @@ -import { ModelNotification, ModelNotificationGroupResponseItem } from "@/types"; +import { NotificationIdentifierType, ModelNotificationGroupResponseItem } from "@/types"; export interface NotificationContextProps { - notifiers?: ModelNotification[]; + notifiers?: NotificationIdentifierType[]; notifierGroup?: ModelNotificationGroupResponseItem[]; } diff --git a/src/types/notificationStore.ts b/src/types/notificationStore.ts index d3b2b28..71c7457 100644 --- a/src/types/notificationStore.ts +++ b/src/types/notificationStore.ts @@ -1,8 +1,13 @@ -import { ModelNotification, ModelNotificationGroupResponseItem } from "@/types"; +import { ModelNotificationGroupResponseItem } from "@/types"; + +export interface NotificationIdentifierType { + id: number; + name: string; +} export interface NotificationStore { - notifiers?: ModelNotification[]; + notifiers?: NotificationIdentifierType[]; notifierGroup?: ModelNotificationGroupResponseItem[]; - setNotifier: (notifiers?: ModelNotification[]) => void; + setNotifier: (notifiers?: NotificationIdentifierType[]) => void; setNotifierGroup: (notifierGroup?: ModelNotificationGroupResponseItem[]) => void; } diff --git a/src/types/serverContext.ts b/src/types/serverContext.ts index a619893..520c0d2 100644 --- a/src/types/serverContext.ts +++ b/src/types/serverContext.ts @@ -1,6 +1,6 @@ -import { ModelServerGroupResponseItem, ModelServer } from "@/types"; +import { ModelServerGroupResponseItem, ServerIdentifierType } from "@/types"; export interface ServerContextProps { - servers?: ModelServer[]; + servers?: ServerIdentifierType[]; serverGroups?: ModelServerGroupResponseItem[]; } diff --git a/src/types/serverStore.ts b/src/types/serverStore.ts index 9df3b40..5054c32 100644 --- a/src/types/serverStore.ts +++ b/src/types/serverStore.ts @@ -1,8 +1,13 @@ -import { ModelServer, ModelServerGroupResponseItem } from "@/types"; +import { ModelServerGroupResponseItem } from "@/types"; + +export interface ServerIdentifierType { + id: number; + name: string; +} export interface ServerStore { - server?: ModelServer[]; + server?: ServerIdentifierType[]; serverGroup?: ModelServerGroupResponseItem[]; - setServer: (server?: ModelServer[]) => void; + setServer: (server?: ServerIdentifierType[]) => void; setServerGroup: (serverGroup?: ModelServerGroupResponseItem[]) => void; }