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
This commit is contained in:
Nicolas Mowen 2022-02-12 12:51:28 -07:00 committed by Blake Blackshear
parent ebdfbfe96c
commit 5627b66a6e
2 changed files with 3 additions and 7 deletions

View File

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

View File

@ -46,7 +46,7 @@ describe('Cameras Route', () => {
expect(screen.queryByLabelText('Loading…')).not.toBeInTheDocument(); 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 () => { test('buttons toggle detect, clips, and snapshots', async () => {