From 8138f32243704af17b115be8cb0d208dfd39c6a5 Mon Sep 17 00:00:00 2001 From: Jack Harper Date: Tue, 12 Nov 2024 11:26:47 +0000 Subject: [PATCH] remove runcontrol table header and make blockname/value bigger, make 4 cols the default on large screen, remove whitespace at top of page by getting rid of instName(duplicated) and moving config name under runstate --- app/components/Block.tsx | 49 +++++++++++------- app/components/Group.tsx | 4 +- app/components/Groups.tsx | 2 +- app/components/InstrumentPage.tsx | 2 +- app/components/TopBar.test.ts | 2 +- app/components/TopBar.tsx | 35 ++++++------- .../__snapshots__/Block.test.tsx.snap | 50 +++++++++++-------- .../__snapshots__/TopBar.test.ts.snap | 42 ++++++---------- 8 files changed, 96 insertions(+), 90 deletions(-) diff --git a/app/components/Block.tsx b/app/components/Block.tsx index dc9ad0d..8df995d 100644 --- a/app/components/Block.tsx +++ b/app/components/Block.tsx @@ -37,6 +37,7 @@ export default function Block({ }, 2000); } + const minimum_date_to_be_shown = 631152000; // This is what PVWS thinks epoch time is for some reason. don't bother showing it as the instrument wasn't running EPICS on 01/01/1990 return ( - + - - - {showAdvanced && "Readback: "} - {pv.value} {pv.units != null && pv.units} + + +
+ + {showAdvanced && "Readback: "} + {pv.value} {pv.units != null && pv.units} + + + + +
{pv.severity != "NONE" ? (
-
- {pv.severity} + Alarm: {pv.severity}
) : null} {showAdvanced && ( @@ -82,8 +95,10 @@ export default function Block({
) : null} - {pv.updateSeconds != null ? ( + {pv.updateSeconds != null && + pv.updateSeconds > minimum_date_to_be_shown ? ( + {/*Multiply by 1000 here as Date() expects milliseconds*/} {`Last update: ${new Date(pv.updateSeconds * 1000).toLocaleString()}`} ) : null} @@ -92,19 +107,17 @@ export default function Block({ - + {pv.runcontrol_enabled && (pv.runcontrol_inrange ? "✅" : "❌")} - - - - {showAdvanced ? "-" : "+"} diff --git a/app/components/Group.tsx b/app/components/Group.tsx index 7928d2a..d9837a6 100644 --- a/app/components/Group.tsx +++ b/app/components/Group.tsx @@ -31,8 +31,8 @@ export default function Group({ Block - Value - In-Range + Value + diff --git a/app/components/Groups.tsx b/app/components/Groups.tsx index b9c74a1..389dc22 100644 --- a/app/components/Groups.tsx +++ b/app/components/Groups.tsx @@ -17,7 +17,7 @@ export default function Groups({ } return ( -
+
{groupsMap.map((group) => { return ( Loading...; } return ( -
+
{ runInfoPVs: instrument.runInfoPVs, }), ); - expect(container.querySelector("#instNameSpan")!.innerHTML).toBe( + expect(container.querySelector("#instNameLabel")!.innerHTML).toContain( instName.toUpperCase(), ); }); diff --git a/app/components/TopBar.tsx b/app/components/TopBar.tsx index 458b051..1e87c20 100644 --- a/app/components/TopBar.tsx +++ b/app/components/TopBar.tsx @@ -42,22 +42,6 @@ export default function TopBar({ id="top_bar" className="w-full bg-white shadow-lg text-black rounded-xl text-md" > -
-

- Instrument:{" "} - - {instName.toUpperCase()} - -

-

- Config:{" "} - - {findPVByHumanReadableName(runInfoPVs, configName) - ? findPVByHumanReadableName(runInfoPVs, configName)!.value - : "UNKNOWN"} - -

-
{instName.toUpperCase()} is{" "} {getRunstate(runInfoPVs)} -
+

+ Config:{" "} + + {findPVByHumanReadableName(runInfoPVs, configName) + ? findPVByHumanReadableName(runInfoPVs, configName)!.value + : "UNKNOWN"} + +

+ +
- @@ -36,22 +57,11 @@ exports[`renders topbar unchanged 1`] = ` > - - - + diff --git a/app/components/__snapshots__/TopBar.test.ts.snap b/app/components/__snapshots__/TopBar.test.ts.snap index b8dcccd..d80096e 100644 --- a/app/components/__snapshots__/TopBar.test.ts.snap +++ b/app/components/__snapshots__/TopBar.test.ts.snap @@ -6,32 +6,6 @@ exports[`renders topbar unchanged 1`] = ` class="w-full bg-white shadow-lg text-black rounded-xl text-md" id="top_bar" > -
-

- Instrument: - - - INSTRUMENT - -

-

- Config: - - -

-
INSTRUMENT is @@ -53,8 +28,18 @@ exports[`renders topbar unchanged 1`] = ` UNKNOWN +

+ Config: + + +

- 123 - - mm +
+ + 123 + + mm + + + + +
-
+ Alarm: