feat: Rename the card to advanced-camera-card (#1873)
Whilst the Frigate support in this card is the best among camera engines, the name incorrectly suggests that Frigate is a requirement. Instead, to broaden the appeal, change to more camera agnostic name. This does not suggest any change in priority, role or support for Frigate. This change is likely to be bug prone, due to the size of the rename -- the code contains 1500+ references to "Frigate" most of which make sense to rename, some which do not, all of which needed human assessment. - Closes #1298 BREAKING CHANGE: References to `frigate-card` in all kinds of configuration need to be updated to `advanced-camera-card`. An automated config upgrade should take care of the majority of usecases (click `Edit -> Upgrade -> Save`), though may not be perfect.
This commit is contained in:
+656
-498
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { setProfiles } from '../../../src/config/profiles';
|
||||
import { frigateCardConfigSchema } from '../../../src/config/types';
|
||||
import { createRawConfig } from '../../test-utils';
|
||||
import { CASTING_PROFILE } from '../../../src/config/profiles/casting';
|
||||
import { advancedCameraCardConfigSchema } from '../../../src/config/types';
|
||||
import { createRawConfig } from '../../test-utils';
|
||||
|
||||
it('should contain expected defaults', () => {
|
||||
expect(CASTING_PROFILE).toEqual({
|
||||
@@ -23,11 +23,11 @@ it('should contain expected defaults', () => {
|
||||
|
||||
it('should be parseable after application', () => {
|
||||
const rawInputConfig = createRawConfig();
|
||||
const parsedConfig = frigateCardConfigSchema.parse(rawInputConfig);
|
||||
const parsedConfig = advancedCameraCardConfigSchema.parse(rawInputConfig);
|
||||
|
||||
setProfiles(rawInputConfig, parsedConfig, ['casting']);
|
||||
|
||||
// Reparse the config to ensure the profile did not introduce errors.
|
||||
const parseResult = frigateCardConfigSchema.safeParse(parsedConfig);
|
||||
const parseResult = advancedCameraCardConfigSchema.safeParse(parsedConfig);
|
||||
expect(parseResult.success, parseResult.error?.toString()).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('setProfiles', () => {
|
||||
|
||||
it('should handle profiles', () => {
|
||||
const input = {
|
||||
type: 'frigate-hass-card',
|
||||
type: 'custom:advanced-camera-card',
|
||||
cameras: [{}],
|
||||
live: {
|
||||
controls: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { setProfiles } from '../../../src/config/profiles';
|
||||
import { LOW_PERFORMANCE_PROFILE } from '../../../src/config/profiles/low-performance';
|
||||
import { frigateCardConfigSchema } from '../../../src/config/types';
|
||||
import { advancedCameraCardConfigSchema } from '../../../src/config/types';
|
||||
import { createRawConfig } from '../../test-utils';
|
||||
|
||||
it('should contain expected defaults', () => {
|
||||
@@ -37,7 +37,7 @@ it('should contain expected defaults', () => {
|
||||
'media_viewer.draggable': false,
|
||||
'media_viewer.snapshot_click_plays_clip': false,
|
||||
'media_viewer.transition_effect': 'none',
|
||||
'menu.buttons.frigate.enabled': false,
|
||||
'menu.buttons.iris.enabled': false,
|
||||
'menu.buttons.media_player.enabled': false,
|
||||
'menu.buttons.timeline.enabled': false,
|
||||
'menu.style': 'outside',
|
||||
@@ -60,11 +60,11 @@ it('should contain expected defaults', () => {
|
||||
|
||||
it('should be parseable after application', () => {
|
||||
const rawInputConfig = createRawConfig();
|
||||
const parsedConfig = frigateCardConfigSchema.parse(rawInputConfig);
|
||||
const parsedConfig = advancedCameraCardConfigSchema.parse(rawInputConfig);
|
||||
|
||||
setProfiles(rawInputConfig, parsedConfig, ['low-performance']);
|
||||
|
||||
// Reparse the config to ensure the profile did not introduce errors.
|
||||
const parseResult = frigateCardConfigSchema.safeParse(parsedConfig);
|
||||
const parseResult = advancedCameraCardConfigSchema.safeParse(parsedConfig);
|
||||
expect(parseResult.success, parseResult.error?.toString()).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { SCRUBBING_PROFILE } from '../../../src/config/profiles/scrubbing';
|
||||
import { setProfiles } from '../../../src/config/profiles';
|
||||
import { frigateCardConfigSchema } from '../../../src/config/types';
|
||||
import { SCRUBBING_PROFILE } from '../../../src/config/profiles/scrubbing';
|
||||
import { advancedCameraCardConfigSchema } from '../../../src/config/types';
|
||||
import { createRawConfig } from '../../test-utils';
|
||||
|
||||
it('should contain expected defaults', () => {
|
||||
@@ -17,11 +17,11 @@ it('should contain expected defaults', () => {
|
||||
|
||||
it('should be parseable after application', () => {
|
||||
const rawInputConfig = createRawConfig();
|
||||
const parsedConfig = frigateCardConfigSchema.parse(rawInputConfig);
|
||||
const parsedConfig = advancedCameraCardConfigSchema.parse(rawInputConfig);
|
||||
|
||||
setProfiles(rawInputConfig, parsedConfig, ['low-performance']);
|
||||
|
||||
// Reparse the config to ensure the profile did not introduce errors.
|
||||
const parseResult = frigateCardConfigSchema.safeParse(parsedConfig);
|
||||
const parseResult = advancedCameraCardConfigSchema.safeParse(parsedConfig);
|
||||
expect(parseResult.success, parseResult.error?.toString()).toBeTruthy();
|
||||
});
|
||||
|
||||
+21
-21
@@ -4,9 +4,9 @@ import {
|
||||
conditionalSchema,
|
||||
customSchema,
|
||||
dimensionsConfigSchema,
|
||||
frigateCardConditionSchema,
|
||||
frigateCardCustomActionsBaseSchema,
|
||||
frigateCardCustomActionSchema,
|
||||
advancedCameraCardConditionSchema,
|
||||
advancedCameraCardCustomActionsBaseSchema,
|
||||
advancedCameraCardCustomActionSchema,
|
||||
} from '../../src/config/types';
|
||||
import { createConfig } from '../test-utils';
|
||||
|
||||
@@ -217,10 +217,6 @@ describe('config defaults', () => {
|
||||
enabled: false,
|
||||
priority: 50,
|
||||
},
|
||||
frigate: {
|
||||
enabled: true,
|
||||
priority: 50,
|
||||
},
|
||||
fullscreen: {
|
||||
enabled: true,
|
||||
priority: 50,
|
||||
@@ -229,6 +225,10 @@ describe('config defaults', () => {
|
||||
enabled: false,
|
||||
priority: 50,
|
||||
},
|
||||
iris: {
|
||||
enabled: true,
|
||||
priority: 50,
|
||||
},
|
||||
live: {
|
||||
enabled: true,
|
||||
priority: 50,
|
||||
@@ -338,7 +338,7 @@ describe('config defaults', () => {
|
||||
style: 'stack',
|
||||
window_seconds: 3600,
|
||||
},
|
||||
type: 'frigate-hass-card',
|
||||
type: 'advanced-camera-card',
|
||||
view: {
|
||||
camera_select: 'current',
|
||||
default: 'live',
|
||||
@@ -416,7 +416,7 @@ it('should transform dimensions.aspect_ratio', () => {
|
||||
describe('should refine user_agent_re conditions', () => {
|
||||
it('should successfully parse valid user_agent_re condition', () => {
|
||||
expect(
|
||||
frigateCardConditionSchema.parse({
|
||||
advancedCameraCardConditionSchema.parse({
|
||||
condition: 'user_agent',
|
||||
user_agent_re: 'Chrome/',
|
||||
}),
|
||||
@@ -428,7 +428,7 @@ describe('should refine user_agent_re conditions', () => {
|
||||
|
||||
it('should reject invalid user_agent_re conditions', () => {
|
||||
expect(() =>
|
||||
frigateCardConditionSchema.parse({
|
||||
advancedCameraCardConditionSchema.parse({
|
||||
condition: 'user_agent',
|
||||
user_agent_re: '[',
|
||||
}),
|
||||
@@ -438,15 +438,15 @@ describe('should refine user_agent_re conditions', () => {
|
||||
|
||||
it('should transform action', () => {
|
||||
expect(
|
||||
frigateCardCustomActionsBaseSchema.parse({
|
||||
action: 'custom:frigate-card-action',
|
||||
advancedCameraCardCustomActionsBaseSchema.parse({
|
||||
action: 'custom:advanced-camera-card-action',
|
||||
}),
|
||||
).toEqual({
|
||||
action: 'fire-dom-event',
|
||||
});
|
||||
});
|
||||
|
||||
describe('should convert webrtc card PTZ to Frigate card PTZ', () => {
|
||||
describe('should convert webrtc card PTZ to Advanced Camera Card PTZ', () => {
|
||||
describe('relative actions', () => {
|
||||
it.each([
|
||||
['left' as const],
|
||||
@@ -632,29 +632,29 @@ describe('should lazy evaluate schemas', () => {
|
||||
it('status bar actions', () => {
|
||||
const input = {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'status_bar',
|
||||
advanced_camera_card_action: 'status_bar',
|
||||
status_bar_action: 'reset',
|
||||
items: [
|
||||
{
|
||||
type: 'custom:frigate-card-status-bar-string',
|
||||
type: 'custom:advanced-camera-card-status-bar-string',
|
||||
string: 'Item',
|
||||
},
|
||||
],
|
||||
};
|
||||
expect(frigateCardCustomActionSchema.parse(input)).toEqual(input);
|
||||
expect(advancedCameraCardCustomActionSchema.parse(input)).toEqual(input);
|
||||
});
|
||||
});
|
||||
|
||||
describe('should handle custom frigate elements', () => {
|
||||
it('should add custom error on frigate entry', () => {
|
||||
describe('should handle custom advanced camera card elements', () => {
|
||||
it('should add custom error on advanced camera card element', () => {
|
||||
const result = customSchema.safeParse({
|
||||
type: 'custom:frigate-card-foo',
|
||||
type: 'custom:advanced-camera-card-foo',
|
||||
});
|
||||
expect(result.success).toBeFalsy();
|
||||
if (!result.success) {
|
||||
expect(result.error.errors[0]).toEqual({
|
||||
code: 'custom',
|
||||
message: 'Frigate-card custom elements must match specific schemas',
|
||||
message: 'advanced-camera-card custom elements must match specific schemas',
|
||||
fatal: true,
|
||||
path: ['type'],
|
||||
});
|
||||
@@ -669,7 +669,7 @@ describe('should handle custom frigate elements', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// https://github.com/dermotduffy/frigate-hass-card/issues/1280
|
||||
// https://github.com/dermotduffy/advanced-camera-card/issues/1280
|
||||
it('should not require title controls to specify all options', () => {
|
||||
expect(
|
||||
createConfig({
|
||||
|
||||
Reference in New Issue
Block a user