Rename several view variables for clarity.

This commit is contained in:
Dermot Duffy
2024-06-11 19:48:39 -07:00
parent f193f9925f
commit afb9af5eb4
40 changed files with 769 additions and 285 deletions
+17
View File
@@ -25,7 +25,11 @@ import {
CONF_OVERRIDES,
CONF_PROFILES,
CONF_TIMELINE_EVENTS_MEDIA_TYPE,
CONF_VIEW_DEFAULT_CYCLE_CAMERA,
CONF_VIEW_INTERACTION_SECONDS,
CONF_VIEW_DEFAULT_RESET_EVERY_SECONDS,
CONF_VIEW_DEFAULT_RESET_ENTITIES,
CONF_VIEW_DEFAULT_RESET_INTERACTION_MODE,
CONF_VIEW_TRIGGERS,
CONF_VIEW_TRIGGERS_ACTIONS_TRIGGER,
CONF_VIEW_TRIGGERS_ACTIONS_UNTRIGGER,
@@ -805,4 +809,17 @@ const UPGRADES = [
keepOriginal: true,
}),
upgradeWithOverrides('live.controls.ptz', ptzControlSettingsTransform),
upgradeMoveToWithOverrides('view.update_cycle_camera', CONF_VIEW_DEFAULT_CYCLE_CAMERA),
upgradeMoveToWithOverrides(
'view.update_force',
CONF_VIEW_DEFAULT_RESET_INTERACTION_MODE,
{
transform: (val) => (val === true ? 'all' : null),
},
),
upgradeMoveToWithOverrides(
'view.update_seconds',
CONF_VIEW_DEFAULT_RESET_EVERY_SECONDS,
),
upgradeMoveToWithOverrides('view.update_entities', CONF_VIEW_DEFAULT_RESET_ENTITIES),
];
+1 -1
View File
@@ -137,5 +137,5 @@ export const LOW_PERFORMANCE_PROFILE = {
[CONF_CAMERAS_GLOBAL_IMAGE_REFRESH_SECONDS]: 10,
// No trigger actions.
[CONF_VIEW_TRIGGERS_ACTIONS_TRIGGER]: 'none'
[CONF_VIEW_TRIGGERS_ACTIONS_TRIGGER]: 'none',
};
+26 -15
View File
@@ -1396,16 +1396,18 @@ const viewConfigDefault = {
default: FRIGATE_CARD_VIEW_DEFAULT,
camera_select: 'current' as const,
interaction_seconds: 300,
reset_after_interaction: true,
update_seconds: 0,
update_force: false,
update_cycle_camera: false,
default_reset: {
every_seconds: 0,
after_interaction: false,
entities: [],
interaction_mode: 'inactive' as const,
},
default_cycle_camera: false,
dark_mode: 'off' as const,
triggers: {
show_trigger_status: false,
filter_selected_camera: true,
actions: {
interaction_mode: 'inactive' as const,
trigger: 'update' as const,
untrigger: 'none' as const,
},
@@ -1414,12 +1416,13 @@ const viewConfigDefault = {
keyboard_shortcuts: keyboardShortcutsDefault,
};
const interactionModeSchema = z.enum(['all', 'inactive', 'active']).default('inactive');
export type InteractionMode = z.infer<typeof interactionModeSchema>;
export const triggersSchema = z.object({
actions: z
.object({
interaction_mode: z
.enum(['all', 'inactive', 'active'])
.default(viewConfigDefault.triggers.actions.interaction_mode),
interaction_mode: interactionModeSchema,
trigger: z
.enum(['default', 'live', 'media', 'none', 'update'])
.default(viewConfigDefault.triggers.actions.trigger),
@@ -1447,13 +1450,21 @@ const viewConfigSchema = z
.enum([...FRIGATE_CARD_VIEWS_USER_SPECIFIED, 'current'])
.default(viewConfigDefault.camera_select),
interaction_seconds: z.number().default(viewConfigDefault.interaction_seconds),
reset_after_interaction: z
.boolean()
.default(viewConfigDefault.reset_after_interaction),
update_seconds: z.number().default(viewConfigDefault.update_seconds),
update_force: z.boolean().default(viewConfigDefault.update_force),
update_cycle_camera: z.boolean().default(viewConfigDefault.update_cycle_camera),
update_entities: z.string().array().optional(),
default_cycle_camera: z.boolean().default(viewConfigDefault.default_cycle_camera),
default_reset: z
.object({
after_interaction: z
.boolean()
.default(viewConfigDefault.default_reset.after_interaction),
every_seconds: z.number().default(viewConfigDefault.default_reset.every_seconds),
entities: z.string().array().default(viewConfigDefault.default_reset.entities),
interaction_mode: interactionModeSchema.default(
viewConfigDefault.default_reset.interaction_mode,
),
})
.default(viewConfigDefault.default_reset),
render_entities: z.string().array().optional(),
dark_mode: z.enum(['on', 'off', 'auto']).optional(),
triggers: triggersSchema.default(viewConfigDefault.triggers),