Rename TimelineDataManager to DataManager .
This commit is contained in:
+7
-10
@@ -100,7 +100,7 @@ import { isValidMediaLoadedInfo } from './utils/media-info.js';
|
|||||||
import { View } from './view.js';
|
import { View } from './view.js';
|
||||||
import pkg from '../package.json';
|
import pkg from '../package.json';
|
||||||
import { ViewContext } from 'view';
|
import { ViewContext } from 'view';
|
||||||
import { TimelineDataManager } from './utils/timeline-data-manager.js';
|
import { DataManager } from './utils/data-manager.js';
|
||||||
|
|
||||||
/** A note on media callbacks:
|
/** A note on media callbacks:
|
||||||
*
|
*
|
||||||
@@ -203,7 +203,7 @@ export class FrigateCard extends LitElement {
|
|||||||
protected _resolvedMediaCache = new ResolvedMediaCache();
|
protected _resolvedMediaCache = new ResolvedMediaCache();
|
||||||
|
|
||||||
// Shared timeline data manager (for main timeline view and mini-timelines).
|
// Shared timeline data manager (for main timeline view and mini-timelines).
|
||||||
protected _timelineDataManager?: TimelineDataManager;
|
protected _dataManager?: DataManager;
|
||||||
|
|
||||||
// The mouse handler may be called continually, throttle it to at most once
|
// The mouse handler may be called continually, throttle it to at most once
|
||||||
// per second for performance reasons.
|
// per second for performance reasons.
|
||||||
@@ -1052,10 +1052,7 @@ export class FrigateCard extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this._cameras && (changedProps.has('_config') || changedProps.has('_cameras'))) {
|
if (this._cameras && (changedProps.has('_config') || changedProps.has('_cameras'))) {
|
||||||
this._timelineDataManager = new TimelineDataManager(
|
this._dataManager = new DataManager(this._cameras, this._config.timeline.media);
|
||||||
this._cameras,
|
|
||||||
this._config.timeline.media,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1956,7 +1953,7 @@ export class FrigateCard extends LitElement {
|
|||||||
.view=${this._view}
|
.view=${this._view}
|
||||||
.cameras=${this._cameras}
|
.cameras=${this._cameras}
|
||||||
.galleryConfig=${this._getConfig().event_gallery}
|
.galleryConfig=${this._getConfig().event_gallery}
|
||||||
.dataManager=${this._timelineDataManager}
|
.dataManager=${this._dataManager}
|
||||||
>
|
>
|
||||||
</frigate-card-gallery>`
|
</frigate-card-gallery>`
|
||||||
: ``}
|
: ``}
|
||||||
@@ -1967,7 +1964,7 @@ export class FrigateCard extends LitElement {
|
|||||||
.cameras=${this._cameras}
|
.cameras=${this._cameras}
|
||||||
.viewerConfig=${this._getConfig().media_viewer}
|
.viewerConfig=${this._getConfig().media_viewer}
|
||||||
.resolvedMediaCache=${this._resolvedMediaCache}
|
.resolvedMediaCache=${this._resolvedMediaCache}
|
||||||
.timelineDataManager=${this._timelineDataManager}
|
.dataManager=${this._dataManager}
|
||||||
>
|
>
|
||||||
</frigate-card-viewer>`
|
</frigate-card-viewer>`
|
||||||
: ``}
|
: ``}
|
||||||
@@ -1977,7 +1974,7 @@ export class FrigateCard extends LitElement {
|
|||||||
.view=${this._view}
|
.view=${this._view}
|
||||||
.cameras=${this._cameras}
|
.cameras=${this._cameras}
|
||||||
.timelineConfig=${this._getConfig().timeline}
|
.timelineConfig=${this._getConfig().timeline}
|
||||||
.timelineDataManager=${this._timelineDataManager}
|
.dataManager=${this._dataManager}
|
||||||
>
|
>
|
||||||
</frigate-card-timeline>`
|
</frigate-card-timeline>`
|
||||||
: ``}
|
: ``}
|
||||||
@@ -1998,7 +1995,7 @@ export class FrigateCard extends LitElement {
|
|||||||
.conditionState=${this._conditionState}
|
.conditionState=${this._conditionState}
|
||||||
.liveOverrides=${getOverridesByKey(this._getConfig().overrides, 'live')}
|
.liveOverrides=${getOverridesByKey(this._getConfig().overrides, 'live')}
|
||||||
.cameras=${this._cameras}
|
.cameras=${this._cameras}
|
||||||
.timelineDataManager=${this._timelineDataManager}
|
.dataManager=${this._dataManager}
|
||||||
class="${classMap(liveClasses)}"
|
class="${classMap(liveClasses)}"
|
||||||
>
|
>
|
||||||
</frigate-card-live>
|
</frigate-card-live>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
getFullDependentBrowseMediaQueryParametersOrDispatchError,
|
getFullDependentBrowseMediaQueryParametersOrDispatchError,
|
||||||
} from '../utils/ha/browse-media';
|
} from '../utils/ha/browse-media';
|
||||||
import { changeViewToRecentRecordingForCameraAndDependents } from '../utils/media-to-view.js';
|
import { changeViewToRecentRecordingForCameraAndDependents } from '../utils/media-to-view.js';
|
||||||
import { TimelineDataManager } from '../utils/timeline-data-manager';
|
import { DataManager } from '../utils/data-manager';
|
||||||
import { View } from '../view.js';
|
import { View } from '../view.js';
|
||||||
import { renderProgressIndicator } from './message.js';
|
import { renderProgressIndicator } from './message.js';
|
||||||
import './thumbnail.js';
|
import './thumbnail.js';
|
||||||
@@ -44,7 +44,7 @@ export class FrigateCardGallery extends LitElement {
|
|||||||
public cameras?: Map<string, CameraConfig>;
|
public cameras?: Map<string, CameraConfig>;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public dataManager?: TimelineDataManager;
|
public dataManager?: DataManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Master render method.
|
* Master render method.
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ import { renderTask } from '../utils/task.js';
|
|||||||
import { classMap } from 'lit/directives/class-map.js';
|
import { classMap } from 'lit/directives/class-map.js';
|
||||||
import './image';
|
import './image';
|
||||||
import { updateElementStyleFromMediaLayoutConfig } from '../utils/media-layout.js';
|
import { updateElementStyleFromMediaLayoutConfig } from '../utils/media-layout.js';
|
||||||
import { TimelineDataManager } from '../utils/timeline-data-manager.js';
|
import { DataManager } from '../utils/data-manager.js';
|
||||||
|
|
||||||
// Number of seconds a signed URL is valid for.
|
// Number of seconds a signed URL is valid for.
|
||||||
const URL_SIGN_EXPIRY_SECONDS = 24 * 60 * 60;
|
const URL_SIGN_EXPIRY_SECONDS = 24 * 60 * 60;
|
||||||
@@ -97,7 +97,7 @@ export class FrigateCardLive extends LitElement {
|
|||||||
public liveOverrides?: LiveOverrides;
|
public liveOverrides?: LiveOverrides;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public timelineDataManager?: TimelineDataManager;
|
public dataManager?: DataManager;
|
||||||
|
|
||||||
// Whether or not the live view is currently in the background (i.e. preloaded
|
// Whether or not the live view is currently in the background (i.e. preloaded
|
||||||
// but not visible)
|
// but not visible)
|
||||||
@@ -221,7 +221,7 @@ export class FrigateCardLive extends LitElement {
|
|||||||
.timelineConfig=${config.controls.timeline}
|
.timelineConfig=${config.controls.timeline}
|
||||||
.browseMediaParams=${browseMediaParams ?? undefined}
|
.browseMediaParams=${browseMediaParams ?? undefined}
|
||||||
.cameras=${this.cameras}
|
.cameras=${this.cameras}
|
||||||
.timelineDataManager=${this.timelineDataManager}
|
.dataManager=${this.dataManager}
|
||||||
.inBackground=${this._inBackground}
|
.inBackground=${this._inBackground}
|
||||||
@frigate-card:message=${(ev: CustomEvent<Message>) => {
|
@frigate-card:message=${(ev: CustomEvent<Message>) => {
|
||||||
this._renderKey++;
|
this._renderKey++;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
getFirstTrueMediaChildIndex,
|
getFirstTrueMediaChildIndex,
|
||||||
multipleBrowseMediaQueryMerged,
|
multipleBrowseMediaQueryMerged,
|
||||||
} from '../utils/ha/browse-media';
|
} from '../utils/ha/browse-media';
|
||||||
import { TimelineDataManager } from '../utils/timeline-data-manager';
|
import { DataManager } from '../utils/data-manager';
|
||||||
import { View } from '../view.js';
|
import { View } from '../view.js';
|
||||||
import { dispatchFrigateCardErrorEvent } from './message.js';
|
import { dispatchFrigateCardErrorEvent } from './message.js';
|
||||||
import { ThumbnailCarouselTap } from './thumbnail-carousel.js';
|
import { ThumbnailCarouselTap } from './thumbnail-carousel.js';
|
||||||
@@ -70,7 +70,7 @@ export class FrigateCardSurround extends LitElement {
|
|||||||
public cameras?: Map<string, CameraConfig>;
|
public cameras?: Map<string, CameraConfig>;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public timelineDataManager?: TimelineDataManager;
|
public dataManager?: DataManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch thumbnail media when a target is not specified in the view (e.g. for
|
* Fetch thumbnail media when a target is not specified in the view (e.g. for
|
||||||
@@ -210,7 +210,7 @@ export class FrigateCardSurround extends LitElement {
|
|||||||
.timelineConfig=${this.timelineConfig}
|
.timelineConfig=${this.timelineConfig}
|
||||||
.thumbnailDetails=${this.thumbnailConfig?.show_details}
|
.thumbnailDetails=${this.thumbnailConfig?.show_details}
|
||||||
.thumbnailSize=${this.thumbnailConfig?.size}
|
.thumbnailSize=${this.thumbnailConfig?.size}
|
||||||
.timelineDataManager=${this.timelineDataManager}
|
.dataManager=${this.dataManager}
|
||||||
>
|
>
|
||||||
</frigate-card-timeline-core>`
|
</frigate-card-timeline-core>`
|
||||||
: ''}
|
: ''}
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
FrigateCardTimelineItem,
|
FrigateCardTimelineItem,
|
||||||
sortYoungestToOldest,
|
sortYoungestToOldest,
|
||||||
TimelineDataManager,
|
DataManager,
|
||||||
} from '../utils/timeline-data-manager';
|
} from '../utils/data-manager';
|
||||||
import { View } from '../view';
|
import { View } from '../view';
|
||||||
import { dispatchMessageEvent } from './message.js';
|
import { dispatchMessageEvent } from './message.js';
|
||||||
import './thumbnail.js';
|
import './thumbnail.js';
|
||||||
@@ -186,7 +186,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
public mini = false;
|
public mini = false;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public timelineDataManager?: TimelineDataManager;
|
public dataManager?: DataManager;
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
protected _locked = false;
|
protected _locked = false;
|
||||||
@@ -385,7 +385,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
!this._timeline ||
|
!this._timeline ||
|
||||||
!this.view ||
|
!this.view ||
|
||||||
!this.view.target?.children?.length ||
|
!this.view.target?.children?.length ||
|
||||||
!this.timelineDataManager
|
!this.dataManager
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -393,7 +393,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
const canSeek = !!this.view?.isViewerView();
|
const canSeek = !!this.view?.isViewerView();
|
||||||
const context = canSeek
|
const context = canSeek
|
||||||
? generateMediaViewerContextForChildren(
|
? generateMediaViewerContextForChildren(
|
||||||
this.timelineDataManager,
|
this.dataManager,
|
||||||
this.view.target.children,
|
this.view.target.children,
|
||||||
targetTime,
|
targetTime,
|
||||||
)
|
)
|
||||||
@@ -439,7 +439,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
!this._ignoreClick &&
|
!this._ignoreClick &&
|
||||||
properties.what &&
|
properties.what &&
|
||||||
this.hass &&
|
this.hass &&
|
||||||
this.timelineDataManager &&
|
this.dataManager &&
|
||||||
this.cameras &&
|
this.cameras &&
|
||||||
this.view
|
this.view
|
||||||
) {
|
) {
|
||||||
@@ -456,7 +456,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
changeViewToRecording(
|
changeViewToRecording(
|
||||||
this,
|
this,
|
||||||
this.hass,
|
this.hass,
|
||||||
this.timelineDataManager,
|
this.dataManager,
|
||||||
this.cameras,
|
this.cameras,
|
||||||
this.view, {
|
this.view, {
|
||||||
cameraIDs: new Set([String(properties.group)]),
|
cameraIDs: new Set([String(properties.group)]),
|
||||||
@@ -469,7 +469,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
changeViewToRecording(
|
changeViewToRecording(
|
||||||
this,
|
this,
|
||||||
this.hass,
|
this.hass,
|
||||||
this.timelineDataManager,
|
this.dataManager,
|
||||||
this.cameras,
|
this.cameras,
|
||||||
this.view, {
|
this.view, {
|
||||||
targetTime: window.end,
|
targetTime: window.end,
|
||||||
@@ -481,7 +481,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
changeViewToRecording(
|
changeViewToRecording(
|
||||||
this,
|
this,
|
||||||
this.hass,
|
this.hass,
|
||||||
this.timelineDataManager,
|
this.dataManager,
|
||||||
this.cameras,
|
this.cameras,
|
||||||
this.view, {
|
this.view, {
|
||||||
cameraIDs: this._getAllCameraIDs(),
|
cameraIDs: this._getAllCameraIDs(),
|
||||||
@@ -496,7 +496,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
properties.item &&
|
properties.item &&
|
||||||
this.view &&
|
this.view &&
|
||||||
this.view.target?.children &&
|
this.view.target?.children &&
|
||||||
this.timelineDataManager
|
this.dataManager
|
||||||
) {
|
) {
|
||||||
let childIndex: number | null = null;
|
let childIndex: number | null = null;
|
||||||
let target: FrigateBrowseMediaSource | null = null;
|
let target: FrigateBrowseMediaSource | null = null;
|
||||||
@@ -510,7 +510,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
childIndex = thumbnails.childIndex;
|
childIndex = thumbnails.childIndex;
|
||||||
if (thumbnails.target?.children?.length) {
|
if (thumbnails.target?.children?.length) {
|
||||||
context = generateMediaViewerContextForChildren(
|
context = generateMediaViewerContextForChildren(
|
||||||
this.timelineDataManager,
|
this.dataManager,
|
||||||
thumbnails.target.children,
|
thumbnails.target.children,
|
||||||
properties.time,
|
properties.time,
|
||||||
);
|
);
|
||||||
@@ -573,7 +573,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
properties.start,
|
properties.start,
|
||||||
properties.end,
|
properties.end,
|
||||||
);
|
);
|
||||||
this.timelineDataManager
|
this.dataManager
|
||||||
?.fetchIfNecessary(this, this.hass, prefetchStart, prefetchEnd)
|
?.fetchIfNecessary(this, this.hass, prefetchStart, prefetchEnd)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Don't show event thumbnails if the user is looking at recordings,
|
// Don't show event thumbnails if the user is looking at recordings,
|
||||||
@@ -879,7 +879,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
windowStart,
|
windowStart,
|
||||||
windowEnd,
|
windowEnd,
|
||||||
);
|
);
|
||||||
fetched = !!(await this.timelineDataManager?.fetchIfNecessary(
|
fetched = !!(await this.dataManager?.fetchIfNecessary(
|
||||||
this,
|
this,
|
||||||
this.hass,
|
this.hass,
|
||||||
prefetchStart,
|
prefetchStart,
|
||||||
@@ -900,7 +900,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
// update the dataset to ensure the newly selected item cannot be included
|
// update the dataset to ensure the newly selected item cannot be included
|
||||||
// in a cluster. Only do this when the pointer is not held to avoid
|
// in a cluster. Only do this when the pointer is not held to avoid
|
||||||
// interrupting the user and to make the timeline smoother.
|
// interrupting the user and to make the timeline smoother.
|
||||||
this.timelineDataManager?.rewriteItem(event.id);
|
this.dataManager?.rewriteItem(event.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -1027,7 +1027,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
let createdTimeline = false;
|
let createdTimeline = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.timelineDataManager &&
|
this.dataManager &&
|
||||||
this._refTimeline.value &&
|
this._refTimeline.value &&
|
||||||
options &&
|
options &&
|
||||||
this.timelineConfig &&
|
this.timelineConfig &&
|
||||||
@@ -1051,7 +1051,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._dataview = this.timelineDataManager.createDataView(
|
this._dataview = this.dataManager.createDataView(
|
||||||
this._getTimelineCameraIDs(),
|
this._getTimelineCameraIDs(),
|
||||||
!!this.timelineConfig.show_recordings,
|
!!this.timelineConfig.show_recordings,
|
||||||
this.timelineConfig.media,
|
this.timelineConfig.media,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit
|
|||||||
import { customElement, property } from 'lit/decorators.js';
|
import { customElement, property } from 'lit/decorators.js';
|
||||||
import timelineStyle from '../scss/timeline.scss';
|
import timelineStyle from '../scss/timeline.scss';
|
||||||
import { CameraConfig, ExtendedHomeAssistant, TimelineConfig } from '../types';
|
import { CameraConfig, ExtendedHomeAssistant, TimelineConfig } from '../types';
|
||||||
import { TimelineDataManager } from '../utils/timeline-data-manager';
|
import { DataManager } from '../utils/data-manager';
|
||||||
import { View } from '../view';
|
import { View } from '../view';
|
||||||
import './surround.js';
|
import './surround.js';
|
||||||
import './timeline-core.js';
|
import './timeline-core.js';
|
||||||
@@ -27,7 +27,7 @@ export class FrigateCardTimeline extends LitElement {
|
|||||||
public timelineConfig?: TimelineConfig;
|
public timelineConfig?: TimelineConfig;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public timelineDataManager?: TimelineDataManager;
|
public dataManager?: DataManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Master render method.
|
* Master render method.
|
||||||
@@ -52,7 +52,7 @@ export class FrigateCardTimeline extends LitElement {
|
|||||||
.timelineConfig=${this.timelineConfig}
|
.timelineConfig=${this.timelineConfig}
|
||||||
.thumbnailDetails=${this.timelineConfig.controls.thumbnails.show_details}
|
.thumbnailDetails=${this.timelineConfig.controls.thumbnails.show_details}
|
||||||
.thumbnailSize=${this.timelineConfig.controls.thumbnails.size}
|
.thumbnailSize=${this.timelineConfig.controls.thumbnails.size}
|
||||||
.timelineDataManager=${this.timelineDataManager}
|
.dataManager=${this.dataManager}
|
||||||
>
|
>
|
||||||
</frigate-card-timeline-core>
|
</frigate-card-timeline-core>
|
||||||
</frigate-card-surround>`;
|
</frigate-card-surround>`;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import './surround.js';
|
|||||||
import { EmblaCarouselPlugins } from './carousel.js';
|
import { EmblaCarouselPlugins } from './carousel.js';
|
||||||
import { renderTask } from '../utils/task.js';
|
import { renderTask } from '../utils/task.js';
|
||||||
import { updateElementStyleFromMediaLayoutConfig } from '../utils/media-layout.js';
|
import { updateElementStyleFromMediaLayoutConfig } from '../utils/media-layout.js';
|
||||||
import { TimelineDataManager } from '../utils/timeline-data-manager.js';
|
import { DataManager } from '../utils/data-manager.js';
|
||||||
import { changeViewToRecentRecordingForCameraAndDependents } from '../utils/media-to-view.js';
|
import { changeViewToRecentRecordingForCameraAndDependents } from '../utils/media-to-view.js';
|
||||||
|
|
||||||
export interface MediaSeek {
|
export interface MediaSeek {
|
||||||
@@ -95,7 +95,7 @@ export class FrigateCardViewer extends LitElement {
|
|||||||
public resolvedMediaCache?: ResolvedMediaCache;
|
public resolvedMediaCache?: ResolvedMediaCache;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public timelineDataManager?: TimelineDataManager;
|
public dataManager?: DataManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Master render method.
|
* Master render method.
|
||||||
@@ -107,7 +107,7 @@ export class FrigateCardViewer extends LitElement {
|
|||||||
!this.view ||
|
!this.view ||
|
||||||
!this.cameras ||
|
!this.cameras ||
|
||||||
!this.viewerConfig ||
|
!this.viewerConfig ||
|
||||||
!this.timelineDataManager
|
!this.dataManager
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ export class FrigateCardViewer extends LitElement {
|
|||||||
changeViewToRecentRecordingForCameraAndDependents(
|
changeViewToRecentRecordingForCameraAndDependents(
|
||||||
this,
|
this,
|
||||||
this.hass,
|
this.hass,
|
||||||
this.timelineDataManager,
|
this.dataManager,
|
||||||
this.cameras,
|
this.cameras,
|
||||||
this.view,
|
this.view,
|
||||||
{
|
{
|
||||||
@@ -160,7 +160,7 @@ export class FrigateCardViewer extends LitElement {
|
|||||||
.fetch=${false}
|
.fetch=${false}
|
||||||
.thumbnailConfig=${this.viewerConfig.controls.thumbnails}
|
.thumbnailConfig=${this.viewerConfig.controls.thumbnails}
|
||||||
.timelineConfig=${this.viewerConfig.controls.timeline}
|
.timelineConfig=${this.viewerConfig.controls.timeline}
|
||||||
.timelineDataManager=${this.timelineDataManager}
|
.dataManager=${this.dataManager}
|
||||||
.cameras=${this.cameras}
|
.cameras=${this.cameras}
|
||||||
>
|
>
|
||||||
<frigate-card-viewer-carousel
|
<frigate-card-viewer-carousel
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
FrigateEvent,
|
FrigateEvent,
|
||||||
FrigateEvents,
|
FrigateEvents,
|
||||||
} from '../types.js';
|
} from '../types.js';
|
||||||
import { errorToConsole, runWhenIdleIfSupported } from '../utils/basic.js';
|
import { errorToConsole, runWhenIdleIfSupported } from './basic.js';
|
||||||
import {
|
import {
|
||||||
FrigateGetEventsParameters,
|
FrigateGetEventsParameters,
|
||||||
getEventsMultiple,
|
getEventsMultiple,
|
||||||
@@ -23,8 +23,8 @@ import fromUnixTime from 'date-fns/fromUnixTime';
|
|||||||
import { throttle } from 'lodash-es';
|
import { throttle } from 'lodash-es';
|
||||||
|
|
||||||
const RECORDING_SEGMENT_TOLERANCE = 60;
|
const RECORDING_SEGMENT_TOLERANCE = 60;
|
||||||
const TIMELINE_DATA_MANAGER_MAX_AGE_SECONDS = 10;
|
const DATA_MANAGER_MAX_AGE_SECONDS = 10;
|
||||||
const TIMELINE_DATA_MANAGER_MAX_FETCH_COUNT = 10000;
|
const DATA_MANAGER_MAX_FETCH_COUNT = 10000;
|
||||||
|
|
||||||
export interface FrigateCardTimelineItem extends TimelineItem {
|
export interface FrigateCardTimelineItem extends TimelineItem {
|
||||||
// DataView has issues using datasets with Date objects, so avoid them and use
|
// DataView has issues using datasets with Date objects, so avoid them and use
|
||||||
@@ -84,7 +84,7 @@ export const sortOldestToYoungest = (
|
|||||||
/**
|
/**
|
||||||
* A manager to maintain/fetch timeline events.
|
* A manager to maintain/fetch timeline events.
|
||||||
*/
|
*/
|
||||||
export class TimelineDataManager {
|
export class DataManager {
|
||||||
protected _recordingSummary: Map<string, RecordingSummary | null> = new Map();
|
protected _recordingSummary: Map<string, RecordingSummary | null> = new Map();
|
||||||
protected _recordingSegments = new DataSet<RecordingSegmentsItem>();
|
protected _recordingSegments = new DataSet<RecordingSegmentsItem>();
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ export class TimelineDataManager {
|
|||||||
|
|
||||||
// The maximum allowable age of fetch data (will not fetch more frequently
|
// The maximum allowable age of fetch data (will not fetch more frequently
|
||||||
// than this).
|
// than this).
|
||||||
protected _maxAgeSeconds: number = TIMELINE_DATA_MANAGER_MAX_AGE_SECONDS;
|
protected _maxAgeSeconds: number = DATA_MANAGER_MAX_AGE_SECONDS;
|
||||||
|
|
||||||
protected _cameras: Map<string, CameraConfig>;
|
protected _cameras: Map<string, CameraConfig>;
|
||||||
protected _mediaType: TimelineMediaType;
|
protected _mediaType: TimelineMediaType;
|
||||||
@@ -526,7 +526,7 @@ export class TimelineDataManager {
|
|||||||
...(cameraConfig.frigate.zone && { label: cameraConfig.frigate.zone }),
|
...(cameraConfig.frigate.zone && { label: cameraConfig.frigate.zone }),
|
||||||
before: Math.floor(end.getTime() / 1000),
|
before: Math.floor(end.getTime() / 1000),
|
||||||
after: Math.floor(start.getTime() / 1000),
|
after: Math.floor(start.getTime() / 1000),
|
||||||
limit: TIMELINE_DATA_MANAGER_MAX_FETCH_COUNT,
|
limit: DATA_MANAGER_MAX_FETCH_COUNT,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -10,8 +10,8 @@ import { createChild, createEventParentForChildren, sortYoungestToOldest } from
|
|||||||
import {
|
import {
|
||||||
RecordingSegmentsItem,
|
RecordingSegmentsItem,
|
||||||
sortOldestToYoungest,
|
sortOldestToYoungest,
|
||||||
TimelineDataManager,
|
DataManager,
|
||||||
} from './timeline-data-manager';
|
} from './data-manager';
|
||||||
import { getAllDependentCameras, getTrueCameras } from './camera.js';
|
import { getAllDependentCameras, getTrueCameras } from './camera.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +26,7 @@ import { getAllDependentCameras, getTrueCameras } from './camera.js';
|
|||||||
export const changeViewToRecentRecordingForCameraAndDependents = async (
|
export const changeViewToRecentRecordingForCameraAndDependents = async (
|
||||||
element: HTMLElement,
|
element: HTMLElement,
|
||||||
hass: ExtendedHomeAssistant,
|
hass: ExtendedHomeAssistant,
|
||||||
dataManager: TimelineDataManager,
|
dataManager: DataManager,
|
||||||
cameras: Map<string, CameraConfig>,
|
cameras: Map<string, CameraConfig>,
|
||||||
view: View,
|
view: View,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -66,7 +66,7 @@ import { getAllDependentCameras, getTrueCameras } from './camera.js';
|
|||||||
export const changeViewToRecording = async (
|
export const changeViewToRecording = async (
|
||||||
element: HTMLElement,
|
element: HTMLElement,
|
||||||
hass: ExtendedHomeAssistant,
|
hass: ExtendedHomeAssistant,
|
||||||
dataManager: TimelineDataManager,
|
dataManager: DataManager,
|
||||||
cameras: Map<string, CameraConfig>,
|
cameras: Map<string, CameraConfig>,
|
||||||
view: View,
|
view: View,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -122,7 +122,7 @@ export const changeViewToRecording = async (
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const createRecordingChildren = (
|
const createRecordingChildren = (
|
||||||
dataManager: TimelineDataManager,
|
dataManager: DataManager,
|
||||||
cameras: Map<string, CameraConfig>,
|
cameras: Map<string, CameraConfig>,
|
||||||
cameraIDs: Set<string>,
|
cameraIDs: Set<string>,
|
||||||
options?: {
|
options?: {
|
||||||
@@ -191,7 +191,7 @@ const createRecordingChildren = (
|
|||||||
* @returns The ViewContext.
|
* @returns The ViewContext.
|
||||||
*/
|
*/
|
||||||
export const generateMediaViewerContextForChildren = (
|
export const generateMediaViewerContextForChildren = (
|
||||||
dataManager: TimelineDataManager,
|
dataManager: DataManager,
|
||||||
children: FrigateBrowseMediaSource[],
|
children: FrigateBrowseMediaSource[],
|
||||||
targetTime: Date,
|
targetTime: Date,
|
||||||
): ViewContext => {
|
): ViewContext => {
|
||||||
|
|||||||
Reference in New Issue
Block a user