Przeglądaj źródła

Always show recording link even if recordings are currently disabled (#2787)

* Always show recording link even if recordings are currently disabled

* Fix test to consider all cameras to have recording link
Nicolas Mowen 3 lat temu
rodzic
commit
5627b66a6e

+ 2 - 6
web/src/routes/Cameras.jsx

@@ -29,12 +29,8 @@ function Camera({ name, conf }) {
   const { payload: snapshotValue, send: sendSnapshots } = useSnapshotsState(name);
   const href = `/cameras/${name}`;
   const buttons = useMemo(() => {
-    const result = [{ name: 'Events', href: `/events?camera=${name}` }];
-    if (conf.record.enabled) {
-      result.push({ name: 'Recordings', href: `/recording/${name}` });
-    }
-    return result;
-  }, [name, conf.record.enabled]);
+    return [{ name: 'Events', href: `/events?camera=${name}` }, { name: 'Recordings', href: `/recording/${name}` }];
+  }, [name]);
   const icons = useMemo(
     () => [
       {

+ 1 - 1
web/src/routes/__tests__/Cameras.test.jsx

@@ -46,7 +46,7 @@ describe('Cameras Route', () => {
 
     expect(screen.queryByLabelText('Loading…')).not.toBeInTheDocument();
 
-    expect(screen.queryAllByText('Recordings')).toHaveLength(1);
+    expect(screen.queryAllByText('Recordings')).toHaveLength(2);
   });
 
   test('buttons toggle detect, clips, and snapshots', async () => {