Handle timeline item click corner case.
This commit is contained in:
@@ -503,39 +503,40 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
);
|
);
|
||||||
} else if (
|
} else if (
|
||||||
properties.item &&
|
properties.item &&
|
||||||
properties.what === 'item' &&
|
properties.what === 'item'
|
||||||
MediaQueriesClassifier.areRecordingQueries(this.view.query)
|
|
||||||
) {
|
) {
|
||||||
const eventView = await this._createViewWithEventMediaQuery(
|
const newResults = this.view.queryResults?.clone()
|
||||||
|
.resetSelectedResult()
|
||||||
|
.selectResultIfFound(
|
||||||
|
(media) => !!this.cameras && media.getID() === properties.item,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!newResults || !newResults.hasSelectedResult()) {
|
||||||
|
// This can happen if this is a recording query (with recorded hours)
|
||||||
|
// and an event is clicked on the timeline, or if the current thumbnails
|
||||||
|
// is a filtered view from the media gallery (i.e. any case where the
|
||||||
|
// thumbnails may not be match the events on the timeline).
|
||||||
|
const fullEventView = await this._createViewWithEventMediaQuery(
|
||||||
this._createEventMediaQuerys(),
|
this._createEventMediaQuerys(),
|
||||||
{
|
{
|
||||||
selectedItem: properties.item,
|
selectedItem: properties.item,
|
||||||
targetView: 'media',
|
targetView: 'media',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const results = eventView?.queryResults?.getResults();
|
if (fullEventView?.queryResults?.hasResults()) {
|
||||||
// Specifically ensure there are _some_ results before dispatching the
|
view = fullEventView;
|
||||||
// view change.
|
|
||||||
if (eventView && results && results.length) {
|
|
||||||
eventView.mergeInContext({ mediaViewer: { seek: properties.time } });
|
|
||||||
view = eventView;
|
|
||||||
}
|
}
|
||||||
} else if (
|
} else {
|
||||||
properties.item &&
|
|
||||||
properties.what === 'item' &&
|
|
||||||
this.view.queryResults?.hasResults() &&
|
|
||||||
this.view.query
|
|
||||||
) {
|
|
||||||
view = this.view.evolve({
|
view = this.view.evolve({
|
||||||
queryResults: this.view.queryResults
|
queryResults: newResults,
|
||||||
?.clone()
|
|
||||||
.resetSelectedResult()
|
|
||||||
.selectResultIfFound(
|
|
||||||
(media) => !!this.cameras && media.getID() === properties.item,
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (view?.queryResults?.hasResults()) {
|
||||||
|
view.mergeInContext({ mediaViewer: { seek: properties.time } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (view) {
|
if (view) {
|
||||||
view
|
view
|
||||||
// If the user is clicking something in the timeline, don't
|
// If the user is clicking something in the timeline, don't
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
// Hard:
|
// Hard:
|
||||||
// - TODO: Remove FrigateBrowseMediaSource if not necessary (post-gallery).
|
// - TODO: Remove FrigateBrowseMediaSource if not necessary (post-gallery).
|
||||||
// - TODO: Remove browse-media.ts TODOs.
|
// - TODO: Remove browse-media.ts TODOs.
|
||||||
// - TODO: What should the timeline do when an event is clicked on that is not in the queryResults (or if queryResults is empty)?
|
|
||||||
// - TODO: Should the timeline data source clear events (as it currently does) when the query changes?
|
|
||||||
|
|
||||||
import { ViewContext } from 'view';
|
import { ViewContext } from 'view';
|
||||||
import {
|
import {
|
||||||
|
|||||||
Reference in New Issue
Block a user