From 0d6dd1ed0fa5a6d5dacd34100d6e2488eb16e432 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 25 Aug 2022 05:44:34 -0600 Subject: [PATCH] Cleanup names of cameras, zones, & labels in the UI (#3708) * Cleanup names of cameras, zones, & labels in the UI * Fix tests to include camera name --- web/config/handlers.js | 1 + web/src/Sidebar.jsx | 4 ++-- web/src/routes/Camera.jsx | 2 +- web/src/routes/Cameras.jsx | 6 +++++- web/src/routes/Debug.jsx | 2 +- web/src/routes/Events.jsx | 10 +++++----- web/src/routes/Recording.jsx | 2 +- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/web/config/handlers.js b/web/config/handlers.js index 59a1649d1..0166d0c3a 100644 --- a/web/config/handlers.js +++ b/web/config/handlers.js @@ -68,6 +68,7 @@ export const handlers = [ top_score: Math.random(), zones: ['front_patio'], thumbnail: '/9j/4aa...', + camera: 'camera_name', })) ) ); diff --git a/web/src/Sidebar.jsx b/web/src/Sidebar.jsx index a74a8c80b..62b040379 100644 --- a/web/src/Sidebar.jsx +++ b/web/src/Sidebar.jsx @@ -65,7 +65,7 @@ function CameraSection({ sortedCameras }) { {sortedCameras.map(([camera]) => ( - + ))} @@ -83,7 +83,7 @@ function RecordingSection({ sortedCameras }) { key={camera} path={`/recording/${camera}/:date?/:hour?/:seconds?`} href={`/recording/${camera}`} - text={camera} + text={camera.replaceAll('_', ' ')} /> ); })} diff --git a/web/src/routes/Camera.jsx b/web/src/routes/Camera.jsx index 39f068568..97f80913e 100644 --- a/web/src/routes/Camera.jsx +++ b/web/src/routes/Camera.jsx @@ -120,7 +120,7 @@ export default function Camera({ camera }) { return (
- {camera} + {camera.replaceAll('_', ' ')} {player} diff --git a/web/src/routes/Cameras.jsx b/web/src/routes/Cameras.jsx index 6628112b3..7e75d1da7 100644 --- a/web/src/routes/Cameras.jsx +++ b/web/src/routes/Cameras.jsx @@ -50,6 +50,10 @@ function Camera({ name }) { { name: 'Recordings', href: `/recording/${name}` }, ]; }, [name]); + const cleanName = useMemo( + () => { return `${name.replaceAll('_', ' ')}` }, + [name] + ); const icons = useMemo( () => [ { @@ -81,6 +85,6 @@ function Camera({ name }) { ); return ( - } /> + } /> ); } diff --git a/web/src/routes/Debug.jsx b/web/src/routes/Debug.jsx index 0cc3e3e1e..b404c61a9 100644 --- a/web/src/routes/Debug.jsx +++ b/web/src/routes/Debug.jsx @@ -81,7 +81,7 @@ export default function Debug() { {cameraNames.map((camera, i) => ( - {camera} + {camera.replaceAll('_', ' ')} {cameraDataKeys.map((name) => ( {cameras[camera][name]} diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index a35ca79d0..b93d661e4 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -251,7 +251,7 @@ export default function Events({ path, ...props }) { {filterValues.cameras.map((item) => ( ))} @@ -262,7 +262,7 @@ export default function Events({ path, ...props }) { > {filterValues.labels.map((item) => ( - ))} @@ -275,7 +275,7 @@ export default function Events({ path, ...props }) { {filterValues.zones.map((item) => ( ))} @@ -457,11 +457,11 @@ export default function Events({ path, ...props }) {
- {event.camera} + {event.camera.replaceAll('_', ' ')}
- {event.zones.join(',')} + {event.zones.join(', ').replaceAll('_', ' ')}