From 4f844f673f874ac37a81b572b3300e57f4632e56 Mon Sep 17 00:00:00 2001 From: karamvir Date: Sun, 6 Aug 2023 01:20:07 -0700 Subject: [PATCH] init alerter config --- frontend/src/resources/alerter/index.tsx | 92 +++++++++++++++++++----- 1 file changed, 74 insertions(+), 18 deletions(-) diff --git a/frontend/src/resources/alerter/index.tsx b/frontend/src/resources/alerter/index.tsx index 4743fb353..c432bb36f 100644 --- a/frontend/src/resources/alerter/index.tsx +++ b/frontend/src/resources/alerter/index.tsx @@ -1,8 +1,13 @@ import { ResourceUpdates } from "@components/updates/resource"; -import { useAddRecentlyViewed, useRead } from "@hooks"; +import { useAddRecentlyViewed, useRead, useWrite } from "@hooks"; import { ResourceCard } from "@layouts/card"; +import { Section } from "@layouts/page"; import { Resource } from "@layouts/resource"; -import { AlarmClock } from "lucide-react"; +import { Types } from "@monitor/client"; +import { Button } from "@ui/button"; +import { History } from "lucide-react"; +import { AlarmClock, Save, Settings } from "lucide-react"; +import { useState } from "react"; import { Link, useParams } from "react-router-dom"; export const AlerterName = ({ id }: { id: string }) => { @@ -19,22 +24,6 @@ const AlerterInfo = ({ id }: { id: string }) => { return <>some description; }; -export const AlerterPage = () => { - const id = useParams().alerterId; - if (!id) return null; - useAddRecentlyViewed("Alerter", id); - - return ( - } - info={} - actions={<>} - > - - - ); -}; - export const AlerterCard = ({ id }: { id: string }) => { const alerters = useRead("ListAlerters", {}).data; const alerter = alerters?.find((a) => a.id === id); @@ -51,3 +40,70 @@ export const AlerterCard = ({ id }: { id: string }) => { ); }; + +export const AlerterConfig = ({ id }: { id: string }) => { + const alerter = useRead("GetAlerter", { id }).data; + const [update, set] = useState>({}); + const { mutate, isLoading } = useWrite("UpdateAlerter"); + + if (!id || !alerter?.config) return null; + return ( +
} + actions={ +
+ + +
+ } + > + {/* */} + {/* + } + loading={isLoading} + update={update} + set={(input) => set((update) => ({ ...update, ...input }))} + layout={{ + general: ["type", "params"], + }} + // overrides={{ + // params: + // }} + /> */} +
+ ); +}; + +export const AlerterPage = () => { + const id = useParams().alerterId; + if (!id) return null; + useAddRecentlyViewed("Alerter", id); + + return ( + } + info={} + actions={<>} + > + + + + ); +};