Clicking on an event in the timeline always plays.

This commit is contained in:
Dermot Duffy
2023-04-07 07:49:36 -07:00
parent deaead562f
commit d25d85eb34
4 changed files with 71 additions and 69 deletions
+1 -4
View File
@@ -144,10 +144,7 @@ export class FrigateCardSurround extends LitElement {
return null; return null;
} }
if (this.view?.is('live')) { if (this.view?.is('live')) {
return getAllDependentCameras( return getAllDependentCameras(this.cameraManager, this.view.camera);
this.cameraManager,
this.view.camera,
);
} }
if (this.view.isViewerView()) { if (this.view.isViewerView()) {
return new Set( return new Set(
+7 -15
View File
@@ -34,15 +34,11 @@ import {
ExtendedHomeAssistant, ExtendedHomeAssistant,
frigateCardConfigDefaults, frigateCardConfigDefaults,
FrigateCardView, FrigateCardView,
ThumbnailsControlConfig, ThumbnailsControlBaseConfig,
TimelineCoreConfig, TimelineCoreConfig,
} from '../types'; } from '../types';
import { stopEventFromActivatingCardWideActions } from '../utils/action'; import { stopEventFromActivatingCardWideActions } from '../utils/action';
import { import { contentsChanged, isHoverableDevice } from '../utils/basic';
contentsChanged,
dispatchFrigateCardEvent,
isHoverableDevice,
} from '../utils/basic';
import { import {
createQueriesForRecordingsView, createQueriesForRecordingsView,
executeMediaQueryForView, executeMediaQueryForView,
@@ -173,7 +169,7 @@ export class FrigateCardTimelineCore extends LitElement {
public timelineConfig?: TimelineCoreConfig; public timelineConfig?: TimelineCoreConfig;
@property({ attribute: true, type: Boolean }) @property({ attribute: true, type: Boolean })
public thumbnailConfig?: ThumbnailsControlConfig; public thumbnailConfig?: ThumbnailsControlBaseConfig;
// Whether or not this is a mini-timeline (in mini-mode the component takes a // Whether or not this is a mini-timeline (in mini-mode the component takes a
// supportive role for other views). // supportive role for other views).
@@ -585,6 +581,7 @@ export class FrigateCardTimelineCore extends LitElement {
} else { } else {
view = this.view.evolve({ view = this.view.evolve({
queryResults: newResults, queryResults: newResults,
view: 'media',
}); });
} }
@@ -595,12 +592,6 @@ export class FrigateCardTimelineCore extends LitElement {
if (view) { if (view) {
view.dispatchChangeEvent(this); view.dispatchChangeEvent(this);
if (this.view?.is('timeline')) {
dispatchFrigateCardEvent(this, 'thumbnails:open');
}
} else if (this.view?.is('timeline')) {
dispatchFrigateCardEvent(this, 'thumbnails:close');
} }
this._ignoreClick = false; this._ignoreClick = false;
@@ -1114,13 +1105,11 @@ export class FrigateCardTimelineCore extends LitElement {
this._destroy(); this._destroy();
} }
const options = this._getOptions();
let createdTimeline = false; let createdTimeline = false;
if ( if (
this._timelineSource && this._timelineSource &&
this._refTimeline.value && this._refTimeline.value &&
options &&
this.timelineConfig && this.timelineConfig &&
(changedProperties.has('timelineConfig') || changedProperties.has('cameraIDs')) (changedProperties.has('timelineConfig') || changedProperties.has('cameraIDs'))
) { ) {
@@ -1139,6 +1128,8 @@ export class FrigateCardTimelineCore extends LitElement {
return; return;
} }
const options = this._getOptions();
if (options) {
createdTimeline = true; createdTimeline = true;
if (this.mini && groups.length === 1) { if (this.mini && groups.length === 1) {
// In a mini timeline, if there's only one group don't bother grouping // In a mini timeline, if there's only one group don't bother grouping
@@ -1179,6 +1170,7 @@ export class FrigateCardTimelineCore extends LitElement {
this._removeTargetBar(); this._removeTargetBar();
}); });
} }
}
if (changedProperties.has('view')) { if (changedProperties.has('view')) {
if (createdTimeline) { if (createdTimeline) {
+24 -11
View File
@@ -779,8 +779,8 @@ export type ImageViewConfig = z.infer<typeof imageConfigSchema>;
/** /**
* Thumbnail controls configuration section. * Thumbnail controls configuration section.
*/ */
const thumbnailControlsDefaults = {
mode: 'right' as const, const thumbnailControlsBaseDefaults = {
size: 100, size: 100,
show_details: true, show_details: true,
show_favorite_control: true, show_favorite_control: true,
@@ -788,26 +788,39 @@ const thumbnailControlsDefaults = {
show_download_control: true, show_download_control: true,
}; };
const thumbnailsControlSchema = z.object({ // Configuration for the actual rendered thumbnail.
mode: z const thumbnailsControlBaseSchema = z.object({
.enum(['none', 'above', 'below', 'left', 'right'])
.default(thumbnailControlsDefaults.mode),
size: z size: z
.number() .number()
.min(THUMBNAIL_WIDTH_MIN) .min(THUMBNAIL_WIDTH_MIN)
.max(THUMBNAIL_WIDTH_MAX) .max(THUMBNAIL_WIDTH_MAX)
.default(thumbnailControlsDefaults.size), .default(thumbnailControlsBaseDefaults.size),
show_details: z.boolean().default(thumbnailControlsDefaults.show_details), show_details: z.boolean().default(thumbnailControlsBaseDefaults.show_details),
show_favorite_control: z show_favorite_control: z
.boolean() .boolean()
.default(thumbnailControlsDefaults.show_favorite_control), .default(thumbnailControlsBaseDefaults.show_favorite_control),
show_timeline_control: z show_timeline_control: z
.boolean() .boolean()
.default(thumbnailControlsDefaults.show_timeline_control), .default(thumbnailControlsBaseDefaults.show_timeline_control),
show_download_control: z show_download_control: z
.boolean() .boolean()
.default(thumbnailControlsDefaults.show_download_control), .default(thumbnailControlsBaseDefaults.show_download_control),
}); });
export type ThumbnailsControlBaseConfig = z.infer<typeof thumbnailsControlBaseSchema>;
// Configuration that may control the placement of the thumbnail.
const thumbnailControlsDefaults = {
...thumbnailControlsBaseDefaults,
mode: 'right' as const,
};
const thumbnailsControlSchema = thumbnailsControlBaseSchema.extend({
mode: z
.enum(['none', 'above', 'below', 'left', 'right'])
.default(thumbnailControlsDefaults.mode),
});
export type ThumbnailsControlConfig = z.infer<typeof thumbnailsControlSchema>; export type ThumbnailsControlConfig = z.infer<typeof thumbnailsControlSchema>;
/** /**