diff --git a/frontend/src/components/updates/resource.tsx b/frontend/src/components/updates/resource.tsx index 11f63d356..2aa16ad26 100644 --- a/frontend/src/components/updates/resource.tsx +++ b/frontend/src/components/updates/resource.tsx @@ -31,8 +31,8 @@ const UpdatePlaceHolder = () => ( ); -const UpdateCard = ({ update }: { update: Types.Update }) => ( - +const UpdateCard = ({ update }: { update: Types.UpdateListItem }) => ( + {update.operation} @@ -76,7 +76,7 @@ export const ResourceUpdates = ({ type, id }: ResourceTarget) => {
{isLoading && } {data?.updates.slice(0, 3).map((update) => ( - + ))}
diff --git a/frontend/src/hooks.ts b/frontend/src/hooks.ts index f6b1c9876..6bbc82bd4 100644 --- a/frontend/src/hooks.ts +++ b/frontend/src/hooks.ts @@ -7,8 +7,6 @@ import { UseMutationOptions, useQueryClient, } from "@tanstack/react-query"; -import { useAtomValue, useSetAtom } from "jotai"; -import { atomWithStorage } from "jotai/utils"; import { useNavigate } from "react-router-dom"; import { ExecuteResponses, @@ -16,7 +14,7 @@ import { WriteResponses, } from "@monitor/client/dist/responses"; import { useEffect, useState } from "react"; -import { ReadRequest, ResourceTarget } from "@monitor/client/dist/types"; +import { ReadRequest } from "@monitor/client/dist/types"; export const useRead = < T extends Types.ReadRequest["type"], diff --git a/frontend/src/resources/alerter/index.tsx b/frontend/src/resources/alerter/index.tsx new file mode 100644 index 000000000..c344e58cf --- /dev/null +++ b/frontend/src/resources/alerter/index.tsx @@ -0,0 +1,35 @@ +import { useRead, useWrite } from "@hooks"; +import { Resource } from "@layouts/resource"; +import { useEffect } from "react"; +import { useParams } from "react-router-dom"; + +const AlerterName = ({ id }: { id: string }) => { + const alerters = useRead("ListAlerters", {}).data; + const alerter = alerters?.find((a) => a._id?.$oid === id); + if (!alerter) return null; + return <>{alerter.name}; +}; + +const AlerterInfo = ({ id }: { id: string }) => { + const alerters = useRead("ListAlerters", {}).data; + const alerter = alerters?.find((a) => a._id?.$oid === id); + if (!alerter) return null; + return <>some description; +}; + +export const Alerter = () => { + const id = useParams().alerterId; + const push = useWrite("PushRecentlyViewed").mutate; + + if (!id) return null; + useEffect(() => { + push({ resource: { type: "Deployment", id } }); + }, []); + + return ( + } + info={} + > + ); +};