Merge pull request #1046 from dermotduffy/timeline-bar
Don't show timeline bar if we cannot seek
This commit is contained in:
@@ -1076,6 +1076,7 @@ export class FrigateCameraManagerEngine
|
|||||||
return {
|
return {
|
||||||
canFavoriteEvents: !isBirdseye,
|
canFavoriteEvents: !isBirdseye,
|
||||||
canFavoriteRecordings: !isBirdseye,
|
canFavoriteRecordings: !isBirdseye,
|
||||||
|
canSeek: true,
|
||||||
supportsClips: !isBirdseye,
|
supportsClips: !isBirdseye,
|
||||||
supportsSnapshots: !isBirdseye,
|
supportsSnapshots: !isBirdseye,
|
||||||
supportsRecordings: !isBirdseye,
|
supportsRecordings: !isBirdseye,
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ export class GenericCameraManagerEngine implements CameraManagerEngine {
|
|||||||
return {
|
return {
|
||||||
canFavoriteEvents: false,
|
canFavoriteEvents: false,
|
||||||
canFavoriteRecordings: false,
|
canFavoriteRecordings: false,
|
||||||
|
canSeek: false,
|
||||||
supportsClips: false,
|
supportsClips: false,
|
||||||
supportsRecordings: false,
|
supportsRecordings: false,
|
||||||
supportsSnapshots: false,
|
supportsSnapshots: false,
|
||||||
|
|||||||
@@ -747,6 +747,9 @@ export class CameraManager {
|
|||||||
canFavoriteRecordings: perCameraCapabilities.some(
|
canFavoriteRecordings: perCameraCapabilities.some(
|
||||||
(cap) => cap?.canFavoriteRecordings,
|
(cap) => cap?.canFavoriteRecordings,
|
||||||
),
|
),
|
||||||
|
canSeek: perCameraCapabilities.some(
|
||||||
|
(cap) => cap?.canSeek,
|
||||||
|
),
|
||||||
|
|
||||||
supportsClips: perCameraCapabilities.some((cap) => cap?.supportsClips),
|
supportsClips: perCameraCapabilities.some((cap) => cap?.supportsClips),
|
||||||
supportsRecordings: perCameraCapabilities.some((cap) => cap?.supportsRecordings),
|
supportsRecordings: perCameraCapabilities.some((cap) => cap?.supportsRecordings),
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ export interface MediaMetadata {
|
|||||||
interface BaseCapabilities {
|
interface BaseCapabilities {
|
||||||
canFavoriteEvents: boolean;
|
canFavoriteEvents: boolean;
|
||||||
canFavoriteRecordings: boolean;
|
canFavoriteRecordings: boolean;
|
||||||
|
canSeek: boolean;
|
||||||
|
|
||||||
supportsClips: boolean;
|
supportsClips: boolean;
|
||||||
supportsRecordings: boolean;
|
supportsRecordings: boolean;
|
||||||
|
|||||||
@@ -280,6 +280,26 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
${ref(this._refTimeline)}
|
${ref(this._refTimeline)}
|
||||||
>
|
>
|
||||||
<div class="timeline-tools">
|
<div class="timeline-tools">
|
||||||
|
${this._shouldSupportSeeking()
|
||||||
|
? html` <ha-icon
|
||||||
|
.icon=${`mdi:${this._locked ? 'lock' : 'lock-open-variant'}`}
|
||||||
|
@click=${() => {
|
||||||
|
this._locked = !this._locked;
|
||||||
|
}}
|
||||||
|
aria-label="${lockTitle}"
|
||||||
|
title="${lockTitle}"
|
||||||
|
>
|
||||||
|
</ha-icon>`
|
||||||
|
: ''}
|
||||||
|
<ha-icon
|
||||||
|
.icon=${`mdi:calendar-search`}
|
||||||
|
aria-label="${localize('timeline.select_date')}"
|
||||||
|
title="${localize('timeline.select_date')}"
|
||||||
|
@click=${() => {
|
||||||
|
this._refDatePicker.value?.open();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</ha-icon>
|
||||||
<frigate-card-date-picker
|
<frigate-card-date-picker
|
||||||
${ref(this._refDatePicker)}
|
${ref(this._refDatePicker)}
|
||||||
@frigate-card:date-picker:change=${(ev: CustomEvent<DatePickerEvent>) => {
|
@frigate-card:date-picker:change=${(ev: CustomEvent<DatePickerEvent>) => {
|
||||||
@@ -290,24 +310,6 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
</frigate-card-date-picker>
|
</frigate-card-date-picker>
|
||||||
<ha-icon
|
|
||||||
.icon=${`mdi:calendar-search`}
|
|
||||||
aria-label="${localize('timeline.select_date')}"
|
|
||||||
title="${localize('timeline.select_date')}"
|
|
||||||
@click=${() => {
|
|
||||||
this._refDatePicker.value?.open();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
</ha-icon>
|
|
||||||
<ha-icon
|
|
||||||
.icon=${`mdi:${this._locked ? 'lock' : 'lock-open-variant'}`}
|
|
||||||
@click=${() => {
|
|
||||||
this._locked = !this._locked;
|
|
||||||
}}
|
|
||||||
aria-label="${lockTitle}"
|
|
||||||
title="${lockTitle}"
|
|
||||||
>
|
|
||||||
</ha-icon>
|
|
||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
: ''}`;
|
: ''}`;
|
||||||
@@ -357,6 +359,16 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected _shouldSupportSeeking(): boolean {
|
||||||
|
const cameraIDs = this._getTimelineCameraIDs();
|
||||||
|
if (!this._timeline || !cameraIDs) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const capabilities = this.cameraManager?.getAggregateCameraCapabilities(cameraIDs);
|
||||||
|
return (this.view?.isViewerView() && capabilities?.canSeek) ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the target bar at a given time.
|
* Set the target bar at a given time.
|
||||||
* @param targetTime
|
* @param targetTime
|
||||||
@@ -367,7 +379,8 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const targetBarOn =
|
const targetBarOn =
|
||||||
!this._locked ||
|
this._shouldSupportSeeking() &&
|
||||||
|
(!this._locked ||
|
||||||
(this.mini &&
|
(this.mini &&
|
||||||
this._timeline.getSelection().some((id) => {
|
this._timeline.getSelection().some((id) => {
|
||||||
const item = this._timelineSource?.dataset?.get(id);
|
const item = this._timelineSource?.dataset?.get(id);
|
||||||
@@ -378,7 +391,7 @@ export class FrigateCardTimelineCore extends LitElement {
|
|||||||
targetTime.getTime() >= item.start &&
|
targetTime.getTime() >= item.start &&
|
||||||
targetTime.getTime() <= item.end
|
targetTime.getTime() <= item.end
|
||||||
);
|
);
|
||||||
}));
|
})));
|
||||||
|
|
||||||
if (targetBarOn) {
|
if (targetBarOn) {
|
||||||
if (!this._targetBarVisible) {
|
if (!this._targetBarVisible) {
|
||||||
|
|||||||
Reference in New Issue
Block a user