Add support for more advanced forms of overriding

This commit is contained in:
Dermot Duffy
2024-04-13 18:23:11 -07:00
parent 0eca5d780c
commit 323925101d
21 changed files with 855 additions and 285 deletions
+50 -7
View File
@@ -420,7 +420,7 @@ describe('should handle version specific upgrades', () => {
media_loaded: true,
},
],
overrides: {
merge: {
view: {
default: 'clips',
},
@@ -489,7 +489,7 @@ describe('should handle version specific upgrades', () => {
overrides: [
{
conditions: {},
overrides: {
merge: {
menu: {
buttons: {
camera_ui: {
@@ -1872,7 +1872,7 @@ describe('should handle version specific upgrades', () => {
views: ['clips', 'snapshots'],
},
],
overrides: {
merge: {
view: {
default: 'clips',
},
@@ -1987,7 +1987,7 @@ describe('should handle version specific upgrades', () => {
cameras: ['camera_1', 'camera_2'],
},
],
overrides: {
merge: {
view: {
default: 'clips',
},
@@ -2107,7 +2107,7 @@ describe('should handle version specific upgrades', () => {
[condition]: true,
},
],
overrides: {
merge: {
view: {
default: 'clips',
},
@@ -2255,7 +2255,7 @@ describe('should handle version specific upgrades', () => {
state_not: 'off',
},
],
overrides: {
merge: {
view: {
default: 'clips',
},
@@ -2387,7 +2387,7 @@ describe('should handle version specific upgrades', () => {
media_query: 'query',
},
],
overrides: {
merge: {
view: {
default: 'clips',
},
@@ -2497,5 +2497,48 @@ describe('should handle version specific upgrades', () => {
});
});
});
it('from overrides to merge', () => {
const config = {
type: 'custom:frigate-card',
cameras: [],
overrides: [
{
conditions: [
{
condition: 'view',
view: ['clips'],
},
],
overrides: {
menu: {
style: 'hidden',
},
},
},
],
};
expect(upgradeConfig(config)).toBeTruthy();
expect(config).toEqual({
type: 'custom:frigate-card',
cameras: [],
overrides: [
{
conditions: [
{
condition: 'view',
view: ['clips'],
},
],
merge: {
menu: {
style: 'hidden',
},
},
},
],
});
});
});
});
+1 -1
View File
@@ -25,7 +25,7 @@ describe('setProfiles', () => {
it('should handle profiles', () => {
const input = {
type: 'frigate-hass-card',
cameras: [],
cameras: [{}],
live: {
controls: {
timeline: {
+2 -2
View File
@@ -12,7 +12,7 @@ import { createConfig } from '../test-utils';
describe('config defaults', () => {
it('should be as expected', () => {
expect(createConfig()).toEqual({
cameras: [],
cameras: [{}],
cameras_global: {
dependencies: {
all_cameras: false,
@@ -453,7 +453,7 @@ describe('should handle custom frigate elements', () => {
it('should not require title controls to specify all options', () => {
expect(
createConfig({
cameras: [],
cameras: [{}],
live: {
controls: {
title: {