Rename DataManager to CameraManager.
This commit is contained in:
@@ -22,7 +22,7 @@ import {
|
||||
getFullDependentBrowseMediaQueryParametersOrDispatchError,
|
||||
} from '../utils/ha/browse-media';
|
||||
import { changeViewToRecentEventsForCameraAndDependents, changeViewToRecentRecordingForCameraAndDependents } from '../utils/media-to-view.js';
|
||||
import { DataManager } from '../utils/data/data-manager.js';
|
||||
import { CameraManager } from '../camera/manager.js';
|
||||
import { View } from '../view.js';
|
||||
import { renderProgressIndicator } from './message.js';
|
||||
import './thumbnail.js';
|
||||
@@ -54,7 +54,7 @@ export class FrigateCardGallery extends LitElement {
|
||||
public cameras?: Map<string, CameraConfig>;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
@property({ attribute: false })
|
||||
public cardWideConfig?: CardWideConfig;
|
||||
@@ -71,7 +71,7 @@ export class FrigateCardGallery extends LitElement {
|
||||
// !this.cameras ||
|
||||
// !this.view.isGalleryView() ||
|
||||
// !mediaType ||
|
||||
// !this.dataManager
|
||||
// !this.cameraManager
|
||||
// ) {
|
||||
// return;
|
||||
// }
|
||||
@@ -81,7 +81,7 @@ export class FrigateCardGallery extends LitElement {
|
||||
// changeViewToRecentRecordingForCameraAndDependents(
|
||||
// this,
|
||||
// this.hass,
|
||||
// this.dataManager,
|
||||
// this.cameraManager,
|
||||
// this.cameras,
|
||||
// this.view,
|
||||
// {
|
||||
@@ -92,7 +92,7 @@ export class FrigateCardGallery extends LitElement {
|
||||
// changeViewToRecentEventsForCameraAndDependents(
|
||||
// this,
|
||||
// this.hass,
|
||||
// this.dataManager,
|
||||
// this.cameraManager,
|
||||
// this.cameras,
|
||||
// this.view,
|
||||
// {
|
||||
|
||||
@@ -51,7 +51,7 @@ import '../surround.js';
|
||||
import { EmblaCarouselPlugins } from '../carousel.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
import { updateElementStyleFromMediaLayoutConfig } from '../../utils/media-layout.js';
|
||||
import { DataManager } from '../../utils/data/data-manager.js';
|
||||
import { CameraManager } from '../../camera/manager.js';
|
||||
import { HomeAssistant } from 'custom-card-helpers';
|
||||
import { dispatchMessageEvent, dispatchErrorMessageEvent } from '../message.js';
|
||||
import { HassEntity } from 'home-assistant-js-websocket';
|
||||
@@ -115,7 +115,7 @@ export class FrigateCardLive extends LitElement {
|
||||
public liveOverrides?: LiveOverrides;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
@property({ attribute: false })
|
||||
public cardWideConfig?: CardWideConfig;
|
||||
@@ -231,7 +231,7 @@ export class FrigateCardLive extends LitElement {
|
||||
.thumbnailConfig=${config.controls.thumbnails}
|
||||
.timelineConfig=${config.controls.timeline}
|
||||
.cameras=${this.cameras}
|
||||
.dataManager=${this.dataManager}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.inBackground=${this._inBackground}
|
||||
@frigate-card:message=${(ev: CustomEvent<Message>) => {
|
||||
this._renderKey++;
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
ThumbnailsControlConfig,
|
||||
} from '../types.js';
|
||||
import { contentsChanged, dispatchFrigateCardEvent } from '../utils/basic.js';
|
||||
import { DataManager } from '../utils/data/data-manager.js';
|
||||
import { CameraManager } from '../camera/manager.js';
|
||||
import { View } from '../view.js';
|
||||
import { ThumbnailCarouselTap } from './thumbnail-carousel.js';
|
||||
import './surround-basic.js';
|
||||
@@ -58,7 +58,7 @@ export class FrigateCardSurround extends LitElement {
|
||||
public cameras?: Map<string, CameraConfig>;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
/**
|
||||
* Fetch thumbnail media when a target is not specified in the view (e.g. for
|
||||
@@ -69,7 +69,7 @@ export class FrigateCardSurround extends LitElement {
|
||||
protected async _fetchMedia(): Promise<void> {
|
||||
if (
|
||||
!this.cameras ||
|
||||
!this.dataManager ||
|
||||
!this.cameraManager ||
|
||||
!this.fetchMedia ||
|
||||
this.inBackground ||
|
||||
!this.hass ||
|
||||
@@ -84,7 +84,7 @@ export class FrigateCardSurround extends LitElement {
|
||||
await changeViewToRecentEventsForCameraAndDependents(
|
||||
this,
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this.cameras,
|
||||
this.view,
|
||||
{
|
||||
@@ -156,7 +156,7 @@ export class FrigateCardSurround extends LitElement {
|
||||
slot=${this.thumbnailConfig.mode}
|
||||
.hass=${this.hass}
|
||||
.config=${this.thumbnailConfig}
|
||||
.dataManager=${this.dataManager}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.view=${this.view}
|
||||
.cameras=${this.cameras}
|
||||
.selected=${this.view.queryResults?.getSelectedIndex() ?? undefined}
|
||||
@@ -194,7 +194,7 @@ export class FrigateCardSurround extends LitElement {
|
||||
.timelineConfig=${this.timelineConfig}
|
||||
.thumbnailDetails=${this.thumbnailConfig?.show_details}
|
||||
.thumbnailSize=${this.thumbnailConfig?.size}
|
||||
.dataManager=${this.dataManager}
|
||||
.cameraManager=${this.cameraManager}
|
||||
>
|
||||
</frigate-card-timeline-core>`
|
||||
: ''}
|
||||
|
||||
@@ -24,7 +24,7 @@ import { FrigateCardCarousel } from './carousel.js';
|
||||
import './thumbnail.js';
|
||||
import './carousel.js';
|
||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||
import { DataManager } from '../utils/data/data-manager.js';
|
||||
import { CameraManager } from '../camera/manager.js';
|
||||
|
||||
export interface ThumbnailCarouselTap {
|
||||
queryResults: MediaQueriesResults;
|
||||
@@ -42,7 +42,7 @@ export class FrigateCardThumbnailCarousel extends LitElement {
|
||||
public cameras?: Map<string, CameraConfig>;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
protected _refCarousel: Ref<FrigateCardCarousel> = createRef();
|
||||
|
||||
@@ -161,7 +161,7 @@ export class FrigateCardThumbnailCarousel extends LitElement {
|
||||
|
||||
return html` <frigate-card-thumbnail
|
||||
class="${classMap(classes)}"
|
||||
.dataManager=${this.dataManager}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.hass=${this.hass}
|
||||
.media=${media}
|
||||
.cameraConfig=${cameraConfig}
|
||||
|
||||
@@ -19,7 +19,7 @@ import { TaskStatus } from '@lit-labs/task';
|
||||
|
||||
import type { CameraConfig, ExtendedHomeAssistant } from '../types.js';
|
||||
import { ViewMedia } from '../view-media.js';
|
||||
import { DataManager } from '../utils/data/data-manager.js';
|
||||
import { CameraManager } from '../camera/manager.js';
|
||||
|
||||
// The minimum width of a thumbnail with details enabled.
|
||||
export const THUMBNAIL_DETAILS_WIDTH_MIN = 300;
|
||||
@@ -221,9 +221,9 @@ export class FrigateCardThumbnail extends LitElement {
|
||||
@property({ attribute: false })
|
||||
public hass?: ExtendedHomeAssistant;
|
||||
|
||||
// DataManager used for marking media as favorite.
|
||||
// CameraManager used for marking media as favorite.
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
@property({ attribute: true })
|
||||
public media?: ViewMedia;
|
||||
@@ -296,7 +296,7 @@ export class FrigateCardThumbnail extends LitElement {
|
||||
@click=${(ev: Event) => {
|
||||
stopEventFromActivatingCardWideActions(ev);
|
||||
if (this.hass && this.cameraConfig && this.media) {
|
||||
this.dataManager?.favoriteMedia(
|
||||
this.cameraManager?.favoriteMedia(
|
||||
this.hass,
|
||||
this.cameraConfig,
|
||||
this.media,
|
||||
|
||||
@@ -49,13 +49,13 @@ import {
|
||||
createViewForRecordings,
|
||||
generateMediaViewerContext,
|
||||
} from '../utils/media-to-view';
|
||||
import { DataManager } from '../utils/data/data-manager';
|
||||
import { CameraManager } from '../camera/manager';
|
||||
import { EventMediaQueries, MediaQueries, View } from '../view';
|
||||
import { dispatchMessageEvent } from './message.js';
|
||||
import './thumbnail.js';
|
||||
import { FrigateCardTimelineItem, TimelineDataSource } from '../utils/timeline-source';
|
||||
import { ViewMedia, ViewMediaClassifier } from '../view-media';
|
||||
import { rangesOverlap } from '../utils/data/data-manager-range';
|
||||
import { rangesOverlap } from '../camera/range';
|
||||
|
||||
interface FrigateCardGroupData {
|
||||
id: string;
|
||||
@@ -89,7 +89,7 @@ declare module 'view' {
|
||||
interface ThumbnailDataRequest {
|
||||
item: IdType;
|
||||
hass?: ExtendedHomeAssistant;
|
||||
dataManager?: DataManager;
|
||||
cameraManager?: CameraManager;
|
||||
cameraConfig?: CameraConfig;
|
||||
media?: ViewMedia;
|
||||
view?: View;
|
||||
@@ -142,7 +142,7 @@ export class FrigateCardTimelineThumbnail extends LitElement {
|
||||
|
||||
if (
|
||||
!dataRequest.hass ||
|
||||
!dataRequest.dataManager ||
|
||||
!dataRequest.cameraManager ||
|
||||
!dataRequest.cameraConfig ||
|
||||
!dataRequest.media ||
|
||||
!dataRequest.view
|
||||
@@ -152,7 +152,7 @@ export class FrigateCardTimelineThumbnail extends LitElement {
|
||||
|
||||
return html` <frigate-card-thumbnail
|
||||
.hass=${dataRequest.hass}
|
||||
.dataManager=${dataRequest.dataManager}
|
||||
.cameraManager=${dataRequest.cameraManager}
|
||||
.cameraConfig=${dataRequest.cameraConfig}
|
||||
.media=${dataRequest.media}
|
||||
.view=${dataRequest.view}
|
||||
@@ -188,7 +188,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
public mini = false;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
@state()
|
||||
protected _locked = false;
|
||||
@@ -245,7 +245,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
request.detail.cameraConfig = media
|
||||
? this.cameras?.get(media.getCameraID())
|
||||
: undefined;
|
||||
request.detail.dataManager = this.dataManager;
|
||||
request.detail.cameraManager = this.cameraManager;
|
||||
request.detail.media = media;
|
||||
request.detail.view = this.view;
|
||||
}
|
||||
@@ -392,7 +392,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
!this._timeline ||
|
||||
!this.view ||
|
||||
// !this.view.target?.length ||
|
||||
!this.dataManager
|
||||
!this.cameraManager
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -401,7 +401,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
// const canSeek = !!this.view?.isViewerView();
|
||||
// const context = canSeek
|
||||
// ? generateMediaViewerContextForChildren(
|
||||
// this.dataManager,
|
||||
// this.cameraManager,
|
||||
// this.view.target,
|
||||
// targetTime,
|
||||
// )
|
||||
@@ -453,7 +453,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
!this._timeline ||
|
||||
!this.cameras ||
|
||||
!this.view ||
|
||||
!this.dataManager ||
|
||||
!this.cameraManager ||
|
||||
!properties.what
|
||||
) {
|
||||
return;
|
||||
@@ -467,7 +467,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
) {
|
||||
viewPromise = createViewForRecordings(
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this.cameras,
|
||||
this.view,
|
||||
{
|
||||
@@ -483,7 +483,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
} else if (this.timelineConfig?.show_recordings && properties.what === 'axis') {
|
||||
viewPromise = createViewForRecordings(
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this.cameras,
|
||||
this.view,
|
||||
{
|
||||
@@ -499,7 +499,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
this.view.query?.areRecordingQueries()
|
||||
) {
|
||||
viewPromise = (async (): Promise<View | null> => {
|
||||
if (!properties.item || !this.dataManager || !this.hass) {
|
||||
if (!properties.item || !this.cameraManager || !this.hass) {
|
||||
return null;
|
||||
}
|
||||
const view = await this._createViewWithEventMediaQuery(
|
||||
@@ -518,7 +518,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
view.mergeInContext(
|
||||
await generateMediaViewerContext(
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
results,
|
||||
properties.time,
|
||||
),
|
||||
@@ -645,12 +645,12 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
noSetWindow?: boolean;
|
||||
},
|
||||
): Promise<View | null> {
|
||||
if (!this.hass || !this.dataManager || !this.cameras || !this.view || !query) {
|
||||
if (!this.hass || !this.cameraManager || !this.cameras || !this.view || !query) {
|
||||
return null;
|
||||
}
|
||||
const view = await createViewForEvents(
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this.cameras,
|
||||
this.view,
|
||||
{
|
||||
@@ -983,11 +983,11 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
|
||||
protected _alreadyHasAcceptableMediaQuery(freshMediaQuery: MediaQueries): boolean {
|
||||
return (
|
||||
!!this.dataManager &&
|
||||
!!this.cameraManager &&
|
||||
!!this.view?.query &&
|
||||
!!this.view.queryResults &&
|
||||
freshMediaQuery.isEqual(this.view.query) &&
|
||||
this.dataManager.areMediaQueriesResultsFresh(
|
||||
this.cameraManager.areMediaQueriesResultsFresh(
|
||||
this.view.query,
|
||||
this.view.queryResults,
|
||||
)
|
||||
@@ -1033,13 +1033,13 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
}
|
||||
|
||||
if (
|
||||
changedProps.has('dataManager') ||
|
||||
changedProps.has('cameraManager') ||
|
||||
changedProps.has('cameras') ||
|
||||
changedProps.has('timelineConfig')
|
||||
) {
|
||||
if (this.dataManager && this.cameras && this.timelineConfig) {
|
||||
if (this.cameraManager && this.cameras && this.timelineConfig) {
|
||||
this._timelineSource = new TimelineDataSource(
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this._getTimelineCameraIDs(),
|
||||
this.timelineConfig.media,
|
||||
);
|
||||
@@ -1069,7 +1069,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
||||
protected updated(changedProperties: PropertyValues): void {
|
||||
super.updated(changedProperties);
|
||||
|
||||
if (changedProperties.has('cameras') || changedProperties.has('dataManager')) {
|
||||
if (changedProperties.has('cameras') || changedProperties.has('cameraManager')) {
|
||||
this._destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
import timelineStyle from '../scss/timeline.scss';
|
||||
import { CameraConfig, ExtendedHomeAssistant, TimelineConfig } from '../types';
|
||||
import { DataManager } from '../utils/data/data-manager';
|
||||
import { CameraManager } from '../camera/manager';
|
||||
import { View } from '../view';
|
||||
import './surround.js';
|
||||
import './timeline-core.js';
|
||||
@@ -27,7 +27,7 @@ export class FrigateCardTimeline extends LitElement {
|
||||
public timelineConfig?: TimelineConfig;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
/**
|
||||
* Master render method.
|
||||
@@ -51,7 +51,7 @@ export class FrigateCardTimeline extends LitElement {
|
||||
.timelineConfig=${this.timelineConfig}
|
||||
.thumbnailDetails=${this.timelineConfig.controls.thumbnails.show_details}
|
||||
.thumbnailSize=${this.timelineConfig.controls.thumbnails.size}
|
||||
.dataManager=${this.dataManager}
|
||||
.cameraManager=${this.cameraManager}
|
||||
>
|
||||
</frigate-card-timeline-core>
|
||||
</frigate-card-surround>`;
|
||||
|
||||
@@ -46,7 +46,7 @@ import '../patches/ha-hls-player';
|
||||
import './surround.js';
|
||||
import { renderTask } from '../utils/task.js';
|
||||
import { updateElementStyleFromMediaLayoutConfig } from '../utils/media-layout.js';
|
||||
import { DataManager } from '../utils/data/data-manager.js';
|
||||
import { CameraManager } from '../camera/manager.js';
|
||||
import {
|
||||
changeViewToRecentEventsForCameraAndDependents,
|
||||
changeViewToRecentRecordingForCameraAndDependents,
|
||||
@@ -92,7 +92,7 @@ export class FrigateCardViewer extends LitElement {
|
||||
public resolvedMediaCache?: ResolvedMediaCache;
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataManager?: DataManager;
|
||||
public cameraManager?: CameraManager;
|
||||
|
||||
@property({ attribute: false })
|
||||
public cardWideConfig?: CardWideConfig;
|
||||
@@ -107,7 +107,7 @@ export class FrigateCardViewer extends LitElement {
|
||||
!this.view ||
|
||||
!this.cameras ||
|
||||
!this.viewerConfig ||
|
||||
!this.dataManager
|
||||
!this.cameraManager
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export class FrigateCardViewer extends LitElement {
|
||||
changeViewToRecentRecordingForCameraAndDependents(
|
||||
this,
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this.cameras,
|
||||
this.view,
|
||||
{
|
||||
@@ -145,7 +145,7 @@ export class FrigateCardViewer extends LitElement {
|
||||
changeViewToRecentEventsForCameraAndDependents(
|
||||
this,
|
||||
this.hass,
|
||||
this.dataManager,
|
||||
this.cameraManager,
|
||||
this.cameras,
|
||||
this.view,
|
||||
{
|
||||
@@ -161,7 +161,7 @@ export class FrigateCardViewer extends LitElement {
|
||||
.view=${this.view}
|
||||
.thumbnailConfig=${this.viewerConfig.controls.thumbnails}
|
||||
.timelineConfig=${this.viewerConfig.controls.timeline}
|
||||
.dataManager=${this.dataManager}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.cameras=${this.cameras}
|
||||
>
|
||||
<frigate-card-viewer-carousel
|
||||
|
||||
Reference in New Issue
Block a user