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:
@@ -4,7 +4,7 @@ import {
|
||||
Interaction,
|
||||
InteractionName,
|
||||
} from '../../../src/card-controller/actions/actions-manager';
|
||||
import { FrigateCardView } from '../../../src/config/types';
|
||||
import { AdvancedCameraCardView } from '../../../src/config/types';
|
||||
import { createLogAction } from '../../../src/utils/action';
|
||||
import {
|
||||
createAction,
|
||||
@@ -114,7 +114,7 @@ describe('ActionsManager', () => {
|
||||
},
|
||||
],
|
||||
['timeline' as const, {}],
|
||||
])('%s', (viewName: FrigateCardView, result: Record<string, unknown>) => {
|
||||
])('%s', (viewName: AdvancedCameraCardView, result: Record<string, unknown>) => {
|
||||
const api = createCardAPI();
|
||||
vi.mocked(api.getViewManager().getView).mockReturnValue(
|
||||
createView({ view: viewName }),
|
||||
@@ -231,7 +231,7 @@ describe('ActionsManager', () => {
|
||||
|
||||
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
|
||||
await manager.handleActionExecutionRequestEvent(
|
||||
new CustomEvent('frigate-card:action:execution-request', {
|
||||
new CustomEvent('advanced-camera-card:action:execution-request', {
|
||||
detail: { action: createLogAction('Hello, world!') },
|
||||
}),
|
||||
);
|
||||
@@ -266,7 +266,7 @@ describe('ActionsManager', () => {
|
||||
const promise = manager.executeActions([
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
createAction({
|
||||
frigate_card_action: 'sleep',
|
||||
advanced_camera_card_action: 'sleep',
|
||||
duration: {
|
||||
m: 1,
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('should handle camera_select action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_select',
|
||||
advanced_camera_card_action: 'camera_select',
|
||||
camera: 'camera',
|
||||
},
|
||||
);
|
||||
@@ -44,7 +44,7 @@ describe('should handle camera_select action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_select',
|
||||
advanced_camera_card_action: 'camera_select',
|
||||
camera: 'camera',
|
||||
},
|
||||
);
|
||||
@@ -83,7 +83,7 @@ describe('should handle camera_select action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_select',
|
||||
advanced_camera_card_action: 'camera_select',
|
||||
camera: 'camera',
|
||||
},
|
||||
);
|
||||
@@ -113,7 +113,7 @@ describe('should handle camera_select action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_select',
|
||||
advanced_camera_card_action: 'camera_select',
|
||||
triggered: true,
|
||||
},
|
||||
);
|
||||
@@ -143,7 +143,7 @@ describe('should handle camera_select action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_select',
|
||||
advanced_camera_card_action: 'camera_select',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('should handle camera_select action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_select',
|
||||
advanced_camera_card_action: 'camera_select',
|
||||
camera: 'camera',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle camera_ui action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'camera_ui',
|
||||
advanced_camera_card_action: 'camera_ui',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle default action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'default',
|
||||
advanced_camera_card_action: 'default',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle default action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'display_mode_select',
|
||||
advanced_camera_card_action: 'display_mode_select',
|
||||
display_mode: 'grid',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle download action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'download',
|
||||
advanced_camera_card_action: 'download',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle expand action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'expand',
|
||||
advanced_camera_card_action: 'expand',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle fullscreen action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'fullscreen',
|
||||
advanced_camera_card_action: 'fullscreen',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ it('should handle log action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'log',
|
||||
advanced_camera_card_action: 'log',
|
||||
message: 'Hello, world!',
|
||||
level: 'warn',
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('should handle media_player action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'media_player',
|
||||
advanced_camera_card_action: 'media_player',
|
||||
media_player_action: 'stop',
|
||||
media_player: 'this_is_a_media_player',
|
||||
},
|
||||
@@ -38,7 +38,7 @@ describe('should handle media_player action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'media_player',
|
||||
advanced_camera_card_action: 'media_player',
|
||||
media_player_action: 'play',
|
||||
media_player: 'this_is_a_media_player',
|
||||
},
|
||||
@@ -65,7 +65,7 @@ describe('should handle media_player action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'media_player',
|
||||
advanced_camera_card_action: 'media_player',
|
||||
media_player_action: 'play',
|
||||
media_player: 'this_is_a_media_player',
|
||||
},
|
||||
@@ -91,7 +91,7 @@ describe('should handle media_player action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'media_player',
|
||||
advanced_camera_card_action: 'media_player',
|
||||
media_player_action: 'play',
|
||||
media_player: 'this_is_a_media_player',
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle menu toggle action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'menu_toggle',
|
||||
advanced_camera_card_action: 'menu_toggle',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle microphone_connect action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'microphone_connect',
|
||||
advanced_camera_card_action: 'microphone_connect',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle microphone_disconnect action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'microphone_disconnect',
|
||||
advanced_camera_card_action: 'microphone_disconnect',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle microphone_mute action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'microphone_mute',
|
||||
advanced_camera_card_action: 'microphone_mute',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle microphone_unmute action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'microphone_unmute',
|
||||
advanced_camera_card_action: 'microphone_unmute',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import { MuteAction } from '../../../../src/card-controller/actions/actions/mute';
|
||||
import { FrigateCardMediaPlayer } from '../../../../src/types';
|
||||
import { AdvancedCameraCardMediaPlayer } from '../../../../src/types';
|
||||
import { createCardAPI, createMediaLoadedInfo } from '../../../test-utils';
|
||||
|
||||
it('should handle mute action', async () => {
|
||||
const api = createCardAPI();
|
||||
const player = mock<FrigateCardMediaPlayer>();
|
||||
const player = mock<AdvancedCameraCardMediaPlayer>();
|
||||
vi.mocked(api.getMediaLoadedInfoManager().get).mockReturnValue(
|
||||
createMediaLoadedInfo({
|
||||
player: player,
|
||||
@@ -16,7 +16,7 @@ it('should handle mute action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'mute',
|
||||
advanced_camera_card_action: 'mute',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import { PauseAction } from '../../../../src/card-controller/actions/actions/pause';
|
||||
import { FrigateCardMediaPlayer } from '../../../../src/types';
|
||||
import { AdvancedCameraCardMediaPlayer } from '../../../../src/types';
|
||||
import { createCardAPI, createMediaLoadedInfo } from '../../../test-utils';
|
||||
|
||||
it('should handle pause action', async () => {
|
||||
const api = createCardAPI();
|
||||
const player = mock<FrigateCardMediaPlayer>();
|
||||
const player = mock<AdvancedCameraCardMediaPlayer>();
|
||||
vi.mocked(api.getMediaLoadedInfoManager().get).mockReturnValue(
|
||||
createMediaLoadedInfo({
|
||||
player: player,
|
||||
@@ -16,7 +16,7 @@ it('should handle pause action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'pause',
|
||||
advanced_camera_card_action: 'pause',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import { PlayAction } from '../../../../src/card-controller/actions/actions/play';
|
||||
import { FrigateCardMediaPlayer } from '../../../../src/types';
|
||||
import { AdvancedCameraCardMediaPlayer } from '../../../../src/types';
|
||||
import { createCardAPI, createMediaLoadedInfo } from '../../../test-utils';
|
||||
|
||||
it('should handle play action', async () => {
|
||||
const api = createCardAPI();
|
||||
const player = mock<FrigateCardMediaPlayer>();
|
||||
const player = mock<AdvancedCameraCardMediaPlayer>();
|
||||
vi.mocked(api.getMediaLoadedInfoManager().get).mockReturnValue(
|
||||
createMediaLoadedInfo({
|
||||
player: player,
|
||||
@@ -16,7 +16,7 @@ it('should handle play action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'play',
|
||||
advanced_camera_card_action: 'play',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle ptz_controls action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_controls',
|
||||
advanced_camera_card_action: 'ptz_controls',
|
||||
enabled: true,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('should handle ptz digital action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
absolute: {
|
||||
zoom: 2,
|
||||
pan: {
|
||||
@@ -70,7 +70,7 @@ describe('should handle ptz digital action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('should handle ptz digital action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -117,7 +117,7 @@ describe('should handle ptz digital action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -330,7 +330,7 @@ describe('should handle ptz digital action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
ptz_action: ptzAction,
|
||||
},
|
||||
);
|
||||
@@ -370,7 +370,7 @@ describe('should handle ptz digital action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
ptz_action: 'right',
|
||||
ptz_phase: 'start',
|
||||
},
|
||||
@@ -442,7 +442,7 @@ describe('should handle ptz digital action', () => {
|
||||
|
||||
const startAction = new PTZDigitalAction(context, {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
ptz_action: 'right',
|
||||
ptz_phase: 'start',
|
||||
});
|
||||
@@ -466,7 +466,7 @@ describe('should handle ptz digital action', () => {
|
||||
|
||||
const stopAction = new PTZDigitalAction(context, {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_digital',
|
||||
advanced_camera_card_action: 'ptz_digital',
|
||||
ptz_phase: 'stop',
|
||||
});
|
||||
await stopAction.execute(api);
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('should handle ptz multi action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_multi',
|
||||
advanced_camera_card_action: 'ptz_multi',
|
||||
ptz_action: 'left',
|
||||
...(targetID && { target_id: targetID }),
|
||||
},
|
||||
@@ -69,7 +69,7 @@ describe('should handle ptz multi action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_multi',
|
||||
advanced_camera_card_action: 'ptz_multi',
|
||||
ptz_action: 'right',
|
||||
...(targetID && { target_id: targetID }),
|
||||
},
|
||||
@@ -108,7 +108,7 @@ describe('should handle ptz multi action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_multi',
|
||||
advanced_camera_card_action: 'ptz_multi',
|
||||
ptz_action: 'right',
|
||||
},
|
||||
);
|
||||
@@ -137,7 +137,7 @@ describe('should handle ptz multi action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz_multi',
|
||||
advanced_camera_card_action: 'ptz_multi',
|
||||
ptz_action: 'right',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
camera: 'camera.office',
|
||||
},
|
||||
@@ -65,7 +65,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -112,7 +112,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -140,7 +140,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -159,7 +159,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -187,7 +187,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -225,7 +225,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -256,7 +256,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'preset',
|
||||
ptz_preset: 'window',
|
||||
},
|
||||
@@ -295,7 +295,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
ptz_phase: 'start',
|
||||
},
|
||||
@@ -343,7 +343,7 @@ describe('should handle ptz action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
},
|
||||
);
|
||||
@@ -388,7 +388,7 @@ describe('should handle ptz action', () => {
|
||||
const context = {};
|
||||
const action = new PTZAction(context, {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
});
|
||||
|
||||
@@ -432,7 +432,7 @@ describe('should handle ptz action', () => {
|
||||
const context = {};
|
||||
const startAction = new PTZAction(context, {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
ptz_phase: 'start',
|
||||
});
|
||||
@@ -455,7 +455,7 @@ describe('should handle ptz action', () => {
|
||||
|
||||
const stopAction = new PTZAction(context, {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
ptz_phase: 'stop',
|
||||
});
|
||||
@@ -486,7 +486,7 @@ describe('should handle ptz action', () => {
|
||||
const context = {};
|
||||
const action = new PTZAction(context, {
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'ptz',
|
||||
advanced_camera_card_action: 'ptz',
|
||||
ptz_action: 'left',
|
||||
ptz_phase: 'start',
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ it('should handle screenshot action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'screenshot',
|
||||
advanced_camera_card_action: 'screenshot',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ it('should handle sleep action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'sleep',
|
||||
advanced_camera_card_action: 'sleep',
|
||||
duration: {
|
||||
s: 5,
|
||||
ms: 200,
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('should handle status bar action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'status_bar',
|
||||
advanced_camera_card_action: 'status_bar',
|
||||
status_bar_action: 'reset',
|
||||
},
|
||||
);
|
||||
@@ -22,7 +22,7 @@ describe('should handle status bar action', () => {
|
||||
it('add', async () => {
|
||||
const api = createCardAPI();
|
||||
const item = {
|
||||
type: 'custom:frigate-card-status-bar-string',
|
||||
type: 'custom:advanced-camera-card-status-bar-string',
|
||||
string: 'Item',
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('should handle status bar action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'status_bar',
|
||||
advanced_camera_card_action: 'status_bar',
|
||||
status_bar_action: 'add',
|
||||
items: [item],
|
||||
},
|
||||
@@ -44,7 +44,7 @@ describe('should handle status bar action', () => {
|
||||
it('remove', async () => {
|
||||
const api = createCardAPI();
|
||||
const item = {
|
||||
type: 'custom:frigate-card-status-bar-string',
|
||||
type: 'custom:advanced-camera-card-status-bar-string',
|
||||
string: 'Item',
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ describe('should handle status bar action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'status_bar',
|
||||
advanced_camera_card_action: 'status_bar',
|
||||
status_bar_action: 'remove',
|
||||
items: [item],
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ it('should handle live_substream_off action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'live_substream_off',
|
||||
advanced_camera_card_action: 'live_substream_off',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ it('should handle live_substream_on action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'live_substream_on',
|
||||
advanced_camera_card_action: 'live_substream_on',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ it('should handle live_substream_select action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'live_substream_select',
|
||||
advanced_camera_card_action: 'live_substream_select',
|
||||
camera: 'substream',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { expect, it, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import { UnmuteAction } from '../../../../src/card-controller/actions/actions/unmute';
|
||||
import { FrigateCardMediaPlayer } from '../../../../src/types';
|
||||
import { AdvancedCameraCardMediaPlayer } from '../../../../src/types';
|
||||
import { createCardAPI, createMediaLoadedInfo } from '../../../test-utils';
|
||||
|
||||
it('should handle unmute action', async () => {
|
||||
const api = createCardAPI();
|
||||
const player = mock<FrigateCardMediaPlayer>();
|
||||
const player = mock<AdvancedCameraCardMediaPlayer>();
|
||||
vi.mocked(api.getMediaLoadedInfoManager().get).mockReturnValue(
|
||||
createMediaLoadedInfo({
|
||||
player: player,
|
||||
@@ -16,7 +16,7 @@ it('should handle unmute action', async () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: 'unmute',
|
||||
advanced_camera_card_action: 'unmute',
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('should handle view action', () => {
|
||||
{},
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
frigate_card_action: viewName,
|
||||
advanced_camera_card_action: viewName,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import { SubstreamSelectAction } from '../../../src/card-controller/actions/acti
|
||||
import { UnmuteAction } from '../../../src/card-controller/actions/actions/unmute';
|
||||
import { ViewAction } from '../../../src/card-controller/actions/actions/view';
|
||||
import { ActionFactory } from '../../../src/card-controller/actions/factory';
|
||||
import { FrigateCardCustomAction } from '../../../src/config/types';
|
||||
import { AdvancedCameraCardCustomAction } from '../../../src/config/types';
|
||||
|
||||
// @vitest-environment jsdom
|
||||
describe('ActionFactory', () => {
|
||||
@@ -39,7 +39,11 @@ describe('ActionFactory', () => {
|
||||
expect(
|
||||
factory.createAction(
|
||||
{},
|
||||
{ action: 'fire-dom-event', frigate_card_action: 'clip', card_id: 'card_id' },
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
advanced_camera_card_action: 'clip',
|
||||
card_id: 'card_id',
|
||||
},
|
||||
{
|
||||
cardID: 'different_card_id',
|
||||
},
|
||||
@@ -48,7 +52,7 @@ describe('ActionFactory', () => {
|
||||
});
|
||||
|
||||
describe('generic', () => {
|
||||
it('non frigate card action', () => {
|
||||
it('non advanced camera card action', () => {
|
||||
const factory = new ActionFactory();
|
||||
expect(factory.createAction({}, { action: 'fire-dom-event' })).toBeInstanceOf(
|
||||
GenericAction,
|
||||
@@ -65,81 +69,105 @@ describe('ActionFactory', () => {
|
||||
|
||||
describe('actions', () => {
|
||||
it.each([
|
||||
[{ frigate_card_action: 'camera_select' as const }, CameraSelectAction],
|
||||
[{ frigate_card_action: 'camera_ui' as const }, CameraUIAction],
|
||||
[{ frigate_card_action: 'clip' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'clips' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'default' as const }, DefaultAction],
|
||||
[{ frigate_card_action: 'diagnostics' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'camera_select' as const }, CameraSelectAction],
|
||||
[{ advanced_camera_card_action: 'camera_ui' as const }, CameraUIAction],
|
||||
[{ advanced_camera_card_action: 'clip' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'clips' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'default' as const }, DefaultAction],
|
||||
[{ advanced_camera_card_action: 'diagnostics' as const }, ViewAction],
|
||||
[
|
||||
{
|
||||
frigate_card_action: 'display_mode_select' as const,
|
||||
advanced_camera_card_action: 'display_mode_select' as const,
|
||||
display_mode: 'single' as const,
|
||||
},
|
||||
DisplayModeSelectAction,
|
||||
],
|
||||
[{ frigate_card_action: 'download' as const }, DownloadAction],
|
||||
[{ frigate_card_action: 'expand' as const }, ExpandAction],
|
||||
[{ frigate_card_action: 'fullscreen' as const }, FullscreenAction],
|
||||
[{ frigate_card_action: 'image' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'live_substream_off' as const }, SubstreamOffAction],
|
||||
[{ frigate_card_action: 'live_substream_on' as const }, SubstreamOnAction],
|
||||
[{ advanced_camera_card_action: 'download' as const }, DownloadAction],
|
||||
[{ advanced_camera_card_action: 'expand' as const }, ExpandAction],
|
||||
[{ advanced_camera_card_action: 'fullscreen' as const }, FullscreenAction],
|
||||
[{ advanced_camera_card_action: 'image' as const }, ViewAction],
|
||||
[
|
||||
{ advanced_camera_card_action: 'live_substream_off' as const },
|
||||
SubstreamOffAction,
|
||||
],
|
||||
[{ advanced_camera_card_action: 'live_substream_on' as const }, SubstreamOnAction],
|
||||
[
|
||||
{
|
||||
frigate_card_action: 'live_substream_select' as const,
|
||||
advanced_camera_card_action: 'live_substream_select' as const,
|
||||
camera: 'camera.office',
|
||||
},
|
||||
SubstreamSelectAction,
|
||||
],
|
||||
[{ frigate_card_action: 'live' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'live' as const }, ViewAction],
|
||||
[
|
||||
{ frigate_card_action: 'log' as const, message: 'Hello, world!' as const },
|
||||
{
|
||||
advanced_camera_card_action: 'log' as const,
|
||||
message: 'Hello, world!' as const,
|
||||
},
|
||||
LogAction,
|
||||
],
|
||||
[
|
||||
{
|
||||
frigate_card_action: 'media_player' as const,
|
||||
advanced_camera_card_action: 'media_player' as const,
|
||||
media_player: 'media_player.foo' as const,
|
||||
media_player_action: 'play' as const,
|
||||
},
|
||||
MediaPlayerAction,
|
||||
],
|
||||
[{ frigate_card_action: 'menu_toggle' as const }, MenuToggleAction],
|
||||
[{ frigate_card_action: 'microphone_connect' as const }, MicrophoneConnectAction],
|
||||
[{ advanced_camera_card_action: 'menu_toggle' as const }, MenuToggleAction],
|
||||
[
|
||||
{ frigate_card_action: 'microphone_disconnect' as const },
|
||||
{ advanced_camera_card_action: 'microphone_connect' as const },
|
||||
MicrophoneConnectAction,
|
||||
],
|
||||
[
|
||||
{ advanced_camera_card_action: 'microphone_disconnect' as const },
|
||||
MicrophoneDisconnectAction,
|
||||
],
|
||||
[{ frigate_card_action: 'microphone_mute' as const }, MicrophoneMuteAction],
|
||||
[{ frigate_card_action: 'microphone_unmute' as const }, MicrophoneUnmuteAction],
|
||||
[{ frigate_card_action: 'mute' as const }, MuteAction],
|
||||
[{ frigate_card_action: 'pause' as const }, PauseAction],
|
||||
[{ frigate_card_action: 'play' as const }, PlayAction],
|
||||
[{ frigate_card_action: 'ptz_digital' as const }, PTZDigitalAction],
|
||||
[
|
||||
{ frigate_card_action: 'ptz_multi' as const, ptz_action: 'right' as const },
|
||||
{ advanced_camera_card_action: 'microphone_mute' as const },
|
||||
MicrophoneMuteAction,
|
||||
],
|
||||
[
|
||||
{ advanced_camera_card_action: 'microphone_unmute' as const },
|
||||
MicrophoneUnmuteAction,
|
||||
],
|
||||
[{ advanced_camera_card_action: 'mute' as const }, MuteAction],
|
||||
[{ advanced_camera_card_action: 'pause' as const }, PauseAction],
|
||||
[{ advanced_camera_card_action: 'play' as const }, PlayAction],
|
||||
[{ advanced_camera_card_action: 'ptz_digital' as const }, PTZDigitalAction],
|
||||
[
|
||||
{
|
||||
advanced_camera_card_action: 'ptz_multi' as const,
|
||||
ptz_action: 'right' as const,
|
||||
},
|
||||
PTZMultiAction,
|
||||
],
|
||||
[{ frigate_card_action: 'ptz' as const, ptz_action: 'right' as const }, PTZAction],
|
||||
[{ frigate_card_action: 'recording' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'recordings' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'screenshot' as const }, ScreenshotAction],
|
||||
[
|
||||
{ frigate_card_action: 'ptz_controls' as const, enabled: true },
|
||||
{ advanced_camera_card_action: 'ptz' as const, ptz_action: 'right' as const },
|
||||
PTZAction,
|
||||
],
|
||||
[{ advanced_camera_card_action: 'recording' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'recordings' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'screenshot' as const }, ScreenshotAction],
|
||||
[
|
||||
{ advanced_camera_card_action: 'ptz_controls' as const, enabled: true },
|
||||
PTZControlsAction,
|
||||
],
|
||||
[{ frigate_card_action: 'sleep' as const }, SleepAction],
|
||||
[{ frigate_card_action: 'snapshot' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'snapshots' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'timeline' as const }, ViewAction],
|
||||
[{ frigate_card_action: 'unmute' as const }, UnmuteAction],
|
||||
[{ advanced_camera_card_action: 'sleep' as const }, SleepAction],
|
||||
[{ advanced_camera_card_action: 'snapshot' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'snapshots' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'timeline' as const }, ViewAction],
|
||||
[{ advanced_camera_card_action: 'unmute' as const }, UnmuteAction],
|
||||
[
|
||||
{ frigate_card_action: 'status_bar' as const, status_bar_action: 'reset' },
|
||||
{
|
||||
advanced_camera_card_action: 'status_bar' as const,
|
||||
status_bar_action: 'reset',
|
||||
},
|
||||
StatusBarAction,
|
||||
],
|
||||
])(
|
||||
'frigate_card_action: $frigate_card_action',
|
||||
(action: Partial<FrigateCardCustomAction>, classObject: object) => {
|
||||
'advanced_camera_card_action: $advanced_camera_card_action',
|
||||
(action: Partial<AdvancedCameraCardCustomAction>, classObject: object) => {
|
||||
const factory = new ActionFactory();
|
||||
expect(
|
||||
factory.createAction({}, { action: 'fire-dom-event', ...action }),
|
||||
|
||||
Reference in New Issue
Block a user