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:
+7
-7
@@ -9,23 +9,23 @@ import isEqualWith from 'lodash-es/isEqualWith';
|
||||
import mergeWith from 'lodash-es/mergeWith';
|
||||
import round from 'lodash-es/round';
|
||||
import uniq from 'lodash-es/uniq';
|
||||
import { FrigateCardError } from '../types';
|
||||
import { AdvancedCameraCardError } from '../types';
|
||||
|
||||
export type ModifyInterface<T, R> = Omit<T, keyof R> & R;
|
||||
|
||||
/**
|
||||
* Dispatch a Frigate Card event.
|
||||
* Dispatch an Advanced Camera Card event.
|
||||
* @param target The target from which send the event.
|
||||
* @param name The name of the Frigate card event to send.
|
||||
* @param name The name of the Advanced Camera Card event to send.
|
||||
* @param detail An optional detail object to attach.
|
||||
*/
|
||||
export function dispatchFrigateCardEvent<T>(
|
||||
export function dispatchAdvancedCameraCardEvent<T>(
|
||||
target: EventTarget,
|
||||
name: string,
|
||||
detail?: T,
|
||||
): void {
|
||||
target.dispatchEvent(
|
||||
new CustomEvent<T>(`frigate-card:${name}`, {
|
||||
new CustomEvent<T>(`advanced-camera-card:${name}`, {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: detail,
|
||||
@@ -35,7 +35,7 @@ export function dispatchFrigateCardEvent<T>(
|
||||
|
||||
/**
|
||||
* Prettify a title by converting '_' to spaces and capitalizing words.
|
||||
* @param input The input Frigate (camera/label/zone) name.
|
||||
* @param input The input string.
|
||||
* @returns A prettified name.
|
||||
*/
|
||||
export function prettifyTitle(input: string): string;
|
||||
@@ -108,7 +108,7 @@ export function errorToConsole(
|
||||
e: Error | { message: unknown } | string,
|
||||
func: CallableFunction = console.warn,
|
||||
): void {
|
||||
if (e instanceof FrigateCardError && e.context) {
|
||||
if (e instanceof AdvancedCameraCardError && e.context) {
|
||||
func(e, e.context);
|
||||
} else if (typeof e === 'object' && 'message' in e) {
|
||||
func(e.message);
|
||||
|
||||
Reference in New Issue
Block a user