feat: Add support for 12-hour clock formatting on timelines (#1862)
- Closes #1779 [skip ci]
This commit is contained in:
@@ -118,6 +118,7 @@ live:
|
|||||||
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `clustering_threshold` | `3` | The minimum number of overlapping events to allow prior to clustering/grouping them. Higher numbers cause clustering to happen less frequently. Depending on the timescale/zoom of the timeline, the underlying timeline library may still allow overlaps for low values of this parameter -- for a fully "flat" timeline use the `ribbon` style. `0` disables clustering entirely. Only used in the `stack` style of timeline. |
|
| `clustering_threshold` | `3` | The minimum number of overlapping events to allow prior to clustering/grouping them. Higher numbers cause clustering to happen less frequently. Depending on the timescale/zoom of the timeline, the underlying timeline library may still allow overlaps for low values of this parameter -- for a fully "flat" timeline use the `ribbon` style. `0` disables clustering entirely. Only used in the `stack` style of timeline. |
|
||||||
| `events_media_type` | `all` | Whether to show only events with `clips`, events with `snapshots` or `all` events. When `all` is used, `clips` are favored for events that have both a clip and a snapshot. |
|
| `events_media_type` | `all` | Whether to show only events with `clips`, events with `snapshots` or `all` events. When `all` is used, `clips` are favored for events that have both a clip and a snapshot. |
|
||||||
|
| `format` | | Configuration for the timeline time & date format. See below. |
|
||||||
| `mode` | `none` | Whether to show the thumbnail carousel `below` the media, `above` the media, in a drawer to the `left` or `right` of the media or to hide it entirely (`none`). |
|
| `mode` | `none` | Whether to show the thumbnail carousel `below` the media, `above` the media, in a drawer to the `left` or `right` of the media or to hide it entirely (`none`). |
|
||||||
| `pan_mode` | `pan` | See [timeline pan mode](timeline-pan-mode.md). |
|
| `pan_mode` | `pan` | See [timeline pan mode](timeline-pan-mode.md). |
|
||||||
| `show_recordings` | `true` | Whether to show recordings on the timeline (specifically: which hours have any recorded content). |
|
| `show_recordings` | `true` | Whether to show recordings on the timeline (specifically: which hours have any recorded content). |
|
||||||
@@ -126,6 +127,22 @@ live:
|
|||||||
|
|
||||||
[](common/timeline-seek-info.md ':include')
|
[](common/timeline-seek-info.md ':include')
|
||||||
|
|
||||||
|
#### `format`
|
||||||
|
|
||||||
|
Configure the date and time format for the `timeline` view.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
live:
|
||||||
|
controls:
|
||||||
|
timeline:
|
||||||
|
format:
|
||||||
|
# [...]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Option | Default | Description |
|
||||||
|
| ------ | ------- | ------------------------------------------------------------------------------- |
|
||||||
|
| `24h` | `true` | If `true` shows time in 24-hour clock. If `false` otherwise uses 12-hour clock. |
|
||||||
|
|
||||||
## `display`
|
## `display`
|
||||||
|
|
||||||
Controls whether to show a single or grid `live` view.
|
Controls whether to show a single or grid `live` view.
|
||||||
@@ -213,6 +230,8 @@ live:
|
|||||||
events_media_type: all
|
events_media_type: all
|
||||||
show_recordings: true
|
show_recordings: true
|
||||||
window_seconds: 3600
|
window_seconds: 3600
|
||||||
|
format:
|
||||||
|
24h: true
|
||||||
microphone:
|
microphone:
|
||||||
always_connected: false
|
always_connected: false
|
||||||
disconnect_seconds: 90
|
disconnect_seconds: 90
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ media_viewer:
|
|||||||
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `clustering_threshold` | `3` | The minimum number of overlapping events to allow prior to clustering/grouping them. Higher numbers cause clustering to happen less frequently. Depending on the timescale/zoom of the timeline, the underlying timeline library may still allow overlaps for low values of this parameter -- for a fully "flat" timeline use the `ribbon` style. `0` disables clustering entirely. Only used in the `stack` style of timeline. |
|
| `clustering_threshold` | `3` | The minimum number of overlapping events to allow prior to clustering/grouping them. Higher numbers cause clustering to happen less frequently. Depending on the timescale/zoom of the timeline, the underlying timeline library may still allow overlaps for low values of this parameter -- for a fully "flat" timeline use the `ribbon` style. `0` disables clustering entirely. Only used in the `stack` style of timeline. |
|
||||||
| `events_media_type` | `all` | Whether to show only events with `clips`, events with `snapshots` or `all` events. When `all` is used, `clips` are favored for events that have both a clip and a snapshot. |
|
| `events_media_type` | `all` | Whether to show only events with `clips`, events with `snapshots` or `all` events. When `all` is used, `clips` are favored for events that have both a clip and a snapshot. |
|
||||||
|
| `format` | | Configuration for the timeline time & date format. See below. |
|
||||||
| `mode` | `none` | Whether to show the thumbnail carousel `below` the media, `above` the media, in a drawer to the `left` or `right` of the media or to hide it entirely (`none`). |
|
| `mode` | `none` | Whether to show the thumbnail carousel `below` the media, `above` the media, in a drawer to the `left` or `right` of the media or to hide it entirely (`none`). |
|
||||||
| `pan_mode` | `pan` | See [timeline pan mode](timeline-pan-mode.md). |
|
| `pan_mode` | `pan` | See [timeline pan mode](timeline-pan-mode.md). |
|
||||||
| `show_recordings` | `true` | Whether to show recordings on the timeline (specifically: which hours have any recorded content). |
|
| `show_recordings` | `true` | Whether to show recordings on the timeline (specifically: which hours have any recorded content). |
|
||||||
@@ -120,6 +121,22 @@ media_viewer:
|
|||||||
|
|
||||||
[](common/timeline-seek-info.md ':include')
|
[](common/timeline-seek-info.md ':include')
|
||||||
|
|
||||||
|
#### `format`
|
||||||
|
|
||||||
|
Configure the date and time format for the `timeline` view.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
media_viewer:
|
||||||
|
controls:
|
||||||
|
timeline:
|
||||||
|
format:
|
||||||
|
# [...]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Option | Default | Description |
|
||||||
|
| ------ | ------- | ------------------------------------------------------------------------------- |
|
||||||
|
| `24h` | `true` | If `true` shows time in 24-hour clock. If `false` otherwise uses 12-hour clock. |
|
||||||
|
|
||||||
## `display`
|
## `display`
|
||||||
|
|
||||||
Controls whether to show a single media item or grid in the media viewer.
|
Controls whether to show a single media item or grid in the media viewer.
|
||||||
@@ -188,6 +205,8 @@ media_viewer:
|
|||||||
events_media_type: all
|
events_media_type: all
|
||||||
show_recordings: true
|
show_recordings: true
|
||||||
window_seconds: 3600
|
window_seconds: 3600
|
||||||
|
format:
|
||||||
|
24h: true
|
||||||
display:
|
display:
|
||||||
mode: single
|
mode: single
|
||||||
grid_selected_width_factor: 2
|
grid_selected_width_factor: 2
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ You can interact with the timeline in a number of ways:
|
|||||||
| `clustering_threshold` | `3` | The minimum number of overlapping events to allow prior to clustering/grouping them. Higher numbers cause clustering to happen less frequently. Depending on the timescale/zoom of the timeline, the underlying timeline library may still allow overlaps for low values of this parameter -- for a fully "flat" timeline use the `ribbon` style. `0` disables clustering entirely. Only used in the `stack` style of timeline. |
|
| `clustering_threshold` | `3` | The minimum number of overlapping events to allow prior to clustering/grouping them. Higher numbers cause clustering to happen less frequently. Depending on the timescale/zoom of the timeline, the underlying timeline library may still allow overlaps for low values of this parameter -- for a fully "flat" timeline use the `ribbon` style. `0` disables clustering entirely. Only used in the `stack` style of timeline. |
|
||||||
| `controls` | | Configuration for the timeline controls. See below. |
|
| `controls` | | Configuration for the timeline controls. See below. |
|
||||||
| `events_media_type` | `all` | Whether to show only events with `clips`, events with `snapshots` or `all` events. When `all` is used, `clips` are favored for events that have both a clip and a snapshot. |
|
| `events_media_type` | `all` | Whether to show only events with `clips`, events with `snapshots` or `all` events. When `all` is used, `clips` are favored for events that have both a clip and a snapshot. |
|
||||||
|
| `format` | | Configuration for the timeline time & date format. See below. |
|
||||||
| `show_recordings` | `true` | Whether to show recordings on the timeline (specifically: which hours have any recorded content). |
|
| `show_recordings` | `true` | Whether to show recordings on the timeline (specifically: which hours have any recorded content). |
|
||||||
| `style` | `stack` | Whether the timeline should show events as a single flat `ribbon` or a `stack` of events that are clustered using the `clustering_threshold`. |
|
| `style` | `stack` | Whether the timeline should show events as a single flat `ribbon` or a `stack` of events that are clustered using the `clustering_threshold`. |
|
||||||
| `window_seconds` | `3600` | The length of the default timeline in seconds. By default, 1 hour (`3600` seconds) is shown in the timeline. |
|
| `window_seconds` | `3600` | The length of the default timeline in seconds. By default, 1 hour (`3600` seconds) is shown in the timeline. |
|
||||||
@@ -37,6 +38,20 @@ timeline:
|
|||||||
| ------------ | ------- | ---------------------------------------------------------------------- |
|
| ------------ | ------- | ---------------------------------------------------------------------- |
|
||||||
| `thumbnails` | | Configures how thumbnails are shown on the `timeline` view. See below. |
|
| `thumbnails` | | Configures how thumbnails are shown on the `timeline` view. See below. |
|
||||||
|
|
||||||
|
## `format`
|
||||||
|
|
||||||
|
Configure the date and time format for the `timeline` view.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
timeline:
|
||||||
|
format:
|
||||||
|
# [...]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Option | Default | Description |
|
||||||
|
| ------ | ------- | ------------------------------------------------------------------------------- |
|
||||||
|
| `24h` | `true` | If `true` shows time in 24-hour clock. If `false` otherwise uses 12-hour clock. |
|
||||||
|
|
||||||
### `thumbnails`
|
### `thumbnails`
|
||||||
|
|
||||||
Configures how thumbnails are shown on the timeline.
|
Configures how thumbnails are shown on the timeline.
|
||||||
@@ -68,6 +83,8 @@ timeline:
|
|||||||
events_media_type: all
|
events_media_type: all
|
||||||
show_recordings: true
|
show_recordings: true
|
||||||
window_seconds: 3600
|
window_seconds: 3600
|
||||||
|
format:
|
||||||
|
24h: true
|
||||||
controls:
|
controls:
|
||||||
thumbnails:
|
thumbnails:
|
||||||
mode: left
|
mode: left
|
||||||
|
|||||||
@@ -13,7 +13,12 @@ import isEqual from 'lodash-es/isEqual';
|
|||||||
import throttle from 'lodash-es/throttle';
|
import throttle from 'lodash-es/throttle';
|
||||||
import { ViewContext } from 'view';
|
import { ViewContext } from 'view';
|
||||||
import { DataSet } from 'vis-data/esnext';
|
import { DataSet } from 'vis-data/esnext';
|
||||||
import type { DataGroupCollectionType, DateType, IdType } from 'vis-timeline/esnext';
|
import type {
|
||||||
|
DataGroupCollectionType,
|
||||||
|
DateType,
|
||||||
|
IdType,
|
||||||
|
TimelineFormatOption,
|
||||||
|
} from 'vis-timeline/esnext';
|
||||||
import {
|
import {
|
||||||
Timeline,
|
Timeline,
|
||||||
TimelineEventPropertiesResult,
|
TimelineEventPropertiesResult,
|
||||||
@@ -814,6 +819,22 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected _getDateTimeFormat(): TimelineFormatOption {
|
||||||
|
const format24Hour = !!this.timelineConfig?.format?.['24h'];
|
||||||
|
|
||||||
|
// See: https://visjs.github.io/vis-timeline/docs/timeline/#Configuration_Options
|
||||||
|
return {
|
||||||
|
minorLabels: {
|
||||||
|
minute: format24Hour ? 'HH:mm' : 'h:mm A',
|
||||||
|
hour: format24Hour ? 'HH:mm' : 'h:mm A',
|
||||||
|
},
|
||||||
|
majorLabels: {
|
||||||
|
millisecond: format24Hour ? 'HH:mm:ss' : 'h:mm:ss A',
|
||||||
|
second: format24Hour ? 'D MMMM HH:mm' : 'D MMMM h:mm A',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get timeline options.
|
* Get timeline options.
|
||||||
*/
|
*/
|
||||||
@@ -883,6 +904,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
overflowMethod: 'cap',
|
overflowMethod: 'cap',
|
||||||
template: this._getTooltip.bind(this),
|
template: this._getTooltip.bind(this),
|
||||||
},
|
},
|
||||||
|
format: this._getDateTimeFormat(),
|
||||||
xss: {
|
xss: {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
filterOptions: {
|
filterOptions: {
|
||||||
|
|||||||
@@ -1060,11 +1060,18 @@ const timelineCoreConfigDefault = {
|
|||||||
show_recordings: true,
|
show_recordings: true,
|
||||||
style: 'stack' as const,
|
style: 'stack' as const,
|
||||||
pan_mode: 'pan' as const,
|
pan_mode: 'pan' as const,
|
||||||
|
format: {
|
||||||
|
'24h': true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const timelinePanModeSchema = z.enum(['pan', 'seek', 'seek-in-media', 'seek-in-camera']);
|
const timelinePanModeSchema = z.enum(['pan', 'seek', 'seek-in-media', 'seek-in-camera']);
|
||||||
export type TimelinePanMode = z.infer<typeof timelinePanModeSchema>;
|
export type TimelinePanMode = z.infer<typeof timelinePanModeSchema>;
|
||||||
|
|
||||||
|
const timelineFormatSchema = z.object({
|
||||||
|
'24h': z.boolean().optional().default(timelineCoreConfigDefault.format['24h']),
|
||||||
|
});
|
||||||
|
|
||||||
const timelineCoreConfigSchema = z.object({
|
const timelineCoreConfigSchema = z.object({
|
||||||
clustering_threshold: z
|
clustering_threshold: z
|
||||||
.number()
|
.number()
|
||||||
@@ -1085,6 +1092,7 @@ const timelineCoreConfigSchema = z.object({
|
|||||||
.default(timelineCoreConfigDefault.show_recordings),
|
.default(timelineCoreConfigDefault.show_recordings),
|
||||||
style: z.enum(['stack', 'ribbon']).optional().default(timelineCoreConfigDefault.style),
|
style: z.enum(['stack', 'ribbon']).optional().default(timelineCoreConfigDefault.style),
|
||||||
pan_mode: timelinePanModeSchema.optional().default(timelineCoreConfigDefault.pan_mode),
|
pan_mode: timelinePanModeSchema.optional().default(timelineCoreConfigDefault.pan_mode),
|
||||||
|
format: timelineFormatSchema.optional().default(timelineCoreConfigDefault.format),
|
||||||
});
|
});
|
||||||
export type TimelineCoreConfig = z.infer<typeof timelineCoreConfigSchema>;
|
export type TimelineCoreConfig = z.infer<typeof timelineCoreConfigSchema>;
|
||||||
|
|
||||||
|
|||||||
@@ -224,6 +224,8 @@ export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD =
|
|||||||
`${CONF_MEDIA_VIEWER}.controls.timeline.clustering_threshold` as const;
|
`${CONF_MEDIA_VIEWER}.controls.timeline.clustering_threshold` as const;
|
||||||
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE =
|
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE =
|
||||||
`${CONF_MEDIA_VIEWER}.controls.timeline.events_media_type` as const;
|
`${CONF_MEDIA_VIEWER}.controls.timeline.events_media_type` as const;
|
||||||
|
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_FORMAT_24H =
|
||||||
|
`${CONF_MEDIA_VIEWER}.controls.timeline.format.24h` as const;
|
||||||
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_MODE =
|
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_MODE =
|
||||||
`${CONF_MEDIA_VIEWER}.controls.timeline.mode` as const;
|
`${CONF_MEDIA_VIEWER}.controls.timeline.mode` as const;
|
||||||
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_PAN_MODE =
|
export const CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_PAN_MODE =
|
||||||
@@ -277,6 +279,8 @@ export const CONF_LIVE_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD =
|
|||||||
`${CONF_LIVE}.controls.timeline.clustering_threshold` as const;
|
`${CONF_LIVE}.controls.timeline.clustering_threshold` as const;
|
||||||
export const CONF_LIVE_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE =
|
export const CONF_LIVE_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE =
|
||||||
`${CONF_LIVE}.controls.timeline.events_media_type` as const;
|
`${CONF_LIVE}.controls.timeline.events_media_type` as const;
|
||||||
|
export const CONF_LIVE_CONTROLS_TIMELINE_FORMAT_24H =
|
||||||
|
`${CONF_LIVE}.controls.timeline.format.24h` as const;
|
||||||
export const CONF_LIVE_CONTROLS_TIMELINE_MODE =
|
export const CONF_LIVE_CONTROLS_TIMELINE_MODE =
|
||||||
`${CONF_LIVE}.controls.timeline.mode` as const;
|
`${CONF_LIVE}.controls.timeline.mode` as const;
|
||||||
export const CONF_LIVE_CONTROLS_TIMELINE_PAN_MODE =
|
export const CONF_LIVE_CONTROLS_TIMELINE_PAN_MODE =
|
||||||
@@ -322,6 +326,7 @@ export const CONF_TIMELINE_CLUSTERING_THRESHOLD =
|
|||||||
`${CONF_TIMELINE}.clustering_threshold` as const;
|
`${CONF_TIMELINE}.clustering_threshold` as const;
|
||||||
export const CONF_TIMELINE_EVENTS_MEDIA_TYPE =
|
export const CONF_TIMELINE_EVENTS_MEDIA_TYPE =
|
||||||
`${CONF_TIMELINE}.events_media_type` as const;
|
`${CONF_TIMELINE}.events_media_type` as const;
|
||||||
|
export const CONF_TIMELINE_FORMAT_24H = `${CONF_TIMELINE}.format.24h` as const;
|
||||||
export const CONF_TIMELINE_SHOW_RECORDINGS = `${CONF_TIMELINE}.show_recordings` as const;
|
export const CONF_TIMELINE_SHOW_RECORDINGS = `${CONF_TIMELINE}.show_recordings` as const;
|
||||||
export const CONF_TIMELINE_STYLE = `${CONF_TIMELINE}.style` as const;
|
export const CONF_TIMELINE_STYLE = `${CONF_TIMELINE}.style` as const;
|
||||||
export const CONF_TIMELINE_CONTROLS_THUMBNAILS_MODE =
|
export const CONF_TIMELINE_CONTROLS_THUMBNAILS_MODE =
|
||||||
|
|||||||
+32
-2
@@ -120,6 +120,7 @@ import {
|
|||||||
CONF_LIVE_CONTROLS_THUMBNAILS_SIZE,
|
CONF_LIVE_CONTROLS_THUMBNAILS_SIZE,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
CONF_LIVE_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
CONF_LIVE_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
||||||
|
CONF_LIVE_CONTROLS_TIMELINE_FORMAT_24H,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_MODE,
|
CONF_LIVE_CONTROLS_TIMELINE_MODE,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_PAN_MODE,
|
CONF_LIVE_CONTROLS_TIMELINE_PAN_MODE,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
CONF_LIVE_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
||||||
@@ -160,6 +161,7 @@ import {
|
|||||||
CONF_MEDIA_VIEWER_CONTROLS_THUMBNAILS_SIZE,
|
CONF_MEDIA_VIEWER_CONTROLS_THUMBNAILS_SIZE,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
||||||
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_FORMAT_24H,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_MODE,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_MODE,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_PAN_MODE,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_PAN_MODE,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
||||||
@@ -200,6 +202,7 @@ import {
|
|||||||
CONF_TIMELINE_CONTROLS_THUMBNAILS_SHOW_TIMELINE_CONTROL,
|
CONF_TIMELINE_CONTROLS_THUMBNAILS_SHOW_TIMELINE_CONTROL,
|
||||||
CONF_TIMELINE_CONTROLS_THUMBNAILS_SIZE,
|
CONF_TIMELINE_CONTROLS_THUMBNAILS_SIZE,
|
||||||
CONF_TIMELINE_EVENTS_MEDIA_TYPE,
|
CONF_TIMELINE_EVENTS_MEDIA_TYPE,
|
||||||
|
CONF_TIMELINE_FORMAT_24H,
|
||||||
CONF_TIMELINE_SHOW_RECORDINGS,
|
CONF_TIMELINE_SHOW_RECORDINGS,
|
||||||
CONF_TIMELINE_STYLE,
|
CONF_TIMELINE_STYLE,
|
||||||
CONF_TIMELINE_WINDOW_SECONDS,
|
CONF_TIMELINE_WINDOW_SECONDS,
|
||||||
@@ -278,6 +281,7 @@ const MENU_OPTIONS = 'options';
|
|||||||
const MENU_PERFORMANCE_FEATURES = 'performance.features';
|
const MENU_PERFORMANCE_FEATURES = 'performance.features';
|
||||||
const MENU_PERFORMANCE_STYLE = 'performance.style';
|
const MENU_PERFORMANCE_STYLE = 'performance.style';
|
||||||
const MENU_STATUS_BAR_ITEMS = 'status_bar.items';
|
const MENU_STATUS_BAR_ITEMS = 'status_bar.items';
|
||||||
|
const MENU_TIMELINE_FORMAT = 'timeline.format';
|
||||||
const MENU_TIMELINE_CONTROLS_THUMBNAILS = 'timeline.controls.thumbnails';
|
const MENU_TIMELINE_CONTROLS_THUMBNAILS = 'timeline.controls.thumbnails';
|
||||||
const MENU_VIEW_DEFAULT_RESET = 'view.default_reset';
|
const MENU_VIEW_DEFAULT_RESET = 'view.default_reset';
|
||||||
const MENU_VIEW_KEYBOARD_SHORTCUTS = 'view.keyboard_shortcuts';
|
const MENU_VIEW_KEYBOARD_SHORTCUTS = 'view.keyboard_shortcuts';
|
||||||
@@ -1535,12 +1539,15 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
* @returns A rendered template.
|
* @returns A rendered template.
|
||||||
*/
|
*/
|
||||||
protected _renderTimelineCoreControls(
|
protected _renderTimelineCoreControls(
|
||||||
|
domain: string,
|
||||||
configPathStyle: string,
|
configPathStyle: string,
|
||||||
configPathWindowSeconds: string,
|
configPathWindowSeconds: string,
|
||||||
configPathClusteringThreshold: string,
|
configPathClusteringThreshold: string,
|
||||||
configPathTimelineEventsMediaType: string,
|
configPathTimelineEventsMediaType: string,
|
||||||
configPathShowRecordings: string,
|
configPathShowRecordings: string,
|
||||||
|
configPathFormat24h: string,
|
||||||
defaultShowRecordings: boolean,
|
defaultShowRecordings: boolean,
|
||||||
|
defaultFormat24h: boolean,
|
||||||
configPathPanMode?: string,
|
configPathPanMode?: string,
|
||||||
): TemplateResult {
|
): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
@@ -1568,6 +1575,17 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
${this._renderSwitch(configPathShowRecordings, defaultShowRecordings, {
|
${this._renderSwitch(configPathShowRecordings, defaultShowRecordings, {
|
||||||
label: localize(`config.common.${CONF_TIMELINE_SHOW_RECORDINGS}`),
|
label: localize(`config.common.${CONF_TIMELINE_SHOW_RECORDINGS}`),
|
||||||
})}
|
})}
|
||||||
|
${this._putInSubmenu(
|
||||||
|
`${domain}.format`,
|
||||||
|
true,
|
||||||
|
'config.common.controls.timeline.format.editor_label',
|
||||||
|
'mdi:clock-edit',
|
||||||
|
html`
|
||||||
|
${this._renderSwitch(configPathFormat24h, defaultFormat24h, {
|
||||||
|
label: localize('config.common.controls.timeline.format.24h'),
|
||||||
|
})}
|
||||||
|
`,
|
||||||
|
)}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1588,7 +1606,9 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
configPathClusteringThreshold: string,
|
configPathClusteringThreshold: string,
|
||||||
configPathTimelineEventsMediaType: string,
|
configPathTimelineEventsMediaType: string,
|
||||||
configPathShowRecordings: string,
|
configPathShowRecordings: string,
|
||||||
showRecordingsDefault: boolean,
|
configPathFormat24h: string,
|
||||||
|
defaultShowRecordings: boolean,
|
||||||
|
defaultFormat24h: boolean,
|
||||||
configPathPanMode: string,
|
configPathPanMode: string,
|
||||||
): TemplateResult | void {
|
): TemplateResult | void {
|
||||||
return this._putInSubmenu(
|
return this._putInSubmenu(
|
||||||
@@ -1600,12 +1620,15 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
label: localize('config.common.controls.timeline.mode'),
|
label: localize('config.common.controls.timeline.mode'),
|
||||||
})}
|
})}
|
||||||
${this._renderTimelineCoreControls(
|
${this._renderTimelineCoreControls(
|
||||||
|
domain,
|
||||||
configPathStyle,
|
configPathStyle,
|
||||||
configPathWindowSeconds,
|
configPathWindowSeconds,
|
||||||
configPathClusteringThreshold,
|
configPathClusteringThreshold,
|
||||||
configPathTimelineEventsMediaType,
|
configPathTimelineEventsMediaType,
|
||||||
configPathShowRecordings,
|
configPathShowRecordings,
|
||||||
showRecordingsDefault,
|
configPathFormat24h,
|
||||||
|
defaultShowRecordings,
|
||||||
|
defaultFormat24h,
|
||||||
configPathPanMode,
|
configPathPanMode,
|
||||||
)}`,
|
)}`,
|
||||||
);
|
);
|
||||||
@@ -2722,7 +2745,9 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
CONF_LIVE_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
CONF_LIVE_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
CONF_LIVE_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
CONF_LIVE_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
||||||
|
CONF_LIVE_CONTROLS_TIMELINE_FORMAT_24H,
|
||||||
this._defaults.live.controls.timeline.show_recordings,
|
this._defaults.live.controls.timeline.show_recordings,
|
||||||
|
this._defaults.live.controls.timeline.format['24h'],
|
||||||
CONF_LIVE_CONTROLS_TIMELINE_PAN_MODE,
|
CONF_LIVE_CONTROLS_TIMELINE_PAN_MODE,
|
||||||
)}
|
)}
|
||||||
${this._putInSubmenu(
|
${this._putInSubmenu(
|
||||||
@@ -2904,7 +2929,9 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_CLUSTERING_THRESHOLD,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_EVENTS_MEDIA_TYPE,
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_SHOW_RECORDINGS,
|
||||||
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_FORMAT_24H,
|
||||||
this._defaults.media_viewer.controls.timeline.show_recordings,
|
this._defaults.media_viewer.controls.timeline.show_recordings,
|
||||||
|
this._defaults.media_viewer.controls.timeline.format['24h'],
|
||||||
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_PAN_MODE,
|
CONF_MEDIA_VIEWER_CONTROLS_TIMELINE_PAN_MODE,
|
||||||
)}
|
)}
|
||||||
`,
|
`,
|
||||||
@@ -2927,12 +2954,15 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
${this._expandedMenus[MENU_OPTIONS] === 'timeline'
|
${this._expandedMenus[MENU_OPTIONS] === 'timeline'
|
||||||
? html` <div class="values">
|
? html` <div class="values">
|
||||||
${this._renderTimelineCoreControls(
|
${this._renderTimelineCoreControls(
|
||||||
|
MENU_TIMELINE_FORMAT,
|
||||||
CONF_TIMELINE_STYLE,
|
CONF_TIMELINE_STYLE,
|
||||||
CONF_TIMELINE_WINDOW_SECONDS,
|
CONF_TIMELINE_WINDOW_SECONDS,
|
||||||
CONF_TIMELINE_CLUSTERING_THRESHOLD,
|
CONF_TIMELINE_CLUSTERING_THRESHOLD,
|
||||||
CONF_TIMELINE_EVENTS_MEDIA_TYPE,
|
CONF_TIMELINE_EVENTS_MEDIA_TYPE,
|
||||||
CONF_TIMELINE_SHOW_RECORDINGS,
|
CONF_TIMELINE_SHOW_RECORDINGS,
|
||||||
|
CONF_TIMELINE_FORMAT_24H,
|
||||||
this._defaults.timeline.show_recordings,
|
this._defaults.timeline.show_recordings,
|
||||||
|
this._defaults.timeline.format['24h'],
|
||||||
)}
|
)}
|
||||||
${this._renderThumbnailsControls(
|
${this._renderThumbnailsControls(
|
||||||
MENU_TIMELINE_CONTROLS_THUMBNAILS,
|
MENU_TIMELINE_CONTROLS_THUMBNAILS,
|
||||||
|
|||||||
@@ -231,6 +231,10 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"editor_label": "Mini cronologia",
|
"editor_label": "Mini cronologia",
|
||||||
|
"format": {
|
||||||
|
"24h": "",
|
||||||
|
"editor_label": ""
|
||||||
|
},
|
||||||
"mode": "Mode",
|
"mode": "Mode",
|
||||||
"modes": {
|
"modes": {
|
||||||
"above": "A dalt",
|
"above": "A dalt",
|
||||||
|
|||||||
@@ -231,6 +231,10 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"editor_label": "Mini Timeline",
|
"editor_label": "Mini Timeline",
|
||||||
|
"format": {
|
||||||
|
"editor_label": "Time & date format",
|
||||||
|
"24h": "Use 24-hour clock"
|
||||||
|
},
|
||||||
"mode": "Mode",
|
"mode": "Mode",
|
||||||
"modes": {
|
"modes": {
|
||||||
"above": "Above",
|
"above": "Above",
|
||||||
|
|||||||
@@ -231,6 +231,10 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"editor_label": "Mini-chronologie",
|
"editor_label": "Mini-chronologie",
|
||||||
|
"format": {
|
||||||
|
"24h": "",
|
||||||
|
"editor_label": ""
|
||||||
|
},
|
||||||
"mode": "Mode",
|
"mode": "Mode",
|
||||||
"modes": {
|
"modes": {
|
||||||
"above": "Au-dessus",
|
"above": "Au-dessus",
|
||||||
|
|||||||
@@ -231,6 +231,10 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"editor_label": "Mini Cronologia",
|
"editor_label": "Mini Cronologia",
|
||||||
|
"format": {
|
||||||
|
"24h": "",
|
||||||
|
"editor_label": ""
|
||||||
|
},
|
||||||
"mode": "Modalità",
|
"mode": "Modalità",
|
||||||
"modes": {
|
"modes": {
|
||||||
"above": "sopra",
|
"above": "sopra",
|
||||||
|
|||||||
@@ -231,6 +231,10 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"editor_label": "Controles da linha do tempo",
|
"editor_label": "Controles da linha do tempo",
|
||||||
|
"format": {
|
||||||
|
"24h": "",
|
||||||
|
"editor_label": ""
|
||||||
|
},
|
||||||
"mode": "Modo",
|
"mode": "Modo",
|
||||||
"modes": {
|
"modes": {
|
||||||
"above": "Acima",
|
"above": "Acima",
|
||||||
|
|||||||
@@ -231,6 +231,10 @@
|
|||||||
},
|
},
|
||||||
"timeline": {
|
"timeline": {
|
||||||
"editor_label": "Controles de linha do tempo",
|
"editor_label": "Controles de linha do tempo",
|
||||||
|
"format": {
|
||||||
|
"24h": "",
|
||||||
|
"editor_label": ""
|
||||||
|
},
|
||||||
"mode": "Modo",
|
"mode": "Modo",
|
||||||
"modes": {
|
"modes": {
|
||||||
"above": "Por cima",
|
"above": "Por cima",
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ describe('config defaults', () => {
|
|||||||
timeline: {
|
timeline: {
|
||||||
clustering_threshold: 3,
|
clustering_threshold: 3,
|
||||||
events_media_type: 'all',
|
events_media_type: 'all',
|
||||||
|
format: {
|
||||||
|
'24h': true,
|
||||||
|
},
|
||||||
mode: 'none',
|
mode: 'none',
|
||||||
pan_mode: 'pan',
|
pan_mode: 'pan',
|
||||||
show_recordings: true,
|
show_recordings: true,
|
||||||
@@ -170,6 +173,9 @@ describe('config defaults', () => {
|
|||||||
timeline: {
|
timeline: {
|
||||||
clustering_threshold: 3,
|
clustering_threshold: 3,
|
||||||
events_media_type: 'all',
|
events_media_type: 'all',
|
||||||
|
format: {
|
||||||
|
'24h': true,
|
||||||
|
},
|
||||||
mode: 'none',
|
mode: 'none',
|
||||||
pan_mode: 'pan',
|
pan_mode: 'pan',
|
||||||
show_recordings: true,
|
show_recordings: true,
|
||||||
@@ -324,6 +330,9 @@ describe('config defaults', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
events_media_type: 'all',
|
events_media_type: 'all',
|
||||||
|
format: {
|
||||||
|
'24h': true,
|
||||||
|
},
|
||||||
pan_mode: 'pan',
|
pan_mode: 'pan',
|
||||||
show_recordings: true,
|
show_recordings: true,
|
||||||
style: 'stack',
|
style: 'stack',
|
||||||
|
|||||||
Reference in New Issue
Block a user