Add new method of casting live cameras based on dashboards.

This commit is contained in:
Dermot Duffy
2023-10-09 22:04:59 -07:00
parent aa9d061331
commit bc71709cc8
10 changed files with 355 additions and 62 deletions
+39 -2
View File
@@ -23,16 +23,53 @@ export class QueryStringManager {
public executeNonViewRelated = (): void => {
this._executeNonViewRelated(this._calculateIntent());
}
};
public executeViewRelated = (): void => {
this._executeViewRelated(this._calculateIntent());
}
};
public executeAll = (): void => {
const intent = this._calculateIntent();
this._executeViewRelated(intent);
this._executeNonViewRelated(intent);
};
public generateQueryString(action: FrigateCardCustomAction): string | null {
const baseKey =
'frigate-card-action.' + (action.card_id ? `${action.card_id}.` : '');
switch (action.frigate_card_action) {
case 'camera_select':
case 'live_substream_select':
return new URLSearchParams([
[baseKey + action.frigate_card_action, action.camera],
]).toString();
case 'camera_ui':
case 'clip':
case 'clips':
case 'default':
case 'diagnostics':
case 'download':
case 'expand':
case 'image':
case 'live':
case 'menu_toggle':
case 'recording':
case 'recordings':
case 'snapshot':
case 'snapshots':
case 'timeline':
return new URLSearchParams([
[baseKey + action.frigate_card_action, ''],
]).toString();
default:
console.warn(
`Frigate card cannot convert unsupported action to query string:`,
action,
);
}
return null;
}
protected _executeViewRelated(intent: QueryStringViewIntent): void {