From c511ae09a15dcd41b1d5388ae8e2cc3125edce3b Mon Sep 17 00:00:00 2001 From: kv Date: Sun, 7 Jan 2024 13:50:05 -0800 Subject: [PATCH] add stashed frontend updates --- frontend/src/components/updates/header.tsx | 25 +++++---- frontend/src/components/updates/resource.tsx | 53 +++++++++++--------- frontend/src/components/util.tsx | 17 ++++--- 3 files changed, 53 insertions(+), 42 deletions(-) diff --git a/frontend/src/components/updates/header.tsx b/frontend/src/components/updates/header.tsx index 7c28c3f03..6f2672de9 100644 --- a/frontend/src/components/updates/header.tsx +++ b/frontend/src/components/updates/header.tsx @@ -10,7 +10,7 @@ import { Button } from "@ui/button"; import { Calendar, User } from "lucide-react"; import { UpdateDetails, UpdateUser } from "./details"; import { ResourceComponents } from "@components/resources"; -import { cn } from "@lib/utils"; +import { cn, fmt_verison } from "@lib/utils"; import { Types } from "@monitor/client"; const fmt_date = (d: Date) => @@ -33,18 +33,21 @@ export const SingleUpdate = ({ update }: { update: Types.UpdateListItem }) => {
-
- -
- {update.operation.match(/[A-Z][a-z]+|[0-9]+/g)?.join(" ")} +
+ + {update.operation.match(/[A-Z][a-z]+|[0-9]+/g)?.join(" ")} +
+ {fmt_verison(update.version)} +
+
- {Components && } + {Components && } {Components && }
-
-
+
+
{update.status === Types.UpdateStatus.InProgress @@ -52,7 +55,7 @@ export const SingleUpdate = ({ update }: { update: Types.UpdateListItem }) => { : fmt_date(new Date(update.start_ts))}
-
+
@@ -68,7 +71,7 @@ export const HeaderUpdates = () => { const last_opened = useRead("GetUser", {}).data?.last_update_view; const unseen_update = updates?.updates.some( - (u) => u.start_ts > (last_opened ?? Number.MAX_SAFE_INTEGER), + (u) => u.start_ts > (last_opened ?? Number.MAX_SAFE_INTEGER) ); const invalidate = useInvalidate(); @@ -84,7 +87,7 @@ export const HeaderUpdates = () => { diff --git a/frontend/src/components/updates/resource.tsx b/frontend/src/components/updates/resource.tsx index 47a3a806b..6bd89026d 100644 --- a/frontend/src/components/updates/resource.tsx +++ b/frontend/src/components/updates/resource.tsx @@ -15,29 +15,30 @@ import { Check, X, Loader2, + Milestone, } from "lucide-react"; import { Link } from "react-router-dom"; import { Types } from "@monitor/client"; import { Section } from "@components/layouts"; -import { fmt_update_date } from "@lib/utils"; +import { fmt_update_date, fmt_verison } from "@lib/utils"; import { UpdateDetails, UpdateUser } from "./details"; import { UpdateStatus } from "@monitor/client/dist/types"; -const UpdatePlaceHolder = () => ( - - - ... - - - ... - - - ... - - - - -); +// const UpdatePlaceHolder = () => ( +// +// +// ... +// +// +// ... +// +// +// ... +// +// +// +// +// ); const UpdateCard = ({ update }: { update: Types.UpdateListItem }) => { const Icon = () => { @@ -50,8 +51,14 @@ const UpdateCard = ({ update }: { update: Types.UpdateListItem }) => { return ( - - {update.operation} + +
+ {update.operation} + + + {fmt_verison(update.version)} + +
@@ -70,7 +77,7 @@ const UpdateCard = ({ update }: { update: Types.UpdateListItem }) => { }; export const ResourceUpdates = ({ type, id }: Types.ResourceTarget) => { - const { data, isLoading } = useRead("ListUpdates", { + const { data } = useRead("ListUpdates", { query: { "target.type": type, "target.id": id, @@ -90,10 +97,10 @@ export const ResourceUpdates = ({ type, id }: Types.ResourceTarget) => { } >
- {isLoading && } - {data?.updates - .slice(0, 3) - .map((update) => )} + {/* {isLoading && } */} + {data?.updates.slice(0, 3).map((update) => ( + + ))}
); diff --git a/frontend/src/components/util.tsx b/frontend/src/components/util.tsx index 9baf81199..86ad0d9bd 100644 --- a/frontend/src/components/util.tsx +++ b/frontend/src/components/util.tsx @@ -334,18 +334,19 @@ export const ResourcesDropdown = () => { + + + + + All {type}s + + + {!list?.length && ( No {type}s Found. )} - {list?.length && ( - - - - All {type}s - - - )} + {list?.map(({ id, name }) => (