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 |
| ------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ------------------------- | --------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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. |
| `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({
sourceMap: dev,
inlineSources: dev,
exclude: ["tests/**/*.test.ts"],
exclude: ['tests/**/*.test.ts'],
}),
json({ exclude: 'package.json' }),
replace({
@@ -17,7 +17,7 @@ export class CameraSelectAction extends FrigateCardAction<CameraSelectActionConf
const targetViewName =
viewOnCameraSelect === 'current' ? view.view : viewOnCameraSelect;
await api.getViewManager().setViewByParametersWithNewQuery({
params:{
params: {
view: targetViewName,
camera: selectCameraID,
},
+1 -3
View File
@@ -98,9 +98,7 @@ export class TriggersManager {
if (this._hasAllowableInteractionStateForAction()) {
if (triggerAction === 'update') {
await this._api
.getViewManager()
.setViewByParametersWithNewQuery({
await this._api.getViewManager().setViewByParametersWithNewQuery({
queryExecutorOptions: { useCache: false },
});
} else if (triggerAction === 'live') {
@@ -1,6 +1,6 @@
import { ViewContext } from "view";
import { View } from "../../../view/view";
import { ViewModifier } from "../types";
import { ViewContext } from 'view';
import { View } from '../../../view/view';
import { ViewModifier } from '../types';
export class MergeContextViewModifier implements ViewModifier {
protected _context?: ViewContext | null;
@@ -1,6 +1,6 @@
import { ViewContext } from "view";
import { View } from "../../../view/view";
import { ViewModifier } from "../types";
import { ViewContext } from 'view';
import { View } from '../../../view/view';
import { ViewModifier } from '../types';
export class RemoveContextViewModifier implements ViewModifier {
protected _keys: (keyof ViewContext)[];
@@ -7,4 +7,3 @@ export class SubstreamOffViewModifier implements ViewModifier {
removeSubstream(view);
}
}
+4 -1
View File
@@ -374,7 +374,10 @@ export class FrigateCardGalleryCore extends LitElement {
const view = this.viewManagerEpoch?.manager.getView();
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
// 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.
+5 -2
View File
@@ -18,9 +18,12 @@ export interface ViewParameters extends ViewEvolveParameters {
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);
}
};
export class View {
public view: FrigateCardView;
@@ -465,7 +465,7 @@ describe('TriggersManager', () => {
params: {
view: 'live' as const,
camera: 'camera_1' as const,
}
},
});
await manager.handleCameraEvent({
@@ -23,4 +23,3 @@ it('should remove context property', () => {
expect(view.context).toEqual({});
});
@@ -2,7 +2,11 @@ import { describe, expect, it, vi } from 'vitest';
import { CardController } from '../../../../src/card-controller/controller';
import { SubstreamOnViewModifier } from '../../../../src/card-controller/view/modifiers/substream-on';
import { RawFrigateCardConfig } from '../../../../src/config/types';
import { getStreamCameraID, hasSubstream, setSubstream } from '../../../../src/utils/substream';
import {
getStreamCameraID,
hasSubstream,
setSubstream,
} from '../../../../src/utils/substream';
import {
createCameraConfig,
createCameraManager,