Rename TimelineDataManager to DataManager .

This commit is contained in:
Dermot Duffy
2022-10-02 20:19:47 -07:00
parent 81d94eb64d
commit 143a597039
9 changed files with 51 additions and 54 deletions
@@ -9,7 +9,7 @@ import {
FrigateEvent,
FrigateEvents,
} from '../types.js';
import { errorToConsole, runWhenIdleIfSupported } from '../utils/basic.js';
import { errorToConsole, runWhenIdleIfSupported } from './basic.js';
import {
FrigateGetEventsParameters,
getEventsMultiple,
@@ -23,8 +23,8 @@ import fromUnixTime from 'date-fns/fromUnixTime';
import { throttle } from 'lodash-es';
const RECORDING_SEGMENT_TOLERANCE = 60;
const TIMELINE_DATA_MANAGER_MAX_AGE_SECONDS = 10;
const TIMELINE_DATA_MANAGER_MAX_FETCH_COUNT = 10000;
const DATA_MANAGER_MAX_AGE_SECONDS = 10;
const DATA_MANAGER_MAX_FETCH_COUNT = 10000;
export interface FrigateCardTimelineItem extends TimelineItem {
// 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.
*/
export class TimelineDataManager {
export class DataManager {
protected _recordingSummary: Map<string, RecordingSummary | null> = new Map();
protected _recordingSegments = new DataSet<RecordingSegmentsItem>();
@@ -101,7 +101,7 @@ export class TimelineDataManager {
// The maximum allowable age of fetch data (will not fetch more frequently
// 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 _mediaType: TimelineMediaType;
@@ -526,7 +526,7 @@ export class TimelineDataManager {
...(cameraConfig.frigate.zone && { label: cameraConfig.frigate.zone }),
before: Math.floor(end.getTime() / 1000),
after: Math.floor(start.getTime() / 1000),
limit: TIMELINE_DATA_MANAGER_MAX_FETCH_COUNT,
limit: DATA_MANAGER_MAX_FETCH_COUNT,
});
}
});
+6 -6
View File
@@ -10,8 +10,8 @@ import { createChild, createEventParentForChildren, sortYoungestToOldest } from
import {
RecordingSegmentsItem,
sortOldestToYoungest,
TimelineDataManager,
} from './timeline-data-manager';
DataManager,
} from './data-manager';
import { getAllDependentCameras, getTrueCameras } from './camera.js';
/**
@@ -26,7 +26,7 @@ import { getAllDependentCameras, getTrueCameras } from './camera.js';
export const changeViewToRecentRecordingForCameraAndDependents = async (
element: HTMLElement,
hass: ExtendedHomeAssistant,
dataManager: TimelineDataManager,
dataManager: DataManager,
cameras: Map<string, CameraConfig>,
view: View,
options?: {
@@ -66,7 +66,7 @@ import { getAllDependentCameras, getTrueCameras } from './camera.js';
export const changeViewToRecording = async (
element: HTMLElement,
hass: ExtendedHomeAssistant,
dataManager: TimelineDataManager,
dataManager: DataManager,
cameras: Map<string, CameraConfig>,
view: View,
options?: {
@@ -122,7 +122,7 @@ export const changeViewToRecording = async (
* @returns
*/
const createRecordingChildren = (
dataManager: TimelineDataManager,
dataManager: DataManager,
cameras: Map<string, CameraConfig>,
cameraIDs: Set<string>,
options?: {
@@ -191,7 +191,7 @@ const createRecordingChildren = (
* @returns The ViewContext.
*/
export const generateMediaViewerContextForChildren = (
dataManager: TimelineDataManager,
dataManager: DataManager,
children: FrigateBrowseMediaSource[],
targetTime: Date,
): ViewContext => {