Minor fixes.

This commit is contained in:
Dermot Duffy
2022-09-23 18:21:17 -07:00
parent c910b5d2a4
commit 0491018aab
3 changed files with 42 additions and 29 deletions
-2
View File
@@ -1,10 +1,8 @@
// TODO: When a media viewer is first loaded the selected child won't work (because the underlying carousel has not yet rendered) // TODO: When a media viewer is first loaded the selected child won't work (because the underlying carousel has not yet rendered)
// TODO: unselect in mini timeline should not cause media viewer to render nothing
// TODO: delete segments if not in summary? is this actually necessary? could it create gaps in data? better off stopping access via summary? // TODO: delete segments if not in summary? is this actually necessary? could it create gaps in data? better off stopping access via summary?
// TODO: support filtering created dataviews by recordings or mediatype (so storage ) // TODO: support filtering created dataviews by recordings or mediatype (so storage )
// TODO: Make minitimeline configurable in the editor // TODO: Make minitimeline configurable in the editor
// TODO: Make performance okay for 2+ days of events
import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit'; import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit';
import { customElement, property } from 'lit/decorators.js'; import { customElement, property } from 'lit/decorators.js';
+29 -27
View File
@@ -569,10 +569,12 @@ export type PictureElements = z.infer<typeof pictureElementsSchema>;
*/ */
const mediaLayoutConfigSchema = z.object({ const mediaLayoutConfigSchema = z.object({
fit: z.enum(['contain', 'cover', 'fill']).optional(), fit: z.enum(['contain', 'cover', 'fill']).optional(),
position: z.object({ position: z
x: z.number().min(0).max(100).optional(), .object({
y: z.number().min(0).max(100).optional(), x: z.number().min(0).max(100).optional(),
}).optional(), y: z.number().min(0).max(100).optional(),
})
.optional(),
}); });
export type MediaLayoutConfig = z.infer<typeof mediaLayoutConfigSchema>; export type MediaLayoutConfig = z.infer<typeof mediaLayoutConfigSchema>;
@@ -667,27 +669,26 @@ const timelineCoreConfigDefault = {
show_recordings: true, show_recordings: true,
}; };
const timelineCoreConfigSchema = z const timelineMediaSchema = z.enum(['all', 'clips', 'snapshots']);
.object({ export type TimelineMedia = z.infer<typeof timelineMediaSchema>;
clustering_threshold: z
.number() const timelineCoreConfigSchema = z.object({
.optional() clustering_threshold: z
.default(timelineCoreConfigDefault.clustering_threshold), .number()
media: z .optional()
.enum(['all', 'clips', 'snapshots']) .default(timelineCoreConfigDefault.clustering_threshold),
.optional() media: timelineMediaSchema.optional().default(timelineCoreConfigDefault.media),
.default(timelineCoreConfigDefault.media), window_seconds: z
window_seconds: z .number()
.number() .min(1 * 60)
.min(1 * 60) .max(24 * 60 * 60)
.max(24 * 60 * 60) .optional()
.optional() .default(timelineCoreConfigDefault.window_seconds),
.default(timelineCoreConfigDefault.window_seconds), show_recordings: z
show_recordings: z .boolean()
.boolean() .optional()
.optional() .default(timelineCoreConfigDefault.show_recordings),
.default(timelineCoreConfigDefault.show_recordings), });
});
export type TimelineCoreConfig = z.infer<typeof timelineCoreConfigSchema>; export type TimelineCoreConfig = z.infer<typeof timelineCoreConfigSchema>;
const miniTimelineConfigSchema = timelineCoreConfigSchema.extend({ const miniTimelineConfigSchema = timelineCoreConfigSchema.extend({
@@ -1136,7 +1137,8 @@ const timelineConfigDefault = {
}, },
}; };
const timelineConfigSchema = timelineCoreConfigSchema.extend({ const timelineConfigSchema = timelineCoreConfigSchema
.extend({
controls: z controls: z
.object({ .object({
thumbnails: thumbnailsControlSchema thumbnails: thumbnailsControlSchema
@@ -1417,7 +1419,7 @@ export const frigateBrowseMediaSourceSchema: z.ZodSchema<BrowseMediaSource> = z.
children: z.array(frigateBrowseMediaSourceSchema).nullable().optional(), children: z.array(frigateBrowseMediaSourceSchema).nullable().optional(),
frigate: z frigate: z
.object({ .object({
event: frigateEventSchema event: frigateEventSchema,
}) })
.optional(), .optional(),
}), }),
+13
View File
@@ -122,6 +122,12 @@ export class TimelineDataManager {
return this._recordingSummary.get(cameraID) ?? null; return this._recordingSummary.get(cameraID) ?? null;
} }
/**
* Create a dataview for a given set of camera.
* @param cameraIDs The cameraIDs to include.
* @param showRecordings Whether or not to show recordings.
* @returns
*/
public createDataView( public createDataView(
cameraIDs: Set<string>, cameraIDs: Set<string>,
showRecordings: boolean, showRecordings: boolean,
@@ -134,10 +140,17 @@ export class TimelineDataManager {
}); });
} }
/**
* Create a dataview for segments.
* @returns
*/
public createSegmentDataView(): DataView<RecordingSegmentsItem> { public createSegmentDataView(): DataView<RecordingSegmentsItem> {
return new DataView(this._recordingSegments); return new DataView(this._recordingSegments);
} }
/**
* Get the underlying recording segments dataset.
*/
get recordingSegments(): DataSet<RecordingSegmentsItem> { get recordingSegments(): DataSet<RecordingSegmentsItem> {
return this._recordingSegments; return this._recordingSegments;
} }