Add new method of casting live cameras based on dashboards.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user