Add editor support.
This commit is contained in:
@@ -33,6 +33,10 @@ export const CONF_VIEW_UPDATE_CYCLE_CAMERA = `${CONF_VIEW}.update_cycle_camera`
|
|||||||
export const CONF_VIEW_UPDATE_FORCE = `${CONF_VIEW}.update_force` as const;
|
export const CONF_VIEW_UPDATE_FORCE = `${CONF_VIEW}.update_force` as const;
|
||||||
export const CONF_VIEW_UPDATE_ENTITIES = `${CONF_VIEW}.update_entities` as const;
|
export const CONF_VIEW_UPDATE_ENTITIES = `${CONF_VIEW}.update_entities` as const;
|
||||||
export const CONF_VIEW_UPDATE_SECONDS = `${CONF_VIEW}.update_seconds` as const;
|
export const CONF_VIEW_UPDATE_SECONDS = `${CONF_VIEW}.update_seconds` as const;
|
||||||
|
export const CONF_VIEW_SCAN = `${CONF_VIEW}.scan` as const;
|
||||||
|
export const CONF_VIEW_SCAN_ENABLED = `${CONF_VIEW_SCAN}.enabled` as const;
|
||||||
|
export const CONF_VIEW_SCAN_TRIGGER_MIN_SECONDS = `${CONF_VIEW_SCAN}.trigger_min_seconds` as const;
|
||||||
|
export const CONF_VIEW_SCAN_TRIGGER_SHOW_BORDER = `${CONF_VIEW_SCAN}.trigger_show_border` as const;
|
||||||
|
|
||||||
export const CONF_EVENT_GALLERY = 'event_gallery' as const;
|
export const CONF_EVENT_GALLERY = 'event_gallery' as const;
|
||||||
export const CONF_EVENT_GALLERY_CONTROLS_THUMBNAILS_SHOW_DETAILS =
|
export const CONF_EVENT_GALLERY_CONTROLS_THUMBNAILS_SHOW_DETAILS =
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ import {
|
|||||||
CONF_VIEW_CAMERA_SELECT,
|
CONF_VIEW_CAMERA_SELECT,
|
||||||
CONF_VIEW_DARK_MODE,
|
CONF_VIEW_DARK_MODE,
|
||||||
CONF_VIEW_DEFAULT,
|
CONF_VIEW_DEFAULT,
|
||||||
|
CONF_VIEW_SCAN,
|
||||||
|
CONF_VIEW_SCAN_ENABLED,
|
||||||
|
CONF_VIEW_SCAN_TRIGGER_MIN_SECONDS,
|
||||||
|
CONF_VIEW_SCAN_TRIGGER_SHOW_BORDER,
|
||||||
CONF_VIEW_TIMEOUT_SECONDS,
|
CONF_VIEW_TIMEOUT_SECONDS,
|
||||||
CONF_VIEW_UPDATE_CYCLE_CAMERA,
|
CONF_VIEW_UPDATE_CYCLE_CAMERA,
|
||||||
CONF_VIEW_UPDATE_FORCE,
|
CONF_VIEW_UPDATE_FORCE,
|
||||||
@@ -104,6 +108,7 @@ import { sideLoadHomeAssistantElements } from './utils/ha';
|
|||||||
const MENU_BUTTONS = 'buttons';
|
const MENU_BUTTONS = 'buttons';
|
||||||
const MENU_CAMERAS = 'cameras';
|
const MENU_CAMERAS = 'cameras';
|
||||||
const MENU_OPTIONS = 'options';
|
const MENU_OPTIONS = 'options';
|
||||||
|
const MENU_VIEW_SCAN = 'scan';
|
||||||
|
|
||||||
interface EditorOptionsSet {
|
interface EditorOptionsSet {
|
||||||
icon: string;
|
icon: string;
|
||||||
@@ -601,6 +606,44 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected _renderViewScanMenu(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<div
|
||||||
|
class="submenu-header"
|
||||||
|
@click=${this._toggleMenu}
|
||||||
|
.domain=${MENU_VIEW_SCAN}
|
||||||
|
.key=${true}
|
||||||
|
>
|
||||||
|
<ha-icon .icon=${'mdi:target-account'}></ha-icon>
|
||||||
|
<span
|
||||||
|
>${localize(`config.${CONF_VIEW_SCAN}.scan_mode`)}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
${this._expandedMenus[MENU_VIEW_SCAN]
|
||||||
|
? html` <div class="values">
|
||||||
|
${this._renderSwitch(
|
||||||
|
CONF_VIEW_SCAN_ENABLED,
|
||||||
|
frigateCardConfigDefaults.view.scan.enabled ?? true,
|
||||||
|
{
|
||||||
|
label: localize('config.view.scan.enabled'),
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
${this._renderSwitch(
|
||||||
|
CONF_VIEW_SCAN_TRIGGER_SHOW_BORDER,
|
||||||
|
frigateCardConfigDefaults.view.scan.trigger_show_border ?? true,
|
||||||
|
{
|
||||||
|
label: localize('config.view.scan.trigger_show_border'),
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
${this._renderNumberInput(CONF_VIEW_SCAN_TRIGGER_MIN_SECONDS, {
|
||||||
|
default: frigateCardConfigDefaults.view.scan.trigger_min_seconds,
|
||||||
|
label: localize('config.view.scan.trigger_min_seconds'),
|
||||||
|
})}
|
||||||
|
</div>`
|
||||||
|
: ''}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render an editor menu for the card menu buttons.
|
* Render an editor menu for the card menu buttons.
|
||||||
* @param button The name of the button.
|
* @param button The name of the button.
|
||||||
@@ -985,6 +1028,7 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
CONF_VIEW_UPDATE_CYCLE_CAMERA,
|
CONF_VIEW_UPDATE_CYCLE_CAMERA,
|
||||||
defaults.view.update_cycle_camera,
|
defaults.view.update_cycle_camera,
|
||||||
)}
|
)}
|
||||||
|
${this._renderViewScanMenu()}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ''}
|
: ''}
|
||||||
|
|||||||
@@ -65,7 +65,13 @@
|
|||||||
"timeout_seconds": "Reset to default view X seconds after user action (0=never)",
|
"timeout_seconds": "Reset to default view X seconds after user action (0=never)",
|
||||||
"update_cycle_camera": "Cycle through cameras when default view updates",
|
"update_cycle_camera": "Cycle through cameras when default view updates",
|
||||||
"update_force": "Force card updates (ignore user interaction)",
|
"update_force": "Force card updates (ignore user interaction)",
|
||||||
"update_seconds": "Refresh default view every X seconds (0=never)"
|
"update_seconds": "Refresh default view every X seconds (0=never)",
|
||||||
|
"scan": {
|
||||||
|
"scan_mode": "Scan mode",
|
||||||
|
"enabled": "Scan mode enabled",
|
||||||
|
"trigger_min_seconds": "Minimum seconds to trigger for",
|
||||||
|
"trigger_show_border": "Show pulsing border when triggered"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"event_gallery": {
|
"event_gallery": {
|
||||||
"controls": {
|
"controls": {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ div.upgrade span {
|
|||||||
|
|
||||||
.submenu-header {
|
.submenu-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 4px;
|
margin-top: 10px;
|
||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user