Formatting pass.

This commit is contained in:
Dermot Duffy
2024-07-30 02:23:51 -07:00
parent 8823e769a2
commit ef7b4b0ddf
12 changed files with 39 additions and 33 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ view:
``` ```
| Option | Default | Description | | Option | Default | Description |
| ------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------------------- | --------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions` | | [Actions](actions/README.md) to use for all views, individual actions may be overriden by view-specific actions. | | `actions` | | [Actions](actions/README.md) to use for all views, individual actions may be overriden by view-specific actions. |
| `camera_select` | `current` | The [view](view.md?id=supported-views) to show when a new camera is selected (e.g. in the camera menu). If `current` the view is unchanged when a new camera is selected. | | `camera_select` | `current` | The [view](view.md?id=supported-views) to show when a new camera is selected (e.g. in the camera menu). If `current` the view is unchanged when a new camera is selected. |
| `dark_mode` | `off` | Whether or not to turn dark mode `on`, `off` or `auto` to automatically turn on if the card `interaction_seconds` has expired (i.e. card has been left unattended for that period of time) or if dark mode is enabled in the HA profile theme setting. Dark mode dims the brightness by `25%`. | | `dark_mode` | `off` | Whether or not to turn dark mode `on`, `off` or `auto` to automatically turn on if the card `interaction_seconds` has expired (i.e. card has been left unattended for that period of time) or if dark mode is enabled in the HA profile theme setting. Dark mode dims the brightness by `25%`. |
+1 -1
View File
@@ -51,7 +51,7 @@ const plugins = [
typescript({ typescript({
sourceMap: dev, sourceMap: dev,
inlineSources: dev, inlineSources: dev,
exclude: ["tests/**/*.test.ts"], exclude: ['tests/**/*.test.ts'],
}), }),
json({ exclude: 'package.json' }), json({ exclude: 'package.json' }),
replace({ replace({
@@ -17,7 +17,7 @@ export class CameraSelectAction extends FrigateCardAction<CameraSelectActionConf
const targetViewName = const targetViewName =
viewOnCameraSelect === 'current' ? view.view : viewOnCameraSelect; viewOnCameraSelect === 'current' ? view.view : viewOnCameraSelect;
await api.getViewManager().setViewByParametersWithNewQuery({ await api.getViewManager().setViewByParametersWithNewQuery({
params:{ params: {
view: targetViewName, view: targetViewName,
camera: selectCameraID, camera: selectCameraID,
}, },
+1 -3
View File
@@ -98,9 +98,7 @@ export class TriggersManager {
if (this._hasAllowableInteractionStateForAction()) { if (this._hasAllowableInteractionStateForAction()) {
if (triggerAction === 'update') { if (triggerAction === 'update') {
await this._api await this._api.getViewManager().setViewByParametersWithNewQuery({
.getViewManager()
.setViewByParametersWithNewQuery({
queryExecutorOptions: { useCache: false }, queryExecutorOptions: { useCache: false },
}); });
} else if (triggerAction === 'live') { } else if (triggerAction === 'live') {
@@ -1,6 +1,6 @@
import { ViewContext } from "view"; import { ViewContext } from 'view';
import { View } from "../../../view/view"; import { View } from '../../../view/view';
import { ViewModifier } from "../types"; import { ViewModifier } from '../types';
export class MergeContextViewModifier implements ViewModifier { export class MergeContextViewModifier implements ViewModifier {
protected _context?: ViewContext | null; protected _context?: ViewContext | null;
@@ -1,6 +1,6 @@
import { ViewContext } from "view"; import { ViewContext } from 'view';
import { View } from "../../../view/view"; import { View } from '../../../view/view';
import { ViewModifier } from "../types"; import { ViewModifier } from '../types';
export class RemoveContextViewModifier implements ViewModifier { export class RemoveContextViewModifier implements ViewModifier {
protected _keys: (keyof ViewContext)[]; protected _keys: (keyof ViewContext)[];
@@ -7,4 +7,3 @@ export class SubstreamOffViewModifier implements ViewModifier {
removeSubstream(view); removeSubstream(view);
} }
} }
+4 -1
View File
@@ -374,7 +374,10 @@ export class FrigateCardGalleryCore extends LitElement {
const view = this.viewManagerEpoch?.manager.getView(); const view = this.viewManagerEpoch?.manager.getView();
const oldView = this.viewManagerEpoch?.oldView; const oldView = this.viewManagerEpoch?.oldView;
if (!this._media || oldView?.queryResults?.getResults() !== view?.queryResults?.getResults()) { if (
!this._media ||
oldView?.queryResults?.getResults() !== view?.queryResults?.getResults()
) {
// Gallery places the most recent media at the top (the query results place // Gallery places the most recent media at the top (the query results place
// the most recent media at the end for use in the viewer). This is copied // the most recent media at the end for use in the viewer). This is copied
// to a new array to avoid reversing the query results in place. // to a new array to avoid reversing the query results in place.
+5 -2
View File
@@ -18,9 +18,12 @@ export interface ViewParameters extends ViewEvolveParameters {
camera: string; camera: string;
} }
export const mergeViewContext = (a?: ViewContext | null, b?: ViewContext | null): ViewContext => { export const mergeViewContext = (
a?: ViewContext | null,
b?: ViewContext | null,
): ViewContext => {
return merge({}, a, b); return merge({}, a, b);
} };
export class View { export class View {
public view: FrigateCardView; public view: FrigateCardView;
@@ -465,7 +465,7 @@ describe('TriggersManager', () => {
params: { params: {
view: 'live' as const, view: 'live' as const,
camera: 'camera_1' as const, camera: 'camera_1' as const,
} },
}); });
await manager.handleCameraEvent({ await manager.handleCameraEvent({
@@ -23,4 +23,3 @@ it('should remove context property', () => {
expect(view.context).toEqual({}); expect(view.context).toEqual({});
}); });
@@ -2,7 +2,11 @@ import { describe, expect, it, vi } from 'vitest';
import { CardController } from '../../../../src/card-controller/controller'; import { CardController } from '../../../../src/card-controller/controller';
import { SubstreamOnViewModifier } from '../../../../src/card-controller/view/modifiers/substream-on'; import { SubstreamOnViewModifier } from '../../../../src/card-controller/view/modifiers/substream-on';
import { RawFrigateCardConfig } from '../../../../src/config/types'; import { RawFrigateCardConfig } from '../../../../src/config/types';
import { getStreamCameraID, hasSubstream, setSubstream } from '../../../../src/utils/substream'; import {
getStreamCameraID,
hasSubstream,
setSubstream,
} from '../../../../src/utils/substream';
import { import {
createCameraConfig, createCameraConfig,
createCameraManager, createCameraManager,