Add timeline to menu.

This commit is contained in:
Dermot Duffy
2022-03-19 09:00:21 -07:00
parent 05d5b246e2
commit b17907a2c7
3 changed files with 17 additions and 3 deletions
+12 -2
View File
@@ -371,6 +371,16 @@ export class FrigateCard extends LitElement {
}); });
} }
if (this._getConfig().menu.buttons.timeline) {
buttons.push({
type: 'custom:frigate-card-menu-icon',
title: localize('config.view.views.timeline'),
icon: 'mdi:chart-gantt',
style: this._view?.is('timeline') ? this._getEmphasizedStyle() : {},
tap_action: createFrigateCardCustomAction('timeline') as FrigateCardCustomAction,
});
}
if (this._getConfig().menu.buttons.download && this._view?.isViewerView()) { if (this._getConfig().menu.buttons.download && this._view?.isViewerView()) {
buttons.push({ buttons.push({
type: 'custom:frigate-card-menu-icon', type: 'custom:frigate-card-menu-icon',
@@ -649,8 +659,7 @@ export class FrigateCard extends LitElement {
// Load the default view. // Load the default view.
let camera; let camera;
if (this._cameras?.size) { if (this._cameras?.size) {
if (this._view?.camera && if (this._view?.camera && this._getConfig().view.update_cycle_camera) {
this._getConfig().view.update_cycle_camera) {
const keys = Array.from(this._cameras.keys()); const keys = Array.from(this._cameras.keys());
const currentIndex = keys.indexOf(this._view.camera); const currentIndex = keys.indexOf(this._view.camera);
const targetIndex = currentIndex + 1 >= keys.length ? 0 : currentIndex + 1; const targetIndex = currentIndex + 1 >= keys.length ? 0 : currentIndex + 1;
@@ -827,6 +836,7 @@ export class FrigateCard extends LitElement {
case 'live': case 'live':
case 'snapshot': case 'snapshot':
case 'snapshots': case 'snapshots':
case 'timeline':
if (this._view) { if (this._view) {
this._changeView({ this._changeView({
view: new View({ view: new View({
+2 -1
View File
@@ -42,7 +42,8 @@
"snapshot": "Most recent snapshot", "snapshot": "Most recent snapshot",
"snapshots": "Snapshots gallery", "snapshots": "Snapshots gallery",
"image": "Static image", "image": "Static image",
"current": "Current view" "current": "Current view",
"timeline": "Timeline view"
}, },
"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",
+3
View File
@@ -127,6 +127,7 @@ const FRIGATE_CARD_GENERAL_ACTIONS = [
'live', 'live',
'snapshot', 'snapshot',
'snapshots', 'snapshots',
'timeline',
'download', 'download',
'frigate_ui', 'frigate_ui',
'fullscreen', 'fullscreen',
@@ -591,6 +592,7 @@ const menuConfigDefault = {
clips: true, clips: true,
snapshots: true, snapshots: true,
image: false, image: false,
timeline: true,
download: true, download: true,
frigate_ui: true, frigate_ui: true,
fullscreen: true, fullscreen: true,
@@ -609,6 +611,7 @@ const menuConfigSchema = z
clips: z.boolean().default(menuConfigDefault.buttons.clips), clips: z.boolean().default(menuConfigDefault.buttons.clips),
snapshots: z.boolean().default(menuConfigDefault.buttons.snapshots), snapshots: z.boolean().default(menuConfigDefault.buttons.snapshots),
image: z.boolean().default(menuConfigDefault.buttons.image), image: z.boolean().default(menuConfigDefault.buttons.image),
timeline: z.boolean().default(menuConfigDefault.buttons.timeline),
download: z.boolean().default(menuConfigDefault.buttons.download), download: z.boolean().default(menuConfigDefault.buttons.download),
frigate_ui: z.boolean().default(menuConfigDefault.buttons.frigate_ui), frigate_ui: z.boolean().default(menuConfigDefault.buttons.frigate_ui),
fullscreen: z.boolean().default(menuConfigDefault.buttons.fullscreen), fullscreen: z.boolean().default(menuConfigDefault.buttons.fullscreen),