From 72344d15c320094b264aebeab7dd073042e8d365 Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:58:27 +0530 Subject: [PATCH 1/3] Location Uptime tracking --- src/Components/Assets/AssetManage.tsx | 4 ++++ src/Components/Common/Uptime.tsx | 8 +++++--- src/Components/Facility/LocationManagement.tsx | 10 ++++++++++ src/Redux/api.tsx | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx index 77bb88da3a8..debfbf29d03 100644 --- a/src/Components/Assets/AssetManage.tsx +++ b/src/Components/Assets/AssetManage.tsx @@ -502,6 +502,10 @@ const AssetManage = (props: AssetManageProps) => { Availability History + } + parentClassNames="mt-8 flex w-full flex-col bg-white p-4 shadow-sm sm:rounded-lg" /> )}
Service History
diff --git a/src/Components/Common/Uptime.tsx b/src/Components/Common/Uptime.tsx index e7272e2e1f4..0bd63a3ce9d 100644 --- a/src/Components/Common/Uptime.tsx +++ b/src/Components/Common/Uptime.tsx @@ -169,6 +169,8 @@ export default function Uptime( props: Readonly<{ route: QueryRoute>; params?: Record; + header?: React.ReactNode; + parentClassNames?: string; }> ) { const [summary, setSummary] = useState<{ @@ -361,10 +363,10 @@ export default function Uptime( ); } else if (summary) { return ( -
-
+
+
-
Availability History
+ {props.header}
diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx index 93a08794c82..baf11d09ec8 100644 --- a/src/Components/Facility/LocationManagement.tsx +++ b/src/Components/Facility/LocationManagement.tsx @@ -7,6 +7,7 @@ import routes from "../../Redux/api"; import PaginatedList from "../../CAREUI/misc/PaginatedList"; import { LocationModel } from "./models"; import RecordMeta from "../../CAREUI/display/RecordMeta"; +import Uptime from "../Common/Uptime"; const Loading = lazy(() => import("../Common/Loading")); @@ -122,6 +123,15 @@ const Location = ({ > {middleware_address || "-"}

+ + Middleware Uptime +

+ } + />
>(), From 3f493091e34080ccc06b71360dbab62187cbef92 Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:04:36 +0530 Subject: [PATCH 2/3] Add facilityId prop to Location component --- src/Components/Facility/LocationManagement.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx index baf11d09ec8..927c2ea00f2 100644 --- a/src/Components/Facility/LocationManagement.tsx +++ b/src/Components/Facility/LocationManagement.tsx @@ -56,7 +56,7 @@ export default function LocationManagement({ facilityId }: Props) { className="my-8 grid gap-3 @4xl:grid-cols-2 @6xl:grid-cols-3 @[100rem]:grid-cols-4 lg:mx-8"> - {(item) => } + {(item) => }
@@ -77,7 +77,8 @@ const Location = ({ created_date, modified_date, id, -}: LocationModel) => ( + facilityId, +}: LocationModel & { facilityId: string }) => (
@@ -125,7 +126,7 @@ const Location = ({

Middleware Uptime From 572a86fb7a1f69ec312ca393235eb419149d2f5b Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 27 Feb 2024 02:06:42 +0530 Subject: [PATCH 3/3] Fix card alignment --- src/Components/Common/Uptime.tsx | 21 ++++++++++--------- .../Facility/LocationManagement.tsx | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Components/Common/Uptime.tsx b/src/Components/Common/Uptime.tsx index 0bd63a3ce9d..4b12a13bd17 100644 --- a/src/Components/Common/Uptime.tsx +++ b/src/Components/Common/Uptime.tsx @@ -171,6 +171,7 @@ export default function Uptime( params?: Record; header?: React.ReactNode; parentClassNames?: string; + centerInfoPanel?: boolean; }> ) { const [summary, setSummary] = useState<{ @@ -193,6 +194,8 @@ export default function Uptime( setNumDays(Math.min(newNumDays, 100)); }; + const centerInfoPanel = props.centerInfoPanel ?? false; + const setUptimeRecord = (records: AvailabilityRecord[]): void => { const recordsByDayBefore: { [key: number]: AvailabilityRecord[] } = {}; @@ -409,15 +412,13 @@ export default function Uptime( }`} >
- {hoveredDay === index && ( - <> - - + {hoveredDay === index && !centerInfoPanel && ( + )} ); @@ -434,7 +435,7 @@ export default function Uptime(
{hoveredDay !== -1 && ( -
+
} + centerInfoPanel />