Rename view.timeout to view.timeout_seconds .
This commit is contained in:
@@ -26,9 +26,9 @@ export class CachedValueController<T> implements ReactiveController {
|
||||
protected _timerID?: number;
|
||||
|
||||
constructor(host: ReactiveControllerHost, timerSeconds: number, callback: () => T) {
|
||||
(this._host = host).addController(this);
|
||||
this._timerSeconds = timerSeconds;
|
||||
this._callback = callback;
|
||||
(this._host = host).addController(this);
|
||||
}
|
||||
|
||||
public removeController(): void {
|
||||
|
||||
+13
-3
@@ -20,7 +20,7 @@ import {
|
||||
CONF_MENU_MODE,
|
||||
CONF_OVERRIDES,
|
||||
CONF_VIEW_DEFAULT,
|
||||
CONF_VIEW_TIMEOUT,
|
||||
CONF_VIEW_TIMEOUT_SECONDS,
|
||||
CONF_VIEW_UPDATE_ENTITIES,
|
||||
} from './const';
|
||||
import { RawFrigateCardConfig, RawFrigateCardConfigArray } from './types';
|
||||
@@ -129,13 +129,22 @@ export const copyConfig = function (obj: RawFrigateCardConfig): RawFrigateCardCo
|
||||
|
||||
/**
|
||||
* Determines if a property is not an object.
|
||||
* @param value The property.
|
||||
* @param value The value.
|
||||
* @returns `true` is the value is not an object.
|
||||
*/
|
||||
const isNotObject = function (value: unknown) {
|
||||
return typeof value !== 'object' ? value : undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts to a number or return undefined.
|
||||
* @param value The value.
|
||||
* @returns A number or undefined.
|
||||
*/
|
||||
const toNumberOrIgnore = function (value: unknown) {
|
||||
return isNaN(value as number) ? undefined : Number(value)
|
||||
};
|
||||
|
||||
/**
|
||||
* Move a property from one location to another.
|
||||
* @param obj The configuration object in which the property resides.
|
||||
@@ -265,7 +274,7 @@ const UPGRADES = [
|
||||
upgradeMoveTo('label', 'frigate.label'),
|
||||
upgradeMoveTo('zone', 'frigate.zone'),
|
||||
upgradeMoveTo('view_default', CONF_VIEW_DEFAULT),
|
||||
upgradeMoveTo('view_timeout', CONF_VIEW_TIMEOUT),
|
||||
upgradeMoveTo('view_timeout', 'view.timeout'),
|
||||
upgradeMoveTo('live_provider', 'live.provider'),
|
||||
upgradeMoveTo('live_preload', CONF_LIVE_PRELOAD),
|
||||
upgradeMoveTo('webrtc', 'live.webrtc'),
|
||||
@@ -283,4 +292,5 @@ const UPGRADES = [
|
||||
// v2.1.0 -> v3.0.0
|
||||
upgradeToMultipleCameras(),
|
||||
updateMenuConditionToMenuOverride(),
|
||||
upgradeMoveTo('view.timeout', CONF_VIEW_TIMEOUT_SECONDS, toNumberOrIgnore),
|
||||
];
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export const CONF_CAMERAS_ARRAY_LIVE_PROVIDER = `${CONF_CAMERAS}.#.live_provider
|
||||
|
||||
export const CONF_VIEW = 'view' as const;
|
||||
export const CONF_VIEW_DEFAULT = `${CONF_VIEW}.default` as const;
|
||||
export const CONF_VIEW_TIMEOUT = `${CONF_VIEW}.timeout` as const;
|
||||
export const CONF_VIEW_TIMEOUT_SECONDS = `${CONF_VIEW}.timeout_seconds` 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;
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ import {
|
||||
CONF_MENU_BUTTON_SIZE,
|
||||
CONF_MENU_MODE,
|
||||
CONF_VIEW_DEFAULT,
|
||||
CONF_VIEW_TIMEOUT,
|
||||
CONF_VIEW_TIMEOUT_SECONDS,
|
||||
CONF_VIEW_UPDATE_FORCE,
|
||||
} from './const.js';
|
||||
import { arrayMove, getEntityTitle, prettifyFrigateName } from './common.js';
|
||||
@@ -657,7 +657,7 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
||||
? html`
|
||||
<div class="values">
|
||||
${this._renderDropdown(CONF_VIEW_DEFAULT, viewModes)}
|
||||
${this._renderStringInput(CONF_VIEW_TIMEOUT, 'number')}
|
||||
${this._renderStringInput(CONF_VIEW_TIMEOUT_SECONDS, 'number')}
|
||||
${this._renderSwitch(CONF_VIEW_UPDATE_FORCE, defaults.view.update_force)}
|
||||
</div>
|
||||
`
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"snapshots": "Snapshots gallery",
|
||||
"image": "Static image"
|
||||
},
|
||||
"timeout": "View timeout secs (before returning to default, 0=never)",
|
||||
"timeout_seconds": "View timeout seconds (before returning to default, 0=never)",
|
||||
"update_force": "Force card updates (ignore media playing / interaction)"
|
||||
},
|
||||
"event_gallery": {
|
||||
@@ -99,7 +99,7 @@
|
||||
},
|
||||
"image": {
|
||||
"src": "Static image URL/data for image view",
|
||||
"refresh_seconds": "Number of seconds after which to refresh"
|
||||
"refresh_seconds": "Number of seconds after which to refresh (0=never)"
|
||||
},
|
||||
"menu": {
|
||||
"buttons": {
|
||||
|
||||
+1
-10
@@ -371,16 +371,7 @@ const viewConfigSchema = z
|
||||
.enum(FRIGATE_CARD_VIEWS_USER_SPECIFIED)
|
||||
.optional()
|
||||
.default(viewConfigDefault.default),
|
||||
timeout: z
|
||||
.number()
|
||||
.or(
|
||||
z
|
||||
.string()
|
||||
.regex(/^\d+$/)
|
||||
.transform((val) => Number(val)),
|
||||
)
|
||||
.optional()
|
||||
.default(viewConfigDefault.timeout),
|
||||
timeout_seconds: z.number().default(viewConfigDefault.timeout),
|
||||
update_force: z.boolean().default(viewConfigDefault.update_force),
|
||||
update_entities: z.string().array().optional(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user