Add option to hide "debug" information.

This commit is contained in:
Michael Pearson 2022-04-23 13:34:59 +10:00
parent f2030d301f
commit 69def58321
4 changed files with 11 additions and 3 deletions

View File

@ -46,6 +46,9 @@ class DetectorConfig(FrigateBaseModel):
class UIConfig(FrigateBaseModel):
use_experimental: bool = Field(default=False, title="Experimental UI")
hide_configuration_options: bool = Field(
default=False, title="Hide UI components used for configuring Frigate"
)
class MqttConfig(FrigateBaseModel):

View File

@ -23,7 +23,8 @@ export default function Sidebar() {
if (!config) {
return null;
}
const { birdseye } = config;
const { birdseye, ui } = config;
const hideConfigurationOptions = ui?.hide_configuration_options;
return (
<NavigationDrawer header={<Header />}>
@ -44,7 +45,7 @@ export default function Sidebar() {
</Match>
{birdseye?.enabled ? <Destination href="/birdseye" text="Birdseye" /> : null}
<Destination href="/events" text="Events" />
<Destination href="/debug" text="Debug" />
{ hideConfigurationOptions ? null : <Destination href="/debug" text="Debug" /> }
<Separator />
<div className="flex flex-grow" />
{ENV !== 'production' ? (

View File

@ -14,6 +14,9 @@ export function Tabs({ children, selectedIndex: selectedIndexProp, onChange, cla
const RenderChildren = useCallback(() => {
return children.map((child, i) => {
if (!child) {
return null
}
child.props.selected = i === selectedIndex;
child.props.onClick = handleSelected(i);
return child;

View File

@ -14,6 +14,7 @@ export default function Camera({ camera }) {
const [playerType, setPlayerType] = useState('live');
const cameraConfig = config?.cameras[camera];
const hideConfigurationOptions = config?.ui?.hide_configuration_options;
const handleTabChange = (index) => {
if (index === 0) {
@ -49,7 +50,7 @@ export default function Camera({ camera }) {
<Tabs selectedIndex={1} onChange={handleTabChange} className='justify'>
<TextTab text='History' />
<TextTab text='Live' />
<TextTab text='Debug' />
{hideConfigurationOptions ? null : <TextTab text="Debug"/>}
</Tabs>
</div>
</div>