mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-03 09:38:15 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2e46fe5a4 |
@@ -14,8 +14,6 @@ services:
|
||||
dockerfile: docker/main/Dockerfile
|
||||
# Use target devcontainer-trt for TensorRT dev
|
||||
target: devcontainer
|
||||
cache_from:
|
||||
- ghcr.io/blakeblackshear/frigate:cache-amd64
|
||||
## Uncomment this block for nvidia gpu support
|
||||
# deploy:
|
||||
# resources:
|
||||
|
||||
@@ -52,14 +52,6 @@ RUN --mount=type=tmpfs,target=/tmp --mount=type=tmpfs,target=/var/cache/apt \
|
||||
--mount=type=cache,target=/root/.ccache \
|
||||
/deps/build_sqlite_vec.sh
|
||||
|
||||
# Build intel-media-driver from source against bookworm's system libva so it
|
||||
# works with Debian 12's glibc/libstdc++ (pre-built noble/trixie packages
|
||||
# require glibc 2.38 which is not available on bookworm).
|
||||
FROM base AS intel-media-driver
|
||||
ARG DEBIAN_FRONTEND
|
||||
RUN --mount=type=bind,source=docker/main/build_intel_media_driver.sh,target=/deps/build_intel_media_driver.sh \
|
||||
/deps/build_intel_media_driver.sh
|
||||
|
||||
FROM scratch AS go2rtc
|
||||
ARG TARGETARCH
|
||||
WORKDIR /rootfs/usr/local/go2rtc/bin
|
||||
@@ -208,7 +200,6 @@ RUN --mount=type=bind,source=docker/main/install_hailort.sh,target=/deps/install
|
||||
FROM scratch AS deps-rootfs
|
||||
COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/
|
||||
COPY --from=sqlite-vec /usr/local/lib/ /usr/local/lib/
|
||||
COPY --from=intel-media-driver /rootfs/ /
|
||||
COPY --from=go2rtc /rootfs/ /
|
||||
COPY --from=libusb-build /usr/local/lib /usr/local/lib
|
||||
COPY --from=tempio /rootfs/ /
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
# Intel media driver is x86_64-only. Create empty rootfs on other arches so
|
||||
# the downstream COPY --from has a valid source.
|
||||
if [ "$(uname -m)" != "x86_64" ]; then
|
||||
mkdir -p /rootfs
|
||||
exit 0
|
||||
fi
|
||||
|
||||
MEDIA_DRIVER_VERSION="intel-media-25.2.6"
|
||||
GMMLIB_VERSION="intel-gmmlib-22.7.2"
|
||||
|
||||
apt-get -qq update
|
||||
apt-get -qq install -y wget gnupg ca-certificates cmake g++ make pkg-config
|
||||
|
||||
# Use Intel's jammy repo for newer libva-dev (2.22) which provides the
|
||||
# VVC/VVC-decode headers required by media-driver 25.x
|
||||
wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
|
||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" > /etc/apt/sources.list.d/intel-gpu-jammy.list
|
||||
apt-get -qq update
|
||||
apt-get -qq install -y libva-dev
|
||||
|
||||
# Build gmmlib (required by media-driver)
|
||||
wget -qO gmmlib.tar.gz "https://github.com/intel/gmmlib/archive/refs/tags/${GMMLIB_VERSION}.tar.gz"
|
||||
mkdir /tmp/gmmlib
|
||||
tar -xf gmmlib.tar.gz -C /tmp/gmmlib --strip-components 1
|
||||
cmake -S /tmp/gmmlib -B /tmp/gmmlib/build -DCMAKE_BUILD_TYPE=Release
|
||||
make -C /tmp/gmmlib/build -j"$(nproc)"
|
||||
make -C /tmp/gmmlib/build install
|
||||
|
||||
# Build intel-media-driver
|
||||
wget -qO media-driver.tar.gz "https://github.com/intel/media-driver/archive/refs/tags/${MEDIA_DRIVER_VERSION}.tar.gz"
|
||||
mkdir /tmp/media-driver
|
||||
tar -xf media-driver.tar.gz -C /tmp/media-driver --strip-components 1
|
||||
cmake -S /tmp/media-driver -B /tmp/media-driver/build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_KERNELS=ON \
|
||||
-DENABLE_NONFREE_KERNELS=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu \
|
||||
-DCMAKE_C_FLAGS="-Wno-error" \
|
||||
-DCMAKE_CXX_FLAGS="-Wno-error"
|
||||
make -C /tmp/media-driver/build -j"$(nproc)"
|
||||
|
||||
# Install driver to rootfs for COPY --from
|
||||
make -C /tmp/media-driver/build install DESTDIR=/rootfs
|
||||
+15
-28
@@ -87,47 +87,38 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then
|
||||
# intel packages use zst compression so we need to update dpkg
|
||||
apt-get install -y dpkg
|
||||
|
||||
# use intel apt repo for libmfx1 (legacy QSV, pre-Gen12)
|
||||
# use intel apt intel packages
|
||||
wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
|
||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | tee /etc/apt/sources.list.d/intel-gpu-jammy.list
|
||||
apt-get -qq update
|
||||
|
||||
# intel-media-va-driver-non-free is built from source in the
|
||||
# intel-media-driver Dockerfile stage for Battlemage (Xe2) support
|
||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
||||
libmfx1
|
||||
rm -f /usr/share/keyrings/intel-graphics.gpg
|
||||
rm -f /etc/apt/sources.list.d/intel-gpu-jammy.list
|
||||
intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2
|
||||
|
||||
# upgrade libva2, oneVPL runtime, and libvpl2 from trixie for Battlemage support
|
||||
echo "deb http://deb.debian.org/debian trixie main" > /etc/apt/sources.list.d/trixie.list
|
||||
apt-get -qq update
|
||||
apt-get -qq install -y -t trixie libva2 libva-drm2 libzstd1
|
||||
apt-get -qq install -y -t trixie libmfx-gen1.2 libvpl2
|
||||
rm -f /etc/apt/sources.list.d/trixie.list
|
||||
apt-get -qq update
|
||||
apt-get -qq install -y ocl-icd-libopencl1
|
||||
|
||||
# install libtbb12 for NPU support
|
||||
apt-get -qq install -y libtbb12
|
||||
|
||||
# install legacy and standard intel compute packages
|
||||
rm -f /usr/share/keyrings/intel-graphics.gpg
|
||||
rm -f /etc/apt/sources.list.d/intel-gpu-jammy.list
|
||||
|
||||
# install legacy and standard intel icd and level-zero-gpu
|
||||
# see https://github.com/intel/compute-runtime/blob/master/LEGACY_PLATFORMS.md for more info
|
||||
# needed core package
|
||||
wget https://github.com/intel/compute-runtime/releases/download/26.14.37833.4/libigdgmm12_22.9.0_amd64.deb
|
||||
dpkg -i libigdgmm12_22.9.0_amd64.deb
|
||||
rm libigdgmm12_22.9.0_amd64.deb
|
||||
wget https://github.com/intel/compute-runtime/releases/download/25.13.33276.19/libigdgmm12_22.7.0_amd64.deb
|
||||
dpkg -i libigdgmm12_22.7.0_amd64.deb
|
||||
rm libigdgmm12_22.7.0_amd64.deb
|
||||
|
||||
# legacy compute-runtime packages
|
||||
# legacy packages
|
||||
wget https://github.com/intel/compute-runtime/releases/download/24.35.30872.36/intel-opencl-icd-legacy1_24.35.30872.36_amd64.deb
|
||||
wget https://github.com/intel/compute-runtime/releases/download/24.35.30872.36/intel-level-zero-gpu-legacy1_1.5.30872.36_amd64.deb
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17537.24/intel-igc-opencl_1.0.17537.24_amd64.deb
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17537.24/intel-igc-core_1.0.17537.24_amd64.deb
|
||||
# standard compute-runtime packages
|
||||
wget https://github.com/intel/compute-runtime/releases/download/26.14.37833.4/intel-opencl-icd_26.14.37833.4-0_amd64.deb
|
||||
wget https://github.com/intel/compute-runtime/releases/download/26.14.37833.4/libze-intel-gpu1_26.14.37833.4-0_amd64.deb
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.32.7/intel-igc-opencl-2_2.32.7+21184_amd64.deb
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.32.7/intel-igc-core-2_2.32.7+21184_amd64.deb
|
||||
# standard packages
|
||||
wget https://github.com/intel/compute-runtime/releases/download/25.13.33276.19/intel-opencl-icd_25.13.33276.19_amd64.deb
|
||||
wget https://github.com/intel/compute-runtime/releases/download/25.13.33276.19/intel-level-zero-gpu_1.6.33276.19_amd64.deb
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.10.10/intel-igc-opencl-2_2.10.10+18926_amd64.deb
|
||||
wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.10.10/intel-igc-core-2_2.10.10+18926_amd64.deb
|
||||
# npu packages
|
||||
wget https://github.com/oneapi-src/level-zero/releases/download/v1.28.2/level-zero_1.28.2+u22.04_amd64.deb
|
||||
wget https://github.com/intel/linux-npu-driver/releases/download/v1.19.0/intel-driver-compiler-npu_1.19.0.20250707-16111289554_ubuntu22.04_amd64.deb
|
||||
@@ -137,10 +128,6 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then
|
||||
dpkg -i *.deb
|
||||
rm *.deb
|
||||
apt-get -qq install -f -y
|
||||
|
||||
# Battlemage uses the xe kernel driver, but the VA-API driver is still iHD.
|
||||
# The oneVPL runtime may look for a driver named after the kernel module.
|
||||
ln -sf /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so /usr/lib/x86_64-linux-gnu/dri/xe_drv_video.so
|
||||
fi
|
||||
|
||||
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||
|
||||
@@ -119,12 +119,6 @@ audio:
|
||||
|
||||
Frigate supports fully local audio transcription using either `sherpa-onnx` or OpenAI's open-source Whisper models via `faster-whisper`. The goal of this feature is to support Semantic Search for `speech` audio events. Frigate is not intended to act as a continuous, fully-automatic speech transcription service — automatically transcribing all speech (or queuing many audio events for transcription) requires substantial CPU (or GPU) resources and is impractical on most systems. For this reason, transcriptions for events are initiated manually from the UI or the API rather than being run continuously in the background.
|
||||
|
||||
:::info
|
||||
|
||||
Audio transcription requires a one-time internet connection to download the Whisper or Sherpa-ONNX model on first use. Once cached, transcription runs fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
Transcription accuracy also depends heavily on the quality of your camera's microphone and recording conditions. Many cameras use inexpensive microphones, and distance to the speaker, low audio bitrate, or background noise can significantly reduce transcription quality. If you need higher accuracy, more robust long-running queues, or large-scale automatic transcription, consider using the HTTP API in combination with an automation platform and a cloud transcription service.
|
||||
|
||||
#### Configuration
|
||||
|
||||
@@ -9,12 +9,6 @@ import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
Bird classification identifies known birds using a quantized Tensorflow model. When a known bird is recognized, its common name will be added as a `sub_label`. This information is included in the UI, filters, as well as in notifications.
|
||||
|
||||
:::info
|
||||
|
||||
Bird classification requires a one-time internet connection to download the classification model and label map from GitHub. Once cached, models work fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Minimum System Requirements
|
||||
|
||||
Bird classification runs a lightweight tflite model on the CPU, there are no significantly different system requirements than running Frigate itself.
|
||||
|
||||
@@ -9,12 +9,6 @@ import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
Object classification allows you to train a custom MobileNetV2 classification model to run on tracked objects (persons, cars, animals, etc.) to identify a finer category or attribute for that object. Classification results are visible in the Tracked Object Details pane in Explore, through the `frigate/tracked_object_details` MQTT topic, in Home Assistant sensors via the official Frigate integration, or through the event endpoints in the HTTP API.
|
||||
|
||||
:::info
|
||||
|
||||
Training a custom object classification model requires a one-time internet connection to download MobileNetV2 base weights. Once trained, the model runs fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Minimum System Requirements
|
||||
|
||||
Object classification models are lightweight and run very fast on CPU.
|
||||
|
||||
@@ -9,12 +9,6 @@ import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
State classification allows you to train a custom MobileNetV2 classification model on a fixed region of your camera frame(s) to determine a current state. The model can be configured to run on a schedule and/or when motion is detected in that region. Classification results are available through the `frigate/<camera_name>/classification/<model_name>` MQTT topic and in Home Assistant sensors via the official Frigate integration.
|
||||
|
||||
:::info
|
||||
|
||||
Training a custom state classification model requires a one-time internet connection to download MobileNetV2 base weights. Once trained, the model runs fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Minimum System Requirements
|
||||
|
||||
State classification models are lightweight and run very fast on CPU.
|
||||
|
||||
@@ -9,12 +9,6 @@ import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
Face recognition identifies known individuals by matching detected faces with previously learned facial data. When a known `person` is recognized, their name will be added as a `sub_label`. This information is included in the UI, filters, as well as in notifications.
|
||||
|
||||
:::info
|
||||
|
||||
Face recognition requires a one-time internet connection to download detection and embedding models from GitHub. Once cached, models work fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Model Requirements
|
||||
|
||||
### Face Detection
|
||||
|
||||
@@ -193,12 +193,6 @@ To use a different OpenAI-compatible API endpoint, set the `OPENAI_BASE_URL` env
|
||||
|
||||
Cloud providers run on remote infrastructure and require an API key for authentication. These services handle all model inference on their servers.
|
||||
|
||||
:::info
|
||||
|
||||
Cloud Generative AI providers require an active internet connection to send images and prompts for processing. Local providers like llama.cpp and Ollama (with local models) do not require internet. See [Network Requirements](/frigate/network_requirements#generative-ai) for details.
|
||||
|
||||
:::
|
||||
|
||||
### Ollama Cloud
|
||||
|
||||
Ollama also supports [cloud models](https://ollama.com/cloud), where your local Ollama instance handles requests from Frigate, but model inference is performed in the cloud. Set up Ollama locally, sign in with your Ollama account, and specify the cloud model name in your Frigate config. For more details, see the Ollama cloud model [docs](https://docs.ollama.com/cloud).
|
||||
|
||||
@@ -59,14 +59,13 @@ Frigate can utilize most Intel integrated GPUs and Arc GPUs to accelerate video
|
||||
|
||||
**Recommended hwaccel Preset**
|
||||
|
||||
| CPU Generation | Intel Driver | Recommended Preset | Notes |
|
||||
| ------------------ | ------------ | ------------------- | ------------------------------------------- |
|
||||
| gen1 - gen5 | i965 | preset-vaapi | qsv is not supported, may not support H.265 |
|
||||
| gen6 - gen7 | iHD | preset-vaapi | qsv is not supported |
|
||||
| gen8 - gen12 | iHD | preset-vaapi | preset-intel-qsv-\* can also be used |
|
||||
| gen13+ | iHD / Xe | preset-intel-qsv-\* | |
|
||||
| Intel Arc A-series | iHD / Xe | preset-intel-qsv-\* | |
|
||||
| Intel Arc B-series | iHD / Xe | preset-intel-qsv-\* | Requires host kernel 6.12+ |
|
||||
| CPU Generation | Intel Driver | Recommended Preset | Notes |
|
||||
| -------------- | ------------ | ------------------- | ------------------------------------------- |
|
||||
| gen1 - gen5 | i965 | preset-vaapi | qsv is not supported, may not support H.265 |
|
||||
| gen6 - gen7 | iHD | preset-vaapi | qsv is not supported |
|
||||
| gen8 - gen12 | iHD | preset-vaapi | preset-intel-qsv-\* can also be used |
|
||||
| gen13+ | iHD / Xe | preset-intel-qsv-\* | |
|
||||
| Intel Arc GPU | iHD / Xe | preset-intel-qsv-\* | |
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -11,12 +11,6 @@ Frigate can recognize license plates on vehicles and automatically add the detec
|
||||
|
||||
LPR works best when the license plate is clearly visible to the camera. For moving vehicles, Frigate continuously refines the recognition process, keeping the most confident result. When a vehicle becomes stationary, LPR continues to run for a short time after to attempt recognition.
|
||||
|
||||
:::info
|
||||
|
||||
License plate recognition requires a one-time internet connection to download OCR and detection models from GitHub. Once cached, models work fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
When a plate is recognized, the details are:
|
||||
|
||||
- Added as a `sub_label` (if [known](#matching)) or the `recognized_license_plate` field (if unknown) to a tracked object.
|
||||
|
||||
@@ -21,12 +21,6 @@ The jsmpeg live view will use more browser and client GPU resources. Using go2rt
|
||||
| mse | native | native | yes (depends on audio codec) | yes | iPhone requires iOS 17.1+, Firefox is h.264 only. This is Frigate's default when go2rtc is configured. |
|
||||
| webrtc | native | native | yes (depends on audio codec) | yes | Requires extra configuration. Frigate attempts to use WebRTC when MSE fails or when using a camera's two-way talk feature. |
|
||||
|
||||
:::info
|
||||
|
||||
WebRTC may use an external STUN server for NAT traversal. MSE and HLS streaming do not require any internet access. See [Network Requirements](/frigate/network_requirements#webrtc-stun) for details.
|
||||
|
||||
:::
|
||||
|
||||
### Camera Settings Recommendations
|
||||
|
||||
If you are using go2rtc, you should adjust the following settings in your camera's firmware for the best experience with Live view:
|
||||
|
||||
@@ -11,12 +11,6 @@ import NavPath from "@site/src/components/NavPath";
|
||||
|
||||
Frigate offers native notifications using the [WebPush Protocol](https://web.dev/articles/push-notifications-web-push-protocol) which uses the [VAPID spec](https://tools.ietf.org/html/draft-thomson-webpush-vapid) to deliver notifications to web apps using encryption.
|
||||
|
||||
:::info
|
||||
|
||||
Push notifications require internet access from the Frigate server to the browser vendor's push service (e.g., Google FCM, Mozilla autopush). See [Network Requirements](/frigate/network_requirements#push-notifications) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Setting up Notifications
|
||||
|
||||
In order to use notifications the following requirements must be met:
|
||||
|
||||
@@ -288,12 +288,6 @@ This detector is available for use with both Hailo-8 and Hailo-8L AI Acceleratio
|
||||
|
||||
See the [installation docs](../frigate/installation.md#hailo-8) for information on configuring the Hailo hardware.
|
||||
|
||||
:::info
|
||||
|
||||
If no custom model is provided, the Hailo detector downloads a default model from the Hailo Model Zoo on first startup. Once cached, the model works fully offline. See [Network Requirements](/frigate/network_requirements#hardware-specific-detector-models) for details.
|
||||
|
||||
:::
|
||||
|
||||
### Configuration
|
||||
|
||||
When configuring the Hailo detector, you have two options to specify the model: a local **path** or a **URL**.
|
||||
@@ -1799,12 +1793,6 @@ Hardware accelerated object detection is supported on the following SoCs:
|
||||
|
||||
This implementation uses the [Rockchip's RKNN-Toolkit2](https://github.com/airockchip/rknn-toolkit2/), version v2.3.2.
|
||||
|
||||
:::info
|
||||
|
||||
If no custom model is provided, the RKNN detector downloads a default model from GitHub on first startup. Once cached, the model works fully offline. See [Network Requirements](/frigate/network_requirements#hardware-specific-detector-models) for details.
|
||||
|
||||
:::
|
||||
|
||||
:::tip
|
||||
|
||||
When using many cameras one detector may not be enough to keep up. Multiple detectors can be defined assuming NPU resources are available. An example configuration would be:
|
||||
@@ -2188,12 +2176,6 @@ This implementation uses the [AXera Pulsar2 Toolchain](https://huggingface.co/AX
|
||||
|
||||
See the [installation docs](../frigate/installation.md#axera) for information on configuring the AXEngine hardware.
|
||||
|
||||
:::info
|
||||
|
||||
The AXEngine detector downloads its default model from HuggingFace on first startup. Once cached, the model works fully offline. See [Network Requirements](/frigate/network_requirements#hardware-specific-detector-models) for details.
|
||||
|
||||
:::
|
||||
|
||||
### Configuration
|
||||
|
||||
When configuring the AXEngine detector, you have to specify the model name.
|
||||
|
||||
@@ -281,52 +281,31 @@ Using Frigate UI, Home Assistant, or MQTT, cameras can be automated to only reco
|
||||
|
||||
Footage can be exported from Frigate by right-clicking (desktop) or long pressing (mobile) on a review item in the Review pane or by clicking the Export button in the History view. Exported footage is then organized and searchable through the Export view, accessible from the main navigation bar.
|
||||
|
||||
### Custom export with FFmpeg arguments
|
||||
### Time-lapse export
|
||||
|
||||
For advanced use cases, the [custom export HTTP API](../integrations/api/export-recording-custom-export-custom-camera-name-start-start-time-end-end-time-post.api.mdx) lets you pass custom FFmpeg arguments when exporting a recording:
|
||||
Time lapse exporting is available only via the [HTTP API](../integrations/api/export-recording-export-camera-name-start-start-time-end-end-time-post.api.mdx).
|
||||
|
||||
```
|
||||
POST /export/custom/{camera_name}/start/{start_time}/end/{end_time}
|
||||
When exporting a time-lapse the default speed-up is 25x with 30 FPS. This means that every 25 seconds of (real-time) recording is condensed into 1 second of time-lapse video (always without audio) with a smoothness of 30 FPS.
|
||||
|
||||
To configure the speed-up factor, the frame rate and further custom settings, use the `timelapse_args` parameter. The below configuration example would change the time-lapse speed to 60x (for fitting 1 hour of recording into 1 minute of time-lapse) with 25 FPS:
|
||||
|
||||
```yaml {3-4}
|
||||
record:
|
||||
enabled: True
|
||||
export:
|
||||
timelapse_args: "-vf setpts=PTS/60 -r 25"
|
||||
```
|
||||
|
||||
The request body accepts `ffmpeg_input_args` and `ffmpeg_output_args` to control encoding, frame rate, filters, and other FFmpeg options. If neither is provided, Frigate defaults to time-lapse output settings (25x speed, 30 FPS).
|
||||
:::tip
|
||||
|
||||
The following example exports a time-lapse at 60x speed with 25 FPS:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Front Door Time-lapse",
|
||||
"ffmpeg_output_args": "-vf setpts=PTS/60 -r 25"
|
||||
}
|
||||
```
|
||||
|
||||
#### CPU fallback
|
||||
|
||||
If hardware acceleration is configured and the export fails (e.g., the GPU is unavailable), set `cpu_fallback: true` in the request body to automatically retry using software encoding.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "My Export",
|
||||
"ffmpeg_output_args": "-c:v libx264 -crf 23",
|
||||
"cpu_fallback": true
|
||||
}
|
||||
```
|
||||
|
||||
:::note
|
||||
|
||||
Non-admin users are restricted from using FFmpeg arguments that can access the filesystem (e.g., `-filter_complex`, file paths, and protocol references). Admin users have full control over FFmpeg arguments.
|
||||
When using `hwaccel_args`, hardware encoding is used for timelapse generation. This setting can be overridden for a specific camera (e.g., when camera resolution exceeds hardware encoder limits); set the camera-level export hwaccel_args with the appropriate settings. Using an unrecognized value or empty string will fall back to software encoding (libx264).
|
||||
|
||||
:::
|
||||
|
||||
:::tip
|
||||
|
||||
When `hwaccel_args` is configured, hardware encoding is used for exports. This can be overridden per camera (e.g., when camera resolution exceeds hardware encoder limits) by setting a camera-level `hwaccel_args`. Using an unrecognized value or empty string falls back to software encoding (libx264).
|
||||
|
||||
:::
|
||||
|
||||
:::tip
|
||||
|
||||
To reduce output file size, add the FFmpeg parameter `-qp n` to `ffmpeg_output_args` (where `n` is the quantization parameter). Adjust the value to balance quality and file size for your scenario.
|
||||
The encoder determines its own behavior so the resulting file size may be undesirably large.
|
||||
To reduce the output file size the ffmpeg parameter `-qp n` can be utilized (where `n` stands for the value of the quantisation parameter). The value can be adjusted to get an acceptable tradeoff between quality and file size for the given scenario.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -13,12 +13,6 @@ Frigate uses models from [Jina AI](https://huggingface.co/jinaai) to create and
|
||||
|
||||
Semantic Search is accessed via the _Explore_ view in the Frigate UI.
|
||||
|
||||
:::info
|
||||
|
||||
Semantic search requires a one-time internet connection to download embedding models from HuggingFace. Once cached, models work fully offline. See [Network Requirements](/frigate/network_requirements#one-time-model-downloads) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Minimum System Requirements
|
||||
|
||||
Semantic Search works by running a large AI model locally on your system. Small or underpowered systems like a Raspberry Pi will not run Semantic Search reliably or at all.
|
||||
|
||||
@@ -146,11 +146,17 @@ A single Coral can handle many cameras using the default model and will be suffi
|
||||
The OpenVINO detector type is able to run on:
|
||||
|
||||
- 6th Gen Intel Platforms and newer that have an iGPU
|
||||
- x86 hosts with an Intel Arc GPU (including Arc A-series and B-series Battlemage)
|
||||
- x86 hosts with an Intel Arc GPU
|
||||
- Intel NPUs
|
||||
- Most modern AMD CPUs (though this is officially not supported by Intel)
|
||||
- x86 & Arm64 hosts via CPU (generally not recommended)
|
||||
|
||||
:::note
|
||||
|
||||
Intel B-series (Battlemage) GPUs are not officially supported with Frigate 0.17, though a user has [provided steps to rebuild the Frigate container](https://github.com/blakeblackshear/frigate/discussions/21257) with support for them.
|
||||
|
||||
:::
|
||||
|
||||
More information is available [in the detector docs](/configuration/object_detectors#openvino-detector)
|
||||
|
||||
Inference speeds vary greatly depending on the CPU or GPU used, some known examples of GPU inference times are below:
|
||||
|
||||
@@ -482,8 +482,7 @@ services:
|
||||
- /dev/apex_0:/dev/apex_0 # Passes a PCIe Coral, follow driver instructions here https://github.com/jnicolson/gasket-builder
|
||||
- /dev/video11:/dev/video11 # For Raspberry Pi 4B
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128 # AMD / Intel GPU, needs to be updated for your hardware
|
||||
- /dev/kfd:/dev/kfd # AMD Kernel Fusion Driver for ROCm
|
||||
- /dev/accel:/dev/accel # AMD / Intel NPU
|
||||
- /dev/accel:/dev/accel # Intel NPU
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /path/to/your/config:/config
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
---
|
||||
id: network_requirements
|
||||
title: Network Requirements
|
||||
---
|
||||
|
||||
# Network Requirements
|
||||
|
||||
Frigate is designed to run locally and does not require a persistent internet connection for core functionality. However, certain features need internet access for initial setup or ongoing operation. This page describes what connects to the internet, when, and how to control it.
|
||||
|
||||
## How Frigate Uses the Internet
|
||||
|
||||
Frigate's internet usage falls into three categories:
|
||||
|
||||
1. **One-time model downloads** — ML models are downloaded the first time a feature is enabled, then cached locally. No internet is needed on subsequent startups.
|
||||
2. **Optional cloud services** — Features like Frigate+ and Generative AI connect to external APIs only when explicitly configured.
|
||||
3. **Build-time dependencies** — Components bundled into the Docker image during the build process. These require no internet at runtime.
|
||||
|
||||
:::tip
|
||||
|
||||
After initial setup, Frigate can run fully offline as long as all required models have been downloaded and no cloud-dependent features are enabled.
|
||||
|
||||
:::
|
||||
|
||||
## One-Time Model Downloads
|
||||
|
||||
The following models are downloaded automatically the first time their associated feature is enabled. Once cached in `/config/model_cache/`, they do not require internet again.
|
||||
|
||||
| Feature | Models Downloaded | Source |
|
||||
| --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------- |
|
||||
| [Semantic search](/configuration/semantic_search) | Jina CLIP v1 or v2 (ONNX) + tokenizer | HuggingFace |
|
||||
| [Face recognition](/configuration/face_recognition) | FaceNet, ArcFace, face detection model | GitHub |
|
||||
| [License plate recognition](/configuration/license_plate_recognition) | PaddleOCR (detection, classification, recognition) + YOLOv9 plate detector | GitHub |
|
||||
| [Bird classification](/configuration/bird_classification) | MobileNetV2 bird model + label map | GitHub |
|
||||
| [Custom classification](/configuration/custom_classification/state_classification) (training) | MobileNetV2 ImageNet base weights (via Keras) | Google storage |
|
||||
| [Audio transcription](/configuration/advanced) | Whisper or Sherpa-ONNX streaming model | HuggingFace / OpenAI |
|
||||
|
||||
### Hardware-Specific Detector Models
|
||||
|
||||
If you are using one of the following hardware detectors and have not provided your own model file, a default model will be downloaded on first startup:
|
||||
|
||||
| Detector | Model Downloaded | Source |
|
||||
| ------------------------------------------------------------------ | -------------------- | ------------------------ |
|
||||
| [Rockchip RKNN](/configuration/object_detectors#rockchip-platform) | RKNN detection model | GitHub |
|
||||
| [Hailo 8 / 8L](/configuration/object_detectors#hailo-8) | YOLOv6n (.hef) | Hailo Model Zoo (AWS S3) |
|
||||
| [AXERA AXEngine](/configuration/object_detectors) | Detection model | HuggingFace |
|
||||
|
||||
:::note
|
||||
|
||||
The default CPU, EdgeTPU, and OpenVINO object detection models are bundled into the Docker image and do not require any download at runtime.
|
||||
|
||||
:::
|
||||
|
||||
### Preventing Model Downloads
|
||||
|
||||
If you have already downloaded all required models and want to prevent Frigate from attempting any outbound connections to HuggingFace or the Transformers library, set the following environment variables on your Frigate container:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
HF_HUB_OFFLINE: "1"
|
||||
TRANSFORMERS_OFFLINE: "1"
|
||||
```
|
||||
|
||||
:::warning
|
||||
|
||||
Setting these variables without having the correct model files already cached in `/config/model_cache/` will cause failures. Only use these after a successful initial setup with internet access.
|
||||
|
||||
:::
|
||||
|
||||
### Mirror Support
|
||||
|
||||
If your Frigate instance has restricted internet access, you can point model downloads at internal mirrors using environment variables:
|
||||
|
||||
| Environment Variable | Default | Used By |
|
||||
| ----------------------------------- | ----------------------------------- | --------------------------------------------- |
|
||||
| `HF_ENDPOINT` | `https://huggingface.co` | Semantic search, Sherpa-ONNX, AXEngine models |
|
||||
| `GITHUB_ENDPOINT` | `https://github.com` | Face recognition, LPR, RKNN models |
|
||||
| `GITHUB_RAW_ENDPOINT` | `https://raw.githubusercontent.com` | Bird classification |
|
||||
| `TF_KERAS_MOBILENET_V2_WEIGHTS_URL` | Google storage (Keras default) | Custom classification training |
|
||||
|
||||
## Optional Cloud Services
|
||||
|
||||
These features connect to external services during normal operation and require internet whenever they are active.
|
||||
|
||||
### Frigate+
|
||||
|
||||
When a Frigate+ API key is configured, Frigate communicates with `https://api.frigate.video` to download models, upload snapshots for training, submit annotations, and report false positives. Remove the API key to disable all Frigate+ network activity.
|
||||
|
||||
See [Frigate+](/integrations/plus) for details.
|
||||
|
||||
### Generative AI
|
||||
|
||||
When a Generative AI provider is configured, Frigate sends images and prompts to the configured provider for event descriptions, chat, and camera monitoring. Available providers:
|
||||
|
||||
| Provider | Internet Required |
|
||||
| ------------- | ---------------------------------------------------------------- |
|
||||
| OpenAI | Yes — connects to OpenAI API (or custom base URL) |
|
||||
| Google Gemini | Yes — connects to Google Generative AI API |
|
||||
| Azure OpenAI | Yes — connects to your Azure endpoint |
|
||||
| Ollama | Depends — typically local (`localhost:11434`), but can be remote |
|
||||
| llama.cpp | No — runs entirely locally |
|
||||
|
||||
Disable Generative AI by removing the `genai` configuration from your cameras. See [Generative AI](/configuration/genai/genai_config) for details.
|
||||
|
||||
### Version Check
|
||||
|
||||
Frigate checks GitHub for the latest release version on startup by querying `https://api.github.com`. This can be disabled:
|
||||
|
||||
```yaml
|
||||
telemetry:
|
||||
version_check: false
|
||||
```
|
||||
|
||||
### Push Notifications
|
||||
|
||||
When [notifications](/configuration/notifications) are enabled and users have registered for push notifications in the web UI, Frigate sends push messages through the browser vendor's push service (e.g., Google FCM, Mozilla autopush). This requires internet access from the Frigate server to these push endpoints.
|
||||
|
||||
### MQTT
|
||||
|
||||
If an [MQTT broker](/integrations/mqtt) is configured, Frigate maintains a connection to the broker's host and port. This is typically a local network connection, but will require internet if you use a cloud-hosted MQTT broker.
|
||||
|
||||
### DeepStack / CodeProject.AI
|
||||
|
||||
When using the [DeepStack detector plugin](/configuration/object_detectors), Frigate sends images to the configured API endpoint for inference. This is typically local but depends on where the service is hosted.
|
||||
|
||||
## WebRTC (STUN)
|
||||
|
||||
For [WebRTC live streaming](/configuration/live), Frigate uses STUN for NAT traversal:
|
||||
|
||||
- **go2rtc** defaults to a local STUN listener (`stun:8555`) — no internet required.
|
||||
- **The web UI's WebRTC player** includes a fallback to Google's public STUN server (`stun:stun.l.google.com:19302`), which requires internet.
|
||||
|
||||
## Home Assistant Supervisor
|
||||
|
||||
When running as a Home Assistant add-on, the go2rtc startup script queries the local Supervisor API (`http://supervisor/`) to discover the host IP address and WebRTC port. This is a local network call to the Home Assistant host, not an internet connection.
|
||||
|
||||
## What Does NOT Require Internet
|
||||
|
||||
- **Object detection** — CPU, EdgeTPU, OpenVINO, and other bundled detector models are included in the Docker image.
|
||||
- **Recording and playback** — All video is stored and served locally.
|
||||
- **Live streaming** — Camera streams are pulled over your local network. MSE and HLS streaming work without any external connections.
|
||||
- **The web interface** — Fully self-contained with no external fonts, scripts, analytics, or CDN dependencies. All translations are bundled locally.
|
||||
- **Custom classification inference** — After training, custom models run entirely locally.
|
||||
- **Audio detection** — The YAMNet audio classification model is bundled in the Docker image.
|
||||
|
||||
## Running Frigate Offline
|
||||
|
||||
To run Frigate in an air-gapped or offline environment:
|
||||
|
||||
1. **Pre-download models** — Start Frigate with internet access once with all desired features enabled. Models will be cached in `/config/model_cache/`.
|
||||
2. **Disable version check** — Set `telemetry.version_check: false` in your configuration.
|
||||
3. **Block outbound model requests** — Set the `HF_HUB_OFFLINE=1` and `TRANSFORMERS_OFFLINE=1` environment variables to prevent HuggingFace and Transformers from attempting any network requests.
|
||||
4. **Avoid cloud features** — Do not configure Frigate+, Generative AI providers that require internet, or cloud MQTT brokers.
|
||||
5. **Use local model mirrors** — If limited internet is available, set the `HF_ENDPOINT`, `GITHUB_ENDPOINT`, and `GITHUB_RAW_ENDPOINT` environment variables to point to local mirrors.
|
||||
|
||||
After these steps, Frigate will operate with no outbound internet connections.
|
||||
@@ -5,12 +5,6 @@ title: MQTT
|
||||
|
||||
These are the MQTT messages generated by Frigate. The default topic_prefix is `frigate`, but can be changed in the config file.
|
||||
|
||||
:::info
|
||||
|
||||
MQTT requires a network connection to your broker. This is typically local, but will require internet if using a cloud-hosted MQTT broker. See [Network Requirements](/frigate/network_requirements#mqtt) for details.
|
||||
|
||||
:::
|
||||
|
||||
## General Frigate Topics
|
||||
|
||||
### `frigate/available`
|
||||
|
||||
@@ -5,12 +5,6 @@ title: Frigate+
|
||||
|
||||
For more information about how to use Frigate+ to improve your model, see the [Frigate+ docs](/plus/).
|
||||
|
||||
:::info
|
||||
|
||||
Frigate+ requires an active internet connection to communicate with `https://api.frigate.video` for model downloads, image uploads, and annotations. See [Network Requirements](/frigate/network_requirements#frigate) for details.
|
||||
|
||||
:::
|
||||
|
||||
## Setup
|
||||
|
||||
### Create an account
|
||||
|
||||
@@ -17,10 +17,6 @@ Please use your own knowledge to assess and vet them before you install anything
|
||||
|
||||
The [Advanced Camera Card](https://card.camera/#/README) is a Home Assistant dashboard card with deep Frigate integration.
|
||||
|
||||
## [cctvQL](https://github.com/arunrajiah/cctvql)
|
||||
|
||||
[cctvQL](https://github.com/arunrajiah/cctvql) is a natural language query layer for Frigate and other CCTV systems. It connects to Frigate's REST API and MQTT broker to let you ask conversational questions about cameras and events (e.g. "Was there motion at the front door last night?"), with support for real-time event streaming, anomaly detection, PTZ control, alert rules, and a Home Assistant custom component.
|
||||
|
||||
## [Double Take](https://github.com/skrashevich/double-take)
|
||||
|
||||
[Double Take](https://github.com/skrashevich/double-take) provides an unified UI and API for processing and training images for facial recognition.
|
||||
|
||||
@@ -110,17 +110,3 @@ No. Frigate uses the TCP protocol to connect to your camera's RTSP URL. VLC auto
|
||||
TCP ensures that all data packets arrive in the correct order. This is crucial for video recording, decoding, and stream processing, which is why Frigate enforces a TCP connection. UDP is faster but less reliable, as it does not guarantee packet delivery or order, and VLC does not have the same requirements as Frigate.
|
||||
|
||||
You can still configure Frigate to use UDP by using ffmpeg input args or the preset `preset-rtsp-udp`. See the [ffmpeg presets](/configuration/ffmpeg_presets) documentation.
|
||||
|
||||
### Frigate is slow to start up with a "probing detect stream" message in the logs
|
||||
|
||||
When `detect.width` and `detect.height` are not set, Frigate probes each camera's detect stream on startup (and when saving the config) to auto-detect its resolution. For RTSP streams Frigate probes with ffprobe and automatically retries over TCP if UDP doesn't respond, with a 5 second timeout per attempt. A camera that cannot be reached over either transport will add up to ~10 seconds to startup before Frigate falls through with default dimensions, which may show up as width `0` and height `0` in Camera Probe Info under System Metrics.
|
||||
|
||||
To skip the probe entirely and make startup instant, set `detect.width` and `detect.height` explicitly in your camera config:
|
||||
|
||||
```yaml
|
||||
cameras:
|
||||
my_camera:
|
||||
detect:
|
||||
width: 1280
|
||||
height: 720
|
||||
```
|
||||
|
||||
@@ -80,85 +80,3 @@ Some users found that mounting a drive via `fstab` with the `sync` option caused
|
||||
#### Copy Times < 1 second
|
||||
|
||||
If the storage is working quickly then this error may be caused by CPU load on the machine being too high for Frigate to have the resources to keep up. Try temporarily shutting down other services to see if the issue improves.
|
||||
|
||||
## I see the message: WARNING : Too many unprocessed recording segments in cache for camera. This likely indicates an issue with the detect stream...
|
||||
|
||||
This warning means that the detect stream for the affected camera has fallen behind or stopped processing frames. Frigate's recording cache holds segments waiting to be analyzed by the detector — when more than 6 segments pile up without being processed, Frigate discards the oldest ones to prevent the cache from filling up.
|
||||
|
||||
:::warning
|
||||
|
||||
This error is a **symptom**, not the root cause. The actual cause is always logged **before** these messages start appearing. You must review the full logs from Frigate startup through the first occurrence of this warning to identify the real issue.
|
||||
|
||||
:::
|
||||
|
||||
### Step 1: Get the full logs
|
||||
|
||||
Collect complete Frigate logs from startup through the first occurrence of the error. Look for errors or warnings that appear **before** the "Too many unprocessed" messages begin — that is where the root cause will be found.
|
||||
|
||||
### Step 2: Check the cache directory
|
||||
|
||||
Exec into the Frigate container and inspect the recording cache:
|
||||
|
||||
```
|
||||
docker exec -it frigate ls -la /tmp/cache
|
||||
```
|
||||
|
||||
Each camera should have a small number of `.mp4` segment files. If one camera has significantly more files than others, that camera is the source of the problem. A problem with a single camera can cascade and cause all cameras to show this error.
|
||||
|
||||
### Step 3: Verify segment duration
|
||||
|
||||
Recording segments should be approximately 10 seconds long. Run `ffprobe` on segments in the cache to check:
|
||||
|
||||
```
|
||||
docker exec -it frigate ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1 /tmp/cache/<camera>@<segment>.mp4
|
||||
```
|
||||
|
||||
If segments are only ~1 second instead of ~10 seconds, the camera is sending corrupt timestamp data, causing segments to be split too frequently and filling the cache 10x faster than expected.
|
||||
|
||||
**Common causes of short segments:**
|
||||
|
||||
- **"Smart Codec" or "Smart+" enabled on the camera** — These features dynamically change encoding parameters mid-stream, which corrupts timestamps. Disable them in your camera's settings.
|
||||
- **Changing codec, bitrate, or resolution mid-stream** — Any encoding changes during an active stream can cause unpredictable segment splitting.
|
||||
- **Camera firmware bugs** — Check for firmware updates from your camera manufacturer.
|
||||
|
||||
### Step 4: Check for a stuck detector
|
||||
|
||||
If the detect stream is not processing frames, segments will accumulate. Common causes:
|
||||
|
||||
- **Detection resolution too high** — Use a substream for detection, not the full resolution main stream.
|
||||
- **Detection FPS too high** — 5 fps is the recommended maximum for detection.
|
||||
- **Model too large** — Use smaller model variants (e.g., YOLO `s` or `t` size, not `e` or `x`). Use 320x320 input size rather than 640x640 unless you have a powerful dedicated detector.
|
||||
- **Virtualization** — Running Frigate in a VM (especially Proxmox) can cause the detector to hang or stall. This is a known issue with GPU/TPU passthrough in virtualized environments and is not something Frigate can fix. Running Frigate in Docker on bare metal is recommended.
|
||||
|
||||
### Step 5: Check for GPU hangs
|
||||
|
||||
On the host machine, check `dmesg` for GPU-related errors:
|
||||
|
||||
```
|
||||
dmesg | grep -i -E "gpu|drm|reset|hang"
|
||||
```
|
||||
|
||||
Messages like `trying reset from guc_exec_queue_timedout_job` or similar GPU reset/hang messages indicate a driver or hardware issue. Ensure your kernel and GPU drivers (especially Intel) are up to date.
|
||||
|
||||
### Step 6: Verify hardware acceleration configuration
|
||||
|
||||
An incorrect `hwaccel_args` preset can cause ffmpeg to fail silently or consume excessive CPU, starving the detector of resources.
|
||||
|
||||
- After upgrading Frigate, verify your preset matches your hardware (e.g., `preset-intel-qsv-h264` instead of the deprecated `preset-vaapi`).
|
||||
- For h265 cameras, use the corresponding h265 preset (e.g., `preset-intel-qsv-h265`).
|
||||
- Note that `hwaccel_args` are only relevant for the detect stream — Frigate does not decode the record stream.
|
||||
|
||||
### Step 7: Verify go2rtc stream configuration
|
||||
|
||||
Ensure that the ffmpeg source names in your go2rtc configuration match the correct camera stream. A misconfigured stream name (e.g., copying a config from one camera to another without updating the stream reference) will cause the wrong stream to be used or the stream to fail entirely.
|
||||
|
||||
### Step 8: Check system resources
|
||||
|
||||
If none of the above apply, the issue may be a general resource constraint. Monitor the following on your host:
|
||||
|
||||
- **CPU usage** — An overloaded CPU can prevent the detector from keeping up.
|
||||
- **RAM and swap** — Excessive swapping dramatically slows all I/O operations.
|
||||
- **Disk I/O** — Use `iotop` or `iostat` to check for saturation.
|
||||
- **Storage space** — Verify you have free space on the Frigate storage volume (check the Storage page in the Frigate UI).
|
||||
|
||||
Try temporarily disabling resource-intensive features like `genai` and `face_recognition` to see if the issue resolves. This can help isolate whether the detector is being starved of resources.
|
||||
|
||||
@@ -12,7 +12,6 @@ const sidebars: SidebarsConfig = {
|
||||
"frigate/updating",
|
||||
"frigate/camera_setup",
|
||||
"frigate/video_pipeline",
|
||||
"frigate/network_requirements",
|
||||
"frigate/glossary",
|
||||
],
|
||||
Guides: [
|
||||
|
||||
Vendored
+63
-299
@@ -2724,135 +2724,6 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
/exports/batch:
|
||||
post:
|
||||
tags:
|
||||
- Export
|
||||
summary: Start recording export batch
|
||||
description: >-
|
||||
Starts recording exports for a batch of items, each with its own camera
|
||||
and time range. Optionally assigns them to a new or existing export case.
|
||||
When neither export_case_id nor new_case_name is provided, exports are
|
||||
added as uncategorized. Attaching to an existing case is admin-only.
|
||||
operationId: export_recordings_batch_exports_batch_post
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BatchExportBody"
|
||||
responses:
|
||||
"202":
|
||||
description: Successful Response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BatchExportResponse"
|
||||
"400":
|
||||
description: Bad Request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"403":
|
||||
description: Forbidden
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"404":
|
||||
description: Not Found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"503":
|
||||
description: Service Unavailable
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"422":
|
||||
description: Validation Error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
/exports/delete:
|
||||
post:
|
||||
tags:
|
||||
- Export
|
||||
summary: Bulk delete exports
|
||||
description: >-
|
||||
Deletes one or more exports by ID. All IDs must exist and none can be
|
||||
in-progress. Admin-only.
|
||||
operationId: bulk_delete_exports_exports_delete_post
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ExportBulkDeleteBody"
|
||||
responses:
|
||||
"200":
|
||||
description: Successful Response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"400":
|
||||
description: Bad Request - one or more exports are in-progress
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"404":
|
||||
description: Not Found - one or more export IDs do not exist
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"422":
|
||||
description: Validation Error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
/exports/reassign:
|
||||
post:
|
||||
tags:
|
||||
- Export
|
||||
summary: Bulk reassign exports to a case
|
||||
description: >-
|
||||
Assigns or unassigns one or more exports to/from a case. All IDs must
|
||||
exist. Pass export_case_id as null to unassign (move to uncategorized).
|
||||
Admin-only.
|
||||
operationId: bulk_reassign_exports_exports_reassign_post
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ExportBulkReassignBody"
|
||||
responses:
|
||||
"200":
|
||||
description: Successful Response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"404":
|
||||
description: Not Found - one or more export IDs or the target case do not exist
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"422":
|
||||
description: Validation Error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
/cases:
|
||||
get:
|
||||
tags:
|
||||
@@ -2982,6 +2853,39 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
"/export/{export_id}/case":
|
||||
patch:
|
||||
tags:
|
||||
- Export
|
||||
summary: Assign export to case
|
||||
description: "Assigns an export to a case, or unassigns it if export_case_id is null."
|
||||
operationId: assign_export_case_export__export_id__case_patch
|
||||
parameters:
|
||||
- name: export_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
title: Export Id
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ExportCaseAssignBody"
|
||||
responses:
|
||||
"200":
|
||||
description: Successful Response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"422":
|
||||
description: Validation Error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
"/export/{camera_name}/start/{start_time}/end/{end_time}":
|
||||
post:
|
||||
tags:
|
||||
@@ -3069,6 +2973,32 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
"/export/{event_id}":
|
||||
delete:
|
||||
tags:
|
||||
- Export
|
||||
summary: Delete export
|
||||
operationId: export_delete_export__event_id__delete
|
||||
parameters:
|
||||
- name: event_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
title: Event Id
|
||||
responses:
|
||||
"200":
|
||||
description: Successful Response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GenericResponse"
|
||||
"422":
|
||||
description: Validation Error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HTTPValidationError"
|
||||
"/export/custom/{camera_name}/start/{start_time}/end/{end_time}":
|
||||
post:
|
||||
tags:
|
||||
@@ -6571,149 +6501,6 @@ components:
|
||||
required:
|
||||
- recognizedLicensePlate
|
||||
title: EventsLPRBody
|
||||
BatchExportBody:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: "#/components/schemas/BatchExportItem"
|
||||
type: array
|
||||
minItems: 1
|
||||
maxItems: 50
|
||||
title: Items
|
||||
description: List of export items. Each item has its own camera and time range.
|
||||
export_case_id:
|
||||
anyOf:
|
||||
- type: string
|
||||
maxLength: 30
|
||||
- type: "null"
|
||||
title: Export case ID
|
||||
description: Existing export case ID to assign all exports to. Attaching to an existing case is temporarily admin-only until case-level ACLs exist.
|
||||
new_case_name:
|
||||
anyOf:
|
||||
- type: string
|
||||
maxLength: 100
|
||||
- type: "null"
|
||||
title: New case name
|
||||
description: Name of a new export case to create when export_case_id is omitted
|
||||
new_case_description:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: New case description
|
||||
description: Optional description for a newly created export case
|
||||
type: object
|
||||
required:
|
||||
- items
|
||||
title: BatchExportBody
|
||||
BatchExportItem:
|
||||
properties:
|
||||
camera:
|
||||
type: string
|
||||
title: Camera name
|
||||
start_time:
|
||||
type: number
|
||||
title: Start time
|
||||
end_time:
|
||||
type: number
|
||||
title: End time
|
||||
image_path:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: Existing thumbnail path
|
||||
description: Optional existing image to use as the export thumbnail
|
||||
friendly_name:
|
||||
anyOf:
|
||||
- type: string
|
||||
maxLength: 256
|
||||
- type: "null"
|
||||
title: Friendly name
|
||||
description: Optional friendly name for this specific export item
|
||||
client_item_id:
|
||||
anyOf:
|
||||
- type: string
|
||||
maxLength: 128
|
||||
- type: "null"
|
||||
title: Client item ID
|
||||
description: Optional opaque client identifier echoed back in results
|
||||
type: object
|
||||
required:
|
||||
- camera
|
||||
- start_time
|
||||
- end_time
|
||||
title: BatchExportItem
|
||||
BatchExportResponse:
|
||||
properties:
|
||||
export_case_id:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: Export Case Id
|
||||
description: Export case ID associated with the batch
|
||||
export_ids:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
title: Export Ids
|
||||
description: Export IDs successfully queued
|
||||
results:
|
||||
items:
|
||||
$ref: "#/components/schemas/BatchExportResultModel"
|
||||
type: array
|
||||
title: Results
|
||||
description: Per-item batch export results
|
||||
type: object
|
||||
required:
|
||||
- export_ids
|
||||
- results
|
||||
title: BatchExportResponse
|
||||
description: Response model for starting an export batch.
|
||||
BatchExportResultModel:
|
||||
properties:
|
||||
camera:
|
||||
type: string
|
||||
title: Camera
|
||||
description: Camera name for this export attempt
|
||||
export_id:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: Export Id
|
||||
description: The export ID when the export was successfully queued
|
||||
success:
|
||||
type: boolean
|
||||
title: Success
|
||||
description: Whether the export was successfully queued
|
||||
status:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: Status
|
||||
description: Queue status for this camera export
|
||||
error:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: Error
|
||||
description: Validation or queueing error for this item, if any
|
||||
item_index:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: "null"
|
||||
title: Item Index
|
||||
description: Zero-based index of this result within the request items list
|
||||
client_item_id:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: "null"
|
||||
title: Client Item Id
|
||||
description: Opaque client-supplied item identifier echoed from the request
|
||||
type: object
|
||||
required:
|
||||
- camera
|
||||
- success
|
||||
title: BatchExportResultModel
|
||||
description: Per-item result for a batch export request.
|
||||
EventsSubLabelBody:
|
||||
properties:
|
||||
subLabel:
|
||||
@@ -6736,41 +6523,18 @@ components:
|
||||
required:
|
||||
- subLabel
|
||||
title: EventsSubLabelBody
|
||||
ExportBulkDeleteBody:
|
||||
ExportCaseAssignBody:
|
||||
properties:
|
||||
ids:
|
||||
items:
|
||||
type: string
|
||||
minLength: 1
|
||||
type: array
|
||||
minItems: 1
|
||||
title: Ids
|
||||
type: object
|
||||
required:
|
||||
- ids
|
||||
title: ExportBulkDeleteBody
|
||||
description: Request body for bulk deleting exports.
|
||||
ExportBulkReassignBody:
|
||||
properties:
|
||||
ids:
|
||||
items:
|
||||
type: string
|
||||
minLength: 1
|
||||
type: array
|
||||
minItems: 1
|
||||
title: Ids
|
||||
export_case_id:
|
||||
anyOf:
|
||||
- type: string
|
||||
maxLength: 30
|
||||
- type: "null"
|
||||
title: Export Case Id
|
||||
description: "Case ID to assign to, or null to unassign from current case"
|
||||
description: "Case ID to assign to the export, or null to unassign"
|
||||
type: object
|
||||
required:
|
||||
- ids
|
||||
title: ExportBulkReassignBody
|
||||
description: Request body for bulk reassigning exports to a case.
|
||||
title: ExportCaseAssignBody
|
||||
description: Request body for assigning or unassigning an export to a case.
|
||||
ExportCaseCreateBody:
|
||||
properties:
|
||||
name:
|
||||
|
||||
@@ -88,9 +88,7 @@ def require_admin_by_default():
|
||||
"/go2rtc/streams",
|
||||
"/event_ids",
|
||||
"/events",
|
||||
"/cases",
|
||||
"/exports",
|
||||
"/jobs/export",
|
||||
}
|
||||
|
||||
# Path prefixes that should be exempt (for paths with parameters)
|
||||
@@ -103,9 +101,7 @@ def require_admin_by_default():
|
||||
"/go2rtc/streams/", # /go2rtc/streams/{camera}
|
||||
"/users/", # /users/{username}/password (has own auth)
|
||||
"/preview/", # /preview/{file}/thumbnail.jpg
|
||||
"/cases/", # /cases/{case_id}
|
||||
"/exports/", # /exports/{export_id}
|
||||
"/jobs/export/", # /jobs/export/{export_id}
|
||||
"/vod/", # /vod/{camera_name}/...
|
||||
"/notifications/", # /notifications/pubkey, /notifications/register
|
||||
)
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
MAX_BATCH_EXPORT_ITEMS = 50
|
||||
|
||||
|
||||
class BatchExportItem(BaseModel):
|
||||
camera: str = Field(title="Camera name")
|
||||
start_time: float = Field(title="Start time")
|
||||
end_time: float = Field(title="End time")
|
||||
image_path: Optional[str] = Field(
|
||||
default=None,
|
||||
title="Existing thumbnail path",
|
||||
description="Optional existing image to use as the export thumbnail",
|
||||
)
|
||||
friendly_name: Optional[str] = Field(
|
||||
default=None,
|
||||
title="Friendly name",
|
||||
max_length=256,
|
||||
description="Optional friendly name for this specific export item",
|
||||
)
|
||||
client_item_id: Optional[str] = Field(
|
||||
default=None,
|
||||
title="Client item ID",
|
||||
max_length=128,
|
||||
description="Optional opaque client identifier echoed back in results",
|
||||
)
|
||||
|
||||
|
||||
class BatchExportBody(BaseModel):
|
||||
items: List[BatchExportItem] = Field(
|
||||
title="Items",
|
||||
min_length=1,
|
||||
max_length=MAX_BATCH_EXPORT_ITEMS,
|
||||
description="List of export items. Each item has its own camera and time range.",
|
||||
)
|
||||
export_case_id: Optional[str] = Field(
|
||||
default=None,
|
||||
title="Export case ID",
|
||||
max_length=30,
|
||||
description=(
|
||||
"Existing export case ID to assign all exports to. Attaching to an "
|
||||
"existing case is temporarily admin-only until case-level ACLs exist."
|
||||
),
|
||||
)
|
||||
new_case_name: Optional[str] = Field(
|
||||
default=None,
|
||||
title="New case name",
|
||||
max_length=100,
|
||||
description="Name of a new export case to create when export_case_id is omitted",
|
||||
)
|
||||
new_case_description: Optional[str] = Field(
|
||||
default=None,
|
||||
title="New case description",
|
||||
description="Optional description for a newly created export case",
|
||||
)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_case_target(self) -> "BatchExportBody":
|
||||
for item in self.items:
|
||||
if item.end_time <= item.start_time:
|
||||
raise ValueError("end_time must be after start_time")
|
||||
|
||||
return self
|
||||
@@ -1,24 +0,0 @@
|
||||
"""Request bodies for bulk export operations."""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field, conlist, constr
|
||||
|
||||
|
||||
class ExportBulkDeleteBody(BaseModel):
|
||||
"""Request body for bulk deleting exports."""
|
||||
|
||||
# List of export IDs with at least one element and each element with at least one char
|
||||
ids: conlist(constr(min_length=1), min_length=1)
|
||||
|
||||
|
||||
class ExportBulkReassignBody(BaseModel):
|
||||
"""Request body for bulk reassigning exports to a case."""
|
||||
|
||||
# List of export IDs with at least one element and each element with at least one char
|
||||
ids: conlist(constr(min_length=1), min_length=1)
|
||||
export_case_id: Optional[str] = Field(
|
||||
default=None,
|
||||
max_length=30,
|
||||
description="Case ID to assign to, or null to unassign from current case",
|
||||
)
|
||||
@@ -23,3 +23,13 @@ class ExportCaseUpdateBody(BaseModel):
|
||||
description: Optional[str] = Field(
|
||||
default=None, description="Updated description of the export case"
|
||||
)
|
||||
|
||||
|
||||
class ExportCaseAssignBody(BaseModel):
|
||||
"""Request body for assigning or unassigning an export to a case."""
|
||||
|
||||
export_case_id: Optional[str] = Field(
|
||||
default=None,
|
||||
max_length=30,
|
||||
description="Case ID to assign to the export, or null to unassign",
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@@ -28,96 +28,6 @@ class StartExportResponse(BaseModel):
|
||||
export_id: Optional[str] = Field(
|
||||
default=None, description="The export ID if successfully started"
|
||||
)
|
||||
status: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Queue status for the export job",
|
||||
)
|
||||
|
||||
|
||||
class BatchExportResultModel(BaseModel):
|
||||
"""Per-item result for a batch export request."""
|
||||
|
||||
camera: str = Field(description="Camera name for this export attempt")
|
||||
export_id: Optional[str] = Field(
|
||||
default=None,
|
||||
description="The export ID when the export was successfully queued",
|
||||
)
|
||||
success: bool = Field(description="Whether the export was successfully queued")
|
||||
status: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Queue status for this camera export",
|
||||
)
|
||||
error: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Validation or queueing error for this item, if any",
|
||||
)
|
||||
item_index: Optional[int] = Field(
|
||||
default=None,
|
||||
description="Zero-based index of this result within the request items list",
|
||||
)
|
||||
client_item_id: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Opaque client-supplied item identifier echoed from the request",
|
||||
)
|
||||
|
||||
|
||||
class BatchExportResponse(BaseModel):
|
||||
"""Response model for starting an export batch."""
|
||||
|
||||
export_case_id: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Export case ID associated with the batch",
|
||||
)
|
||||
export_ids: List[str] = Field(description="Export IDs successfully queued")
|
||||
results: List[BatchExportResultModel] = Field(
|
||||
description="Per-item batch export results"
|
||||
)
|
||||
|
||||
|
||||
class ExportJobModel(BaseModel):
|
||||
"""Model representing a queued or running export job."""
|
||||
|
||||
id: str = Field(description="Unique identifier for the export job")
|
||||
job_type: str = Field(description="Job type")
|
||||
status: str = Field(description="Current job status")
|
||||
camera: str = Field(description="Camera associated with this export job")
|
||||
name: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Friendly name for the export",
|
||||
)
|
||||
export_case_id: Optional[str] = Field(
|
||||
default=None,
|
||||
description="ID of the export case this export belongs to",
|
||||
)
|
||||
request_start_time: float = Field(description="Requested export start time")
|
||||
request_end_time: float = Field(description="Requested export end time")
|
||||
start_time: Optional[float] = Field(
|
||||
default=None,
|
||||
description="Unix timestamp when execution started",
|
||||
)
|
||||
end_time: Optional[float] = Field(
|
||||
default=None,
|
||||
description="Unix timestamp when execution completed",
|
||||
)
|
||||
error_message: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Error message for failed jobs",
|
||||
)
|
||||
results: Optional[dict[str, Any]] = Field(
|
||||
default=None,
|
||||
description="Result metadata for completed jobs",
|
||||
)
|
||||
current_step: str = Field(
|
||||
default="queued",
|
||||
description="Current execution step (queued, preparing, encoding, encoding_retry, finalizing)",
|
||||
)
|
||||
progress_percent: float = Field(
|
||||
default=0.0,
|
||||
description="Progress percentage of the current step (0.0 - 100.0)",
|
||||
)
|
||||
|
||||
|
||||
ExportJobsResponse = List[ExportJobModel]
|
||||
|
||||
|
||||
ExportsResponse = List[ExportModel]
|
||||
|
||||
+260
-635
File diff suppressed because it is too large
Load Diff
+16
-6
@@ -52,7 +52,6 @@ from frigate.embeddings import EmbeddingProcess, EmbeddingsContext
|
||||
from frigate.events.audio import AudioProcessor
|
||||
from frigate.events.cleanup import EventCleanup
|
||||
from frigate.events.maintainer import EventProcessor
|
||||
from frigate.jobs.export import reap_stale_exports
|
||||
from frigate.jobs.motion_search import stop_all_motion_search_jobs
|
||||
from frigate.log import _stop_logging
|
||||
from frigate.models import (
|
||||
@@ -189,6 +188,17 @@ class FrigateApp:
|
||||
except PermissionError:
|
||||
logger.error("Unable to write to /config to save DB state")
|
||||
|
||||
def cleanup_timeline_db(db: SqliteExtDatabase) -> None:
|
||||
db.execute_sql(
|
||||
"DELETE FROM timeline WHERE source_id NOT IN (SELECT id FROM event);"
|
||||
)
|
||||
|
||||
try:
|
||||
with open(f"{CONFIG_DIR}/.timeline", "w") as f:
|
||||
f.write(str(datetime.datetime.now().timestamp()))
|
||||
except PermissionError:
|
||||
logger.error("Unable to write to /config to save DB state")
|
||||
|
||||
# Migrate DB schema
|
||||
migrate_db = SqliteExtDatabase(self.config.database.path)
|
||||
|
||||
@@ -205,6 +215,11 @@ class FrigateApp:
|
||||
|
||||
router.run()
|
||||
|
||||
# this is a temporary check to clean up user DB from beta
|
||||
# will be removed before final release
|
||||
if not os.path.exists(f"{CONFIG_DIR}/.timeline"):
|
||||
cleanup_timeline_db(migrate_db)
|
||||
|
||||
# check if vacuum needs to be run
|
||||
if os.path.exists(f"{CONFIG_DIR}/.vacuum"):
|
||||
with open(f"{CONFIG_DIR}/.vacuum") as f:
|
||||
@@ -596,11 +611,6 @@ class FrigateApp:
|
||||
# Clean up any stale replay camera artifacts (filesystem + DB)
|
||||
cleanup_replay_cameras()
|
||||
|
||||
# Reap any Export rows still marked in_progress from a previous
|
||||
# session (crash, kill, broken migration). Runs synchronously before
|
||||
# uvicorn binds so no API request can observe a stale row.
|
||||
reap_stale_exports()
|
||||
|
||||
self.init_inter_process_communicator()
|
||||
self.start_detectors()
|
||||
self.init_dispatcher()
|
||||
|
||||
@@ -92,12 +92,6 @@ class RecordExportConfig(FrigateBaseModel):
|
||||
title="Export hwaccel args",
|
||||
description="Hardware acceleration args to use for export/transcode operations.",
|
||||
)
|
||||
max_concurrent: int = Field(
|
||||
default=3,
|
||||
ge=1,
|
||||
title="Maximum concurrent exports",
|
||||
description="Maximum number of export jobs to process at the same time.",
|
||||
)
|
||||
|
||||
|
||||
class RecordConfig(FrigateBaseModel):
|
||||
|
||||
@@ -730,9 +730,6 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
|
||||
if need_detect_dimensions:
|
||||
logger.info(
|
||||
f"detect.width and detect.height not set for {camera_config.name}, probing detect stream to determine resolution."
|
||||
)
|
||||
stream_info = {"width": 0, "height": 0, "fourcc": None}
|
||||
try:
|
||||
stream_info = stream_info_retriever.get_stream_info(
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
"""Local only processors for handling real time object processing."""
|
||||
|
||||
import logging
|
||||
import threading
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import deque
|
||||
from concurrent.futures import Future
|
||||
from queue import Empty, Full, Queue
|
||||
from typing import Any, Callable
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -78,123 +74,3 @@ class RealTimeProcessorApi(ABC):
|
||||
payload: The updated configuration object.
|
||||
"""
|
||||
pass
|
||||
|
||||
def drain_results(self) -> list[dict[str, Any]]:
|
||||
"""Return pending results that need IPC side-effects.
|
||||
|
||||
Deferred processors accumulate results on a worker thread.
|
||||
The maintainer calls this each loop iteration to collect them
|
||||
and perform publishes on the main thread.
|
||||
|
||||
Synchronous processors return an empty list (default).
|
||||
"""
|
||||
return []
|
||||
|
||||
def shutdown(self) -> None:
|
||||
"""Stop any background work and release resources.
|
||||
|
||||
Called when the processor is being removed or the maintainer
|
||||
is shutting down. Default is a no-op for synchronous processors.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class DeferredRealtimeProcessorApi(RealTimeProcessorApi):
|
||||
"""Base class for processors that offload heavy work to a background thread.
|
||||
|
||||
Subclasses implement:
|
||||
- process_frame(): do cheap gating + crop + copy, then call _enqueue_task()
|
||||
- _process_task(task): heavy work (inference, consensus) on the worker thread
|
||||
- handle_request(): optionally use _enqueue_request() for sync request/response
|
||||
- expire_object(): call _enqueue_task() with a control message
|
||||
|
||||
The worker thread owns all processor state. No locks are needed because
|
||||
only the worker mutates state. Results that need IPC are placed in
|
||||
_pending_results via _emit_result(), and the maintainer drains them
|
||||
each loop iteration.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
metrics: DataProcessorMetrics,
|
||||
max_queue: int = 8,
|
||||
) -> None:
|
||||
super().__init__(config, metrics)
|
||||
self._task_queue: Queue = Queue(maxsize=max_queue)
|
||||
self._pending_results: deque[dict[str, Any]] = deque()
|
||||
self._results_lock = threading.Lock()
|
||||
self._stop_event = threading.Event()
|
||||
self._worker = threading.Thread(
|
||||
target=self._drain_loop,
|
||||
daemon=True,
|
||||
name=f"{type(self).__name__}_worker",
|
||||
)
|
||||
self._worker.start()
|
||||
|
||||
def _drain_loop(self) -> None:
|
||||
"""Worker thread main loop — drains the task queue until stopped."""
|
||||
while not self._stop_event.is_set():
|
||||
try:
|
||||
task = self._task_queue.get(timeout=0.5)
|
||||
except Empty:
|
||||
continue
|
||||
|
||||
if (
|
||||
isinstance(task, tuple)
|
||||
and len(task) == 2
|
||||
and isinstance(task[1], Future)
|
||||
):
|
||||
# Request/response: (callable_and_args, future)
|
||||
(func, args), future = task
|
||||
try:
|
||||
result = func(args)
|
||||
future.set_result(result)
|
||||
except Exception as e:
|
||||
future.set_exception(e)
|
||||
else:
|
||||
try:
|
||||
self._process_task(task)
|
||||
except Exception:
|
||||
logger.exception("Error processing deferred task")
|
||||
|
||||
def _enqueue_task(self, task: Any) -> bool:
|
||||
"""Enqueue a task for the worker. Returns False if queue is full (dropped)."""
|
||||
try:
|
||||
self._task_queue.put_nowait(task)
|
||||
return True
|
||||
except Full:
|
||||
logger.debug("Deferred processor queue full, dropping task")
|
||||
return False
|
||||
|
||||
def _enqueue_request(self, func: Callable, args: Any, timeout: float = 10.0) -> Any:
|
||||
"""Enqueue a request and block until the worker returns a result."""
|
||||
future: Future = Future()
|
||||
self._task_queue.put(((func, args), future), timeout=timeout)
|
||||
return future.result(timeout=timeout)
|
||||
|
||||
def _emit_result(self, result: dict[str, Any]) -> None:
|
||||
"""Called by the worker thread to stage a result for the maintainer."""
|
||||
with self._results_lock:
|
||||
self._pending_results.append(result)
|
||||
|
||||
def drain_results(self) -> list[dict[str, Any]]:
|
||||
"""Called by the maintainer on the main thread to collect pending results."""
|
||||
with self._results_lock:
|
||||
results = list(self._pending_results)
|
||||
self._pending_results.clear()
|
||||
return results
|
||||
|
||||
def shutdown(self) -> None:
|
||||
"""Signal the worker to stop and wait for it to finish."""
|
||||
self._stop_event.set()
|
||||
self._worker.join(timeout=5.0)
|
||||
|
||||
@abstractmethod
|
||||
def _process_task(self, task: Any) -> None:
|
||||
"""Process a single task on the worker thread.
|
||||
|
||||
Subclasses implement inference, consensus, training image saves here.
|
||||
Call _emit_result() to stage results for the maintainer to publish.
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Real time processor that works with classification tflite models."""
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from typing import Any
|
||||
@@ -9,18 +10,25 @@ import cv2
|
||||
import numpy as np
|
||||
|
||||
from frigate.comms.embeddings_updater import EmbeddingsRequestEnum
|
||||
from frigate.comms.event_metadata_updater import EventMetadataPublisher
|
||||
from frigate.comms.event_metadata_updater import (
|
||||
EventMetadataPublisher,
|
||||
EventMetadataTypeEnum,
|
||||
)
|
||||
from frigate.comms.inter_process import InterProcessRequestor
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.config.classification import CustomClassificationConfig
|
||||
from frigate.config.classification import (
|
||||
CustomClassificationConfig,
|
||||
ObjectClassificationType,
|
||||
)
|
||||
from frigate.const import CLIPS_DIR, MODEL_CACHE_DIR
|
||||
from frigate.log import suppress_stderr_during
|
||||
from frigate.types import TrackedObjectUpdateTypesEnum
|
||||
from frigate.util.builtin import EventsPerSecond, InferenceSpeed, load_labels
|
||||
from frigate.util.image import calculate_region
|
||||
from frigate.util.object import box_overlaps
|
||||
|
||||
from ..types import DataProcessorMetrics
|
||||
from .api import DeferredRealtimeProcessorApi
|
||||
from .api import RealTimeProcessorApi
|
||||
|
||||
try:
|
||||
from tflite_runtime.interpreter import Interpreter
|
||||
@@ -32,7 +40,7 @@ logger = logging.getLogger(__name__)
|
||||
MAX_OBJECT_CLASSIFICATIONS = 16
|
||||
|
||||
|
||||
class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
class CustomStateClassificationProcessor(RealTimeProcessorApi):
|
||||
def __init__(
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
@@ -40,7 +48,7 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
requestor: InterProcessRequestor,
|
||||
metrics: DataProcessorMetrics,
|
||||
):
|
||||
super().__init__(config, metrics, max_queue=4)
|
||||
super().__init__(config, metrics)
|
||||
self.model_config = model_config
|
||||
|
||||
if not self.model_config.name:
|
||||
@@ -251,34 +259,14 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
return
|
||||
|
||||
cropped_frame = rgb[y1:y2, x1:x2]
|
||||
frame = rgb[y1:y2, x1:x2]
|
||||
|
||||
try:
|
||||
resized_frame = cv2.resize(cropped_frame, (224, 224))
|
||||
resized_frame = cv2.resize(frame, (224, 224))
|
||||
except Exception:
|
||||
logger.warning("Failed to resize image for state classification")
|
||||
return
|
||||
|
||||
# Copy for training image saves on worker thread
|
||||
crop_bgr = cv2.cvtColor(cropped_frame, cv2.COLOR_RGB2BGR)
|
||||
|
||||
self._enqueue_task(("classify", camera, now, resized_frame, crop_bgr))
|
||||
|
||||
def _process_task(self, task: Any) -> None:
|
||||
kind = task[0]
|
||||
if kind == "classify":
|
||||
_, camera, timestamp, resized_frame, crop_bgr = task
|
||||
self._classify_state(camera, timestamp, resized_frame, crop_bgr)
|
||||
elif kind == "reload":
|
||||
self.__build_detector()
|
||||
|
||||
def _classify_state(
|
||||
self,
|
||||
camera: str,
|
||||
timestamp: float,
|
||||
resized_frame: np.ndarray,
|
||||
crop_bgr: np.ndarray,
|
||||
) -> None:
|
||||
if self.interpreter is None:
|
||||
# When interpreter is None, always save (score is 0.0, which is < 1.0)
|
||||
if self._should_save_image(camera, "unknown", 0.0):
|
||||
@@ -289,18 +277,15 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
write_classification_attempt(
|
||||
self.train_dir,
|
||||
crop_bgr,
|
||||
cv2.cvtColor(frame, cv2.COLOR_RGB2BGR),
|
||||
"none-none",
|
||||
timestamp,
|
||||
now,
|
||||
"unknown",
|
||||
0.0,
|
||||
max_files=save_attempts,
|
||||
)
|
||||
return
|
||||
|
||||
if not self.tensor_input_details or not self.tensor_output_details:
|
||||
return
|
||||
|
||||
input = np.expand_dims(resized_frame, axis=0)
|
||||
self.interpreter.set_tensor(self.tensor_input_details[0]["index"], input)
|
||||
self.interpreter.invoke()
|
||||
@@ -313,7 +298,7 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
best_id = int(np.argmax(probs))
|
||||
score = round(probs[best_id], 2)
|
||||
self.__update_metrics(datetime.datetime.now().timestamp() - timestamp)
|
||||
self.__update_metrics(datetime.datetime.now().timestamp() - now)
|
||||
|
||||
detected_state = self.labelmap[best_id]
|
||||
|
||||
@@ -325,9 +310,9 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
write_classification_attempt(
|
||||
self.train_dir,
|
||||
crop_bgr,
|
||||
cv2.cvtColor(frame, cv2.COLOR_RGB2BGR),
|
||||
"none-none",
|
||||
timestamp,
|
||||
now,
|
||||
detected_state,
|
||||
score,
|
||||
max_files=save_attempts,
|
||||
@@ -342,14 +327,9 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
verified_state = self.verify_state_change(camera, detected_state)
|
||||
|
||||
if verified_state is not None:
|
||||
self._emit_result(
|
||||
{
|
||||
"type": "classification",
|
||||
"processor": "state",
|
||||
"model_name": self.model_config.name,
|
||||
"camera": camera,
|
||||
"state": verified_state,
|
||||
}
|
||||
self.requestor.send_data(
|
||||
f"{camera}/classification/{self.model_config.name}",
|
||||
verified_state,
|
||||
)
|
||||
|
||||
def handle_request(
|
||||
@@ -357,19 +337,14 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
) -> dict[str, Any] | None:
|
||||
if topic == EmbeddingsRequestEnum.reload_classification_model.value:
|
||||
if request_data.get("model_name") == self.model_config.name:
|
||||
|
||||
def _do_reload(data: dict[str, Any]) -> dict[str, Any]:
|
||||
self.__build_detector()
|
||||
logger.info(
|
||||
f"Successfully loaded updated model for {self.model_config.name}"
|
||||
)
|
||||
return {
|
||||
"success": True,
|
||||
"message": f"Loaded {self.model_config.name} model.",
|
||||
}
|
||||
|
||||
result: dict[str, Any] = self._enqueue_request(_do_reload, request_data)
|
||||
return result
|
||||
self.__build_detector()
|
||||
logger.info(
|
||||
f"Successfully loaded updated model for {self.model_config.name}"
|
||||
)
|
||||
return {
|
||||
"success": True,
|
||||
"message": f"Loaded {self.model_config.name} model.",
|
||||
}
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
@@ -379,7 +354,7 @@ class CustomStateClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
pass
|
||||
|
||||
|
||||
class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
class CustomObjectClassificationProcessor(RealTimeProcessorApi):
|
||||
def __init__(
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
@@ -388,7 +363,7 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
requestor: InterProcessRequestor,
|
||||
metrics: DataProcessorMetrics,
|
||||
):
|
||||
super().__init__(config, metrics, max_queue=8)
|
||||
super().__init__(config, metrics)
|
||||
self.model_config = model_config
|
||||
|
||||
if not self.model_config.name:
|
||||
@@ -561,41 +536,18 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
|
||||
rgb = cv2.cvtColor(frame, cv2.COLOR_YUV2RGB_I420)
|
||||
crop = rgb[y:y2, x:x2]
|
||||
crop = rgb[
|
||||
y:y2,
|
||||
x:x2,
|
||||
]
|
||||
|
||||
try:
|
||||
resized_crop = cv2.resize(crop, (224, 224))
|
||||
except Exception:
|
||||
logger.warning("Failed to resize image for object classification")
|
||||
return
|
||||
if crop.shape != (224, 224):
|
||||
try:
|
||||
resized_crop = cv2.resize(crop, (224, 224))
|
||||
except Exception:
|
||||
logger.warning("Failed to resize image for state classification")
|
||||
return
|
||||
|
||||
# Copy crop for training images (will be used on worker thread)
|
||||
crop_bgr = cv2.cvtColor(crop, cv2.COLOR_RGB2BGR)
|
||||
|
||||
self._enqueue_task(
|
||||
("classify", object_id, obj_data["camera"], now, resized_crop, crop_bgr)
|
||||
)
|
||||
|
||||
def _process_task(self, task: Any) -> None:
|
||||
kind = task[0]
|
||||
if kind == "classify":
|
||||
_, object_id, camera, timestamp, resized_crop, crop_bgr = task
|
||||
self._classify_object(object_id, camera, timestamp, resized_crop, crop_bgr)
|
||||
elif kind == "expire":
|
||||
_, object_id = task
|
||||
if object_id in self.classification_history:
|
||||
self.classification_history.pop(object_id)
|
||||
elif kind == "reload":
|
||||
self.__build_detector()
|
||||
|
||||
def _classify_object(
|
||||
self,
|
||||
object_id: str,
|
||||
camera: str,
|
||||
timestamp: float,
|
||||
resized_crop: np.ndarray,
|
||||
crop_bgr: np.ndarray,
|
||||
) -> None:
|
||||
if self.interpreter is None:
|
||||
save_attempts = (
|
||||
self.model_config.save_attempts
|
||||
@@ -604,9 +556,9 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
write_classification_attempt(
|
||||
self.train_dir,
|
||||
crop_bgr,
|
||||
cv2.cvtColor(crop, cv2.COLOR_RGB2BGR),
|
||||
object_id,
|
||||
timestamp,
|
||||
now,
|
||||
"unknown",
|
||||
0.0,
|
||||
max_files=save_attempts,
|
||||
@@ -617,10 +569,7 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
if object_id not in self.classification_history:
|
||||
self.classification_history[object_id] = []
|
||||
|
||||
self.classification_history[object_id].append(("unknown", 0.0, timestamp))
|
||||
return
|
||||
|
||||
if not self.tensor_input_details or not self.tensor_output_details:
|
||||
self.classification_history[object_id].append(("unknown", 0.0, now))
|
||||
return
|
||||
|
||||
input = np.expand_dims(resized_crop, axis=0)
|
||||
@@ -635,7 +584,7 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
best_id = int(np.argmax(probs))
|
||||
score = round(probs[best_id], 2)
|
||||
self.__update_metrics(datetime.datetime.now().timestamp() - timestamp)
|
||||
self.__update_metrics(datetime.datetime.now().timestamp() - now)
|
||||
|
||||
save_attempts = (
|
||||
self.model_config.save_attempts
|
||||
@@ -644,9 +593,9 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
)
|
||||
write_classification_attempt(
|
||||
self.train_dir,
|
||||
crop_bgr,
|
||||
cv2.cvtColor(crop, cv2.COLOR_RGB2BGR),
|
||||
object_id,
|
||||
timestamp,
|
||||
now,
|
||||
self.labelmap[best_id],
|
||||
score,
|
||||
max_files=save_attempts,
|
||||
@@ -661,57 +610,92 @@ class CustomObjectClassificationProcessor(DeferredRealtimeProcessorApi):
|
||||
sub_label = self.labelmap[best_id]
|
||||
|
||||
logger.debug(
|
||||
f"{self.model_config.name}: Object {object_id} passed threshold with sub_label={sub_label}, score={score}"
|
||||
f"{self.model_config.name}: Object {object_id} (label={obj_data['label']}) passed threshold with sub_label={sub_label}, score={score}"
|
||||
)
|
||||
|
||||
consensus_label, consensus_score = self.get_weighted_score(
|
||||
object_id, sub_label, score, timestamp
|
||||
object_id, sub_label, score, now
|
||||
)
|
||||
|
||||
logger.debug(
|
||||
f"{self.model_config.name}: get_weighted_score returned consensus_label={consensus_label}, consensus_score={consensus_score} for {object_id}"
|
||||
)
|
||||
|
||||
if consensus_label is not None and self.model_config.object_config is not None:
|
||||
self._emit_result(
|
||||
{
|
||||
"type": "classification",
|
||||
"processor": "object",
|
||||
"model_name": self.model_config.name,
|
||||
"classification_type": self.model_config.object_config.classification_type,
|
||||
"object_id": object_id,
|
||||
"camera": camera,
|
||||
"timestamp": timestamp,
|
||||
"label": consensus_label,
|
||||
"score": consensus_score,
|
||||
}
|
||||
if consensus_label is not None:
|
||||
camera = obj_data["camera"]
|
||||
logger.debug(
|
||||
f"{self.model_config.name}: Publishing sub_label={consensus_label} for {obj_data['label']} object {object_id} on {camera}"
|
||||
)
|
||||
|
||||
def handle_request(
|
||||
self, topic: str, request_data: dict[str, Any]
|
||||
) -> dict[str, Any] | None:
|
||||
if (
|
||||
self.model_config.object_config.classification_type
|
||||
== ObjectClassificationType.sub_label
|
||||
):
|
||||
self.sub_label_publisher.publish(
|
||||
(object_id, consensus_label, consensus_score),
|
||||
EventMetadataTypeEnum.sub_label,
|
||||
)
|
||||
self.requestor.send_data(
|
||||
"tracked_object_update",
|
||||
json.dumps(
|
||||
{
|
||||
"type": TrackedObjectUpdateTypesEnum.classification,
|
||||
"id": object_id,
|
||||
"camera": camera,
|
||||
"timestamp": now,
|
||||
"model": self.model_config.name,
|
||||
"sub_label": consensus_label,
|
||||
"score": consensus_score,
|
||||
}
|
||||
),
|
||||
)
|
||||
elif (
|
||||
self.model_config.object_config.classification_type
|
||||
== ObjectClassificationType.attribute
|
||||
):
|
||||
self.sub_label_publisher.publish(
|
||||
(
|
||||
object_id,
|
||||
self.model_config.name,
|
||||
consensus_label,
|
||||
consensus_score,
|
||||
),
|
||||
EventMetadataTypeEnum.attribute.value,
|
||||
)
|
||||
self.requestor.send_data(
|
||||
"tracked_object_update",
|
||||
json.dumps(
|
||||
{
|
||||
"type": TrackedObjectUpdateTypesEnum.classification,
|
||||
"id": object_id,
|
||||
"camera": camera,
|
||||
"timestamp": now,
|
||||
"model": self.model_config.name,
|
||||
"attribute": consensus_label,
|
||||
"score": consensus_score,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
def handle_request(self, topic: str, request_data: dict) -> dict | None:
|
||||
if topic == EmbeddingsRequestEnum.reload_classification_model.value:
|
||||
if request_data.get("model_name") == self.model_config.name:
|
||||
|
||||
def _do_reload(data: dict[str, Any]) -> dict[str, Any]:
|
||||
self.__build_detector()
|
||||
logger.info(
|
||||
f"Successfully loaded updated model for {self.model_config.name}"
|
||||
)
|
||||
return {
|
||||
"success": True,
|
||||
"message": f"Loaded {self.model_config.name} model.",
|
||||
}
|
||||
|
||||
result: dict[str, Any] = self._enqueue_request(_do_reload, request_data)
|
||||
return result
|
||||
self.__build_detector()
|
||||
logger.info(
|
||||
f"Successfully loaded updated model for {self.model_config.name}"
|
||||
)
|
||||
return {
|
||||
"success": True,
|
||||
"message": f"Loaded {self.model_config.name} model.",
|
||||
}
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
def expire_object(self, object_id: str, camera: str) -> None:
|
||||
self._enqueue_task(("expire", object_id))
|
||||
if object_id in self.classification_history:
|
||||
self.classification_history.pop(object_id)
|
||||
|
||||
|
||||
def write_classification_attempt(
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import base64
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import threading
|
||||
from multiprocessing.synchronize import Event as MpEvent
|
||||
@@ -34,7 +33,6 @@ from frigate.config.camera.updater import (
|
||||
CameraConfigUpdateEnum,
|
||||
CameraConfigUpdateSubscriber,
|
||||
)
|
||||
from frigate.config.classification import ObjectClassificationType
|
||||
from frigate.data_processing.common.license_plate.model import (
|
||||
LicensePlateModelRunner,
|
||||
)
|
||||
@@ -63,7 +61,6 @@ from frigate.db.sqlitevecq import SqliteVecQueueDatabase
|
||||
from frigate.events.types import EventTypeEnum, RegenerateDescriptionEnum
|
||||
from frigate.genai import GenAIClientManager
|
||||
from frigate.models import Event, Recordings, ReviewSegment, Trigger
|
||||
from frigate.types import TrackedObjectUpdateTypesEnum
|
||||
from frigate.util.builtin import serialize
|
||||
from frigate.util.file import get_event_thumbnail_bytes
|
||||
from frigate.util.image import SharedMemoryFrameManager
|
||||
@@ -277,15 +274,10 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
self._process_recordings_updates()
|
||||
self._process_review_updates()
|
||||
self._process_frame_updates()
|
||||
self._process_deferred_results()
|
||||
self._expire_dedicated_lpr()
|
||||
self._process_finalized()
|
||||
self._process_event_metadata()
|
||||
|
||||
# Shutdown deferred processors
|
||||
for processor in self.realtime_processors:
|
||||
processor.shutdown()
|
||||
|
||||
self.config_updater.stop()
|
||||
self.enrichment_config_subscriber.stop()
|
||||
self.event_subscriber.stop()
|
||||
@@ -310,10 +302,6 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
self._handle_custom_classification_update(topic, payload)
|
||||
return
|
||||
|
||||
if topic == "config/genai":
|
||||
self.config.genai = payload
|
||||
self.genai_manager.update_config(self.config)
|
||||
|
||||
# Broadcast to all processors — each decides if the topic is relevant
|
||||
for processor in self.realtime_processors:
|
||||
processor.update_config(topic, payload)
|
||||
@@ -328,9 +316,10 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
model_name = topic.split("/")[-1]
|
||||
|
||||
if model_config is None:
|
||||
remaining = []
|
||||
for processor in self.realtime_processors:
|
||||
if (
|
||||
self.realtime_processors = [
|
||||
processor
|
||||
for processor in self.realtime_processors
|
||||
if not (
|
||||
isinstance(
|
||||
processor,
|
||||
(
|
||||
@@ -339,11 +328,8 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
),
|
||||
)
|
||||
and processor.model_config.name == model_name
|
||||
):
|
||||
processor.shutdown()
|
||||
else:
|
||||
remaining.append(processor)
|
||||
self.realtime_processors = remaining
|
||||
)
|
||||
]
|
||||
|
||||
logger.info(
|
||||
f"Successfully removed classification processor for model: {model_name}"
|
||||
@@ -711,68 +697,6 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
|
||||
self.frame_manager.close(frame_name)
|
||||
|
||||
def _process_deferred_results(self) -> None:
|
||||
"""Drain results from deferred processors and perform IPC side-effects."""
|
||||
for processor in self.realtime_processors:
|
||||
results = processor.drain_results()
|
||||
|
||||
for result in results:
|
||||
if result.get("type") != "classification":
|
||||
continue
|
||||
|
||||
if result["processor"] == "state":
|
||||
self.requestor.send_data(
|
||||
f"{result['camera']}/classification/{result['model_name']}",
|
||||
result["state"],
|
||||
)
|
||||
elif result["processor"] == "object":
|
||||
object_id = result["object_id"]
|
||||
camera = result["camera"]
|
||||
timestamp = result["timestamp"]
|
||||
model_name = result["model_name"]
|
||||
label = result["label"]
|
||||
score = result["score"]
|
||||
classification_type = result["classification_type"]
|
||||
|
||||
if classification_type == ObjectClassificationType.sub_label:
|
||||
self.event_metadata_publisher.publish(
|
||||
(object_id, label, score),
|
||||
EventMetadataTypeEnum.sub_label,
|
||||
)
|
||||
self.requestor.send_data(
|
||||
"tracked_object_update",
|
||||
json.dumps(
|
||||
{
|
||||
"type": TrackedObjectUpdateTypesEnum.classification,
|
||||
"id": object_id,
|
||||
"camera": camera,
|
||||
"timestamp": timestamp,
|
||||
"model": model_name,
|
||||
"sub_label": label,
|
||||
"score": score,
|
||||
}
|
||||
),
|
||||
)
|
||||
elif classification_type == ObjectClassificationType.attribute:
|
||||
self.event_metadata_publisher.publish(
|
||||
(object_id, model_name, label, score),
|
||||
EventMetadataTypeEnum.attribute.value,
|
||||
)
|
||||
self.requestor.send_data(
|
||||
"tracked_object_update",
|
||||
json.dumps(
|
||||
{
|
||||
"type": TrackedObjectUpdateTypesEnum.classification,
|
||||
"id": object_id,
|
||||
"camera": camera,
|
||||
"timestamp": timestamp,
|
||||
"model": model_name,
|
||||
"attribute": label,
|
||||
"score": score,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
def _embed_thumbnail(self, event_id: str, thumbnail: bytes) -> None:
|
||||
"""Embed the thumbnail for an event."""
|
||||
if not self.config.semantic_search.enabled:
|
||||
|
||||
+2
-26
@@ -113,15 +113,6 @@ class OllamaClient(GenAIClient):
|
||||
schema = response_format.get("json_schema", {}).get("schema")
|
||||
if schema:
|
||||
ollama_options["format"] = self._clean_schema_for_ollama(schema)
|
||||
logger.debug(
|
||||
"Ollama generate request: model=%s, prompt_len=%s, image_count=%s, "
|
||||
"has_format=%s, options=%s",
|
||||
self.genai_config.model,
|
||||
len(prompt),
|
||||
len(images) if images else 0,
|
||||
"format" in ollama_options,
|
||||
{k: v for k, v in ollama_options.items() if k != "format"},
|
||||
)
|
||||
result = self.provider.generate(
|
||||
self.genai_config.model,
|
||||
prompt,
|
||||
@@ -129,24 +120,9 @@ class OllamaClient(GenAIClient):
|
||||
**ollama_options,
|
||||
)
|
||||
logger.debug(
|
||||
"Ollama generate response: done=%s, done_reason=%s, eval_count=%s, "
|
||||
"prompt_eval_count=%s, response_len=%s",
|
||||
result.get("done"),
|
||||
result.get("done_reason"),
|
||||
result.get("eval_count"),
|
||||
result.get("prompt_eval_count"),
|
||||
len(result.get("response", "") or ""),
|
||||
f"Ollama tokens used: eval_count={result.get('eval_count')}, prompt_eval_count={result.get('prompt_eval_count')}"
|
||||
)
|
||||
response_text = str(result["response"]).strip()
|
||||
if not response_text:
|
||||
logger.warning(
|
||||
"Ollama returned a blank response for model %s (done_reason=%s, "
|
||||
"eval_count=%s). Check model output, ensure thinking is disabled.",
|
||||
self.genai_config.model,
|
||||
result.get("done_reason"),
|
||||
result.get("eval_count"),
|
||||
)
|
||||
return response_text
|
||||
return str(result["response"]).strip()
|
||||
except (
|
||||
TimeoutException,
|
||||
ResponseError,
|
||||
|
||||
+1
-17
@@ -80,23 +80,7 @@ class OpenAIClient(GenAIClient):
|
||||
and hasattr(result, "choices")
|
||||
and len(result.choices) > 0
|
||||
):
|
||||
message = result.choices[0].message
|
||||
content = message.content
|
||||
|
||||
if not content:
|
||||
# When reasoning is enabled for some OpenAI backends the actual response
|
||||
# is incorrectly placed in reasoning_content instead of content.
|
||||
# This is buggy/incorrect behavior — reasoning should not be
|
||||
# enabled for these models.
|
||||
reasoning_content = getattr(message, "reasoning_content", None)
|
||||
if reasoning_content:
|
||||
logger.warning(
|
||||
"Response content was empty but reasoning_content was provided; "
|
||||
"reasoning appears to be enabled and should be disabled for this model."
|
||||
)
|
||||
content = reasoning_content
|
||||
|
||||
return str(content.strip()) if content else None
|
||||
return str(result.choices[0].message.content.strip())
|
||||
return None
|
||||
except (TimeoutException, Exception) as e:
|
||||
logger.warning("OpenAI returned an error: %s", str(e))
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
"""Export job management with queued background execution."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from queue import Full, Queue
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from peewee import DoesNotExist
|
||||
|
||||
from frigate.comms.inter_process import InterProcessRequestor
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.const import UPDATE_JOB_STATE
|
||||
from frigate.jobs.job import Job
|
||||
from frigate.models import Export
|
||||
from frigate.record.export import PlaybackSourceEnum, RecordingExporter
|
||||
from frigate.types import JobStatusTypesEnum
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Maximum number of jobs that can sit in the queue waiting to run.
|
||||
# Prevents a runaway client from unbounded memory growth.
|
||||
MAX_QUEUED_EXPORT_JOBS = 100
|
||||
|
||||
# Minimum interval between progress broadcasts. FFmpeg can emit progress
|
||||
# events many times per second; we coalesce them so the WebSocket isn't
|
||||
# flooded with redundant updates.
|
||||
PROGRESS_BROADCAST_MIN_INTERVAL = 1.0
|
||||
|
||||
# Delay before removing a completed job from the in-memory map. Gives the
|
||||
# frontend a chance to receive the final state via WebSocket before SWR
|
||||
# polling takes over.
|
||||
COMPLETED_JOB_CLEANUP_DELAY = 5.0
|
||||
|
||||
|
||||
class ExportQueueFullError(RuntimeError):
|
||||
"""Raised when the export queue is at capacity."""
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExportJob(Job):
|
||||
"""Job state for export operations."""
|
||||
|
||||
job_type: str = "export"
|
||||
camera: str = ""
|
||||
name: Optional[str] = None
|
||||
image_path: Optional[str] = None
|
||||
export_case_id: Optional[str] = None
|
||||
request_start_time: float = 0.0
|
||||
request_end_time: float = 0.0
|
||||
playback_source: str = PlaybackSourceEnum.recordings.value
|
||||
ffmpeg_input_args: Optional[str] = None
|
||||
ffmpeg_output_args: Optional[str] = None
|
||||
cpu_fallback: bool = False
|
||||
current_step: str = "queued"
|
||||
progress_percent: float = 0.0
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
"""Convert to dictionary for API responses.
|
||||
|
||||
Only exposes fields that are part of the public ExportJobModel schema.
|
||||
Internal execution details (image_path, ffmpeg args, cpu_fallback) are
|
||||
intentionally omitted so they don't leak through the API.
|
||||
"""
|
||||
return {
|
||||
"id": self.id,
|
||||
"job_type": self.job_type,
|
||||
"status": self.status,
|
||||
"camera": self.camera,
|
||||
"name": self.name,
|
||||
"export_case_id": self.export_case_id,
|
||||
"request_start_time": self.request_start_time,
|
||||
"request_end_time": self.request_end_time,
|
||||
"start_time": self.start_time,
|
||||
"end_time": self.end_time,
|
||||
"error_message": self.error_message,
|
||||
"results": self.results,
|
||||
"current_step": self.current_step,
|
||||
"progress_percent": self.progress_percent,
|
||||
}
|
||||
|
||||
|
||||
class ExportQueueWorker(threading.Thread):
|
||||
"""Worker that executes queued exports."""
|
||||
|
||||
def __init__(self, manager: "ExportJobManager", worker_index: int) -> None:
|
||||
super().__init__(
|
||||
daemon=True,
|
||||
name=f"export_queue_worker_{worker_index}",
|
||||
)
|
||||
self.manager = manager
|
||||
|
||||
def run(self) -> None:
|
||||
while True:
|
||||
job = self.manager.queue.get()
|
||||
|
||||
try:
|
||||
self.manager.run_job(job)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Export queue worker failed while processing %s", job.id
|
||||
)
|
||||
finally:
|
||||
self.manager.queue.task_done()
|
||||
|
||||
|
||||
class JobStatePublisher:
|
||||
"""Publishes a single job state payload to the dispatcher.
|
||||
|
||||
Each call opens a short-lived :py:class:`InterProcessRequestor`, sends
|
||||
the payload, and closes the socket. The short-lived design avoids
|
||||
REQ/REP state corruption that would arise from sharing a single REQ
|
||||
socket across the API thread and worker threads (REQ sockets must
|
||||
strictly alternate send/recv).
|
||||
|
||||
With the 1s broadcast throttle in place, socket creation overhead is
|
||||
negligible. The class also exists so tests can substitute a no-op
|
||||
instance instead of stubbing ZMQ — see ``BaseTestHttp.setUp``.
|
||||
"""
|
||||
|
||||
def publish(self, payload: dict[str, Any]) -> None:
|
||||
try:
|
||||
requestor = InterProcessRequestor()
|
||||
except Exception as err:
|
||||
logger.warning("Failed to open job state requestor: %s", err)
|
||||
return
|
||||
|
||||
try:
|
||||
requestor.send_data(UPDATE_JOB_STATE, payload)
|
||||
except Exception as err:
|
||||
logger.debug("Job state broadcast failed: %s", err)
|
||||
finally:
|
||||
try:
|
||||
requestor.stop()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
class ExportJobManager:
|
||||
"""Concurrency-limited manager for queued export jobs."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
max_concurrent: int,
|
||||
max_queued: int = MAX_QUEUED_EXPORT_JOBS,
|
||||
publisher: Optional[JobStatePublisher] = None,
|
||||
) -> None:
|
||||
self.config = config
|
||||
self.max_concurrent = max(1, max_concurrent)
|
||||
self.queue: Queue[ExportJob] = Queue(maxsize=max(1, max_queued))
|
||||
self.jobs: dict[str, ExportJob] = {}
|
||||
self.lock = threading.Lock()
|
||||
self.workers: list[ExportQueueWorker] = []
|
||||
self.started = False
|
||||
self.publisher = publisher if publisher is not None else JobStatePublisher()
|
||||
self._last_broadcast_monotonic: float = 0.0
|
||||
self._broadcast_throttle_lock = threading.Lock()
|
||||
|
||||
def _broadcast_all_jobs(self, force: bool = False) -> None:
|
||||
"""Publish aggregate export job state via the job_state WS topic.
|
||||
|
||||
When ``force`` is False, broadcasts within
|
||||
``PROGRESS_BROADCAST_MIN_INTERVAL`` of the previous one are skipped
|
||||
to avoid flooding the WebSocket with rapid progress updates.
|
||||
``force`` bypasses the throttle and is used for status transitions
|
||||
(enqueue/start/finish) where the frontend needs the latest state.
|
||||
"""
|
||||
now = time.monotonic()
|
||||
with self._broadcast_throttle_lock:
|
||||
if (
|
||||
not force
|
||||
and now - self._last_broadcast_monotonic
|
||||
< PROGRESS_BROADCAST_MIN_INTERVAL
|
||||
):
|
||||
return
|
||||
self._last_broadcast_monotonic = now
|
||||
|
||||
with self.lock:
|
||||
active = [
|
||||
j
|
||||
for j in self.jobs.values()
|
||||
if j.status in (JobStatusTypesEnum.queued, JobStatusTypesEnum.running)
|
||||
]
|
||||
|
||||
any_running = any(j.status == JobStatusTypesEnum.running for j in active)
|
||||
payload: dict[str, Any] = {
|
||||
"job_type": "export",
|
||||
"status": "running" if any_running else "queued",
|
||||
"results": {"jobs": [j.to_dict() for j in active]},
|
||||
}
|
||||
|
||||
try:
|
||||
self.publisher.publish(payload)
|
||||
except Exception as err:
|
||||
logger.warning("Publisher raised during job state broadcast: %s", err)
|
||||
|
||||
def _make_progress_callback(self, job: ExportJob) -> Callable[[str, float], None]:
|
||||
"""Build a callback the exporter can invoke during execution."""
|
||||
|
||||
def on_progress(step: str, percent: float) -> None:
|
||||
job.current_step = step
|
||||
job.progress_percent = percent
|
||||
self._broadcast_all_jobs()
|
||||
|
||||
return on_progress
|
||||
|
||||
def _schedule_job_cleanup(self, job_id: str) -> None:
|
||||
"""Drop a completed job from ``self.jobs`` after a short delay."""
|
||||
|
||||
def cleanup() -> None:
|
||||
with self.lock:
|
||||
self.jobs.pop(job_id, None)
|
||||
|
||||
timer = threading.Timer(COMPLETED_JOB_CLEANUP_DELAY, cleanup)
|
||||
timer.daemon = True
|
||||
timer.start()
|
||||
|
||||
def ensure_started(self) -> None:
|
||||
"""Ensure worker threads are started exactly once."""
|
||||
with self.lock:
|
||||
if self.started:
|
||||
self._restart_dead_workers_locked()
|
||||
return
|
||||
|
||||
for index in range(self.max_concurrent):
|
||||
worker = ExportQueueWorker(self, index)
|
||||
worker.start()
|
||||
self.workers.append(worker)
|
||||
|
||||
self.started = True
|
||||
|
||||
def _restart_dead_workers_locked(self) -> None:
|
||||
for index, worker in enumerate(self.workers):
|
||||
if worker.is_alive():
|
||||
continue
|
||||
|
||||
logger.error(
|
||||
"Export queue worker %s died unexpectedly, restarting", worker.name
|
||||
)
|
||||
replacement = ExportQueueWorker(self, index)
|
||||
replacement.start()
|
||||
self.workers[index] = replacement
|
||||
|
||||
def enqueue(self, job: ExportJob) -> str:
|
||||
"""Queue a job for background execution.
|
||||
|
||||
Raises ExportQueueFullError if the queue is at capacity.
|
||||
"""
|
||||
self.ensure_started()
|
||||
|
||||
try:
|
||||
self.queue.put_nowait(job)
|
||||
except Full as err:
|
||||
raise ExportQueueFullError(
|
||||
"Export queue is full; try again once current exports finish"
|
||||
) from err
|
||||
|
||||
with self.lock:
|
||||
self.jobs[job.id] = job
|
||||
|
||||
self._broadcast_all_jobs(force=True)
|
||||
|
||||
return job.id
|
||||
|
||||
def get_job(self, job_id: str) -> Optional[ExportJob]:
|
||||
"""Get a job by ID."""
|
||||
with self.lock:
|
||||
return self.jobs.get(job_id)
|
||||
|
||||
def list_active_jobs(self) -> list[ExportJob]:
|
||||
"""List queued and running jobs."""
|
||||
with self.lock:
|
||||
return [
|
||||
job
|
||||
for job in self.jobs.values()
|
||||
if job.status in (JobStatusTypesEnum.queued, JobStatusTypesEnum.running)
|
||||
]
|
||||
|
||||
def cancel_queued_jobs_for_case(self, case_id: str) -> list[ExportJob]:
|
||||
"""Cancel queued export jobs assigned to a deleted case."""
|
||||
cancelled_jobs: list[ExportJob] = []
|
||||
|
||||
with self.lock:
|
||||
with self.queue.mutex:
|
||||
retained_jobs: list[ExportJob] = []
|
||||
|
||||
while self.queue.queue:
|
||||
job = self.queue.queue.popleft()
|
||||
|
||||
if (
|
||||
job.export_case_id == case_id
|
||||
and job.status == JobStatusTypesEnum.queued
|
||||
):
|
||||
job.status = JobStatusTypesEnum.cancelled
|
||||
job.end_time = time.time()
|
||||
cancelled_jobs.append(job)
|
||||
continue
|
||||
|
||||
retained_jobs.append(job)
|
||||
|
||||
self.queue.queue.extend(retained_jobs)
|
||||
|
||||
if cancelled_jobs:
|
||||
self.queue.unfinished_tasks = max(
|
||||
0,
|
||||
self.queue.unfinished_tasks - len(cancelled_jobs),
|
||||
)
|
||||
if self.queue.unfinished_tasks == 0:
|
||||
self.queue.all_tasks_done.notify_all()
|
||||
self.queue.not_full.notify_all()
|
||||
|
||||
return cancelled_jobs
|
||||
|
||||
def available_slots(self) -> int:
|
||||
"""Approximate number of additional jobs that could be queued right now.
|
||||
|
||||
Uses Queue.qsize() which is best-effort; callers should treat the
|
||||
result as advisory since another thread could enqueue between
|
||||
checking and enqueueing.
|
||||
"""
|
||||
return max(0, self.queue.maxsize - self.queue.qsize())
|
||||
|
||||
def run_job(self, job: ExportJob) -> None:
|
||||
"""Execute a queued export job."""
|
||||
job.status = JobStatusTypesEnum.running
|
||||
job.start_time = time.time()
|
||||
self._broadcast_all_jobs(force=True)
|
||||
|
||||
exporter = RecordingExporter(
|
||||
self.config,
|
||||
job.id,
|
||||
job.camera,
|
||||
job.name,
|
||||
job.image_path,
|
||||
int(job.request_start_time),
|
||||
int(job.request_end_time),
|
||||
PlaybackSourceEnum(job.playback_source),
|
||||
job.export_case_id,
|
||||
job.ffmpeg_input_args,
|
||||
job.ffmpeg_output_args,
|
||||
job.cpu_fallback,
|
||||
on_progress=self._make_progress_callback(job),
|
||||
)
|
||||
|
||||
try:
|
||||
exporter.run()
|
||||
export = Export.get_or_none(Export.id == job.id)
|
||||
if export is None:
|
||||
job.status = JobStatusTypesEnum.failed
|
||||
job.error_message = "Export failed"
|
||||
elif export.in_progress:
|
||||
job.status = JobStatusTypesEnum.failed
|
||||
job.error_message = "Export did not complete"
|
||||
else:
|
||||
job.status = JobStatusTypesEnum.success
|
||||
job.results = {
|
||||
"export_id": export.id,
|
||||
"export_case_id": export.export_case_id,
|
||||
"video_path": export.video_path,
|
||||
"thumb_path": export.thumb_path,
|
||||
}
|
||||
except DoesNotExist:
|
||||
job.status = JobStatusTypesEnum.failed
|
||||
job.error_message = "Export not found"
|
||||
except Exception as err:
|
||||
logger.exception("Export job %s failed: %s", job.id, err)
|
||||
job.status = JobStatusTypesEnum.failed
|
||||
job.error_message = str(err)
|
||||
finally:
|
||||
job.end_time = time.time()
|
||||
self._broadcast_all_jobs(force=True)
|
||||
self._schedule_job_cleanup(job.id)
|
||||
|
||||
|
||||
_job_manager: Optional[ExportJobManager] = None
|
||||
_job_manager_lock = threading.Lock()
|
||||
|
||||
|
||||
def _get_max_concurrent(config: FrigateConfig) -> int:
|
||||
return int(config.record.export.max_concurrent)
|
||||
|
||||
|
||||
def reap_stale_exports() -> None:
|
||||
"""Sweep Export rows stuck with in_progress=True from previous sessions.
|
||||
|
||||
On Frigate startup no export job is alive yet, so any in_progress=True
|
||||
row must be a leftover from a previous session that crashed, was killed
|
||||
mid-export, or returned early from RecordingExporter.run() without
|
||||
flipping the flag. For each stale row we either:
|
||||
|
||||
- delete the row (and any thumb) if the video file is missing or empty,
|
||||
since there is nothing worth recovering
|
||||
- flip in_progress to False if the video file exists on disk and is
|
||||
non-empty, treating it as a completed export the user can manage
|
||||
through the normal UI
|
||||
|
||||
Must only be called when the export job manager is certain to have no
|
||||
active jobs — i.e., at Frigate startup, before any worker runs.
|
||||
|
||||
All exceptions are caught and logged; the caller does not need to wrap
|
||||
this in a try/except. A failure on a single row will not stop the rest
|
||||
of the sweep, and a failure in the top-level query will log and return.
|
||||
"""
|
||||
try:
|
||||
stale_exports = list(Export.select().where(Export.in_progress == True)) # noqa: E712
|
||||
except Exception:
|
||||
logger.exception("Failed to query stale in-progress exports")
|
||||
return
|
||||
|
||||
if not stale_exports:
|
||||
logger.debug("No stale in-progress exports found on startup")
|
||||
return
|
||||
|
||||
flipped = 0
|
||||
deleted = 0
|
||||
errored = 0
|
||||
|
||||
for export in stale_exports:
|
||||
try:
|
||||
video_path = export.video_path
|
||||
has_usable_file = False
|
||||
|
||||
if video_path:
|
||||
try:
|
||||
has_usable_file = os.path.getsize(video_path) > 0
|
||||
except OSError:
|
||||
has_usable_file = False
|
||||
|
||||
if has_usable_file:
|
||||
# Unassign from any case on recovery: the user should
|
||||
# re-triage a recovered export rather than have it silently
|
||||
# reappear inside a case they curated.
|
||||
Export.update(
|
||||
{Export.in_progress: False, Export.export_case: None}
|
||||
).where(Export.id == export.id).execute()
|
||||
flipped += 1
|
||||
logger.info(
|
||||
"Recovered stale in-progress export %s (file intact on disk)",
|
||||
export.id,
|
||||
)
|
||||
continue
|
||||
|
||||
if export.thumb_path:
|
||||
Path(export.thumb_path).unlink(missing_ok=True)
|
||||
if video_path:
|
||||
Path(video_path).unlink(missing_ok=True)
|
||||
Export.delete().where(Export.id == export.id).execute()
|
||||
deleted += 1
|
||||
logger.info(
|
||||
"Deleted stale in-progress export %s (no usable file on disk)",
|
||||
export.id,
|
||||
)
|
||||
except Exception:
|
||||
errored += 1
|
||||
logger.exception("Failed to reap stale export %s", export.id)
|
||||
|
||||
logger.info(
|
||||
"Stale export cleanup complete: %d recovered, %d deleted, %d errored",
|
||||
flipped,
|
||||
deleted,
|
||||
errored,
|
||||
)
|
||||
|
||||
|
||||
def get_export_job_manager(config: FrigateConfig) -> ExportJobManager:
|
||||
"""Get or create the singleton export job manager."""
|
||||
global _job_manager
|
||||
|
||||
with _job_manager_lock:
|
||||
if _job_manager is None:
|
||||
_job_manager = ExportJobManager(config, _get_max_concurrent(config))
|
||||
_job_manager.ensure_started()
|
||||
return _job_manager
|
||||
|
||||
|
||||
def start_export_job(config: FrigateConfig, job: ExportJob) -> str:
|
||||
"""Queue an export job and return its ID."""
|
||||
return get_export_job_manager(config).enqueue(job)
|
||||
|
||||
|
||||
def get_export_job(config: FrigateConfig, job_id: str) -> Optional[ExportJob]:
|
||||
"""Get a queued or completed export job by ID."""
|
||||
return get_export_job_manager(config).get_job(job_id)
|
||||
|
||||
|
||||
def list_active_export_jobs(config: FrigateConfig) -> list[ExportJob]:
|
||||
"""List queued and running export jobs."""
|
||||
return get_export_job_manager(config).list_active_jobs()
|
||||
|
||||
|
||||
def cancel_queued_export_jobs_for_case(
|
||||
config: FrigateConfig, case_id: str
|
||||
) -> list[ExportJob]:
|
||||
"""Cancel queued export jobs that still point at a deleted case."""
|
||||
return get_export_job_manager(config).cancel_queued_jobs_for_case(case_id)
|
||||
|
||||
|
||||
def available_export_queue_slots(config: FrigateConfig) -> int:
|
||||
"""Approximate number of additional export jobs that could be queued now."""
|
||||
return get_export_job_manager(config).available_slots()
|
||||
+14
-229
@@ -4,14 +4,13 @@ import datetime
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import shutil
|
||||
import string
|
||||
import subprocess as sp
|
||||
import threading
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import Callable, Optional
|
||||
from typing import Optional
|
||||
|
||||
from peewee import DoesNotExist
|
||||
|
||||
@@ -37,10 +36,6 @@ logger = logging.getLogger(__name__)
|
||||
DEFAULT_TIME_LAPSE_FFMPEG_ARGS = "-vf setpts=0.04*PTS -r 30"
|
||||
TIMELAPSE_DATA_INPUT_ARGS = "-an -skip_frame nokey"
|
||||
|
||||
# Matches the setpts factor used in timelapse exports (e.g. setpts=0.04*PTS).
|
||||
# Captures the floating-point factor so we can scale expected duration.
|
||||
SETPTS_FACTOR_RE = re.compile(r"setpts=([0-9]*\.?[0-9]+)\*PTS")
|
||||
|
||||
# ffmpeg flags that can read from or write to arbitrary files
|
||||
BLOCKED_FFMPEG_ARGS = frozenset(
|
||||
{
|
||||
@@ -121,7 +116,6 @@ class RecordingExporter(threading.Thread):
|
||||
ffmpeg_input_args: Optional[str] = None,
|
||||
ffmpeg_output_args: Optional[str] = None,
|
||||
cpu_fallback: bool = False,
|
||||
on_progress: Optional[Callable[[str, float], None]] = None,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.config = config
|
||||
@@ -136,213 +130,10 @@ class RecordingExporter(threading.Thread):
|
||||
self.ffmpeg_input_args = ffmpeg_input_args
|
||||
self.ffmpeg_output_args = ffmpeg_output_args
|
||||
self.cpu_fallback = cpu_fallback
|
||||
self.on_progress = on_progress
|
||||
|
||||
# ensure export thumb dir
|
||||
Path(os.path.join(CLIPS_DIR, "export")).mkdir(exist_ok=True)
|
||||
|
||||
def _emit_progress(self, step: str, percent: float) -> None:
|
||||
"""Invoke the progress callback if one was supplied."""
|
||||
if self.on_progress is None:
|
||||
return
|
||||
try:
|
||||
self.on_progress(step, max(0.0, min(100.0, percent)))
|
||||
except Exception:
|
||||
logger.exception("Export progress callback failed")
|
||||
|
||||
def _expected_output_duration_seconds(self) -> float:
|
||||
"""Compute the expected duration of the output video in seconds.
|
||||
|
||||
Users often request a wide time range (e.g. a full hour) when only
|
||||
a few minutes of recordings actually live on disk for that span,
|
||||
so the requested range overstates the work and progress would
|
||||
plateau very early. We sum the actual saved seconds from the
|
||||
Recordings/Previews tables and use that as the input duration.
|
||||
Timelapse exports then scale this by the setpts factor.
|
||||
"""
|
||||
requested_duration = max(0.0, float(self.end_time - self.start_time))
|
||||
|
||||
recorded = self._sum_source_duration_seconds()
|
||||
input_duration = (
|
||||
recorded if recorded is not None and recorded > 0 else requested_duration
|
||||
)
|
||||
|
||||
if not self.ffmpeg_output_args:
|
||||
return input_duration
|
||||
|
||||
match = SETPTS_FACTOR_RE.search(self.ffmpeg_output_args)
|
||||
if match is None:
|
||||
return input_duration
|
||||
|
||||
try:
|
||||
factor = float(match.group(1))
|
||||
except ValueError:
|
||||
return input_duration
|
||||
|
||||
if factor <= 0:
|
||||
return input_duration
|
||||
|
||||
return input_duration * factor
|
||||
|
||||
def _sum_source_duration_seconds(self) -> Optional[float]:
|
||||
"""Sum saved-video seconds inside [start_time, end_time].
|
||||
|
||||
Queries Recordings or Previews depending on the playback source,
|
||||
clamps each segment to the requested range, and returns the total.
|
||||
Returns ``None`` on any error so the caller can fall back to the
|
||||
requested range duration without losing progress reporting.
|
||||
"""
|
||||
try:
|
||||
if self.playback_source == PlaybackSourceEnum.recordings:
|
||||
rows = (
|
||||
Recordings.select(Recordings.start_time, Recordings.end_time)
|
||||
.where(
|
||||
Recordings.start_time.between(self.start_time, self.end_time)
|
||||
| Recordings.end_time.between(self.start_time, self.end_time)
|
||||
| (
|
||||
(self.start_time > Recordings.start_time)
|
||||
& (self.end_time < Recordings.end_time)
|
||||
)
|
||||
)
|
||||
.where(Recordings.camera == self.camera)
|
||||
.iterator()
|
||||
)
|
||||
else:
|
||||
rows = (
|
||||
Previews.select(Previews.start_time, Previews.end_time)
|
||||
.where(
|
||||
Previews.start_time.between(self.start_time, self.end_time)
|
||||
| Previews.end_time.between(self.start_time, self.end_time)
|
||||
| (
|
||||
(self.start_time > Previews.start_time)
|
||||
& (self.end_time < Previews.end_time)
|
||||
)
|
||||
)
|
||||
.where(Previews.camera == self.camera)
|
||||
.iterator()
|
||||
)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Failed to sum source duration for export %s", self.export_id
|
||||
)
|
||||
return None
|
||||
|
||||
total = 0.0
|
||||
try:
|
||||
for row in rows:
|
||||
clipped_start = max(float(row.start_time), float(self.start_time))
|
||||
clipped_end = min(float(row.end_time), float(self.end_time))
|
||||
if clipped_end > clipped_start:
|
||||
total += clipped_end - clipped_start
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Failed to read recording rows for export %s", self.export_id
|
||||
)
|
||||
return None
|
||||
|
||||
return total
|
||||
|
||||
def _inject_progress_flags(self, ffmpeg_cmd: list[str]) -> list[str]:
|
||||
"""Insert FFmpeg progress reporting flags before the output path.
|
||||
|
||||
``-progress pipe:2`` writes structured key=value lines to stderr,
|
||||
``-nostats`` suppresses the noisy default stats output.
|
||||
"""
|
||||
if not ffmpeg_cmd:
|
||||
return ffmpeg_cmd
|
||||
return ffmpeg_cmd[:-1] + ["-progress", "pipe:2", "-nostats", ffmpeg_cmd[-1]]
|
||||
|
||||
def _run_ffmpeg_with_progress(
|
||||
self,
|
||||
ffmpeg_cmd: list[str],
|
||||
playlist_lines: str | list[str],
|
||||
step: str = "encoding",
|
||||
) -> tuple[int, str]:
|
||||
"""Run an FFmpeg export command, parsing progress events from stderr.
|
||||
|
||||
Returns ``(returncode, captured_stderr)``. Stdout is left attached to
|
||||
the parent process so we don't have to drain it (and risk a deadlock
|
||||
if the buffer fills). Progress percent is computed against the
|
||||
expected output duration; values are clamped to [0, 100] inside
|
||||
:py:meth:`_emit_progress`.
|
||||
"""
|
||||
cmd = ["nice", "-n", str(PROCESS_PRIORITY_LOW)] + self._inject_progress_flags(
|
||||
ffmpeg_cmd
|
||||
)
|
||||
|
||||
if isinstance(playlist_lines, list):
|
||||
stdin_payload = "\n".join(playlist_lines)
|
||||
else:
|
||||
stdin_payload = playlist_lines
|
||||
|
||||
expected_duration = self._expected_output_duration_seconds()
|
||||
|
||||
self._emit_progress(step, 0.0)
|
||||
|
||||
proc = sp.Popen(
|
||||
cmd,
|
||||
stdin=sp.PIPE,
|
||||
stderr=sp.PIPE,
|
||||
text=True,
|
||||
encoding="ascii",
|
||||
errors="replace",
|
||||
)
|
||||
|
||||
assert proc.stdin is not None
|
||||
assert proc.stderr is not None
|
||||
|
||||
try:
|
||||
proc.stdin.write(stdin_payload)
|
||||
except (BrokenPipeError, OSError):
|
||||
# FFmpeg may have rejected the input early; still wait for it
|
||||
# to terminate so the returncode is meaningful.
|
||||
pass
|
||||
finally:
|
||||
try:
|
||||
proc.stdin.close()
|
||||
except (BrokenPipeError, OSError):
|
||||
pass
|
||||
|
||||
captured: list[str] = []
|
||||
|
||||
try:
|
||||
for raw_line in proc.stderr:
|
||||
captured.append(raw_line)
|
||||
line = raw_line.strip()
|
||||
|
||||
if not line:
|
||||
continue
|
||||
|
||||
if line.startswith("out_time_us="):
|
||||
if expected_duration <= 0:
|
||||
continue
|
||||
try:
|
||||
out_time_us = int(line.split("=", 1)[1])
|
||||
except (ValueError, IndexError):
|
||||
continue
|
||||
if out_time_us < 0:
|
||||
continue
|
||||
out_seconds = out_time_us / 1_000_000.0
|
||||
percent = (out_seconds / expected_duration) * 100.0
|
||||
self._emit_progress(step, percent)
|
||||
elif line == "progress=end":
|
||||
self._emit_progress(step, 100.0)
|
||||
break
|
||||
except Exception:
|
||||
logger.exception("Failed reading FFmpeg progress for %s", self.export_id)
|
||||
|
||||
proc.wait()
|
||||
|
||||
# Drain any remaining stderr so callers can log it on failure.
|
||||
try:
|
||||
remaining = proc.stderr.read()
|
||||
if remaining:
|
||||
captured.append(remaining)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return proc.returncode, "".join(captured)
|
||||
|
||||
def get_datetime_from_timestamp(self, timestamp: int) -> str:
|
||||
# return in iso format
|
||||
return datetime.datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
|
||||
@@ -615,7 +406,6 @@ class RecordingExporter(threading.Thread):
|
||||
logger.debug(
|
||||
f"Beginning export for {self.camera} from {self.start_time} to {self.end_time}"
|
||||
)
|
||||
self._emit_progress("preparing", 0.0)
|
||||
export_name = (
|
||||
self.user_provided_name
|
||||
or f"{self.camera.replace('_', ' ')} {self.get_datetime_from_timestamp(self.start_time)} {self.get_datetime_from_timestamp(self.end_time)}"
|
||||
@@ -653,23 +443,16 @@ class RecordingExporter(threading.Thread):
|
||||
except DoesNotExist:
|
||||
return
|
||||
|
||||
# When neither custom ffmpeg arg is set the default path uses
|
||||
# `-c copy` (stream copy — no re-encoding). Report that as a
|
||||
# distinct step so the UI doesn't mislabel a remux as encoding.
|
||||
# The retry branch below always re-encodes because cpu_fallback
|
||||
# requires custom args; it stays "encoding_retry".
|
||||
is_stream_copy = (
|
||||
self.ffmpeg_input_args is None and self.ffmpeg_output_args is None
|
||||
)
|
||||
initial_step = "copying" if is_stream_copy else "encoding"
|
||||
|
||||
returncode, stderr = self._run_ffmpeg_with_progress(
|
||||
ffmpeg_cmd, playlist_lines, step=initial_step
|
||||
p = sp.run(
|
||||
["nice", "-n", str(PROCESS_PRIORITY_LOW)] + ffmpeg_cmd,
|
||||
input="\n".join(playlist_lines),
|
||||
encoding="ascii",
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
# If export failed and cpu_fallback is enabled, retry without hwaccel
|
||||
if (
|
||||
returncode != 0
|
||||
p.returncode != 0
|
||||
and self.cpu_fallback
|
||||
and self.ffmpeg_input_args is not None
|
||||
and self.ffmpeg_output_args is not None
|
||||
@@ -687,21 +470,23 @@ class RecordingExporter(threading.Thread):
|
||||
video_path, use_hwaccel=False
|
||||
)
|
||||
|
||||
returncode, stderr = self._run_ffmpeg_with_progress(
|
||||
ffmpeg_cmd, playlist_lines, step="encoding_retry"
|
||||
p = sp.run(
|
||||
["nice", "-n", str(PROCESS_PRIORITY_LOW)] + ffmpeg_cmd,
|
||||
input="\n".join(playlist_lines),
|
||||
encoding="ascii",
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
if returncode != 0:
|
||||
if p.returncode != 0:
|
||||
logger.error(
|
||||
f"Failed to export {self.playback_source.value} for command {' '.join(ffmpeg_cmd)}"
|
||||
)
|
||||
logger.error(stderr)
|
||||
logger.error(p.stderr)
|
||||
Path(video_path).unlink(missing_ok=True)
|
||||
Export.delete().where(Export.id == self.export_id).execute()
|
||||
Path(thumb_path).unlink(missing_ok=True)
|
||||
return
|
||||
else:
|
||||
self._emit_progress("finalizing", 100.0)
|
||||
Export.update({Export.in_progress: False}).where(
|
||||
Export.id == self.export_id
|
||||
).execute()
|
||||
|
||||
@@ -372,7 +372,6 @@ class RecordingMaintainer(threading.Thread):
|
||||
)
|
||||
|
||||
record_config = self.config.cameras[camera].record
|
||||
segment_stats: SegmentInfo | None = None
|
||||
highest = None
|
||||
|
||||
if record_config.continuous.days > 0:
|
||||
@@ -402,19 +401,9 @@ class RecordingMaintainer(threading.Thread):
|
||||
if highest == "continuous"
|
||||
else RetainModeEnum.motion
|
||||
)
|
||||
segment_stats = self.segment_stats(camera, start_time, end_time)
|
||||
|
||||
# Here we only check if we should move the segment based on non-object recording retention
|
||||
# we will always want to check for overlapping review items below before dropping the segment
|
||||
if not segment_stats.should_discard_segment(record_mode):
|
||||
return await self.move_segment(
|
||||
camera,
|
||||
start_time,
|
||||
end_time,
|
||||
duration,
|
||||
cache_path,
|
||||
segment_stats,
|
||||
)
|
||||
return await self.move_segment(
|
||||
camera, start_time, end_time, duration, cache_path, record_mode
|
||||
)
|
||||
|
||||
# we fell through the continuous / motion check, so we need to check the review items
|
||||
# if the cached segment overlaps with the review items:
|
||||
@@ -446,30 +435,19 @@ class RecordingMaintainer(threading.Thread):
|
||||
if review.severity == "alert"
|
||||
else record_config.detections.retain.mode
|
||||
)
|
||||
|
||||
if segment_stats is None:
|
||||
segment_stats = self.segment_stats(camera, start_time, end_time)
|
||||
|
||||
if not segment_stats.should_discard_segment(record_mode):
|
||||
# move from cache to recordings immediately
|
||||
return await self.move_segment(
|
||||
camera,
|
||||
start_time,
|
||||
end_time,
|
||||
duration,
|
||||
cache_path,
|
||||
segment_stats,
|
||||
)
|
||||
else:
|
||||
self.drop_segment(cache_path)
|
||||
return None
|
||||
|
||||
# if it doesn't overlap with a review item, drop the segment once it
|
||||
# ends more than event_pre_capture before the most recently processed
|
||||
# frame. at this point we've already decided not to keep it for
|
||||
# continuous/motion retention (either disabled or segment_stats said
|
||||
# discard), so waiting longer just fills the cache.
|
||||
else:
|
||||
# move from cache to recordings immediately
|
||||
return await self.move_segment(
|
||||
camera,
|
||||
start_time,
|
||||
end_time,
|
||||
duration,
|
||||
cache_path,
|
||||
record_mode,
|
||||
)
|
||||
# if it doesn't overlap with an review item, go ahead and drop the segment
|
||||
# if it ends more than the configured pre_capture for the camera
|
||||
# BUT only if continuous/motion is NOT enabled (otherwise wait for processing)
|
||||
elif highest is None:
|
||||
camera_info = self.object_recordings_info[camera]
|
||||
most_recently_processed_frame_time = (
|
||||
camera_info[-1][0] if len(camera_info) > 0 else 0
|
||||
@@ -477,7 +455,6 @@ class RecordingMaintainer(threading.Thread):
|
||||
retain_cutoff = datetime.datetime.fromtimestamp(
|
||||
most_recently_processed_frame_time - record_config.event_pre_capture
|
||||
).astimezone(datetime.timezone.utc)
|
||||
|
||||
if end_time < retain_cutoff:
|
||||
self.drop_segment(cache_path)
|
||||
|
||||
@@ -601,8 +578,15 @@ class RecordingMaintainer(threading.Thread):
|
||||
end_time: datetime.datetime,
|
||||
duration: float,
|
||||
cache_path: str,
|
||||
segment_info: SegmentInfo,
|
||||
store_mode: RetainModeEnum,
|
||||
) -> Optional[dict[str, Any]]:
|
||||
segment_info = self.segment_stats(camera, start_time, end_time)
|
||||
|
||||
# check if the segment shouldn't be stored
|
||||
if segment_info.should_discard_segment(store_mode):
|
||||
self.drop_segment(cache_path)
|
||||
return None
|
||||
|
||||
# directory will be in utc due to start_time being in utc
|
||||
directory = os.path.join(
|
||||
RECORD_DIR,
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ class StorageMaintainer(threading.Thread):
|
||||
# check if need to delete retained segments
|
||||
if deleted_segments_size < hourly_bandwidth:
|
||||
logger.error(
|
||||
f"Could not clear {hourly_bandwidth} MB, currently {deleted_segments_size:.2f} MB have been cleared. Retained recordings must be deleted."
|
||||
f"Could not clear {hourly_bandwidth} MB, currently {deleted_segments_size} MB have been cleared. Retained recordings must be deleted."
|
||||
)
|
||||
recordings = (
|
||||
Recordings.select(
|
||||
@@ -225,7 +225,7 @@ class StorageMaintainer(threading.Thread):
|
||||
# this file was not found so we must assume no space was cleaned up
|
||||
pass
|
||||
else:
|
||||
logger.info(f"Cleaned up {deleted_segments_size:.2f} MB of recordings")
|
||||
logger.info(f"Cleaned up {deleted_segments_size} MB of recordings")
|
||||
|
||||
logger.debug(f"Expiring {len(deleted_recordings)} recordings")
|
||||
# delete up to 100,000 at a time
|
||||
|
||||
@@ -2,7 +2,6 @@ import datetime
|
||||
import logging
|
||||
import os
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from fastapi import Request
|
||||
from fastapi.testclient import TestClient
|
||||
@@ -15,7 +14,6 @@ from frigate.api.fastapi_app import create_fastapi_app
|
||||
from frigate.config import FrigateConfig
|
||||
from frigate.const import BASE_DIR, CACHE_DIR
|
||||
from frigate.debug_replay import DebugReplayManager
|
||||
from frigate.jobs.export import JobStatePublisher
|
||||
from frigate.models import Event, Recordings, ReviewSegment
|
||||
from frigate.review.types import SeverityEnum
|
||||
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
||||
@@ -46,19 +44,6 @@ class BaseTestHttp(unittest.TestCase):
|
||||
self.db = SqliteQueueDatabase(TEST_DB)
|
||||
self.db.bind(models)
|
||||
|
||||
# The export job manager broadcasts via JobStatePublisher on
|
||||
# enqueue/start/finish. There is no dispatcher process bound to
|
||||
# the IPC socket in tests, so a real publish() would block on
|
||||
# recv_json forever. Replace publish with a no-op for the
|
||||
# lifetime of this test; the lookup goes through the class so any
|
||||
# already-instantiated publisher (the singleton manager's) picks
|
||||
# up the no-op too.
|
||||
publisher_patch = patch.object(
|
||||
JobStatePublisher, "publish", lambda self, payload: None
|
||||
)
|
||||
publisher_patch.start()
|
||||
self.addCleanup(publisher_patch.stop)
|
||||
|
||||
self.minimal_config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"cameras": {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,211 +0,0 @@
|
||||
"""Tests for DeferredRealtimeProcessorApi."""
|
||||
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import numpy as np
|
||||
|
||||
from frigate.data_processing.real_time.api import DeferredRealtimeProcessorApi
|
||||
|
||||
# Mock TFLite before importing classification module
|
||||
_MOCK_MODULES = [
|
||||
"tflite_runtime",
|
||||
"tflite_runtime.interpreter",
|
||||
"ai_edge_litert",
|
||||
"ai_edge_litert.interpreter",
|
||||
]
|
||||
for mod in _MOCK_MODULES:
|
||||
if mod not in sys.modules:
|
||||
sys.modules[mod] = MagicMock()
|
||||
|
||||
from frigate.data_processing.real_time.custom_classification import ( # noqa: E402
|
||||
CustomObjectClassificationProcessor,
|
||||
)
|
||||
|
||||
|
||||
class StubDeferredProcessor(DeferredRealtimeProcessorApi):
|
||||
"""Minimal concrete subclass for testing the deferred base."""
|
||||
|
||||
def __init__(self, max_queue: int = 8):
|
||||
config = MagicMock()
|
||||
metrics = MagicMock()
|
||||
super().__init__(config, metrics, max_queue=max_queue)
|
||||
self.processed_items: list[tuple] = []
|
||||
|
||||
def process_frame(self, obj_data: dict[str, Any], frame: np.ndarray) -> None:
|
||||
"""Enqueue every call — no gating logic in the stub."""
|
||||
self._enqueue_task(("frame", obj_data, frame.copy()))
|
||||
|
||||
def _process_task(self, task: tuple) -> None:
|
||||
kind = task[0]
|
||||
if kind == "frame":
|
||||
_, obj_data, frame = task
|
||||
self.processed_items.append((obj_data["id"], frame.shape))
|
||||
self._emit_result(
|
||||
{
|
||||
"type": "test_result",
|
||||
"id": obj_data["id"],
|
||||
"label": "cat",
|
||||
"score": 0.95,
|
||||
}
|
||||
)
|
||||
elif kind == "expire":
|
||||
_, object_id = task
|
||||
self.processed_items.append(("expired", object_id))
|
||||
|
||||
def handle_request(
|
||||
self, topic: str, request_data: dict[str, Any]
|
||||
) -> dict[str, Any] | None:
|
||||
if topic == "reload":
|
||||
|
||||
def _do_reload(data):
|
||||
return {"success": True, "model": data.get("name")}
|
||||
|
||||
return self._enqueue_request(_do_reload, request_data)
|
||||
return None
|
||||
|
||||
def expire_object(self, object_id: str, camera: str) -> None:
|
||||
self._enqueue_task(("expire", object_id))
|
||||
|
||||
|
||||
class TestDeferredProcessorBase(unittest.TestCase):
|
||||
def test_enqueue_and_drain(self):
|
||||
"""Tasks enqueued on main thread are processed by worker, results are drainable."""
|
||||
proc = StubDeferredProcessor()
|
||||
frame = np.zeros((100, 100, 3), dtype=np.uint8)
|
||||
proc.process_frame({"id": "obj1"}, frame)
|
||||
proc.process_frame({"id": "obj2"}, frame)
|
||||
|
||||
# Give the worker time to process
|
||||
time.sleep(0.1)
|
||||
|
||||
results = proc.drain_results()
|
||||
self.assertEqual(len(results), 2)
|
||||
self.assertEqual(results[0]["id"], "obj1")
|
||||
self.assertEqual(results[1]["id"], "obj2")
|
||||
|
||||
# Second drain should be empty
|
||||
self.assertEqual(len(proc.drain_results()), 0)
|
||||
|
||||
def test_backpressure_drops_tasks(self):
|
||||
"""When queue is full, new tasks are silently dropped."""
|
||||
proc = StubDeferredProcessor(max_queue=2)
|
||||
|
||||
frame = np.zeros((10, 10, 3), dtype=np.uint8)
|
||||
for i in range(10):
|
||||
proc.process_frame({"id": f"obj{i}"}, frame)
|
||||
|
||||
time.sleep(0.2)
|
||||
results = proc.drain_results()
|
||||
# The key property: no crash, no unbounded growth
|
||||
self.assertLessEqual(len(results), 10)
|
||||
self.assertGreater(len(results), 0)
|
||||
|
||||
def test_handle_request_through_worker(self):
|
||||
"""handle_request blocks until the worker processes it and returns a response."""
|
||||
proc = StubDeferredProcessor()
|
||||
result = proc.handle_request("reload", {"name": "my_model"})
|
||||
self.assertEqual(result, {"success": True, "model": "my_model"})
|
||||
|
||||
def test_expire_object_serialized_with_work(self):
|
||||
"""expire_object goes through the queue, serialized with inference work."""
|
||||
proc = StubDeferredProcessor()
|
||||
frame = np.zeros((10, 10, 3), dtype=np.uint8)
|
||||
proc.process_frame({"id": "obj1"}, frame)
|
||||
proc.expire_object("obj1", "front_door")
|
||||
|
||||
time.sleep(0.1)
|
||||
# Both should have been processed in order
|
||||
self.assertEqual(len(proc.processed_items), 2)
|
||||
self.assertEqual(proc.processed_items[0][0], "obj1")
|
||||
self.assertEqual(proc.processed_items[1], ("expired", "obj1"))
|
||||
|
||||
def test_shutdown_joins_worker(self):
|
||||
"""shutdown() signals the worker to stop and joins the thread."""
|
||||
proc = StubDeferredProcessor()
|
||||
proc.shutdown()
|
||||
self.assertFalse(proc._worker.is_alive())
|
||||
|
||||
def test_drain_results_returns_list(self):
|
||||
"""drain_results returns a plain list, not a deque."""
|
||||
proc = StubDeferredProcessor()
|
||||
results = proc.drain_results()
|
||||
self.assertIsInstance(results, list)
|
||||
|
||||
|
||||
class TestCustomObjectClassificationDeferred(unittest.TestCase):
|
||||
"""Test that CustomObjectClassificationProcessor uses the deferred pattern correctly."""
|
||||
|
||||
def _make_processor(self):
|
||||
config = MagicMock()
|
||||
model_config = MagicMock()
|
||||
model_config.name = "test_breed"
|
||||
model_config.object_config = MagicMock()
|
||||
model_config.object_config.objects = ["dog"]
|
||||
model_config.threshold = 0.5
|
||||
model_config.save_attempts = 10
|
||||
model_config.object_config.classification_type = "sub_label"
|
||||
publisher = MagicMock()
|
||||
requestor = MagicMock()
|
||||
metrics = MagicMock()
|
||||
metrics.classification_speeds = {}
|
||||
metrics.classification_cps = {}
|
||||
|
||||
with patch.object(
|
||||
CustomObjectClassificationProcessor,
|
||||
"_CustomObjectClassificationProcessor__build_detector",
|
||||
):
|
||||
proc = CustomObjectClassificationProcessor(
|
||||
config, model_config, publisher, requestor, metrics
|
||||
)
|
||||
proc.interpreter = None
|
||||
proc.tensor_input_details = [{"index": 0}]
|
||||
proc.tensor_output_details = [{"index": 0}]
|
||||
proc.labelmap = {0: "labrador", 1: "poodle", 2: "none"}
|
||||
return proc
|
||||
|
||||
def test_is_deferred_processor(self):
|
||||
"""CustomObjectClassificationProcessor should be a DeferredRealtimeProcessorApi."""
|
||||
proc = self._make_processor()
|
||||
self.assertIsInstance(proc, DeferredRealtimeProcessorApi)
|
||||
|
||||
def test_expire_clears_history(self):
|
||||
"""expire_object should clear classification history for the object."""
|
||||
proc = self._make_processor()
|
||||
proc.classification_history["obj1"] = [("labrador", 0.9, 1.0)]
|
||||
|
||||
proc.expire_object("obj1", "front")
|
||||
time.sleep(0.1)
|
||||
|
||||
self.assertNotIn("obj1", proc.classification_history)
|
||||
|
||||
def test_drain_results_empty_when_no_model(self):
|
||||
"""With no interpreter, process_frame saves training images but emits no results."""
|
||||
proc = self._make_processor()
|
||||
proc.interpreter = None
|
||||
|
||||
frame = np.zeros((150, 100), dtype=np.uint8)
|
||||
obj_data = {
|
||||
"id": "obj1",
|
||||
"label": "dog",
|
||||
"false_positive": False,
|
||||
"end_time": None,
|
||||
"box": [10, 10, 50, 50],
|
||||
"camera": "front",
|
||||
}
|
||||
|
||||
with patch(
|
||||
"frigate.data_processing.real_time.custom_classification.write_classification_attempt"
|
||||
):
|
||||
proc.process_frame(obj_data, frame)
|
||||
|
||||
time.sleep(0.1)
|
||||
results = proc.drain_results()
|
||||
self.assertEqual(len(results), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,385 +0,0 @@
|
||||
"""Tests for export progress tracking, broadcast, and FFmpeg parsing."""
|
||||
|
||||
import io
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from frigate.jobs.export import (
|
||||
PROGRESS_BROADCAST_MIN_INTERVAL,
|
||||
ExportJob,
|
||||
ExportJobManager,
|
||||
)
|
||||
from frigate.record.export import PlaybackSourceEnum, RecordingExporter
|
||||
from frigate.types import JobStatusTypesEnum
|
||||
|
||||
|
||||
def _make_exporter(
|
||||
end_minus_start: int = 100,
|
||||
ffmpeg_input_args=None,
|
||||
ffmpeg_output_args=None,
|
||||
on_progress=None,
|
||||
) -> RecordingExporter:
|
||||
"""Build a RecordingExporter without invoking its real __init__ side
|
||||
effects (which create directories and require a full FrigateConfig)."""
|
||||
exporter = RecordingExporter.__new__(RecordingExporter)
|
||||
exporter.config = MagicMock()
|
||||
exporter.export_id = "test_export"
|
||||
exporter.camera = "front"
|
||||
exporter.user_provided_name = None
|
||||
exporter.user_provided_image = None
|
||||
exporter.start_time = 1_000
|
||||
exporter.end_time = 1_000 + end_minus_start
|
||||
exporter.playback_source = PlaybackSourceEnum.recordings
|
||||
exporter.export_case_id = None
|
||||
exporter.ffmpeg_input_args = ffmpeg_input_args
|
||||
exporter.ffmpeg_output_args = ffmpeg_output_args
|
||||
exporter.cpu_fallback = False
|
||||
exporter.on_progress = on_progress
|
||||
return exporter
|
||||
|
||||
|
||||
class TestExportJobToDict(unittest.TestCase):
|
||||
def test_to_dict_includes_progress_fields(self) -> None:
|
||||
job = ExportJob(camera="front", request_start_time=0, request_end_time=10)
|
||||
result = job.to_dict()
|
||||
|
||||
assert "current_step" in result
|
||||
assert "progress_percent" in result
|
||||
assert result["current_step"] == "queued"
|
||||
assert result["progress_percent"] == 0.0
|
||||
|
||||
def test_to_dict_reflects_updated_progress(self) -> None:
|
||||
job = ExportJob(camera="front", request_start_time=0, request_end_time=10)
|
||||
job.current_step = "encoding"
|
||||
job.progress_percent = 42.5
|
||||
|
||||
result = job.to_dict()
|
||||
|
||||
assert result["current_step"] == "encoding"
|
||||
assert result["progress_percent"] == 42.5
|
||||
|
||||
|
||||
class TestExpectedOutputDuration(unittest.TestCase):
|
||||
def test_normal_export_uses_input_duration(self) -> None:
|
||||
exporter = _make_exporter(end_minus_start=600)
|
||||
assert exporter._expected_output_duration_seconds() == 600.0
|
||||
|
||||
def test_timelapse_uses_setpts_factor(self) -> None:
|
||||
exporter = _make_exporter(
|
||||
end_minus_start=1000,
|
||||
ffmpeg_input_args="-y",
|
||||
ffmpeg_output_args="-vf setpts=0.04*PTS -r 30",
|
||||
)
|
||||
# 1000s input * 0.04 = 40s of output
|
||||
assert exporter._expected_output_duration_seconds() == 40.0
|
||||
|
||||
def test_unknown_factor_falls_back_to_input_duration(self) -> None:
|
||||
exporter = _make_exporter(
|
||||
end_minus_start=300,
|
||||
ffmpeg_input_args="-y",
|
||||
ffmpeg_output_args="-c:v libx264 -preset veryfast",
|
||||
)
|
||||
assert exporter._expected_output_duration_seconds() == 300.0
|
||||
|
||||
def test_zero_factor_falls_back_to_input_duration(self) -> None:
|
||||
exporter = _make_exporter(
|
||||
end_minus_start=300,
|
||||
ffmpeg_input_args="-y",
|
||||
ffmpeg_output_args="-vf setpts=0*PTS",
|
||||
)
|
||||
assert exporter._expected_output_duration_seconds() == 300.0
|
||||
|
||||
def test_uses_actual_recorded_seconds_when_available(self) -> None:
|
||||
"""If the DB shows only 120s of saved recordings inside a 1h
|
||||
requested range, progress should be computed against 120s."""
|
||||
exporter = _make_exporter(end_minus_start=3600)
|
||||
exporter._sum_source_duration_seconds = lambda: 120.0 # type: ignore[method-assign]
|
||||
assert exporter._expected_output_duration_seconds() == 120.0
|
||||
|
||||
def test_actual_recorded_seconds_scaled_by_setpts(self) -> None:
|
||||
"""Recorded duration must still be scaled by the timelapse factor."""
|
||||
exporter = _make_exporter(
|
||||
end_minus_start=3600,
|
||||
ffmpeg_input_args="-y",
|
||||
ffmpeg_output_args="-vf setpts=0.04*PTS -r 30",
|
||||
)
|
||||
exporter._sum_source_duration_seconds = lambda: 600.0 # type: ignore[method-assign]
|
||||
# 600s * 0.04 = 24s of output
|
||||
assert exporter._expected_output_duration_seconds() == 24.0
|
||||
|
||||
def test_db_failure_falls_back_to_requested_range(self) -> None:
|
||||
exporter = _make_exporter(end_minus_start=300)
|
||||
exporter._sum_source_duration_seconds = lambda: None # type: ignore[method-assign]
|
||||
assert exporter._expected_output_duration_seconds() == 300.0
|
||||
|
||||
|
||||
class TestProgressFlagInjection(unittest.TestCase):
|
||||
def test_inserts_before_output_path(self) -> None:
|
||||
exporter = _make_exporter()
|
||||
cmd = ["ffmpeg", "-i", "input.m3u8", "-c", "copy", "/tmp/output.mp4"]
|
||||
|
||||
result = exporter._inject_progress_flags(cmd)
|
||||
|
||||
assert result == [
|
||||
"ffmpeg",
|
||||
"-i",
|
||||
"input.m3u8",
|
||||
"-c",
|
||||
"copy",
|
||||
"-progress",
|
||||
"pipe:2",
|
||||
"-nostats",
|
||||
"/tmp/output.mp4",
|
||||
]
|
||||
|
||||
def test_handles_empty_cmd(self) -> None:
|
||||
exporter = _make_exporter()
|
||||
assert exporter._inject_progress_flags([]) == []
|
||||
|
||||
|
||||
class TestFfmpegProgressParsing(unittest.TestCase):
|
||||
"""Verify percentage calculation from FFmpeg ``-progress`` output."""
|
||||
|
||||
def _run_with_stderr(
|
||||
self,
|
||||
stderr_text: str,
|
||||
expected_duration_seconds: int = 90,
|
||||
) -> list[tuple[str, float]]:
|
||||
"""Helper: run _run_ffmpeg_with_progress against a mocked Popen
|
||||
whose stderr emits the supplied text. Returns the list of
|
||||
(step, percent) tuples that the on_progress callback received."""
|
||||
captured: list[tuple[str, float]] = []
|
||||
|
||||
def on_progress(step: str, percent: float) -> None:
|
||||
captured.append((step, percent))
|
||||
|
||||
exporter = _make_exporter(
|
||||
end_minus_start=expected_duration_seconds,
|
||||
on_progress=on_progress,
|
||||
)
|
||||
|
||||
fake_proc = MagicMock()
|
||||
fake_proc.stdin = io.StringIO()
|
||||
fake_proc.stderr = io.StringIO(stderr_text)
|
||||
fake_proc.returncode = 0
|
||||
fake_proc.wait = MagicMock(return_value=0)
|
||||
|
||||
with patch("frigate.record.export.sp.Popen", return_value=fake_proc):
|
||||
returncode, _stderr = exporter._run_ffmpeg_with_progress(
|
||||
["ffmpeg", "-i", "x.m3u8", "/tmp/out.mp4"], "playlist", step="encoding"
|
||||
)
|
||||
|
||||
assert returncode == 0
|
||||
return captured
|
||||
|
||||
def test_parses_out_time_us_into_percent(self) -> None:
|
||||
# 90s duration; 45s out_time => 50%
|
||||
stderr = "out_time_us=45000000\nprogress=continue\n"
|
||||
captured = self._run_with_stderr(stderr, expected_duration_seconds=90)
|
||||
|
||||
# The first call is the synchronous 0.0 emit before Popen runs.
|
||||
assert captured[0] == ("encoding", 0.0)
|
||||
assert any(percent == 50.0 for step, percent in captured if step == "encoding")
|
||||
|
||||
def test_progress_end_emits_100_percent(self) -> None:
|
||||
stderr = "out_time_us=10000000\nprogress=end\n"
|
||||
captured = self._run_with_stderr(stderr, expected_duration_seconds=90)
|
||||
|
||||
assert captured[-1] == ("encoding", 100.0)
|
||||
|
||||
def test_clamps_overshoot_at_100(self) -> None:
|
||||
# 150s of output reported against 90s expected duration.
|
||||
stderr = "out_time_us=150000000\nprogress=continue\n"
|
||||
captured = self._run_with_stderr(stderr, expected_duration_seconds=90)
|
||||
|
||||
encoding_values = [p for s, p in captured if s == "encoding" and p > 0]
|
||||
assert all(p <= 100.0 for p in encoding_values)
|
||||
assert encoding_values[-1] == 100.0
|
||||
|
||||
def test_ignores_garbage_lines(self) -> None:
|
||||
stderr = (
|
||||
"frame= 120 fps= 30 q=23.0 size= 512kB\n"
|
||||
"out_time_us=not-a-number\n"
|
||||
"out_time_us=30000000\n"
|
||||
"progress=continue\n"
|
||||
)
|
||||
captured = self._run_with_stderr(stderr, expected_duration_seconds=90)
|
||||
|
||||
# We expect 0.0 (from initial emit) plus the 30s/90s = 33.33...% step
|
||||
encoding_percents = sorted({round(p, 2) for s, p in captured})
|
||||
assert 0.0 in encoding_percents
|
||||
assert any(abs(p - (30 / 90 * 100)) < 0.01 for p in encoding_percents)
|
||||
|
||||
|
||||
class TestBroadcastAggregation(unittest.TestCase):
|
||||
"""Verify ExportJobManager broadcast payload shape and throttling."""
|
||||
|
||||
def _make_manager(self) -> tuple[ExportJobManager, MagicMock]:
|
||||
"""Build a manager with an injected mock publisher. Returns
|
||||
``(manager, publisher)`` so tests can assert on broadcast payloads
|
||||
without touching ZMQ at all."""
|
||||
config = MagicMock()
|
||||
publisher = MagicMock()
|
||||
manager = ExportJobManager(
|
||||
config, max_concurrent=2, max_queued=10, publisher=publisher
|
||||
)
|
||||
return manager, publisher
|
||||
|
||||
@staticmethod
|
||||
def _last_payload(publisher: MagicMock) -> dict:
|
||||
return publisher.publish.call_args.args[0]
|
||||
|
||||
def test_empty_jobs_broadcasts_empty_list(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
|
||||
publisher.publish.assert_called_once()
|
||||
payload = self._last_payload(publisher)
|
||||
assert payload["job_type"] == "export"
|
||||
assert payload["status"] == "queued"
|
||||
assert payload["results"]["jobs"] == []
|
||||
|
||||
def test_single_running_job_payload(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
job = ExportJob(camera="front", request_start_time=0, request_end_time=10)
|
||||
job.status = JobStatusTypesEnum.running
|
||||
job.current_step = "encoding"
|
||||
job.progress_percent = 75.0
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
|
||||
payload = self._last_payload(publisher)
|
||||
assert payload["status"] == "running"
|
||||
assert len(payload["results"]["jobs"]) == 1
|
||||
broadcast_job = payload["results"]["jobs"][0]
|
||||
assert broadcast_job["current_step"] == "encoding"
|
||||
assert broadcast_job["progress_percent"] == 75.0
|
||||
|
||||
def test_multiple_jobs_broadcast(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
for i, status in enumerate(
|
||||
(JobStatusTypesEnum.queued, JobStatusTypesEnum.running)
|
||||
):
|
||||
job = ExportJob(
|
||||
id=f"job_{i}",
|
||||
camera="front",
|
||||
request_start_time=0,
|
||||
request_end_time=10,
|
||||
)
|
||||
job.status = status
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
|
||||
payload = self._last_payload(publisher)
|
||||
assert payload["status"] == "running"
|
||||
assert len(payload["results"]["jobs"]) == 2
|
||||
|
||||
def test_completed_jobs_are_excluded(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
active = ExportJob(id="active", camera="front")
|
||||
active.status = JobStatusTypesEnum.running
|
||||
finished = ExportJob(id="done", camera="front")
|
||||
finished.status = JobStatusTypesEnum.success
|
||||
manager.jobs[active.id] = active
|
||||
manager.jobs[finished.id] = finished
|
||||
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
|
||||
payload = self._last_payload(publisher)
|
||||
ids = [j["id"] for j in payload["results"]["jobs"]]
|
||||
assert ids == ["active"]
|
||||
|
||||
def test_throttle_skips_rapid_unforced_broadcasts(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
job = ExportJob(camera="front")
|
||||
job.status = JobStatusTypesEnum.running
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
# Immediately following non-forced broadcasts should be skipped.
|
||||
for _ in range(5):
|
||||
manager._broadcast_all_jobs(force=False)
|
||||
|
||||
assert publisher.publish.call_count == 1
|
||||
|
||||
def test_throttle_allows_broadcast_after_interval(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
job = ExportJob(camera="front")
|
||||
job.status = JobStatusTypesEnum.running
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
with patch("frigate.jobs.export.time.monotonic") as mock_mono:
|
||||
mock_mono.return_value = 100.0
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
|
||||
mock_mono.return_value = 100.0 + PROGRESS_BROADCAST_MIN_INTERVAL + 0.01
|
||||
manager._broadcast_all_jobs(force=False)
|
||||
|
||||
assert publisher.publish.call_count == 2
|
||||
|
||||
def test_force_bypasses_throttle(self) -> None:
|
||||
manager, publisher = self._make_manager()
|
||||
job = ExportJob(camera="front")
|
||||
job.status = JobStatusTypesEnum.running
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
|
||||
assert publisher.publish.call_count == 2
|
||||
|
||||
def test_publisher_exceptions_do_not_propagate(self) -> None:
|
||||
"""A failing publisher must not break the manager: broadcasts are
|
||||
best-effort since the dispatcher may not be available (tests,
|
||||
startup races)."""
|
||||
manager, publisher = self._make_manager()
|
||||
publisher.publish.side_effect = RuntimeError("comms down")
|
||||
|
||||
job = ExportJob(camera="front")
|
||||
job.status = JobStatusTypesEnum.running
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
# Swallow our own RuntimeError if the manager doesn't; the real
|
||||
# JobStatePublisher handles its own exceptions internally, so the
|
||||
# manager can stay naive. But if something bubbles up it should
|
||||
# not escape _broadcast_all_jobs — enforce that contract here.
|
||||
try:
|
||||
manager._broadcast_all_jobs(force=True)
|
||||
except RuntimeError:
|
||||
self.fail("_broadcast_all_jobs must tolerate publisher failures")
|
||||
|
||||
def test_progress_callback_updates_job_and_broadcasts(self) -> None:
|
||||
manager, _publisher = self._make_manager()
|
||||
job = ExportJob(camera="front")
|
||||
job.status = JobStatusTypesEnum.running
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
callback = manager._make_progress_callback(job)
|
||||
callback("encoding", 33.0)
|
||||
|
||||
assert job.current_step == "encoding"
|
||||
assert job.progress_percent == 33.0
|
||||
|
||||
|
||||
class TestSchedulesCleanup(unittest.TestCase):
|
||||
def test_schedule_job_cleanup_removes_after_delay(self) -> None:
|
||||
config = MagicMock()
|
||||
manager = ExportJobManager(config, max_concurrent=1, max_queued=1)
|
||||
job = ExportJob(id="cleanup_me", camera="front")
|
||||
manager.jobs[job.id] = job
|
||||
|
||||
with patch("frigate.jobs.export.threading.Timer") as mock_timer:
|
||||
manager._schedule_job_cleanup(job.id)
|
||||
mock_timer.assert_called_once()
|
||||
delay, fn = mock_timer.call_args.args
|
||||
assert delay > 0
|
||||
|
||||
# Invoke the callback directly to confirm it removes the job.
|
||||
fn()
|
||||
assert job.id not in manager.jobs
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,4 +1,3 @@
|
||||
import datetime
|
||||
import sys
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
@@ -75,46 +74,6 @@ class TestMaintainer(unittest.IsolatedAsyncioTestCase):
|
||||
f"Expected a single warning for unexpected files, got {len(matching)}",
|
||||
)
|
||||
|
||||
async def test_drops_quiet_segment_when_only_motion_retention(self):
|
||||
# Regression: when motion retention is enabled but a segment has no
|
||||
# motion and no review overlaps it, the segment must still be dropped.
|
||||
# Otherwise it sits in cache forever, accumulates, and triggers the
|
||||
# "Unable to keep up with recording segments in cache" warning every
|
||||
# ~10s as the overflow trim in move_files discards the oldest one.
|
||||
config = MagicMock(spec=FrigateConfig)
|
||||
|
||||
camera_config = MagicMock()
|
||||
camera_config.record.enabled = True
|
||||
camera_config.record.continuous.days = 0
|
||||
camera_config.record.motion.days = 1
|
||||
camera_config.record.event_pre_capture = 5
|
||||
config.cameras = {"test_cam": camera_config}
|
||||
|
||||
stop_event = MagicMock()
|
||||
maintainer = RecordingMaintainer(config, stop_event)
|
||||
|
||||
now = datetime.datetime.now(datetime.timezone.utc)
|
||||
start_time = now - datetime.timedelta(seconds=20)
|
||||
end_time = now - datetime.timedelta(seconds=10)
|
||||
cache_path = "/tmp/cache/test_cam@20260417150000+0000.mp4"
|
||||
|
||||
maintainer.end_time_cache = {cache_path: (end_time, 10.0)}
|
||||
# Single processed frame well past end_time with no motion/objects.
|
||||
maintainer.object_recordings_info["test_cam"] = [(now.timestamp(), [], [], [])]
|
||||
maintainer.audio_recordings_info["test_cam"] = []
|
||||
|
||||
maintainer.drop_segment = MagicMock()
|
||||
maintainer.recordings_publisher = MagicMock()
|
||||
|
||||
result = await maintainer.validate_and_move_segment(
|
||||
"test_cam",
|
||||
reviews=[],
|
||||
recording={"start_time": start_time, "cache_path": cache_path},
|
||||
)
|
||||
|
||||
self.assertIsNone(result)
|
||||
maintainer.drop_segment.assert_called_once_with(cache_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -807,15 +807,10 @@ async def get_video_properties(
|
||||
) -> dict[str, Any]:
|
||||
async def probe_with_ffprobe(
|
||||
url: str,
|
||||
rtsp_transport: Optional[str] = None,
|
||||
) -> tuple[bool, int, int, Optional[str], float]:
|
||||
"""Fallback using ffprobe: returns (valid, width, height, codec, duration)."""
|
||||
cmd = [ffmpeg.ffprobe_path]
|
||||
if rtsp_transport:
|
||||
cmd += ["-rtsp_transport", rtsp_transport]
|
||||
cmd += [
|
||||
"-rw_timeout",
|
||||
"5000000",
|
||||
cmd = [
|
||||
ffmpeg.ffprobe_path,
|
||||
"-v",
|
||||
"quiet",
|
||||
"-print_format",
|
||||
@@ -877,26 +872,12 @@ async def get_video_properties(
|
||||
cap.release()
|
||||
return valid, width, height, fourcc, duration
|
||||
|
||||
is_rtsp = url.startswith("rtsp://")
|
||||
# try cv2 first
|
||||
has_video, width, height, fourcc, duration = probe_with_cv2(url)
|
||||
|
||||
if is_rtsp:
|
||||
# skip cv2 for RTSP: its FFmpeg backend has a hardcoded ~30s internal
|
||||
# timeout that cannot be shortened per-call, and ffprobe bounded by
|
||||
# -rw_timeout handles RTSP probing reliably
|
||||
# fallback to ffprobe if needed
|
||||
if not has_video or (get_duration and duration < 0):
|
||||
has_video, width, height, fourcc, duration = await probe_with_ffprobe(url)
|
||||
else:
|
||||
# try cv2 first for local files, HTTP, RTMP
|
||||
has_video, width, height, fourcc, duration = probe_with_cv2(url)
|
||||
|
||||
# fallback to ffprobe if needed
|
||||
if not has_video or (get_duration and duration < 0):
|
||||
has_video, width, height, fourcc, duration = await probe_with_ffprobe(url)
|
||||
|
||||
# last resort for RTSP: try TCP transport, since default UDP may be blocked
|
||||
if (not has_video or (get_duration and duration < 0)) and is_rtsp:
|
||||
has_video, width, height, fourcc, duration = await probe_with_ffprobe(
|
||||
url, rtsp_transport="tcp"
|
||||
)
|
||||
|
||||
result: dict[str, Any] = {"has_valid_video": has_video}
|
||||
if has_video:
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* Debug replay status factory.
|
||||
*
|
||||
* The Replay page polls /api/debug_replay/status every 1s via SWR.
|
||||
* The no-session state shows an empty state; the active state
|
||||
* renders the live camera image + debug toggles + objects/messages
|
||||
* tabs. Used by replay.spec.ts.
|
||||
*/
|
||||
|
||||
export type DebugReplayStatus = {
|
||||
active: boolean;
|
||||
replay_camera: string | null;
|
||||
source_camera: string | null;
|
||||
start_time: number | null;
|
||||
end_time: number | null;
|
||||
live_ready: boolean;
|
||||
};
|
||||
|
||||
export function noSessionStatus(): DebugReplayStatus {
|
||||
return {
|
||||
active: false,
|
||||
replay_camera: null,
|
||||
source_camera: null,
|
||||
start_time: null,
|
||||
end_time: null,
|
||||
live_ready: false,
|
||||
};
|
||||
}
|
||||
|
||||
export function activeSessionStatus(
|
||||
opts: {
|
||||
camera?: string;
|
||||
sourceCamera?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
liveReady?: boolean;
|
||||
} = {},
|
||||
): DebugReplayStatus {
|
||||
const {
|
||||
camera = "front_door",
|
||||
sourceCamera = "front_door",
|
||||
startTime = Date.now() / 1000 - 3600,
|
||||
endTime = Date.now() / 1000 - 1800,
|
||||
liveReady = true,
|
||||
} = opts;
|
||||
return {
|
||||
active: true,
|
||||
replay_camera: camera,
|
||||
source_camera: sourceCamera,
|
||||
start_time: startTime,
|
||||
end_time: endTime,
|
||||
live_ready: liveReady,
|
||||
};
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Face library factories.
|
||||
*
|
||||
* The /api/faces endpoint returns a record keyed by collection name
|
||||
* with the list of face image filenames. Grouped training attempts
|
||||
* live under the "train" key with filenames of the form
|
||||
* `${event_id}-${timestamp}-${label}-${score}.webp`.
|
||||
*
|
||||
* Used by face-library.spec.ts and chat.spec.ts (attachment chip).
|
||||
*/
|
||||
|
||||
export type FacesMock = Record<string, string[]>;
|
||||
|
||||
export function basicFacesMock(): FacesMock {
|
||||
return {
|
||||
alice: ["alice-1.webp", "alice-2.webp"],
|
||||
bob: ["bob-1.webp"],
|
||||
charlie: ["charlie-1.webp"],
|
||||
};
|
||||
}
|
||||
|
||||
export function emptyFacesMock(): FacesMock {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a grouped recent-recognition training attempt to an existing
|
||||
* faces mock. The grouping key on the backend is the event id — so
|
||||
* images with the same event-id prefix render as one dialog-able card.
|
||||
*/
|
||||
export function withGroupedTrainingAttempt(
|
||||
base: FacesMock,
|
||||
opts: {
|
||||
eventId: string;
|
||||
attempts: Array<{ timestamp: number; label: string; score: number }>;
|
||||
},
|
||||
): FacesMock {
|
||||
const trainImages = opts.attempts.map(
|
||||
(a) => `${opts.eventId}-${a.timestamp}-${a.label}-${a.score}.webp`,
|
||||
);
|
||||
return {
|
||||
...base,
|
||||
train: [...(base.train ?? []), ...trainImages],
|
||||
};
|
||||
}
|
||||
@@ -82,26 +82,14 @@ export class ApiMocker {
|
||||
route.fulfill({ json: stats }),
|
||||
);
|
||||
|
||||
// Reviews. The real backend exposes /review (singular) for the main
|
||||
// list and /review/summary for the summary — the previous plural glob
|
||||
// (**/api/reviews**) never matched either endpoint, so review-dependent
|
||||
// tests silently ran without data. The POST mutations at /reviews/viewed
|
||||
// and /reviews/delete (plural) still fall through to the generic
|
||||
// mutation catch-all further down the file.
|
||||
await this.page.route(/\/api\/review\/summary/, (route) =>
|
||||
route.fulfill({ json: reviewSummary }),
|
||||
);
|
||||
await this.page.route(/\/api\/review(\?|$)/, (route) =>
|
||||
route.fulfill({ json: reviews }),
|
||||
);
|
||||
|
||||
// Export jobs. The Exports page polls this every 2s while any export
|
||||
// is in_progress; without a mock route it falls through to the preview
|
||||
// server which returns 500 and makes the page flap between loading and
|
||||
// rendered state, breaking tests that navigate to /export.
|
||||
await this.page.route("**/api/jobs/export", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
// Reviews
|
||||
await this.page.route("**/api/reviews**", (route) => {
|
||||
const url = route.request().url();
|
||||
if (url.includes("summary")) {
|
||||
return route.fulfill({ json: reviewSummary });
|
||||
}
|
||||
return route.fulfill({ json: reviews });
|
||||
});
|
||||
|
||||
// Recordings summary
|
||||
await this.page.route("**/api/recordings/summary**", (route) =>
|
||||
@@ -113,12 +101,11 @@ export class ApiMocker {
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
|
||||
// Sub-labels and attributes (for explore filters).
|
||||
// Use trailing ** so query-string variants (e.g. ?split_joined=1) match.
|
||||
await this.page.route("**/api/sub_labels**", (route) =>
|
||||
// Sub-labels and attributes (for explore filters)
|
||||
await this.page.route("**/api/sub_labels", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
await this.page.route("**/api/labels**", (route) =>
|
||||
await this.page.route("**/api/labels", (route) =>
|
||||
route.fulfill({ json: ["person", "car"] }),
|
||||
);
|
||||
await this.page.route("**/api/*/attributes", (route) =>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Clipboard read helper for e2e tests.
|
||||
*
|
||||
* Clipboard API requires a browser permission in headless mode.
|
||||
* grantClipboardPermissions() must be called before any readClipboard()
|
||||
* attempt. Used by logs.spec.ts (Copy button) and config-editor.spec.ts
|
||||
* (Copy button).
|
||||
*/
|
||||
|
||||
import type { BrowserContext, Page } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Grant clipboard-read + clipboard-write permissions on the context.
|
||||
* Call in beforeEach or at the top of a test before the Copy action.
|
||||
*/
|
||||
export async function grantClipboardPermissions(
|
||||
context: BrowserContext,
|
||||
): Promise<void> {
|
||||
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
||||
}
|
||||
|
||||
/** Read the current clipboard contents via the page's navigator.clipboard. */
|
||||
export async function readClipboard(page: Page): Promise<string> {
|
||||
return page.evaluate(async () => await navigator.clipboard.readText());
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* Monaco editor DOM helpers for e2e tests.
|
||||
*
|
||||
* Monaco is imported as a module-local object in the app and is NOT
|
||||
* exposed on window; we drive + read through the rendered DOM and
|
||||
* keyboard instead. Used by config-editor.spec.ts only.
|
||||
*/
|
||||
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Returns the current visible text of the first Monaco editor on the
|
||||
* page. Monaco virtualizes long files — this reads only the rendered
|
||||
* lines. For short configs (our mocks) that's the full content.
|
||||
*/
|
||||
export async function getMonacoVisibleText(page: Page): Promise<string> {
|
||||
return page.locator(".monaco-editor .view-lines").first().innerText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus the editor and replace its full content with `value` via
|
||||
* keyboard. Uses Ctrl+A (Cmd+A on macOS Playwright is equivalent)
|
||||
* + Delete + type. Works cross-platform because Playwright normalizes.
|
||||
*/
|
||||
export async function replaceMonacoValue(
|
||||
page: Page,
|
||||
value: string,
|
||||
): Promise<void> {
|
||||
const editor = page.locator(".monaco-editor").first();
|
||||
await editor.click();
|
||||
await page.keyboard.press("ControlOrMeta+A");
|
||||
await page.keyboard.press("Delete");
|
||||
// Use `type` with zero delay — Monaco handles each key.
|
||||
await page.keyboard.type(value, { delay: 0 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when the editor shows at least one error-severity
|
||||
* marker. Monaco renders error underlines as `.squiggly-error` in
|
||||
* the `.view-overlays` layer.
|
||||
*/
|
||||
export async function hasErrorMarkers(page: Page): Promise<boolean> {
|
||||
const count = await page.locator(".monaco-editor .squiggly-error").count();
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll until an error marker appears. Monaco schedules marker updates
|
||||
* asynchronously after content changes (debounce + schema validation).
|
||||
*/
|
||||
export async function waitForErrorMarker(
|
||||
page: Page,
|
||||
timeoutMs: number = 10_000,
|
||||
): Promise<void> {
|
||||
await expect
|
||||
.poll(() => hasErrorMarkers(page), { timeout: timeoutMs })
|
||||
.toBe(true);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Overlay interaction helpers for Radix-based UI tests.
|
||||
*
|
||||
* These helpers exist to guard the class of bugs fixed by de-duping
|
||||
* `@radix-ui/react-dismissable-layer` across the tree: body pointer-events
|
||||
* getting stuck, dropdown typeahead breaking, tooltips re-popping after a
|
||||
* dropdown closes, and related nested-overlay regressions.
|
||||
*/
|
||||
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* Assert that `<body>` is interactive (no stuck `pointer-events: none`).
|
||||
*
|
||||
* Call after closing any overlay. This is the fast secondary assertion —
|
||||
* test specs should also assert a user-visible behavior like "a button
|
||||
* responded to a click" so the test fails on meaningful breakage rather
|
||||
* than just a CSS invariant.
|
||||
*/
|
||||
export async function expectBodyInteractive(page: Page) {
|
||||
const stuck = await page.evaluate(
|
||||
() => document.body.style.pointerEvents === "none",
|
||||
);
|
||||
expect(stuck, "body.style.pointer-events stuck after overlay close").toBe(
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until the `<body>` is no longer marked with `pointer-events: none`.
|
||||
*
|
||||
* Useful right after closing an overlay when Radix's cleanup runs in the
|
||||
* next frame. Throws if the style does not clear within `timeoutMs`.
|
||||
*/
|
||||
export async function waitForBodyInteractive(page: Page, timeoutMs = 2000) {
|
||||
await page.waitForFunction(
|
||||
() => document.body.style.pointerEvents !== "none",
|
||||
null,
|
||||
{ timeout: timeoutMs },
|
||||
);
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/**
|
||||
* WebSocket frame capture helper.
|
||||
*
|
||||
* The ws-mocker intercepts the /ws route, so Playwright's page-level
|
||||
* `websocket` event never fires. This helper patches client-side
|
||||
* WebSocket.prototype.send before any app code runs and mirrors every
|
||||
* sent frame into a window-level array the test can read back.
|
||||
*
|
||||
* Used by live.spec.ts (feature toggles, PTZ preset commands) and
|
||||
* config-editor.spec.ts (restart command via useRestart).
|
||||
*/
|
||||
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
export type CapturedFrame = string;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__sentWsFrames: CapturedFrame[];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch WebSocket.prototype.send to capture every outbound frame into
|
||||
* window.__sentWsFrames. Must be called BEFORE page.goto().
|
||||
*/
|
||||
export async function installWsFrameCapture(page: Page): Promise<void> {
|
||||
await page.addInitScript(() => {
|
||||
window.__sentWsFrames = [];
|
||||
const origSend = WebSocket.prototype.send;
|
||||
WebSocket.prototype.send = function (data) {
|
||||
try {
|
||||
window.__sentWsFrames.push(
|
||||
typeof data === "string" ? data : "(binary)",
|
||||
);
|
||||
} catch {
|
||||
// ignore — best-effort tracing
|
||||
}
|
||||
return origSend.call(this, data);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** Read all captured frames at call time. */
|
||||
export async function readWsFrames(page: Page): Promise<CapturedFrame[]> {
|
||||
return page.evaluate(() => window.__sentWsFrames ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll until at least one captured frame matches the predicate.
|
||||
* Throws via expect if the frame never arrives within timeout.
|
||||
*/
|
||||
export async function waitForWsFrame(
|
||||
page: Page,
|
||||
matcher: (frame: CapturedFrame) => boolean,
|
||||
opts: { timeout?: number; message?: string } = {},
|
||||
): Promise<void> {
|
||||
const { timeout = 2_000, message } = opts;
|
||||
await expect
|
||||
.poll(async () => (await readWsFrames(page)).some(matcher), {
|
||||
timeout,
|
||||
message,
|
||||
})
|
||||
.toBe(true);
|
||||
}
|
||||
@@ -79,20 +79,7 @@ export class WsMocker {
|
||||
this.send("model_state", JSON.stringify({}));
|
||||
}
|
||||
if (data.topic === "embeddingsReindexProgress") {
|
||||
// Send a completed reindex state so Explore renders when
|
||||
// semantic_search.enabled is true. A null payload leaves the page
|
||||
// in a permanent loading spinner because !reindexState is truthy.
|
||||
this.send(
|
||||
"embeddings_reindex_progress",
|
||||
JSON.stringify({
|
||||
status: "completed",
|
||||
processed_objects: 0,
|
||||
total_objects: 0,
|
||||
thumbnails: 0,
|
||||
descriptions: 0,
|
||||
time_remaining: null,
|
||||
}),
|
||||
);
|
||||
this.send("embeddings_reindex_progress", JSON.stringify(null));
|
||||
}
|
||||
if (data.topic === "birdseyeLayout") {
|
||||
this.send("birdseye_layout", JSON.stringify(null));
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Live dashboard + single-camera page object.
|
||||
*
|
||||
* Encapsulates selectors and viewport-conditional openers for the
|
||||
* Live route. Does NOT own assertions — specs call expect on the
|
||||
* locators returned from these getters.
|
||||
*/
|
||||
|
||||
import type { Locator, Page } from "@playwright/test";
|
||||
import { BasePage } from "./base.page";
|
||||
|
||||
export class LivePage extends BasePage {
|
||||
constructor(page: Page, isDesktop: boolean) {
|
||||
super(page, isDesktop);
|
||||
}
|
||||
|
||||
/** The camera card wrapper on the dashboard, keyed by camera name. */
|
||||
cameraCard(name: string): Locator {
|
||||
return this.page.locator(`[data-camera='${name}']`);
|
||||
}
|
||||
|
||||
/** Back button on the single-camera view header (desktop text). */
|
||||
get backButton(): Locator {
|
||||
return this.page.getByText("Back", { exact: true });
|
||||
}
|
||||
|
||||
/** History button on the single-camera view header (desktop text). */
|
||||
get historyButton(): Locator {
|
||||
return this.page.getByText("History", { exact: true });
|
||||
}
|
||||
|
||||
/** All CameraFeatureToggle elements (active + inactive). */
|
||||
get featureToggles(): Locator {
|
||||
// Use div selector to exclude NavItem anchor elements that share the same classes.
|
||||
return this.page.locator(
|
||||
"div.flex.flex-col.items-center.justify-center.bg-selected, div.flex.flex-col.items-center.justify-center.bg-secondary",
|
||||
);
|
||||
}
|
||||
|
||||
/** Only the active (bg-selected) feature toggles. */
|
||||
get activeFeatureToggles(): Locator {
|
||||
// Use div selector to exclude NavItem anchor elements that share the same classes.
|
||||
return this.page.locator(
|
||||
"div.flex.flex-col.items-center.justify-center.bg-selected",
|
||||
);
|
||||
}
|
||||
|
||||
/** Open the right-click context menu on a camera card (desktop only). */
|
||||
async openContextMenuOn(cameraName: string): Promise<Locator> {
|
||||
await this.cameraCard(cameraName).first().click({ button: "right" });
|
||||
return this.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Review/events page object.
|
||||
*
|
||||
* Encapsulates severity tab, filter bar, calendar, and mobile filter
|
||||
* drawer selectors. Does NOT own assertions.
|
||||
*/
|
||||
|
||||
import type { Locator, Page } from "@playwright/test";
|
||||
import { BasePage } from "./base.page";
|
||||
|
||||
export class ReviewPage extends BasePage {
|
||||
constructor(page: Page, isDesktop: boolean) {
|
||||
super(page, isDesktop);
|
||||
}
|
||||
|
||||
get alertsTab(): Locator {
|
||||
return this.page.getByLabel("Alerts");
|
||||
}
|
||||
|
||||
get detectionsTab(): Locator {
|
||||
return this.page.getByLabel("Detections");
|
||||
}
|
||||
|
||||
get motionTab(): Locator {
|
||||
return this.page.getByRole("radio", { name: "Motion" });
|
||||
}
|
||||
|
||||
get camerasFilterTrigger(): Locator {
|
||||
return this.page.getByRole("button", { name: /cameras/i }).first();
|
||||
}
|
||||
|
||||
get calendarTrigger(): Locator {
|
||||
return this.page.getByRole("button", { name: /24 hours|calendar|date/i });
|
||||
}
|
||||
|
||||
get showReviewedToggle(): Locator {
|
||||
return this.page.getByRole("button", { name: /reviewed/i });
|
||||
}
|
||||
|
||||
get reviewItems(): Locator {
|
||||
return this.page.locator(".review-item");
|
||||
}
|
||||
|
||||
/** The filter popover content (desktop) or drawer (mobile). */
|
||||
get filterOverlay(): Locator {
|
||||
return this.page
|
||||
.locator(
|
||||
'[data-radix-popper-content-wrapper], [role="dialog"], [data-vaul-drawer]',
|
||||
)
|
||||
.first();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
*
|
||||
* @mobile rule: every .spec.ts under specs/ (not specs/_meta/) must
|
||||
* contain at least one test title or describe with the substring "@mobile".
|
||||
*
|
||||
* Specs in PENDING_REWRITE are exempt from all rules until they are
|
||||
* rewritten with proper assertions and mobile coverage. Remove each
|
||||
* entry when its spec is updated.
|
||||
*/
|
||||
|
||||
import { readFileSync, readdirSync, statSync } from "node:fs";
|
||||
@@ -24,6 +28,24 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const SPECS_DIR = resolve(__dirname, "..", "specs");
|
||||
const META_PREFIX = resolve(SPECS_DIR, "_meta");
|
||||
|
||||
// Specs exempt from lint rules until they are rewritten with proper
|
||||
// assertions and mobile coverage. Remove each entry when its spec is updated.
|
||||
const PENDING_REWRITE = new Set([
|
||||
"auth.spec.ts",
|
||||
"chat.spec.ts",
|
||||
"classification.spec.ts",
|
||||
"config-editor.spec.ts",
|
||||
"explore.spec.ts",
|
||||
"export.spec.ts",
|
||||
"face-library.spec.ts",
|
||||
"live.spec.ts",
|
||||
"logs.spec.ts",
|
||||
"navigation.spec.ts",
|
||||
"replay.spec.ts",
|
||||
"review.spec.ts",
|
||||
"system.spec.ts",
|
||||
]);
|
||||
|
||||
const BANNED_PATTERNS = [
|
||||
{
|
||||
name: "page.waitForTimeout",
|
||||
@@ -40,12 +62,14 @@ const BANNED_PATTERNS = [
|
||||
{
|
||||
name: "conditional count() assertion",
|
||||
regex: /\bif\s*\(\s*\(?\s*await\s+[^)]*\.count\s*\(\s*\)\s*\)?\s*[><=!]/,
|
||||
advice: "Assertions must be unconditional. Use expect(...).toHaveCount(n).",
|
||||
advice:
|
||||
"Assertions must be unconditional. Use expect(...).toHaveCount(n).",
|
||||
},
|
||||
{
|
||||
name: "vacuous textContent length assertion",
|
||||
regex: /expect\([^)]*\.length\)\.toBeGreaterThan\(0\)/,
|
||||
advice: "Assert specific content, not that some text exists.",
|
||||
advice:
|
||||
"Assert specific content, not that some text exists.",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -65,6 +89,8 @@ function walk(dir) {
|
||||
}
|
||||
|
||||
function lintFile(file) {
|
||||
const basename = file.split("/").pop();
|
||||
if (PENDING_REWRITE.has(basename)) return [];
|
||||
if (file.includes("/specs/settings/")) return [];
|
||||
|
||||
const errors = [];
|
||||
|
||||
+101
-64
@@ -1,110 +1,147 @@
|
||||
/**
|
||||
* Auth and role tests -- HIGH tier.
|
||||
* Auth and cross-cutting tests -- HIGH tier.
|
||||
*
|
||||
* Admin access to /system, /config, /logs; viewer access denied
|
||||
* markers (via i18n heading, not a data-testid we don't own);
|
||||
* viewer nav restrictions; all-routes smoke.
|
||||
* Tests protected route access for admin/viewer roles,
|
||||
* access denied page rendering, viewer nav restrictions,
|
||||
* and all routes smoke test.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { viewerProfile } from "../fixtures/mock-data/profile";
|
||||
|
||||
test.describe("Auth — admin access @high", () => {
|
||||
test("admin /system renders general tab", async ({ frigateApp }) => {
|
||||
test.describe("Auth - Admin Access @high", () => {
|
||||
test("admin can access /system and sees system tabs", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/system");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
await frigateApp.page.waitForTimeout(3000);
|
||||
// System page should have named tab buttons
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toBeVisible({
|
||||
timeout: 15_000,
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("admin /config renders Monaco editor", async ({ frigateApp }) => {
|
||||
test("admin can access /config and Monaco editor loads", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/config");
|
||||
await expect(
|
||||
frigateApp.page
|
||||
.locator(".monaco-editor, [data-keybinding-context]")
|
||||
.first(),
|
||||
).toBeVisible({ timeout: 15_000 });
|
||||
await frigateApp.page.waitForTimeout(5000);
|
||||
const editor = frigateApp.page.locator(
|
||||
".monaco-editor, [data-keybinding-context]",
|
||||
);
|
||||
await expect(editor.first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("admin /logs renders frigate tab", async ({ frigateApp }) => {
|
||||
test("admin can access /logs and sees service tabs", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/logs");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
await expect(frigateApp.page.getByLabel("Select frigate")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("admin sees Classification nav on desktop", async ({ frigateApp }) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/classification"]'),
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Auth — viewer restrictions @high", () => {
|
||||
for (const path of ["/system", "/config", "/logs"]) {
|
||||
test(`viewer on ${path} sees AccessDenied`, async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await frigateApp.page.goto(path);
|
||||
await frigateApp.page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
level: 2,
|
||||
name: /access denied/i,
|
||||
}),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
}
|
||||
|
||||
test("viewer sees cameras on /", async ({ frigateApp }) => {
|
||||
test.describe("Auth - Viewer Restrictions @high", () => {
|
||||
test("viewer sees Access Denied on /system", async ({ frigateApp, page }) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await frigateApp.page.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator("[data-camera='front_door']"),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
await page.goto("/system");
|
||||
await page.waitForTimeout(2000);
|
||||
// Should show "Access Denied" text
|
||||
await expect(page.getByText("Access Denied")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("viewer sees severity tabs on /review", async ({ frigateApp }) => {
|
||||
test("viewer sees Access Denied on /config", async ({ frigateApp, page }) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await frigateApp.page.goto("/review");
|
||||
await expect(frigateApp.page.getByLabel("Alerts")).toBeVisible({
|
||||
await page.goto("/config");
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.getByText("Access Denied")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("viewer sees Access Denied on /logs", async ({ frigateApp, page }) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await page.goto("/logs");
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.getByText("Access Denied")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("viewer can access Live page and sees cameras", async ({
|
||||
frigateApp,
|
||||
page,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await page.goto("/");
|
||||
await page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
await expect(page.locator("[data-camera='front_door']")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("viewer can access all non-admin routes without AccessDenied", async ({
|
||||
test("viewer can access Review page and sees severity tabs", async ({
|
||||
frigateApp,
|
||||
page,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await page.goto("/review");
|
||||
await page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
await expect(page.getByLabel("Alerts")).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test("viewer can access all main user routes without crash", async ({
|
||||
frigateApp,
|
||||
page,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
const routes = ["/", "/review", "/explore", "/export", "/settings"];
|
||||
for (const route of routes) {
|
||||
await frigateApp.page.goto(route);
|
||||
await frigateApp.page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
level: 2,
|
||||
name: /access denied/i,
|
||||
}),
|
||||
).toHaveCount(0);
|
||||
await page.goto(route);
|
||||
await page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Auth — viewer nav restrictions (desktop) @high", () => {
|
||||
test.skip(({ frigateApp }) => frigateApp.isMobile, "Sidebar only on desktop");
|
||||
|
||||
test("viewer sidebar hides admin routes", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await frigateApp.page.goto("/");
|
||||
await frigateApp.page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
for (const href of ["/system", "/config", "/logs"]) {
|
||||
await expect(
|
||||
frigateApp.page.locator(`aside a[href='${href}']`),
|
||||
).toHaveCount(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Auth — all routes smoke @high @mobile", () => {
|
||||
test("every common route renders #pageRoot", async ({ frigateApp }) => {
|
||||
for (const route of ["/", "/review", "/explore", "/export", "/settings"]) {
|
||||
test.describe("Auth - All Routes Smoke @high", () => {
|
||||
test("all user routes render without crash", async ({ frigateApp }) => {
|
||||
const routes = ["/", "/review", "/explore", "/export", "/settings"];
|
||||
for (const route of routes) {
|
||||
await frigateApp.goto(route);
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("admin routes render with specific content", async ({ frigateApp }) => {
|
||||
// System page should have tab controls
|
||||
await frigateApp.goto("/system");
|
||||
await frigateApp.page.waitForTimeout(3000);
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
|
||||
// Logs page should have service tabs
|
||||
await frigateApp.goto("/logs");
|
||||
await expect(frigateApp.page.getByLabel("Select frigate")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+19
-296
@@ -1,311 +1,34 @@
|
||||
/**
|
||||
* Chat page tests -- MEDIUM tier.
|
||||
*
|
||||
* Starting state, NDJSON streaming contract (not SSE), assistant
|
||||
* bubble grows as chunks arrive, error path, and mobile viewport.
|
||||
* Tests chat interface rendering, input area, and example prompt buttons.
|
||||
*/
|
||||
|
||||
import { test, expect, type FrigateApp } from "../fixtures/frigate-test";
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
|
||||
/**
|
||||
* Install a window.fetch override on the page so that POSTs to
|
||||
* chat/completion resolve with a real ReadableStream that emits the
|
||||
* given chunks over time. This is the only way to validate
|
||||
* chunk-by-chunk rendering through Playwright — page.route() does not
|
||||
* support streaming responses.
|
||||
*
|
||||
* Must be called BEFORE frigateApp.goto(). The override also exposes
|
||||
* `__chatRequests` on window so tests can assert the outgoing body.
|
||||
*/
|
||||
async function installChatStreamOverride(
|
||||
app: FrigateApp,
|
||||
chunks: Array<Record<string, unknown>>,
|
||||
opts: { chunkDelayMs?: number; status?: number } = {},
|
||||
) {
|
||||
const { chunkDelayMs = 40, status = 200 } = opts;
|
||||
await app.page.addInitScript(
|
||||
({ chunks, chunkDelayMs, status }) => {
|
||||
(window as unknown as { __chatRequests: unknown[] }).__chatRequests = [];
|
||||
const origFetch = window.fetch;
|
||||
window.fetch = async (input, init) => {
|
||||
const url =
|
||||
typeof input === "string"
|
||||
? input
|
||||
: input instanceof URL
|
||||
? input.toString()
|
||||
: (input as Request).url;
|
||||
if (url.includes("chat/completion")) {
|
||||
const body =
|
||||
init?.body instanceof String || typeof init?.body === "string"
|
||||
? JSON.parse(init!.body as string)
|
||||
: null;
|
||||
(
|
||||
window as unknown as { __chatRequests: unknown[] }
|
||||
).__chatRequests.push({ url, body });
|
||||
if (status !== 200) {
|
||||
return new Response(JSON.stringify({ error: "boom" }), {
|
||||
status,
|
||||
});
|
||||
}
|
||||
const encoder = new TextEncoder();
|
||||
const stream = new ReadableStream({
|
||||
async start(controller) {
|
||||
for (const chunk of chunks) {
|
||||
await new Promise((r) => setTimeout(r, chunkDelayMs));
|
||||
controller.enqueue(
|
||||
encoder.encode(JSON.stringify(chunk) + "\n"),
|
||||
);
|
||||
}
|
||||
controller.close();
|
||||
},
|
||||
});
|
||||
return new Response(stream, { status: 200 });
|
||||
}
|
||||
return origFetch.call(window, input as RequestInfo, init);
|
||||
};
|
||||
},
|
||||
{ chunks, chunkDelayMs, status },
|
||||
);
|
||||
}
|
||||
|
||||
test.describe("Chat — starting state @medium", () => {
|
||||
test("empty message list renders ChatStartingState with title and input", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.describe("Chat Page @medium", () => {
|
||||
test("chat page renders without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/chat");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 1 }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
await expect(frigateApp.page.getByPlaceholder(/ask/i)).toBeVisible();
|
||||
// Four quick-reply buttons from starting_requests.*
|
||||
const quickReplies = frigateApp.page.locator(
|
||||
"button:has-text('Show recent events'), button:has-text('Show camera status'), button:has-text('What happened'), button:has-text('Watch')",
|
||||
);
|
||||
await expect(quickReplies.first()).toBeVisible({ timeout: 5_000 });
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Chat — streaming @medium", () => {
|
||||
test("submission POSTs to chat/completion with stream: true", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installChatStreamOverride(frigateApp, [
|
||||
{ type: "content", delta: "Hel" },
|
||||
{ type: "content", delta: "lo" },
|
||||
]);
|
||||
test("chat page has interactive input or buttons", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/chat");
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.fill("hello chat");
|
||||
await input.press("Enter");
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
frigateApp.page.evaluate(
|
||||
() =>
|
||||
(window as unknown as { __chatRequests: unknown[] })
|
||||
.__chatRequests?.length ?? 0,
|
||||
),
|
||||
{ timeout: 5_000 },
|
||||
)
|
||||
.toBeGreaterThan(0);
|
||||
|
||||
const request = await frigateApp.page.evaluate(
|
||||
() =>
|
||||
(
|
||||
window as unknown as {
|
||||
__chatRequests: Array<{
|
||||
url: string;
|
||||
body: { stream: boolean; messages: Array<{ content: string }> };
|
||||
}>;
|
||||
}
|
||||
).__chatRequests[0],
|
||||
);
|
||||
expect(request.body.stream).toBe(true);
|
||||
expect(
|
||||
request.body.messages[request.body.messages.length - 1].content,
|
||||
).toBe("hello chat");
|
||||
});
|
||||
|
||||
test("NDJSON content chunks accumulate in the assistant bubble", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installChatStreamOverride(
|
||||
frigateApp,
|
||||
[
|
||||
{ type: "content", delta: "Hel" },
|
||||
{ type: "content", delta: "lo, " },
|
||||
{ type: "content", delta: "world!" },
|
||||
],
|
||||
{ chunkDelayMs: 50 },
|
||||
);
|
||||
await frigateApp.goto("/chat");
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.fill("greet me");
|
||||
await input.press("Enter");
|
||||
|
||||
await expect(frigateApp.page.getByText(/Hello, world!/i)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("tool_calls chunks render a ToolCallsGroup", async ({ frigateApp }) => {
|
||||
await installChatStreamOverride(frigateApp, [
|
||||
{
|
||||
type: "tool_calls",
|
||||
tool_calls: [
|
||||
{
|
||||
id: "call_1",
|
||||
name: "search_objects",
|
||||
arguments: { label: "person" },
|
||||
},
|
||||
],
|
||||
},
|
||||
{ type: "content", delta: "Searching for people." },
|
||||
]);
|
||||
await frigateApp.goto("/chat");
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.fill("find people");
|
||||
await input.press("Enter");
|
||||
|
||||
// ToolCallsGroup normalizes "search_objects" → "Search Objects" via
|
||||
// normalizeName(). Match the rendered display label instead.
|
||||
await expect(frigateApp.page.getByText(/search objects/i)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(
|
||||
frigateApp.page.getByText(/searching for people/i),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const interactive = frigateApp.page.locator("input, textarea, button");
|
||||
const count = await interactive.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Chat — stop @medium", () => {
|
||||
test("Stop button aborts an in-flight stream and freezes the partial message", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// A long chunk sequence with big delays gives us time to hit Stop.
|
||||
await installChatStreamOverride(
|
||||
frigateApp,
|
||||
[
|
||||
{ type: "content", delta: "First chunk. " },
|
||||
{ type: "content", delta: "Second chunk. " },
|
||||
{ type: "content", delta: "Third chunk. " },
|
||||
],
|
||||
{ chunkDelayMs: 300 },
|
||||
);
|
||||
await frigateApp.goto("/chat");
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.fill("slow response please");
|
||||
await input.press("Enter");
|
||||
|
||||
// Wait for the first chunk to render
|
||||
await expect(frigateApp.page.getByText(/First chunk\./)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
|
||||
// The Stop button is a destructive rounded button shown while isLoading.
|
||||
// It contains only an FaStop SVG icon (no visible text). Find it by the
|
||||
// destructive variant class or fall back to aria-label.
|
||||
const stopBtn = frigateApp.page
|
||||
.locator("button.bg-destructive, button[class*='destructive']")
|
||||
.first();
|
||||
await stopBtn.click({ timeout: 3_000 }).catch(async () => {
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /stop|cancel/i })
|
||||
.first()
|
||||
.click();
|
||||
});
|
||||
|
||||
// Third chunk should never appear.
|
||||
await expect(frigateApp.page.getByText(/Third chunk\./)).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Chat — error @medium", () => {
|
||||
test("non-OK response renders an error banner", async ({ frigateApp }) => {
|
||||
await installChatStreamOverride(frigateApp, [], { status: 500 });
|
||||
await frigateApp.goto("/chat");
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.fill("trigger error");
|
||||
await input.press("Enter");
|
||||
// The error banner is a role="alert" paragraph; target by role so we
|
||||
// don't collide with the user-message bubble that contains "trigger
|
||||
// error" (which would match /error/ in strict mode).
|
||||
await expect(
|
||||
frigateApp.page.getByRole("alert").filter({
|
||||
hasText: /boom|something went wrong/i,
|
||||
}),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Chat — attachment chip @medium", () => {
|
||||
test("attaching an event renders a ChatAttachmentChip", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// The chat starts with an empty message list (ChatStartingState).
|
||||
// After sending a message, ChatEntry with the paperclip button appears.
|
||||
// We use the stream override so the first message completes quickly.
|
||||
await installChatStreamOverride(frigateApp, [
|
||||
{ type: "content", delta: "Done." },
|
||||
]);
|
||||
await frigateApp.goto("/chat");
|
||||
|
||||
// Send a first message to transition out of ChatStartingState so the
|
||||
// full ChatEntry (with the paperclip) is visible.
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.fill("hello");
|
||||
await input.press("Enter");
|
||||
// Wait for the assistant response to complete so isLoading becomes false
|
||||
// and the paperclip button is re-enabled.
|
||||
await expect(frigateApp.page.getByText(/Done\./i)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
|
||||
// The paperclip button has aria-label from t("attachment_picker_placeholder")
|
||||
// = "Attach an event".
|
||||
const paperclip = frigateApp.page
|
||||
.getByRole("button", { name: /attach an event/i })
|
||||
.first();
|
||||
await expect(paperclip).toBeVisible({ timeout: 5_000 });
|
||||
await paperclip.click();
|
||||
|
||||
// The popover shows a paste input with placeholder "Or paste event ID".
|
||||
const idInput = frigateApp.page
|
||||
.locator('input[placeholder*="event" i], input[aria-label*="attach" i]')
|
||||
.first();
|
||||
await expect(idInput).toBeVisible({ timeout: 3_000 });
|
||||
await idInput.fill("test-event-1");
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /^attach$/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
// The ChatAttachmentChip renders in the composer area. It shows an
|
||||
// activity indicator while loading event data (event_ids API not mocked),
|
||||
// so assert on the chip container being present in the composer.
|
||||
await expect(
|
||||
frigateApp.page.locator(
|
||||
"[class*='inline-flex'][class*='rounded-lg'][class*='border']",
|
||||
),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Chat — mobile @medium @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("chat input is focusable at mobile viewport", async ({ frigateApp }) => {
|
||||
test("chat input accepts text", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/chat");
|
||||
const input = frigateApp.page.getByPlaceholder(/ask/i);
|
||||
await expect(input).toBeVisible({ timeout: 10_000 });
|
||||
await input.focus();
|
||||
await expect(input).toBeFocused();
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const input = frigateApp.page.locator("input, textarea").first();
|
||||
if (await input.isVisible().catch(() => false)) {
|
||||
await input.fill("What cameras detected a person today?");
|
||||
const value = await input.inputValue();
|
||||
expect(value.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,228 +1,33 @@
|
||||
/**
|
||||
* Classification page tests -- MEDIUM tier.
|
||||
*
|
||||
* Model list driven by config.classification.custom + per-model
|
||||
* dataset fetches. Admin-only access.
|
||||
* Tests model selection view rendering and interactive elements.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { viewerProfile } from "../fixtures/mock-data/profile";
|
||||
|
||||
const CUSTOM_MODELS = {
|
||||
object_classifier: {
|
||||
name: "object_classifier",
|
||||
object_config: { objects: ["person"], classification_type: "sub_label" },
|
||||
},
|
||||
state_classifier: {
|
||||
name: "state_classifier",
|
||||
state_config: { cameras: { front_door: { crop: [0, 0, 1, 1] } } },
|
||||
},
|
||||
};
|
||||
|
||||
async function installDatasetRoute(
|
||||
app: { page: import("@playwright/test").Page },
|
||||
name: string,
|
||||
body: Record<string, unknown> = { categories: {} },
|
||||
) {
|
||||
await app.page.route(
|
||||
new RegExp(`/api/classification/${name}/dataset`),
|
||||
(route) => route.fulfill({ json: body }),
|
||||
);
|
||||
}
|
||||
|
||||
async function installTrainRoute(
|
||||
app: { page: import("@playwright/test").Page },
|
||||
name: string,
|
||||
) {
|
||||
await app.page.route(
|
||||
new RegExp(`/api/classification/${name}/train`),
|
||||
(route) => route.fulfill({ json: [] }),
|
||||
);
|
||||
}
|
||||
|
||||
test.describe("Classification — model list @medium", () => {
|
||||
test("custom models render by name", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({
|
||||
config: { classification: { custom: CUSTOM_MODELS } },
|
||||
});
|
||||
await installDatasetRoute(frigateApp, "object_classifier");
|
||||
await installDatasetRoute(frigateApp, "state_classifier");
|
||||
test.describe("Classification @medium", () => {
|
||||
test("classification page renders without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/classification");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
await expect(frigateApp.page.getByText("object_classifier")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("empty custom map renders without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({
|
||||
config: { classification: { custom: {} } },
|
||||
});
|
||||
await frigateApp.goto("/classification");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("toggling to states view switches the rendered card set", async ({
|
||||
test("classification page shows content and controls", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({
|
||||
config: { classification: { custom: CUSTOM_MODELS } },
|
||||
});
|
||||
await installDatasetRoute(frigateApp, "object_classifier");
|
||||
await installDatasetRoute(frigateApp, "state_classifier");
|
||||
await frigateApp.goto("/classification");
|
||||
// Objects is default — object_classifier visible, state_classifier hidden.
|
||||
await expect(frigateApp.page.getByText("object_classifier")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(frigateApp.page.getByText("state_classifier")).toHaveCount(0);
|
||||
|
||||
// Click the "states" toggle. Radix ToggleGroup type="single" uses role="radio".
|
||||
const statesToggle = frigateApp.page
|
||||
.getByRole("radio", { name: /state/i })
|
||||
.first();
|
||||
await expect(statesToggle).toBeVisible({ timeout: 5_000 });
|
||||
await statesToggle.click();
|
||||
|
||||
await expect(frigateApp.page.getByText("state_classifier")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
await expect(frigateApp.page.getByText("object_classifier")).toHaveCount(0);
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const text = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(text?.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Classification — model detail navigation @medium", () => {
|
||||
test("clicking a model card opens ModelTrainingView", async ({
|
||||
test("classification page has interactive elements", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({
|
||||
config: { classification: { custom: CUSTOM_MODELS } },
|
||||
});
|
||||
await installDatasetRoute(frigateApp, "object_classifier");
|
||||
await installDatasetRoute(frigateApp, "state_classifier");
|
||||
await installTrainRoute(frigateApp, "object_classifier");
|
||||
await frigateApp.goto("/classification");
|
||||
|
||||
const objectCard = frigateApp.page.getByText("object_classifier").first();
|
||||
await expect(objectCard).toBeVisible({ timeout: 10_000 });
|
||||
await objectCard.click();
|
||||
|
||||
// ModelTrainingView renders a Back button (aria-label "Back").
|
||||
// useOverlayState stores the selected model in window.history.state
|
||||
// (not the URL), so we verify the state transition via the DOM.
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: /back/i }),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// The model grid is no longer shown; state_classifier card is gone.
|
||||
await expect(frigateApp.page.getByText("state_classifier")).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Classification — delete model (desktop) @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Delete action menu is desktop-focused",
|
||||
);
|
||||
|
||||
test("deleting a model fires DELETE + PUT /config/set", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
let deleteCalled = false;
|
||||
let configSetCalled = false;
|
||||
|
||||
// installDefaults must run first because Playwright matches routes in
|
||||
// LIFO order — routes registered after installDefaults take precedence
|
||||
// over the generic catch-all registered inside it.
|
||||
await frigateApp.installDefaults({
|
||||
config: { classification: { custom: CUSTOM_MODELS } },
|
||||
});
|
||||
await installDatasetRoute(frigateApp, "object_classifier");
|
||||
await installDatasetRoute(frigateApp, "state_classifier");
|
||||
|
||||
// Register spy routes after installDefaults so they win over the catch-all.
|
||||
await frigateApp.page.route(
|
||||
/\/api\/classification\/object_classifier$/,
|
||||
async (route) => {
|
||||
if (route.request().method() === "DELETE") {
|
||||
deleteCalled = true;
|
||||
await route.fulfill({ json: { success: true } });
|
||||
return;
|
||||
}
|
||||
return route.fallback();
|
||||
},
|
||||
);
|
||||
await frigateApp.page.route("**/api/config/set", async (route) => {
|
||||
if (route.request().method() === "PUT") configSetCalled = true;
|
||||
await route.fulfill({ json: { success: true, require_restart: false } });
|
||||
});
|
||||
await frigateApp.goto("/classification");
|
||||
await expect(frigateApp.page.getByText("object_classifier")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
|
||||
// The card-level actions menu (FiMoreVertical three-dot icon) is a
|
||||
// DropdownMenuTrigger with asChild on a BlurredIconButton div.
|
||||
// Radix forwards aria-haspopup="menu" to the child element.
|
||||
// Scope the selector to the model card grid to avoid hitting the
|
||||
// settings sidebar trigger.
|
||||
const cardGrid = frigateApp.page.locator(".grid.auto-rows-max");
|
||||
await expect(cardGrid).toBeVisible({ timeout: 5_000 });
|
||||
const trigger = cardGrid.locator('[aria-haspopup="menu"]').first();
|
||||
await expect(trigger).toBeVisible({ timeout: 5_000 });
|
||||
await trigger.click();
|
||||
const deleteItem = frigateApp.page
|
||||
.getByRole("menuitem", { name: /delete/i })
|
||||
.first();
|
||||
await expect(deleteItem).toBeVisible({ timeout: 5_000 });
|
||||
await deleteItem.click();
|
||||
|
||||
// Confirm the AlertDialog.
|
||||
const alert = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(alert).toBeVisible({ timeout: 5_000 });
|
||||
await alert
|
||||
.getByRole("button", { name: /delete|confirm/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect.poll(() => deleteCalled, { timeout: 5_000 }).toBe(true);
|
||||
await expect.poll(() => configSetCalled, { timeout: 5_000 }).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Classification — admin only @medium", () => {
|
||||
test("viewer navigating to /classification is redirected to access-denied", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ profile: viewerProfile() });
|
||||
await frigateApp.page.goto("/classification");
|
||||
await frigateApp.page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
await expect(frigateApp.page).toHaveURL(/\/unauthorized/, {
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
level: 2,
|
||||
name: /access denied/i,
|
||||
}),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Classification — mobile @medium @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("page renders at mobile viewport", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({
|
||||
config: { classification: { custom: CUSTOM_MODELS } },
|
||||
});
|
||||
await installDatasetRoute(frigateApp, "object_classifier");
|
||||
await installDatasetRoute(frigateApp, "state_classifier");
|
||||
await frigateApp.goto("/classification");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const buttons = frigateApp.page.locator("#pageRoot button");
|
||||
const count = await buttons.count();
|
||||
expect(count).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,276 +1,44 @@
|
||||
/**
|
||||
* Config Editor tests -- MEDIUM tier.
|
||||
* Config Editor page tests -- MEDIUM tier.
|
||||
*
|
||||
* Monaco load + value, Save (config/save?save_option=saveonly),
|
||||
* Save error path, Save and Restart (WS frame via useRestart),
|
||||
* Copy (clipboard), schema markers.
|
||||
* Tests Monaco editor loading, YAML content rendering,
|
||||
* save button presence, and copy button interaction.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { installWsFrameCapture, waitForWsFrame } from "../helpers/ws-frames";
|
||||
import { grantClipboardPermissions, readClipboard } from "../helpers/clipboard";
|
||||
import {
|
||||
getMonacoVisibleText,
|
||||
replaceMonacoValue,
|
||||
waitForErrorMarker,
|
||||
} from "../helpers/monaco";
|
||||
|
||||
const SAMPLE_CONFIG =
|
||||
"mqtt:\n host: mqtt\ncameras:\n front_door:\n enabled: true\n";
|
||||
|
||||
async function installSaveRoute(
|
||||
app: { page: import("@playwright/test").Page },
|
||||
status: number,
|
||||
body: Record<string, unknown>,
|
||||
): Promise<{
|
||||
capturedUrl: () => string | null;
|
||||
capturedBody: () => string | null;
|
||||
}> {
|
||||
let lastUrl: string | null = null;
|
||||
let lastBody: string | null = null;
|
||||
await app.page.route("**/api/config/save**", async (route) => {
|
||||
lastUrl = route.request().url();
|
||||
lastBody = route.request().postData();
|
||||
await route.fulfill({ status, json: body });
|
||||
});
|
||||
return {
|
||||
capturedUrl: () => lastUrl,
|
||||
capturedBody: () => lastBody,
|
||||
};
|
||||
}
|
||||
|
||||
test.describe("Config Editor — Monaco @medium", () => {
|
||||
test("editor loads with mocked configRaw content", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
// Assert via DOM-rendered visible text (Monaco virtualizes — works
|
||||
// for short configs which covers our mocked content).
|
||||
await expect
|
||||
.poll(() => getMonacoVisibleText(frigateApp.page), { timeout: 10_000 })
|
||||
.toContain("front_door");
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — Save @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Save button copy is desktop-visible (hidden md:block)",
|
||||
);
|
||||
|
||||
test("clicking Save Only POSTs config/save?save_option=saveonly", async ({
|
||||
test.describe("Config Editor @medium", () => {
|
||||
test("config editor loads Monaco editor with content", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
const capture = await installSaveRoute(frigateApp, 200, {
|
||||
message: "Config saved",
|
||||
});
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
await frigateApp.page.waitForTimeout(5000);
|
||||
// Monaco editor should render with a specific class
|
||||
const editor = frigateApp.page.locator(
|
||||
".monaco-editor, [data-keybinding-context]",
|
||||
);
|
||||
await frigateApp.page.getByLabel("Save Only").click();
|
||||
await expect
|
||||
.poll(() => capture.capturedUrl(), { timeout: 5_000 })
|
||||
.toMatch(/config\/save\?save_option=saveonly/);
|
||||
// Body is the raw YAML as text/plain
|
||||
await expect
|
||||
.poll(() => capture.capturedBody(), { timeout: 5_000 })
|
||||
.toContain("front_door");
|
||||
await expect(editor.first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("Save error shows the server message in the error area", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
await installSaveRoute(frigateApp, 400, {
|
||||
message: "Invalid field `cameras.front_door`",
|
||||
});
|
||||
test("config editor has action buttons", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await frigateApp.page.getByLabel("Save Only").click();
|
||||
await expect(frigateApp.page.getByText(/Invalid field/i)).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
await frigateApp.page.waitForTimeout(5000);
|
||||
const buttons = frigateApp.page.locator("button");
|
||||
const count = await buttons.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — Save and Restart @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Save and Restart button copy is desktop-visible",
|
||||
);
|
||||
|
||||
test("Save and Restart opens dialog; confirm sends WS restart frame", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
await installSaveRoute(frigateApp, 200, { message: "Saved" });
|
||||
await installWsFrameCapture(frigateApp.page);
|
||||
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await frigateApp.page.getByLabel("Save & Restart").click();
|
||||
const dialog = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
await dialog.getByRole("button", { name: /restart/i }).click();
|
||||
await waitForWsFrame(
|
||||
frigateApp.page,
|
||||
(frame) => frame.includes('"restart"') || frame.includes("restart"),
|
||||
{ message: "useRestart should send a WS frame on the restart topic" },
|
||||
);
|
||||
});
|
||||
|
||||
test("cancelling the restart dialog leaves body interactive", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
await installSaveRoute(frigateApp, 200, { message: "Saved" });
|
||||
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await frigateApp.page.getByLabel("Save & Restart").click();
|
||||
const dialog = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
await dialog.getByRole("button", { name: /cancel/i }).click();
|
||||
await expect(dialog).not.toBeVisible({ timeout: 3_000 });
|
||||
await expect(
|
||||
frigateApp.page.locator(".monaco-editor").first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — Copy @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Copy button copy is desktop-visible",
|
||||
);
|
||||
|
||||
test("Copy places the editor value in the clipboard", async ({
|
||||
frigateApp,
|
||||
context,
|
||||
}) => {
|
||||
await grantClipboardPermissions(context);
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await frigateApp.page.getByLabel("Copy Config").click();
|
||||
await expect
|
||||
.poll(() => readClipboard(frigateApp.page), { timeout: 5_000 })
|
||||
.toContain("front_door");
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — schema markers @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Schema validation assumes focused desktop editing",
|
||||
);
|
||||
|
||||
test("invalid YAML renders at least one error marker in the DOM", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
// Replace editor contents with clearly invalid YAML via keyboard.
|
||||
await replaceMonacoValue(
|
||||
frigateApp.page,
|
||||
"this is not: [yaml: and has {unbalanced",
|
||||
);
|
||||
// Monaco debounces marker evaluation; the .squiggly-error decoration
|
||||
// appears asynchronously in the .view-overlays layer.
|
||||
await waitForErrorMarker(frigateApp.page);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — Cmd+S keyboard shortcut @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Keyboard save shortcut is desktop-only",
|
||||
);
|
||||
|
||||
test("Cmd/Ctrl+S fires the same config/save POST as the Save button", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
const capture = await installSaveRoute(frigateApp, 200, {
|
||||
message: "Saved",
|
||||
});
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
// Focus the editor so Monaco's keybinding receives the shortcut.
|
||||
await frigateApp.page.locator(".monaco-editor").first().click();
|
||||
await frigateApp.page.keyboard.press("ControlOrMeta+s");
|
||||
|
||||
await expect
|
||||
.poll(() => capture.capturedUrl(), { timeout: 5_000 })
|
||||
.toMatch(/config\/save\?save_option=saveonly/);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — Safe Mode auto-validation @medium", () => {
|
||||
test("safe-mode config auto-posts on mount and shows the inline error", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Thread safe_mode: true through the config override, then stub
|
||||
// config/save to return a validation error. The page's
|
||||
// initialValidationRef effect runs on mount and POSTs
|
||||
// config/save?save_option=saveonly with the raw config; the 400
|
||||
// surfaces through setError.
|
||||
// installDefaults must come first so our specific route wins (LIFO).
|
||||
await frigateApp.installDefaults({
|
||||
config: { safe_mode: true } as unknown as Record<string, unknown>,
|
||||
configRaw: "cameras:\n front_door:\n ffmpeg: {}\n",
|
||||
});
|
||||
let autoSaveCalled = false;
|
||||
await frigateApp.page.route("**/api/config/save**", async (route) => {
|
||||
autoSaveCalled = true;
|
||||
await route.fulfill({
|
||||
status: 400,
|
||||
json: { message: "safe-mode validation failure" },
|
||||
});
|
||||
});
|
||||
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await expect.poll(() => autoSaveCalled, { timeout: 10_000 }).toBe(true);
|
||||
await expect(
|
||||
frigateApp.page.getByText(/safe-mode validation failure/i),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Config Editor — mobile @medium @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("editor renders at narrow viewport", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ configRaw: SAMPLE_CONFIG });
|
||||
test("config editor button clicks do not crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/config");
|
||||
await expect(frigateApp.page.locator(".monaco-editor").first()).toBeVisible(
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await frigateApp.page.waitForTimeout(5000);
|
||||
// Find buttons with SVG icons (copy, save, etc.)
|
||||
const iconButtons = frigateApp.page.locator("button:has(svg)");
|
||||
const count = await iconButtons.count();
|
||||
if (count > 0) {
|
||||
// Click the first icon button (likely copy)
|
||||
await iconButtons.first().click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
}
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
+76
-244
@@ -1,265 +1,97 @@
|
||||
/**
|
||||
* Explore page tests -- HIGH tier.
|
||||
*
|
||||
* Search input, Enter submission, camera filter popover (desktop),
|
||||
* event grid rendering with mocked events, mobile filter drawer.
|
||||
*
|
||||
* DEVIATION NOTES (from original plan):
|
||||
*
|
||||
* 1. Search input: InputWithTags is only rendered when
|
||||
* config.semantic_search.enabled is true. Tests that exercise the search
|
||||
* input override the config accordingly, using model:"genai" (not in the
|
||||
* JINA_EMBEDDING_MODELS list) so the page skips local model-state checks
|
||||
* and renders without waiting for model-download WS messages.
|
||||
*
|
||||
* 2. Filter buttons (Cameras, Labels, More Filters): SearchFilterGroup is
|
||||
* only rendered when hasExistingSearch is true. Tests navigate with a URL
|
||||
* param (?labels=person) to surface the filter bar.
|
||||
*
|
||||
* 3. Cameras button: accessible name is "Cameras Filter" (aria-label), not
|
||||
* "All Cameras" (inner text). Use getByLabel("Cameras Filter").
|
||||
*
|
||||
* 4. Labels: button accessible name is "Labels" (aria-label). With
|
||||
* ?labels=person, the text shows "Person" rather than "All Labels".
|
||||
* Use getByLabel("Labels").
|
||||
*
|
||||
* 5. Sub-labels / Zones: These live inside the "More Filters" dialog
|
||||
* (SearchFilterDialog), not as standalone top-level buttons. The Zones
|
||||
* test opens "More Filters" and asserts zone content from config.
|
||||
*
|
||||
* 6. similarity_search_id URL param: This param does not exist in the app.
|
||||
* The correct entrypoint for similarity search is
|
||||
* ?search_type=similarity&event_id=<id>. The test uses this URL and
|
||||
* polls for the resulting API request.
|
||||
* Tests search input with text entry and clearing, camera filter popover
|
||||
* opening with camera names, and content rendering with mock events.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
|
||||
// Semantic search config override used by multiple tests. Using model:
|
||||
// "genai" (not in JINA_EMBEDDING_MODELS) sets isGenaiEmbeddings=true, which
|
||||
// skips local model-state checks and lets the page render without waiting for
|
||||
// individual model download WS messages. The WS mocker returns a completed
|
||||
// reindexState so !reindexState is false and the loading gate clears.
|
||||
const SEMANTIC_SEARCH_CONFIG = {
|
||||
semantic_search: { enabled: true, model: "genai" },
|
||||
} as const;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Search input (semantic_search must be enabled)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test.describe("Explore — search @high", () => {
|
||||
test("search input accepts text and clears", async ({ frigateApp }) => {
|
||||
// Enable semantic search so InputWithTags renders.
|
||||
await frigateApp.installDefaults({ config: SEMANTIC_SEARCH_CONFIG });
|
||||
test.describe("Explore Page - Search @high", () => {
|
||||
test("explore page renders with filter buttons", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/explore");
|
||||
const searchInput = frigateApp.page.locator("input").first();
|
||||
await expect(searchInput).toBeVisible({ timeout: 10_000 });
|
||||
await searchInput.fill("person");
|
||||
await expect(searchInput).toHaveValue("person");
|
||||
await searchInput.fill("");
|
||||
await expect(searchInput).toHaveValue("");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
const buttons = frigateApp.page.locator("#pageRoot button");
|
||||
await expect(buttons.first()).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("Enter submission does not crash the page", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ config: SEMANTIC_SEARCH_CONFIG });
|
||||
test("search input accepts text and can be cleared", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/explore");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const searchInput = frigateApp.page.locator("input").first();
|
||||
await expect(searchInput).toBeVisible({ timeout: 10_000 });
|
||||
await searchInput.fill("car in driveway");
|
||||
await searchInput.press("Enter");
|
||||
if (await searchInput.isVisible()) {
|
||||
await searchInput.fill("person");
|
||||
await expect(searchInput).toHaveValue("person");
|
||||
await searchInput.fill("");
|
||||
await expect(searchInput).toHaveValue("");
|
||||
}
|
||||
});
|
||||
|
||||
test("search input submits on Enter", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/explore");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const searchInput = frigateApp.page.locator("input").first();
|
||||
if (await searchInput.isVisible()) {
|
||||
await searchInput.fill("car in driveway");
|
||||
await searchInput.press("Enter");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
// Page should not crash after search submit
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Explore Page - Filters @high", () => {
|
||||
test("camera filter button opens popover with camera names (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/explore");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const camerasBtn = frigateApp.page.getByRole("button", {
|
||||
name: /cameras/i,
|
||||
});
|
||||
if (await camerasBtn.isVisible().catch(() => false)) {
|
||||
await camerasBtn.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
const popover = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper]",
|
||||
);
|
||||
await expect(popover.first()).toBeVisible({ timeout: 3_000 });
|
||||
// Camera names from config should be in the popover
|
||||
await expect(frigateApp.page.getByText("Front Door")).toBeVisible();
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
}
|
||||
});
|
||||
|
||||
test("filter button opens and closes overlay cleanly", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/explore");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const firstButton = frigateApp.page.locator("#pageRoot button").first();
|
||||
await expect(firstButton).toBeVisible({ timeout: 5_000 });
|
||||
await firstButton.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await frigateApp.page.waitForTimeout(300);
|
||||
// Page is still functional after open/close cycle
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Filter bar — desktop only
|
||||
// Filter buttons appear once hasExistingSearch is true (URL params present).
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test.describe("Explore — filters (desktop) @high", () => {
|
||||
test.skip(({ frigateApp }) => frigateApp.isMobile, "Desktop popovers");
|
||||
|
||||
test("Cameras popover lists configured cameras", async ({ frigateApp }) => {
|
||||
// Navigate with a labels filter param so the filter bar renders.
|
||||
await frigateApp.goto("/explore?labels=person");
|
||||
// CamerasFilterButton has aria-label="Cameras Filter". Use getByLabel to
|
||||
// match against the accessible name (not the inner "All Cameras" text).
|
||||
const camerasBtn = frigateApp.page.getByLabel("Cameras Filter").first();
|
||||
await expect(camerasBtn).toBeVisible({ timeout: 10_000 });
|
||||
await camerasBtn.click();
|
||||
// DropdownMenu on desktop wraps content in data-radix-popper-content-wrapper.
|
||||
const popover = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper]",
|
||||
);
|
||||
await expect(popover.first()).toBeVisible({ timeout: 3_000 });
|
||||
await expect(frigateApp.page.getByText("Front Door")).toBeVisible();
|
||||
});
|
||||
|
||||
test("Labels filter lists labels from config", async ({ frigateApp }) => {
|
||||
// Navigate with an existing search so the filter bar renders.
|
||||
await frigateApp.goto("/explore?labels=person");
|
||||
// GeneralFilterButton has aria-label="Labels". With ?labels=person the
|
||||
// button text shows "Person" (the selected label), but the aria-label
|
||||
// remains "Labels".
|
||||
const labelsBtn = frigateApp.page.getByLabel("Labels").first();
|
||||
await expect(labelsBtn).toBeVisible({ timeout: 10_000 });
|
||||
await labelsBtn.click();
|
||||
// PlatformAwareDialog renders on desktop as a dropdown/popover overlay.
|
||||
const overlay = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper], [role='dialog'], [data-state='open']",
|
||||
);
|
||||
await expect(overlay.first()).toBeVisible({ timeout: 3_000 });
|
||||
// "person" is already selected (it's in the URL); assert it appears in
|
||||
// the overlay content.
|
||||
await expect(overlay.first().getByText(/person/i)).toBeVisible();
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("Sub-labels filter renders inside More Filters dialog", async ({
|
||||
test.describe("Explore Page - Content @high", () => {
|
||||
test("explore page shows content with mock events", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Sub-labels live inside SearchFilterDialog ("More Filters" button).
|
||||
// With sub_labels mocked as [], the section still renders its heading.
|
||||
await frigateApp.page.route("**/api/sub_labels**", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
await frigateApp.goto("/explore?labels=person");
|
||||
const moreBtn = frigateApp.page.getByLabel("More Filters").first();
|
||||
await expect(moreBtn).toBeVisible({ timeout: 10_000 });
|
||||
await moreBtn.click();
|
||||
const overlay = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper], [role='dialog'], [data-state='open']",
|
||||
);
|
||||
await expect(overlay.first()).toBeVisible({ timeout: 3_000 });
|
||||
// "Sub Labels" section heading always renders inside the dialog.
|
||||
await expect(
|
||||
frigateApp.page.getByText(/sub.?label/i).first(),
|
||||
).toBeVisible();
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("Zones filter lists configured zones inside More Filters dialog", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Override config to guarantee a known zone on front_door.
|
||||
await frigateApp.installDefaults({
|
||||
config: {
|
||||
cameras: {
|
||||
front_door: {
|
||||
zones: {
|
||||
front_yard: { coordinates: "0.1,0.1,0.9,0.1,0.9,0.9,0.1,0.9" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
await frigateApp.goto("/explore?labels=person");
|
||||
const moreBtn = frigateApp.page.getByLabel("More Filters").first();
|
||||
await expect(moreBtn).toBeVisible({ timeout: 10_000 });
|
||||
await moreBtn.click();
|
||||
const overlay = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper], [role='dialog'], [data-state='open']",
|
||||
);
|
||||
await expect(overlay.first()).toBeVisible({ timeout: 3_000 });
|
||||
await expect(frigateApp.page.getByText(/front.?yard/i)).toBeVisible();
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Content
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test.describe("Explore — content @high", () => {
|
||||
test("page renders with mock events", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/explore");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(
|
||||
frigateApp.page.locator("#pageRoot button").first(),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("empty events renders without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ events: [] });
|
||||
await frigateApp.goto("/explore");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("search fires a /api/events request with the query", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ config: SEMANTIC_SEARCH_CONFIG });
|
||||
const eventsRequests: string[] = [];
|
||||
frigateApp.page.on("request", (req) => {
|
||||
const url = req.url();
|
||||
if (/\/api\/events/.test(url)) eventsRequests.push(url);
|
||||
});
|
||||
await frigateApp.goto("/explore");
|
||||
const searchInput = frigateApp.page.locator("input").first();
|
||||
await expect(searchInput).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
const before = eventsRequests.length;
|
||||
await searchInput.fill("person in driveway");
|
||||
await searchInput.press("Enter");
|
||||
await expect
|
||||
.poll(() => eventsRequests.length > before, { timeout: 5_000 })
|
||||
.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Similarity search URL param
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test.describe("Explore — similarity search (desktop) @high", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Similarity trigger is hover-based; desktop-focused",
|
||||
);
|
||||
|
||||
test("URL similarity search params fetch events", async ({ frigateApp }) => {
|
||||
const eventsRequests: string[] = [];
|
||||
frigateApp.page.on("request", (req) => {
|
||||
const url = req.url();
|
||||
if (/\/api\/events/.test(url)) eventsRequests.push(url);
|
||||
});
|
||||
// The app uses search_type=similarity&event_id=<id> (not
|
||||
// similarity_search_id). This exercises the same similarity search code
|
||||
// path as clicking "Find Similar" on a thumbnail.
|
||||
// Use a valid event-id format (timestamp.fractional-alphanumeric).
|
||||
await frigateApp.goto(
|
||||
"/explore?search_type=similarity&event_id=1712412000.000000-abc123",
|
||||
);
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
// Poll to allow any pending SWR fetch to complete and be captured.
|
||||
await expect
|
||||
.poll(() => eventsRequests.length, { timeout: 5_000 })
|
||||
.toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mobile
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test.describe("Explore — mobile @high @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("search input is focusable at mobile viewport", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({ config: SEMANTIC_SEARCH_CONFIG });
|
||||
await frigateApp.goto("/explore");
|
||||
const searchInput = frigateApp.page.locator("input").first();
|
||||
await expect(searchInput).toBeVisible({ timeout: 10_000 });
|
||||
await searchInput.focus();
|
||||
await expect(searchInput).toBeFocused();
|
||||
await frigateApp.page.waitForTimeout(3000);
|
||||
const pageText = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(pageText?.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
+45
-902
@@ -1,931 +1,74 @@
|
||||
/**
|
||||
* Export page tests -- HIGH tier.
|
||||
*
|
||||
* Tests export card rendering with mock data, search filtering,
|
||||
* and delete confirmation dialog.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
|
||||
test.describe("Export Page - Overview @high", () => {
|
||||
test("renders uncategorized exports and case cards from mock data", async ({
|
||||
test.describe("Export Page - Cards @high", () => {
|
||||
test("export page renders export cards from mock data", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Should show export names from our mock data
|
||||
await expect(
|
||||
frigateApp.page.getByText("Front Door - Person Alert"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Garage - In Progress"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Package Theft Investigation"),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("search filters uncategorized exports", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
const searchInput = frigateApp.page.getByPlaceholder(/search/i).first();
|
||||
await searchInput.fill("Front Door");
|
||||
|
||||
await expect(
|
||||
frigateApp.page.getByText("Front Door - Person Alert"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Backyard - Car Detection"),
|
||||
).toBeHidden();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Garage - In Progress"),
|
||||
).toBeHidden();
|
||||
});
|
||||
|
||||
test("new case button opens the create case dialog", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page.getByRole("button", { name: "New Case" }).click();
|
||||
|
||||
await expect(
|
||||
frigateApp.page.getByRole("dialog").filter({ hasText: "Create Case" }),
|
||||
).toBeVisible();
|
||||
await expect(frigateApp.page.getByPlaceholder("Case name")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Export Page - Case Detail @high", () => {
|
||||
test("opening a case shows its detail view and associated export", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page
|
||||
.getByText("Package Theft Investigation")
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
name: "Package Theft Investigation",
|
||||
}),
|
||||
).toBeVisible();
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
await expect(
|
||||
frigateApp.page.getByText("Backyard - Car Detection"),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: "Add Export" }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: "Edit Case" }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: "Delete Case" }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("edit case opens a prefilled dialog", async ({ frigateApp }) => {
|
||||
test("export page shows in-progress indicator", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page
|
||||
.getByText("Package Theft Investigation")
|
||||
.first()
|
||||
.click();
|
||||
await frigateApp.page.getByRole("button", { name: "Edit Case" }).click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("dialog")
|
||||
.filter({ hasText: "Edit Case" });
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect(dialog.locator("input")).toHaveValue(
|
||||
"Package Theft Investigation",
|
||||
);
|
||||
await expect(dialog.locator("textarea")).toHaveValue(
|
||||
"Review of suspicious activity near the front porch",
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// "Garage - In Progress" export should be visible
|
||||
await expect(frigateApp.page.getByText("Garage - In Progress")).toBeVisible(
|
||||
{ timeout: 10_000 },
|
||||
);
|
||||
});
|
||||
|
||||
test("add export shows completed uncategorized exports for assignment", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test("export page shows case grouping", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page
|
||||
.getByText("Package Theft Investigation")
|
||||
.first()
|
||||
.click();
|
||||
await frigateApp.page.getByRole("button", { name: "Add Export" }).click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("dialog")
|
||||
.filter({ hasText: "Add Export to Package Theft Investigation" });
|
||||
await expect(dialog).toBeVisible();
|
||||
// Completed, uncategorized exports are selectable
|
||||
await expect(dialog.getByText("Front Door - Person Alert")).toBeVisible();
|
||||
// In-progress exports are intentionally hidden by AssignExportDialog
|
||||
// (see Exports.tsx filteredExports) — they can't be assigned until
|
||||
// they finish, so they should not show in the picker.
|
||||
await expect(dialog.getByText("Garage - In Progress")).toBeHidden();
|
||||
});
|
||||
|
||||
test("delete case opens a confirmation dialog", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page
|
||||
.getByText("Package Theft Investigation")
|
||||
.first()
|
||||
.click();
|
||||
await frigateApp.page.getByRole("button", { name: "Delete Case" }).click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("alertdialog")
|
||||
.filter({ hasText: "Delete Case" });
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect(dialog.getByText(/Package Theft Investigation/)).toBeVisible();
|
||||
});
|
||||
|
||||
test("delete case can also delete its exports", async ({ frigateApp }) => {
|
||||
let deleteRequestUrl: string | null = null;
|
||||
let deleteCaseCompleted = false;
|
||||
|
||||
const initialCases = [
|
||||
{
|
||||
id: "case-001",
|
||||
name: "Package Theft Investigation",
|
||||
description: "Review of suspicious activity near the front porch",
|
||||
created_at: 1775407931.3863528,
|
||||
updated_at: 1775483531.3863528,
|
||||
},
|
||||
];
|
||||
|
||||
const initialExports = [
|
||||
{
|
||||
id: "export-001",
|
||||
camera: "front_door",
|
||||
name: "Front Door - Person Alert",
|
||||
date: 1775490731.3863528,
|
||||
video_path: "/exports/export-001.mp4",
|
||||
thumb_path: "/exports/export-001-thumb.jpg",
|
||||
in_progress: false,
|
||||
export_case_id: null,
|
||||
},
|
||||
{
|
||||
id: "export-002",
|
||||
camera: "backyard",
|
||||
name: "Backyard - Car Detection",
|
||||
date: 1775483531.3863528,
|
||||
video_path: "/exports/export-002.mp4",
|
||||
thumb_path: "/exports/export-002-thumb.jpg",
|
||||
in_progress: false,
|
||||
export_case_id: "case-001",
|
||||
},
|
||||
{
|
||||
id: "export-003",
|
||||
camera: "garage",
|
||||
name: "Garage - In Progress",
|
||||
date: 1775492531.3863528,
|
||||
video_path: "/exports/export-003.mp4",
|
||||
thumb_path: "/exports/export-003-thumb.jpg",
|
||||
in_progress: true,
|
||||
export_case_id: null,
|
||||
},
|
||||
];
|
||||
|
||||
await frigateApp.page.route(/\/api\/cases(?:$|\?|\/)/, async (route) => {
|
||||
const request = route.request();
|
||||
|
||||
if (request.method() === "DELETE") {
|
||||
deleteRequestUrl = request.url();
|
||||
deleteCaseCompleted = true;
|
||||
return route.fulfill({ json: { success: true } });
|
||||
}
|
||||
|
||||
if (request.method() === "GET") {
|
||||
return route.fulfill({
|
||||
json: deleteCaseCompleted ? [] : initialCases,
|
||||
});
|
||||
}
|
||||
|
||||
return route.fallback();
|
||||
});
|
||||
|
||||
await frigateApp.page.route("**/api/exports**", async (route) => {
|
||||
if (route.request().method() !== "GET") {
|
||||
return route.fallback();
|
||||
}
|
||||
|
||||
return route.fulfill({
|
||||
json: deleteCaseCompleted
|
||||
? initialExports.filter((exp) => exp.export_case_id !== "case-001")
|
||||
: initialExports,
|
||||
});
|
||||
});
|
||||
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page
|
||||
.getByText("Package Theft Investigation")
|
||||
.first()
|
||||
.click();
|
||||
await frigateApp.page.getByRole("button", { name: "Delete Case" }).click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("alertdialog")
|
||||
.filter({ hasText: "Delete Case" });
|
||||
await expect(dialog).toBeVisible();
|
||||
|
||||
const deleteExportsSwitch = dialog.getByRole("switch", {
|
||||
name: "Also delete exports",
|
||||
});
|
||||
await expect(deleteExportsSwitch).toHaveAttribute("aria-checked", "false");
|
||||
await expect(
|
||||
dialog.getByText(
|
||||
"Exports will remain available as uncategorized exports.",
|
||||
),
|
||||
).toBeVisible();
|
||||
|
||||
await deleteExportsSwitch.click();
|
||||
|
||||
await expect(deleteExportsSwitch).toHaveAttribute("aria-checked", "true");
|
||||
await expect(
|
||||
dialog.getByText("All exports in this case will be permanently deleted."),
|
||||
).toBeVisible();
|
||||
|
||||
await dialog.getByRole("button", { name: /^delete$/i }).click();
|
||||
|
||||
await expect
|
||||
.poll(() => deleteRequestUrl)
|
||||
.toContain("/api/cases/case-001?delete_exports=true");
|
||||
|
||||
await expect(dialog).toBeHidden();
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
name: "Package Theft Investigation",
|
||||
}),
|
||||
).toBeHidden();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Backyard - Car Detection"),
|
||||
).toBeHidden();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Front Door - Person Alert"),
|
||||
).toBeVisible();
|
||||
await frigateApp.page.waitForTimeout(3000);
|
||||
// Cases may render differently depending on API response shape
|
||||
const pageText = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(pageText?.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Export Page - Empty State @high", () => {
|
||||
test("renders the empty state when there are no exports or cases", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.page.route("**/api/export**", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
await frigateApp.page.route("**/api/exports**", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
await frigateApp.page.route("**/api/cases", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
await frigateApp.page.route("**/api/cases**", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
|
||||
test.describe("Export Page - Search @high", () => {
|
||||
test("search input filters export list", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await expect(frigateApp.page.getByText("No exports found")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Export Page - Mobile @high @mobile", () => {
|
||||
test("mobile can open an export preview dialog", async ({ frigateApp }) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only assertion");
|
||||
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await frigateApp.page
|
||||
.getByText("Front Door - Person Alert")
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("dialog")
|
||||
.filter({ hasText: "Front Door - Person Alert" });
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect(dialog.locator("video")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Multi-Review Export @high", () => {
|
||||
// Two alert reviews close enough to "now" to fall within the
|
||||
// default last-24-hours review window. Using numeric timestamps
|
||||
// because the TS ReviewSegment type expects numbers even though
|
||||
// the backend pydantic model serializes datetime as ISO strings —
|
||||
// the app reads these as numbers for display math.
|
||||
const now = Date.now() / 1000;
|
||||
const mockReviews = [
|
||||
{
|
||||
id: "mex-review-001",
|
||||
camera: "front_door",
|
||||
start_time: now - 600,
|
||||
end_time: now - 580,
|
||||
has_been_reviewed: false,
|
||||
severity: "alert",
|
||||
thumb_path: "/clips/front_door/mex-review-001-thumb.jpg",
|
||||
data: {
|
||||
audio: [],
|
||||
detections: ["person-001"],
|
||||
objects: ["person"],
|
||||
sub_labels: [],
|
||||
significant_motion_areas: [],
|
||||
zones: ["front_yard"],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "mex-review-002",
|
||||
camera: "backyard",
|
||||
start_time: now - 1200,
|
||||
end_time: now - 1170,
|
||||
has_been_reviewed: false,
|
||||
severity: "alert",
|
||||
thumb_path: "/clips/backyard/mex-review-002-thumb.jpg",
|
||||
data: {
|
||||
audio: [],
|
||||
detections: ["car-002"],
|
||||
objects: ["car"],
|
||||
sub_labels: [],
|
||||
significant_motion_areas: [],
|
||||
zones: ["driveway"],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// 51 alert reviews, all front_door, spaced 5 minutes apart. Used by the
|
||||
// over-limit test to trigger Ctrl+A select-all and verify the Export
|
||||
// button is hidden at 51 selected.
|
||||
const oversizedReviews = Array.from({ length: 51 }, (_, i) => ({
|
||||
id: `mex-oversized-${i.toString().padStart(3, "0")}`,
|
||||
camera: "front_door",
|
||||
start_time: now - 60 * 60 - i * 300,
|
||||
end_time: now - 60 * 60 - i * 300 + 20,
|
||||
has_been_reviewed: false,
|
||||
severity: "alert",
|
||||
thumb_path: `/clips/front_door/mex-oversized-${i}-thumb.jpg`,
|
||||
data: {
|
||||
audio: [],
|
||||
detections: [`person-${i}`],
|
||||
objects: ["person"],
|
||||
sub_labels: [],
|
||||
significant_motion_areas: [],
|
||||
zones: ["front_yard"],
|
||||
},
|
||||
}));
|
||||
|
||||
const mockSummary = {
|
||||
last24Hours: {
|
||||
reviewed_alert: 0,
|
||||
reviewed_detection: 0,
|
||||
total_alert: 2,
|
||||
total_detection: 0,
|
||||
},
|
||||
};
|
||||
|
||||
async function routeReviews(
|
||||
page: import("@playwright/test").Page,
|
||||
reviews: unknown[],
|
||||
) {
|
||||
// Intercept the actual `/api/review` endpoint (singular — the
|
||||
// default api-mocker only registers `/api/reviews**` (plural)
|
||||
// which does not match the real request URL).
|
||||
await page.route(/\/api\/review(\?|$)/, (route) =>
|
||||
route.fulfill({ json: reviews }),
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const searchInput = frigateApp.page.locator(
|
||||
'#pageRoot input[type="text"], #pageRoot input',
|
||||
);
|
||||
await page.route(/\/api\/review\/summary/, (route) =>
|
||||
route.fulfill({ json: mockSummary }),
|
||||
);
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ frigateApp }) => {
|
||||
await routeReviews(frigateApp.page, mockReviews);
|
||||
// Empty cases list by default so the dialog defaults to "new case".
|
||||
// Individual tests override this to populate existing cases.
|
||||
await frigateApp.page.route("**/api/cases", (route) =>
|
||||
route.fulfill({ json: [] }),
|
||||
);
|
||||
});
|
||||
|
||||
async function selectTwoReviews(frigateApp: {
|
||||
page: import("@playwright/test").Page;
|
||||
}) {
|
||||
// Every review card has className `review-item` on its wrapper
|
||||
// (see EventView.tsx). Cards also have data-start attributes that
|
||||
// we can key off if needed.
|
||||
const reviewItems = frigateApp.page.locator(".review-item");
|
||||
await reviewItems.first().waitFor({ state: "visible", timeout: 10_000 });
|
||||
|
||||
// Meta-click the first two items to enter multi-select mode.
|
||||
// PreviewThumbnailPlayer reads e.metaKey to decide multi-select.
|
||||
await reviewItems.nth(0).click({ modifiers: ["Meta"] });
|
||||
await reviewItems.nth(1).click();
|
||||
}
|
||||
|
||||
test("selecting two reviews reveals the export button", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop multi-select flow");
|
||||
|
||||
await frigateApp.goto("/review");
|
||||
|
||||
await selectTwoReviews(frigateApp);
|
||||
|
||||
// Action group replaces the filter bar once items are selected
|
||||
await expect(frigateApp.page.getByText(/2.*selected/i)).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
|
||||
const exportButton = frigateApp.page.getByRole("button", {
|
||||
name: /export/i,
|
||||
});
|
||||
await expect(exportButton).toBeVisible();
|
||||
});
|
||||
|
||||
test("clicking export opens the multi-review dialog with correct title", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop multi-select flow");
|
||||
|
||||
await frigateApp.goto("/review");
|
||||
|
||||
await selectTwoReviews(frigateApp);
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /export/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("dialog")
|
||||
.filter({ hasText: /Export 2 reviews/i });
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
// The dialog uses a Select trigger for case selection (admins). The
|
||||
// default "None" value is shown on the trigger.
|
||||
await expect(dialog.locator("button[role='combobox']")).toBeVisible();
|
||||
await expect(dialog.getByText(/None/)).toBeVisible();
|
||||
});
|
||||
|
||||
test("starting an export posts the expected payload and navigates to the case", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop multi-select flow");
|
||||
|
||||
let capturedPayload: unknown = null;
|
||||
await frigateApp.page.route("**/api/exports/batch", async (route) => {
|
||||
capturedPayload = route.request().postDataJSON();
|
||||
await route.fulfill({
|
||||
status: 202,
|
||||
json: {
|
||||
export_case_id: "new-case-xyz",
|
||||
export_ids: ["front_door_a", "backyard_b"],
|
||||
results: [
|
||||
{
|
||||
camera: "front_door",
|
||||
export_id: "front_door_a",
|
||||
success: true,
|
||||
status: "queued",
|
||||
error: null,
|
||||
item_index: 0,
|
||||
},
|
||||
{
|
||||
camera: "backyard",
|
||||
export_id: "backyard_b",
|
||||
success: true,
|
||||
status: "queued",
|
||||
error: null,
|
||||
item_index: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
await frigateApp.goto("/review");
|
||||
await selectTwoReviews(frigateApp);
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /export/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("dialog")
|
||||
.filter({ hasText: /Export 2 reviews/i });
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// Select "Create new case" from the case dropdown (default is "None")
|
||||
await dialog.locator("button[role='combobox']").click();
|
||||
await frigateApp.page
|
||||
.getByRole("option", { name: /Create new case/i })
|
||||
.click();
|
||||
|
||||
const nameInput = dialog.locator("input").first();
|
||||
await nameInput.fill("E2E Incident");
|
||||
|
||||
await dialog.getByRole("button", { name: /export 2 reviews/i }).click();
|
||||
|
||||
// Wait for the POST to fire
|
||||
await expect.poll(() => capturedPayload, { timeout: 5_000 }).not.toBeNull();
|
||||
|
||||
const payload = capturedPayload as {
|
||||
items: Array<{
|
||||
camera: string;
|
||||
start_time: number;
|
||||
end_time: number;
|
||||
image_path?: string;
|
||||
client_item_id?: string;
|
||||
}>;
|
||||
new_case_name?: string;
|
||||
export_case_id?: string;
|
||||
};
|
||||
expect(payload.items).toHaveLength(2);
|
||||
expect(payload.new_case_name).toBe("E2E Incident");
|
||||
// When creating a new case, we must NOT also send export_case_id —
|
||||
// the two fields are mutually exclusive on the backend.
|
||||
expect(payload.export_case_id).toBeUndefined();
|
||||
expect(payload.items.map((i) => i.camera).sort()).toEqual([
|
||||
"backyard",
|
||||
"front_door",
|
||||
]);
|
||||
// Each item must preserve REVIEW_PADDING (4s) on the edges —
|
||||
// i.e. the padded window is 8s longer than the original review.
|
||||
// The mock reviews above have 20s and 30s raw durations, so the
|
||||
// expected padded durations are 28s and 38s.
|
||||
const paddedDurations = payload.items
|
||||
.map((i) => i.end_time - i.start_time)
|
||||
.sort((a, b) => a - b);
|
||||
expect(paddedDurations).toEqual([28, 38]);
|
||||
// Thumbnails should be passed through per item
|
||||
for (const item of payload.items) {
|
||||
expect(item.image_path).toMatch(/mex-review-\d+-thumb\.jpg$/);
|
||||
if (
|
||||
(await searchInput.count()) > 0 &&
|
||||
(await searchInput.first().isVisible())
|
||||
) {
|
||||
// Type a search term that matches one export
|
||||
await searchInput.first().fill("Front Door");
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
// "Front Door - Person Alert" should still be visible
|
||||
await expect(
|
||||
frigateApp.page.getByText("Front Door - Person Alert"),
|
||||
).toBeVisible();
|
||||
}
|
||||
expect(payload.items.map((item) => item.client_item_id)).toEqual([
|
||||
"mex-review-001",
|
||||
"mex-review-002",
|
||||
]);
|
||||
|
||||
await expect(frigateApp.page).toHaveURL(/caseId=new-case-xyz/, {
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("mobile opens a drawer (not a dialog) for the multi-review export flow", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only Drawer assertion");
|
||||
|
||||
await frigateApp.goto("/review");
|
||||
await selectTwoReviews(frigateApp);
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /export/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
// On mobile the component renders a shadcn Drawer, which uses
|
||||
// role="dialog" but sets data-vaul-drawer. Desktop renders a
|
||||
// shadcn Dialog with role="dialog" but no data-vaul-drawer.
|
||||
// The title and submit button both contain "Export 2 reviews", so
|
||||
// assert each element distinctly: the title is a heading and the
|
||||
// submit button has role="button".
|
||||
const drawer = frigateApp.page.locator("[data-vaul-drawer]");
|
||||
await expect(drawer).toBeVisible({ timeout: 5_000 });
|
||||
await expect(
|
||||
drawer.getByRole("heading", { name: /Export 2 reviews/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
drawer.getByRole("button", { name: /export 2 reviews/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("hides export button when more than 50 reviews are selected", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop select-all keyboard flow");
|
||||
|
||||
// Override the default 2-review mock with 51 reviews before
|
||||
// navigation. Playwright matches routes last-registered-first so
|
||||
// this takes precedence over the beforeEach.
|
||||
await routeReviews(frigateApp.page, oversizedReviews);
|
||||
|
||||
await frigateApp.goto("/review");
|
||||
|
||||
// Wait for any review item to render before firing the shortcut
|
||||
await frigateApp.page
|
||||
.locator(".review-item")
|
||||
.first()
|
||||
.waitFor({ state: "visible", timeout: 10_000 });
|
||||
|
||||
// Ctrl+A triggers onSelectAllReviews (see EventView.tsx useKeyboardListener)
|
||||
await frigateApp.page.keyboard.press("Control+a");
|
||||
|
||||
// The action group should show "51 selected" but no Export button.
|
||||
// Mark-as-reviewed is still there so the action bar is rendered.
|
||||
// Scope the "Mark as reviewed" lookup to its exact aria-label because
|
||||
// the page can render other "mark as reviewed" controls elsewhere
|
||||
// (e.g. on individual cards) that would trip strict-mode matching.
|
||||
await expect(frigateApp.page.getByText(/51.*selected/i)).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: "Mark as reviewed" }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByRole("button", { name: /^export$/i }),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("attaching to an existing case sends export_case_id without new_case_name", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop multi-select flow");
|
||||
|
||||
// Seed one existing case so the dialog can offer the "existing" branch.
|
||||
// The fixture mocks the user as admin (adminProfile()), so useIsAdmin()
|
||||
// is true and the dialog renders the "Existing case" radio.
|
||||
await frigateApp.page.route("**/api/cases", (route) =>
|
||||
route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "existing-case-abc",
|
||||
name: "Incident #42",
|
||||
description: "",
|
||||
created_at: now - 3600,
|
||||
updated_at: now - 3600,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
let capturedPayload: unknown = null;
|
||||
await frigateApp.page.route("**/api/exports/batch", async (route) => {
|
||||
capturedPayload = route.request().postDataJSON();
|
||||
await route.fulfill({
|
||||
status: 202,
|
||||
json: {
|
||||
export_case_id: "existing-case-abc",
|
||||
export_ids: ["front_door_a", "backyard_b"],
|
||||
results: [
|
||||
{
|
||||
camera: "front_door",
|
||||
export_id: "front_door_a",
|
||||
success: true,
|
||||
status: "queued",
|
||||
error: null,
|
||||
item_index: 0,
|
||||
},
|
||||
{
|
||||
camera: "backyard",
|
||||
export_id: "backyard_b",
|
||||
success: true,
|
||||
status: "queued",
|
||||
error: null,
|
||||
item_index: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
await frigateApp.goto("/review");
|
||||
await selectTwoReviews(frigateApp);
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /export/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const dialog = frigateApp.page
|
||||
.getByRole("dialog")
|
||||
.filter({ hasText: /Export 2 reviews/i });
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// Open the Case Select dropdown and pick the seeded case directly.
|
||||
// The dialog now uses a single Select listing existing cases above
|
||||
// the "Create new case" option — no radio toggle needed.
|
||||
const selectTrigger = dialog.locator("button[role='combobox']").first();
|
||||
await selectTrigger.waitFor({ state: "visible", timeout: 5_000 });
|
||||
await selectTrigger.click();
|
||||
|
||||
// The dropdown portal renders outside the dialog
|
||||
await frigateApp.page.getByRole("option", { name: /Incident #42/ }).click();
|
||||
|
||||
await dialog.getByRole("button", { name: /export 2 reviews/i }).click();
|
||||
|
||||
await expect.poll(() => capturedPayload, { timeout: 5_000 }).not.toBeNull();
|
||||
|
||||
const payload = capturedPayload as {
|
||||
items: unknown[];
|
||||
new_case_name?: string;
|
||||
new_case_description?: string;
|
||||
export_case_id?: string;
|
||||
};
|
||||
expect(payload.export_case_id).toBe("existing-case-abc");
|
||||
expect(payload.new_case_name).toBeUndefined();
|
||||
expect(payload.new_case_description).toBeUndefined();
|
||||
expect(payload.items).toHaveLength(2);
|
||||
|
||||
// Navigate should hit /export. useSearchEffect consumes the caseId
|
||||
// query param and strips it once the case is found in the cases list,
|
||||
// so we assert on the path, not the query string.
|
||||
await expect(frigateApp.page).toHaveURL(/\/export(\?|$)/, {
|
||||
timeout: 5_000,
|
||||
});
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Export Page - Active Job Progress @medium", () => {
|
||||
test("encoding job renders percent label and progress bar", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Override the default empty mock with an encoding job. Per-test
|
||||
// page.route registrations win over those set by the api-mocker.
|
||||
await frigateApp.page.route("**/api/jobs/export", (route) =>
|
||||
route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "job-encoding",
|
||||
job_type: "export",
|
||||
status: "running",
|
||||
camera: "front_door",
|
||||
name: "Encoding Sample",
|
||||
export_case_id: null,
|
||||
request_start_time: 1775407931,
|
||||
request_end_time: 1775408531,
|
||||
start_time: 1775407932,
|
||||
end_time: null,
|
||||
error_message: null,
|
||||
results: null,
|
||||
current_step: "encoding",
|
||||
progress_percent: 42,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
test.describe("Export Page - Controls @high", () => {
|
||||
test("export page filter controls are present", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await expect(frigateApp.page.getByText("Encoding Sample")).toBeVisible();
|
||||
// Step label and percent are rendered together as text near the
|
||||
// progress bar (separated by a middle dot), not in a corner badge.
|
||||
await expect(frigateApp.page.getByText(/Encoding\s*·\s*42%/)).toBeVisible();
|
||||
});
|
||||
|
||||
test("queued job shows queued badge", async ({ frigateApp }) => {
|
||||
await frigateApp.page.route("**/api/jobs/export", (route) =>
|
||||
route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "job-queued",
|
||||
job_type: "export",
|
||||
status: "queued",
|
||||
camera: "front_door",
|
||||
name: "Queued Sample",
|
||||
export_case_id: null,
|
||||
request_start_time: 1775407931,
|
||||
request_end_time: 1775408531,
|
||||
start_time: null,
|
||||
end_time: null,
|
||||
error_message: null,
|
||||
results: null,
|
||||
current_step: "queued",
|
||||
progress_percent: 0,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await expect(frigateApp.page.getByText("Queued Sample")).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByText("Queued", { exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("active job hides matching in_progress export row", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// The backend inserts the Export row with in_progress=True before
|
||||
// FFmpeg starts encoding, so the same id appears in BOTH /jobs/export
|
||||
// and /exports during the run. The page must show the rich progress
|
||||
// card from the active jobs feed and suppress the binary-spinner
|
||||
// ExportCard from the exports feed; otherwise the older binary
|
||||
// spinner replaces the percent label as soon as SWR re-polls.
|
||||
await frigateApp.page.route("**/api/jobs/export", (route) =>
|
||||
route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "shared-id",
|
||||
job_type: "export",
|
||||
status: "running",
|
||||
camera: "front_door",
|
||||
name: "Shared Id Encoding",
|
||||
export_case_id: null,
|
||||
request_start_time: 1775407931,
|
||||
request_end_time: 1775408531,
|
||||
start_time: 1775407932,
|
||||
end_time: null,
|
||||
error_message: null,
|
||||
results: null,
|
||||
current_step: "encoding",
|
||||
progress_percent: 67,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
await frigateApp.page.route("**/api/exports**", (route) => {
|
||||
if (route.request().method() !== "GET") {
|
||||
return route.fallback();
|
||||
}
|
||||
return route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "shared-id",
|
||||
camera: "front_door",
|
||||
name: "Shared Id Encoding",
|
||||
date: 1775407931,
|
||||
video_path: "/exports/shared-id.mp4",
|
||||
thumb_path: "/exports/shared-id-thumb.jpg",
|
||||
in_progress: true,
|
||||
export_case_id: null,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
// The progress label must be present — proving the rich card won.
|
||||
await expect(frigateApp.page.getByText(/Encoding\s*·\s*67%/)).toBeVisible();
|
||||
|
||||
// And only ONE card should be visible for that id, not two.
|
||||
const titles = frigateApp.page.getByText("Shared Id Encoding");
|
||||
await expect(titles).toHaveCount(1);
|
||||
});
|
||||
|
||||
test("stream copy job shows copying label", async ({ frigateApp }) => {
|
||||
// Default (non-custom) exports use `-c copy`, which is a remux, not
|
||||
// a real encode. The step label should read "Copying" so users
|
||||
// aren't misled into thinking re-encoding is happening.
|
||||
await frigateApp.page.route("**/api/jobs/export", (route) =>
|
||||
route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "job-copying",
|
||||
job_type: "export",
|
||||
status: "running",
|
||||
camera: "front_door",
|
||||
name: "Copy Sample",
|
||||
export_case_id: null,
|
||||
request_start_time: 1775407931,
|
||||
request_end_time: 1775408531,
|
||||
start_time: 1775407932,
|
||||
end_time: null,
|
||||
error_message: null,
|
||||
results: null,
|
||||
current_step: "copying",
|
||||
progress_percent: 80,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await expect(frigateApp.page.getByText("Copy Sample")).toBeVisible();
|
||||
await expect(frigateApp.page.getByText(/Copying\s*·\s*80%/)).toBeVisible();
|
||||
});
|
||||
|
||||
test("encoding retry job shows retry label", async ({ frigateApp }) => {
|
||||
await frigateApp.page.route("**/api/jobs/export", (route) =>
|
||||
route.fulfill({
|
||||
json: [
|
||||
{
|
||||
id: "job-retry",
|
||||
job_type: "export",
|
||||
status: "running",
|
||||
camera: "front_door",
|
||||
name: "Retry Sample",
|
||||
export_case_id: null,
|
||||
request_start_time: 1775407931,
|
||||
request_end_time: 1775408531,
|
||||
start_time: 1775407932,
|
||||
end_time: null,
|
||||
error_message: null,
|
||||
results: null,
|
||||
current_step: "encoding_retry",
|
||||
progress_percent: 12,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
await frigateApp.goto("/export");
|
||||
|
||||
await expect(frigateApp.page.getByText("Retry Sample")).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.getByText(/Encoding \(retry\)\s*·\s*12%/),
|
||||
).toBeVisible();
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const buttons = frigateApp.page.locator("#pageRoot button");
|
||||
const count = await buttons.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,390 +1,32 @@
|
||||
/**
|
||||
* Face Library page tests -- HIGH tier.
|
||||
* Face Library page tests -- MEDIUM tier.
|
||||
*
|
||||
* Collection selector, face tiles, grouped recent-recognition dialog
|
||||
* (migrated from radix-overlay-regressions.spec.ts), and mobile
|
||||
* library selector.
|
||||
* Tests face grid rendering, empty state, and interactive controls.
|
||||
*/
|
||||
|
||||
import { type Locator } from "@playwright/test";
|
||||
import { test, expect, type FrigateApp } from "../fixtures/frigate-test";
|
||||
import {
|
||||
basicFacesMock,
|
||||
emptyFacesMock,
|
||||
withGroupedTrainingAttempt,
|
||||
} from "../fixtures/mock-data/faces";
|
||||
import {
|
||||
expectBodyInteractive,
|
||||
waitForBodyInteractive,
|
||||
} from "../helpers/overlay-interaction";
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
|
||||
const GROUPED_EVENT_ID = "1775487131.3863528-abc123";
|
||||
|
||||
function groupedFacesMock() {
|
||||
return withGroupedTrainingAttempt(basicFacesMock(), {
|
||||
eventId: GROUPED_EVENT_ID,
|
||||
attempts: [
|
||||
{ timestamp: 1775487131.3863528, label: "unknown", score: 0.95 },
|
||||
{ timestamp: 1775487132.3863528, label: "unknown", score: 0.91 },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
async function installGroupedFaces(app: FrigateApp) {
|
||||
await app.api.install({
|
||||
events: [
|
||||
{
|
||||
id: GROUPED_EVENT_ID,
|
||||
label: "person",
|
||||
sub_label: null,
|
||||
camera: "front_door",
|
||||
start_time: 1775487131.3863528,
|
||||
end_time: 1775487161.3863528,
|
||||
false_positive: false,
|
||||
zones: ["front_yard"],
|
||||
thumbnail: null,
|
||||
has_clip: true,
|
||||
has_snapshot: true,
|
||||
retain_indefinitely: false,
|
||||
plus_id: null,
|
||||
model_hash: "abc123",
|
||||
detector_type: "cpu",
|
||||
model_type: "ssd",
|
||||
data: {
|
||||
top_score: 0.92,
|
||||
score: 0.92,
|
||||
region: [0.1, 0.1, 0.5, 0.8],
|
||||
box: [0.2, 0.15, 0.45, 0.75],
|
||||
area: 0.18,
|
||||
ratio: 0.6,
|
||||
type: "object",
|
||||
path_data: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
faces: groupedFacesMock(),
|
||||
});
|
||||
}
|
||||
|
||||
async function openGroupedFaceDialog(app: FrigateApp): Promise<Locator> {
|
||||
await installGroupedFaces(app);
|
||||
await app.goto("/faces");
|
||||
const groupedImage = app.page
|
||||
.locator('img[src*="clips/faces/train/"]')
|
||||
.first();
|
||||
const groupedCard = groupedImage.locator("xpath=..");
|
||||
await expect(groupedImage).toBeVisible({ timeout: 5_000 });
|
||||
await groupedCard.click();
|
||||
const dialog = app.page
|
||||
.getByRole("dialog")
|
||||
.filter({ has: app.page.locator('img[src*="clips/faces/train/"]') })
|
||||
.first();
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
await expect(dialog.locator('img[src*="clips/faces/train/"]')).toHaveCount(2);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the LibrarySelector dropdown (the single button at the top-left of
|
||||
* the Face Library page) and returns the dropdown menu locator.
|
||||
*
|
||||
* The LibrarySelector is a single DropdownMenu whose trigger shows the
|
||||
* current tab name + count (e.g. "Recent Recognitions (0)"). Named face
|
||||
* collections (alice, bob, charlie) are items inside this dropdown.
|
||||
*/
|
||||
async function openLibraryDropdown(app: FrigateApp): Promise<Locator> {
|
||||
// The trigger is the first button on the page with a parenthesised count.
|
||||
const trigger = app.page
|
||||
.getByRole("button")
|
||||
.filter({ hasText: /\(\d+\)/ })
|
||||
.first();
|
||||
await expect(trigger).toBeVisible({ timeout: 10_000 });
|
||||
await trigger.click();
|
||||
const menu = app.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 5_000 });
|
||||
return menu;
|
||||
}
|
||||
|
||||
test.describe("Face Library — collection selector @high", () => {
|
||||
test("selector shows named face collections", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ faces: basicFacesMock() });
|
||||
await frigateApp.goto("/faces");
|
||||
// Named collections appear in the LibrarySelector dropdown.
|
||||
const menu = await openLibraryDropdown(frigateApp);
|
||||
await expect(menu.getByText(/alice/i).first()).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("empty state renders when no faces exist", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ faces: emptyFacesMock() });
|
||||
test.describe("Face Library @medium", () => {
|
||||
test("face library page renders without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/faces");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.locator('img[src*="/clips/faces/"]'),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("tiles render for each named collection", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ faces: basicFacesMock() });
|
||||
await frigateApp.goto("/faces");
|
||||
// Open the dropdown — collections list shows "alice (2)" and "bob (1)".
|
||||
const menu = await openLibraryDropdown(frigateApp);
|
||||
await expect(
|
||||
menu.locator('[role="menuitem"]').filter({ hasText: /alice/i }).first(),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
await expect(
|
||||
menu.locator('[role="menuitem"]').filter({ hasText: /bob/i }).first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Face Library — delete flow (desktop) @high", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Delete action menu is desktop-focused",
|
||||
);
|
||||
|
||||
test("deleting a collection fires POST /faces/<name>/delete", async ({
|
||||
test("face library shows empty state with no faces", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
let deleteUrl: string | null = null;
|
||||
let deleteBody: unknown = null;
|
||||
// Install base mocks first, then register our more-specific route AFTER
|
||||
// so it takes priority over the ApiMocker catch-all (Playwright LIFO order).
|
||||
await frigateApp.installDefaults({ faces: basicFacesMock() });
|
||||
await frigateApp.page.route(
|
||||
/\/api\/faces\/[^/]+\/delete/,
|
||||
async (route) => {
|
||||
deleteUrl = route.request().url();
|
||||
deleteBody = route.request().postDataJSON();
|
||||
await route.fulfill({ json: { success: true } });
|
||||
},
|
||||
);
|
||||
await frigateApp.goto("/faces");
|
||||
|
||||
// Open the LibrarySelector dropdown and click the trash icon next
|
||||
// to the alice row. The trash icon is a ghost-variant Button inside
|
||||
// the DropdownMenuItem — it becomes visible on hover/focus.
|
||||
const menu = await openLibraryDropdown(frigateApp);
|
||||
const aliceRow = menu
|
||||
.locator('[role="menuitem"]')
|
||||
.filter({ hasText: /alice/i })
|
||||
.first();
|
||||
await expect(aliceRow).toBeVisible({ timeout: 5_000 });
|
||||
// Hover first to make hover-only opacity-0 buttons visible.
|
||||
await aliceRow.hover();
|
||||
// The icon buttons have no aria-label or title. The row renders exactly
|
||||
// two buttons in fixed source order: [0] LuPencil (rename), [1] LuTrash2
|
||||
// (delete). This order is determined by FaceLibrary.tsx and is stable.
|
||||
const trashBtn = aliceRow.locator("button").nth(1);
|
||||
await trashBtn.click();
|
||||
|
||||
// The delete confirmation is a Dialog (not AlertDialog) in this flow.
|
||||
const dialog = frigateApp.page.getByRole("dialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
await dialog
|
||||
.getByRole("button", { name: /delete/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect
|
||||
.poll(() => deleteUrl, { timeout: 5_000 })
|
||||
.toMatch(/\/faces\/alice\/delete/);
|
||||
expect(deleteBody).toMatchObject({ ids: expect.any(Array) });
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// With empty faces mock, should show empty state or content
|
||||
const text = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(text?.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Face Library — rename flow (desktop) @high", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Rename action menu is desktop-focused",
|
||||
);
|
||||
|
||||
test("renaming a collection fires PUT /faces/<name>/rename", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
let renameUrl: string | null = null;
|
||||
let renameBody: unknown = null;
|
||||
// Install base mocks first, then register our more-specific route AFTER
|
||||
// so it takes priority over the ApiMocker catch-all (Playwright LIFO order).
|
||||
await frigateApp.installDefaults({ faces: basicFacesMock() });
|
||||
await frigateApp.page.route(
|
||||
/\/api\/faces\/[^/]+\/rename/,
|
||||
async (route) => {
|
||||
renameUrl = route.request().url();
|
||||
renameBody = route.request().postDataJSON();
|
||||
await route.fulfill({ json: { success: true } });
|
||||
},
|
||||
);
|
||||
test("face library has interactive buttons", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/faces");
|
||||
|
||||
// Open the LibrarySelector dropdown and click the pencil (rename) icon
|
||||
// next to alice. The icon is a ghost Button inside the DropdownMenuItem.
|
||||
const menu = await openLibraryDropdown(frigateApp);
|
||||
const aliceRow = menu
|
||||
.locator('[role="menuitem"]')
|
||||
.filter({ hasText: /alice/i })
|
||||
.first();
|
||||
await expect(aliceRow).toBeVisible({ timeout: 5_000 });
|
||||
await aliceRow.hover();
|
||||
// The icon buttons have no aria-label or title. The row renders exactly
|
||||
// two buttons in fixed source order: [0] LuPencil (rename), [1] LuTrash2
|
||||
// (delete). This order is determined by FaceLibrary.tsx and is stable.
|
||||
const pencilBtn = aliceRow.locator("button").nth(0);
|
||||
await pencilBtn.click();
|
||||
|
||||
// TextEntryDialog — fill the input and confirm.
|
||||
const dialog = frigateApp.page.getByRole("dialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
await dialog.locator("input").first().fill("alice_renamed");
|
||||
await dialog
|
||||
.getByRole("button", { name: /save|rename|confirm/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect
|
||||
.poll(() => renameUrl, { timeout: 5_000 })
|
||||
.toMatch(/\/faces\/alice\/rename/);
|
||||
expect(renameBody).toEqual({ new_name: "alice_renamed" });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Face Library — upload flow @high", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Upload button has no accessible text on mobile — icon-only on narrow viewports",
|
||||
);
|
||||
|
||||
test("Upload button opens the upload dialog", async ({ frigateApp }) => {
|
||||
await frigateApp.installDefaults({ faces: basicFacesMock() });
|
||||
await frigateApp.goto("/faces");
|
||||
|
||||
// Navigate to the alice tab by opening the dropdown and clicking alice.
|
||||
const menu = await openLibraryDropdown(frigateApp);
|
||||
await menu
|
||||
.locator('[role="menuitem"]')
|
||||
.filter({ hasText: /alice/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
// After switching to alice, the Upload Image button appears in the toolbar.
|
||||
const uploadBtn = frigateApp.page
|
||||
.getByRole("button")
|
||||
.filter({ hasText: /upload/i })
|
||||
.first();
|
||||
await expect(uploadBtn).toBeVisible({ timeout: 5_000 });
|
||||
await uploadBtn.click();
|
||||
|
||||
// UploadImageDialog renders a file input + confirm button.
|
||||
const dialog = frigateApp.page.getByRole("dialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
await expect(dialog.locator('input[type="file"]')).toHaveCount(1);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("FaceSelectionDialog @high", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Grouped dropdown flow is desktop-only",
|
||||
);
|
||||
|
||||
test("reclassify dropdown selects a name and closes cleanly", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Migrated from radix-overlay-regressions.spec.ts.
|
||||
const dialog = await openGroupedFaceDialog(frigateApp);
|
||||
const triggers = dialog.locator('[aria-haspopup="menu"]');
|
||||
await expect(triggers).toHaveCount(2);
|
||||
|
||||
await triggers.first().click();
|
||||
const menu = frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
await menu.getByRole("menuitem", { name: /^bob$/i }).click();
|
||||
|
||||
await expect(menu).not.toBeVisible({ timeout: 3_000 });
|
||||
await expect(dialog).toBeVisible();
|
||||
|
||||
const tooltipVisible = await frigateApp.page
|
||||
.locator('[role="tooltip"]')
|
||||
.filter({ hasText: /train face/i })
|
||||
.isVisible()
|
||||
.catch(() => false);
|
||||
expect(
|
||||
tooltipVisible,
|
||||
"Train Face tooltip popped after dropdown closed — focus-restore regression",
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
test("second dropdown open accepts typeahead keyboard input", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Migrated from radix-overlay-regressions.spec.ts.
|
||||
const dialog = await openGroupedFaceDialog(frigateApp);
|
||||
const triggers = dialog.locator('[aria-haspopup="menu"]');
|
||||
await expect(triggers).toHaveCount(2);
|
||||
|
||||
await triggers.first().click();
|
||||
let menu = frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 5_000 });
|
||||
await menu.getByRole("menuitem", { name: /^bob$/i }).click();
|
||||
await expect(menu).not.toBeVisible({ timeout: 3_000 });
|
||||
|
||||
await triggers.nth(1).click();
|
||||
menu = frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
await frigateApp.page.keyboard.press("c");
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
frigateApp.page.evaluate(
|
||||
() =>
|
||||
document.activeElement?.textContent?.trim().toLowerCase() ?? "",
|
||||
),
|
||||
{ timeout: 2_000 },
|
||||
)
|
||||
.toMatch(/^charlie/);
|
||||
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await expect(menu).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Face Library — mobile @high @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("mobile library selector dropdown closes cleanly on Escape", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Migrated from radix-overlay-regressions.spec.ts.
|
||||
await installGroupedFaces(frigateApp);
|
||||
await frigateApp.goto("/faces");
|
||||
|
||||
const selector = frigateApp.page
|
||||
.getByRole("button")
|
||||
.filter({ hasText: /\(\d+\)/ })
|
||||
.first();
|
||||
await expect(selector).toBeVisible({ timeout: 5_000 });
|
||||
await selector.click();
|
||||
|
||||
const menu = frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 3_000 });
|
||||
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await expect(menu).not.toBeVisible({ timeout: 3_000 });
|
||||
await waitForBodyInteractive(frigateApp.page);
|
||||
await expectBodyInteractive(frigateApp.page);
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const buttons = frigateApp.page.locator("#pageRoot button");
|
||||
const count = await buttons.count();
|
||||
expect(count).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
+193
-229
@@ -1,47 +1,59 @@
|
||||
/**
|
||||
* Live page tests -- CRITICAL tier.
|
||||
*
|
||||
* Dashboard grid, single-camera controls, feature toggles (with WS
|
||||
* frame assertions), context menu, birdseye, and mobile layout.
|
||||
* Also absorbs the PTZ preset-dropdown regression tests from the
|
||||
* now-deleted ptz-overlay.spec.ts.
|
||||
* Tests camera dashboard rendering, camera card clicks, single camera view
|
||||
* with named controls, feature toggle behavior, context menu, and mobile layout.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { LivePage } from "../pages/live.page";
|
||||
import { installWsFrameCapture, waitForWsFrame } from "../helpers/ws-frames";
|
||||
import {
|
||||
expectBodyInteractive,
|
||||
waitForBodyInteractive,
|
||||
} from "../helpers/overlay-interaction";
|
||||
|
||||
const PTZ_CAMERA = "front_door";
|
||||
const PRESET_NAMES = ["home", "driveway", "front_porch"];
|
||||
|
||||
test.describe("Live Dashboard @critical", () => {
|
||||
test("every configured camera renders on the dashboard", async ({
|
||||
test("dashboard renders all configured cameras by name", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/");
|
||||
const live = new LivePage(frigateApp.page, !frigateApp.isMobile);
|
||||
for (const cam of ["front_door", "backyard", "garage"]) {
|
||||
await expect(live.cameraCard(cam)).toBeVisible({ timeout: 10_000 });
|
||||
await expect(
|
||||
frigateApp.page.locator(`[data-camera='${cam}']`),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
}
|
||||
});
|
||||
|
||||
test("clicking a camera card opens the single-camera view via hash", async ({
|
||||
test("clicking camera card opens single camera view via hash", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/");
|
||||
const live = new LivePage(frigateApp.page, !frigateApp.isMobile);
|
||||
await live.cameraCard("front_door").first().click({ timeout: 10_000 });
|
||||
const card = frigateApp.page.locator("[data-camera='front_door']").first();
|
||||
await card.click({ timeout: 10_000 });
|
||||
await expect(frigateApp.page).toHaveURL(/#front_door/);
|
||||
});
|
||||
|
||||
test("birdseye route renders without crash", async ({ frigateApp }) => {
|
||||
test("back button returns from single camera to dashboard", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// First navigate to dashboard so there's history to go back to
|
||||
await frigateApp.goto("/");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
// Click a camera to enter single view
|
||||
const card = frigateApp.page.locator("[data-camera='front_door']").first();
|
||||
await card.click({ timeout: 10_000 });
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Now click Back to return to dashboard
|
||||
const backBtn = frigateApp.page.getByText("Back", { exact: true });
|
||||
if (await backBtn.isVisible().catch(() => false)) {
|
||||
await backBtn.click();
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
}
|
||||
// Should be back on the dashboard with cameras visible
|
||||
await expect(
|
||||
frigateApp.page.locator("[data-camera='front_door']"),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("birdseye view loads without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/#birdseye");
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
});
|
||||
|
||||
test("empty group shows fallback content", async ({ frigateApp }) => {
|
||||
@@ -51,239 +63,191 @@ test.describe("Live Dashboard @critical", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live Single Camera — desktop controls @critical", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Desktop-only header controls",
|
||||
);
|
||||
|
||||
test("single-camera view shows Back and History buttons", async ({
|
||||
test.describe("Live Single Camera - Controls @critical", () => {
|
||||
test("single camera view shows Back and History buttons (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip(); // On mobile, buttons may show icons only
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/#front_door");
|
||||
const live = new LivePage(frigateApp.page, true);
|
||||
await expect(live.backButton).toBeVisible({ timeout: 5_000 });
|
||||
await expect(live.historyButton).toBeVisible();
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Back and History are visible text buttons in the header
|
||||
await expect(
|
||||
frigateApp.page.getByText("Back", { exact: true }),
|
||||
).toBeVisible({ timeout: 5_000 });
|
||||
await expect(
|
||||
frigateApp.page.getByText("History", { exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("feature toggles render (at least 3)", async ({ frigateApp }) => {
|
||||
test("single camera view shows feature toggle icons (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/#front_door");
|
||||
const live = new LivePage(frigateApp.page, true);
|
||||
// Wait for the single-camera header to render before counting toggles.
|
||||
await expect(live.backButton).toBeVisible({ timeout: 5_000 });
|
||||
await expect(live.featureToggles.first()).toBeVisible({ timeout: 5_000 });
|
||||
const count = await live.featureToggles.count();
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Feature toggles are CameraFeatureToggle components rendered as divs
|
||||
// with bg-selected (active) or bg-secondary (inactive) classes
|
||||
// Count the toggles - should have at least detect, recording, snapshots
|
||||
const toggles = frigateApp.page.locator(
|
||||
".flex.flex-col.items-center.justify-center.bg-selected, .flex.flex-col.items-center.justify-center.bg-secondary",
|
||||
);
|
||||
const count = await toggles.count();
|
||||
expect(count).toBeGreaterThanOrEqual(3);
|
||||
});
|
||||
|
||||
test("clicking a feature toggle sends the matching WS frame", async ({
|
||||
test("clicking a feature toggle changes its visual state (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installWsFrameCapture(frigateApp.page);
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/#front_door");
|
||||
const live = new LivePage(frigateApp.page, true);
|
||||
// Wait for feature toggles to render (WS camera_activity must arrive first).
|
||||
await expect(live.activeFeatureToggles.first()).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
const activeBefore = await live.activeFeatureToggles.count();
|
||||
expect(activeBefore).toBeGreaterThan(0);
|
||||
|
||||
await live.activeFeatureToggles.first().click();
|
||||
|
||||
// The toggle dispatches a frame on <camera>/<feature>/set — match on
|
||||
// front_door/ prefix + /set suffix (any feature).
|
||||
await waitForWsFrame(
|
||||
frigateApp.page,
|
||||
(frame) => frame.includes("front_door/") && frame.includes("/set"),
|
||||
{
|
||||
message:
|
||||
"feature toggle should dispatch a <camera>/<feature>/set frame",
|
||||
},
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Find active toggles (bg-selected class = feature is ON)
|
||||
const activeToggles = frigateApp.page.locator(
|
||||
".flex.flex-col.items-center.justify-center.bg-selected",
|
||||
);
|
||||
const initialCount = await activeToggles.count();
|
||||
if (initialCount > 0) {
|
||||
// Click the first active toggle to disable it
|
||||
await activeToggles.first().click();
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
// After WS mock echoes back new state, count should decrease
|
||||
const newCount = await activeToggles.count();
|
||||
expect(newCount).toBeLessThan(initialCount);
|
||||
}
|
||||
});
|
||||
|
||||
test("keyboard shortcut f does not crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/");
|
||||
await frigateApp.page.keyboard.press("f");
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
// Note: headless Chromium rejects fullscreen requests without a user
|
||||
// gesture, so document.fullscreenElement cannot be asserted reliably
|
||||
// in e2e. We assert the keypress doesn't crash the app; real
|
||||
// fullscreen behavior is covered by manual testing.
|
||||
});
|
||||
|
||||
test("settings gear opens a dropdown with Stream/Play menu items", async ({
|
||||
test("settings gear button opens dropdown (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/#front_door");
|
||||
// Wait for the single-camera view to render — use the Back button
|
||||
// as a deterministic marker.
|
||||
const live = new LivePage(frigateApp.page, true);
|
||||
await expect(live.backButton).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
// The gear icon button is the last button-like element in the
|
||||
// single-camera header. Clicking it opens a Radix dropdown.
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Find the gear icon button (last button-like element in header)
|
||||
// The settings gear opens a dropdown with Stream, Play in background, etc.
|
||||
const gearButtons = frigateApp.page.locator("button:has(svg)");
|
||||
const count = await gearButtons.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
await gearButtons.last().click();
|
||||
|
||||
const menu = frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 3_000 });
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await expect(menu).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live Context Menu (desktop) @critical", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Right-click is desktop-only",
|
||||
);
|
||||
|
||||
test("right-click opens the context menu", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/");
|
||||
const live = new LivePage(frigateApp.page, true);
|
||||
const menu = await live.openContextMenuOn("front_door");
|
||||
await expect(menu).toBeVisible({ timeout: 5_000 });
|
||||
// Click the last one (gear icon is typically last in the header)
|
||||
if (count > 0) {
|
||||
await gearButtons.last().click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
// A dropdown or drawer should appear
|
||||
const overlay = frigateApp.page.locator(
|
||||
'[role="menu"], [data-radix-menu-content], [role="dialog"]',
|
||||
);
|
||||
const visible = await overlay
|
||||
.first()
|
||||
.isVisible()
|
||||
.catch(() => false);
|
||||
if (visible) {
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("context menu closes on Escape and leaves body interactive", async ({
|
||||
test("keyboard shortcut f does not crash on desktop", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
const live = new LivePage(frigateApp.page, true);
|
||||
const menu = await live.openContextMenuOn("front_door");
|
||||
await expect(menu).toBeVisible({ timeout: 5_000 });
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await expect(menu).not.toBeVisible();
|
||||
await waitForBodyInteractive(frigateApp.page);
|
||||
await expectBodyInteractive(frigateApp.page);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live PTZ preset dropdown @critical", () => {
|
||||
// Migrated from ptz-overlay.spec.ts. Guards:
|
||||
// 1. After selecting a preset, the "Presets" tooltip must not re-pop.
|
||||
// 2. Keyboard shortcuts after close should not re-open the dropdown.
|
||||
|
||||
test("selecting a preset closes menu cleanly and does not re-open on keyboard", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "PTZ preset dropdown is desktop-only");
|
||||
|
||||
await frigateApp.api.install({
|
||||
config: {
|
||||
cameras: {
|
||||
[PTZ_CAMERA]: { onvif: { host: "10.0.0.50" } },
|
||||
},
|
||||
},
|
||||
});
|
||||
await frigateApp.page.route(`**/api/${PTZ_CAMERA}/ptz/info`, (route) =>
|
||||
route.fulfill({
|
||||
json: {
|
||||
name: PTZ_CAMERA,
|
||||
features: ["pt", "zoom"],
|
||||
presets: PRESET_NAMES,
|
||||
profiles: [],
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
await installWsFrameCapture(frigateApp.page);
|
||||
await frigateApp.goto(`/#${PTZ_CAMERA}`);
|
||||
|
||||
const presetTrigger = frigateApp.page.getByRole("button", {
|
||||
name: /presets/i,
|
||||
});
|
||||
await expect(presetTrigger.first()).toBeVisible({ timeout: 5_000 });
|
||||
await presetTrigger.first().click();
|
||||
|
||||
const menu = frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first();
|
||||
await expect(menu).toBeVisible({ timeout: 3_000 });
|
||||
|
||||
await menu.getByRole("menuitem", { name: PRESET_NAMES[0] }).first().click();
|
||||
await expect(menu).not.toBeVisible({ timeout: 3_000 });
|
||||
|
||||
await waitForWsFrame(
|
||||
frigateApp.page,
|
||||
(frame) =>
|
||||
frame.includes(`"${PTZ_CAMERA}/ptz"`) &&
|
||||
frame.includes(`preset_${PRESET_NAMES[0]}`),
|
||||
);
|
||||
|
||||
await waitForBodyInteractive(frigateApp.page);
|
||||
await expectBodyInteractive(frigateApp.page);
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
async () =>
|
||||
frigateApp.page
|
||||
.locator('[role="tooltip"]')
|
||||
.filter({ hasText: /presets/i })
|
||||
.isVisible()
|
||||
.catch(() => false),
|
||||
{ timeout: 1_000 },
|
||||
)
|
||||
.toBe(false);
|
||||
|
||||
await frigateApp.page.keyboard.press("ArrowUp");
|
||||
await frigateApp.page.keyboard.press("Space");
|
||||
await frigateApp.page.keyboard.press("Enter");
|
||||
await expect
|
||||
.poll(() => menu.isVisible().catch(() => false), { timeout: 1_000 })
|
||||
.toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live mobile layout @critical @mobile", () => {
|
||||
test("mobile dashboard has no sidebar and renders cameras", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only");
|
||||
await frigateApp.goto("/");
|
||||
await expect(frigateApp.page.locator("aside")).toHaveCount(0);
|
||||
const live = new LivePage(frigateApp.page, false);
|
||||
await expect(live.cameraCard("front_door")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("mobile camera tap opens single view", async ({ frigateApp }) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only");
|
||||
await frigateApp.goto("/");
|
||||
const live = new LivePage(frigateApp.page, false);
|
||||
await live.cameraCard("front_door").first().click({ timeout: 10_000 });
|
||||
await expect(frigateApp.page).toHaveURL(/#front_door/);
|
||||
});
|
||||
|
||||
test("mobile onvif single-camera view loads without freezing body", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only");
|
||||
// Migrated from ptz-overlay.spec.ts — dismissable-layer dedupe smoke test.
|
||||
await frigateApp.api.install({
|
||||
config: {
|
||||
cameras: { [PTZ_CAMERA]: { onvif: { host: "10.0.0.50" } } },
|
||||
},
|
||||
});
|
||||
await frigateApp.page.route(`**/api/${PTZ_CAMERA}/ptz/info`, (route) =>
|
||||
route.fulfill({
|
||||
json: {
|
||||
name: PTZ_CAMERA,
|
||||
features: ["pt", "zoom"],
|
||||
presets: PRESET_NAMES,
|
||||
profiles: [],
|
||||
},
|
||||
}),
|
||||
);
|
||||
await frigateApp.goto(`/#${PTZ_CAMERA}`);
|
||||
await expectBodyInteractive(frigateApp.page);
|
||||
await frigateApp.page.keyboard.press("f");
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live Single Camera - Mobile Controls @critical", () => {
|
||||
test("mobile camera view has settings drawer trigger", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (!frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/#front_door");
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// On mobile, settings gear opens a drawer
|
||||
// The button has aria-label with the camera name like "front_door Settings"
|
||||
const buttons = frigateApp.page.locator("button:has(svg)");
|
||||
const count = await buttons.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live Context Menu @critical", () => {
|
||||
test("right-click on camera opens context menu on desktop", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
const card = frigateApp.page.locator("[data-camera='front_door']").first();
|
||||
await card.waitFor({ state: "visible", timeout: 10_000 });
|
||||
await card.click({ button: "right" });
|
||||
const contextMenu = frigateApp.page.locator(
|
||||
'[role="menu"], [data-radix-menu-content]',
|
||||
);
|
||||
await expect(contextMenu.first()).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test("context menu closes on escape", async ({ frigateApp }) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
const card = frigateApp.page.locator("[data-camera='front_door']").first();
|
||||
await card.waitFor({ state: "visible", timeout: 10_000 });
|
||||
await card.click({ button: "right" });
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await frigateApp.page.waitForTimeout(300);
|
||||
const contextMenu = frigateApp.page.locator(
|
||||
'[role="menu"], [data-radix-menu-content]',
|
||||
);
|
||||
await expect(contextMenu).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Live Mobile Layout @critical", () => {
|
||||
test("mobile renders cameras without sidebar", async ({ frigateApp }) => {
|
||||
if (!frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
await expect(frigateApp.page.locator("aside")).not.toBeVisible();
|
||||
await expect(
|
||||
frigateApp.page.locator("[data-camera='front_door']"),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("mobile camera click opens single camera view", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (!frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
const card = frigateApp.page.locator("[data-camera='front_door']").first();
|
||||
await card.click({ timeout: 10_000 });
|
||||
await expect(frigateApp.page).toHaveURL(/#front_door/);
|
||||
});
|
||||
});
|
||||
|
||||
+45
-192
@@ -1,222 +1,75 @@
|
||||
/**
|
||||
* Logs page tests -- MEDIUM tier.
|
||||
*
|
||||
* Service tabs (with real /logs/<service> JSON contract),
|
||||
* log content render, Copy (clipboard), Download (assert
|
||||
* ?download=true request fired), mobile tab selector.
|
||||
* Tests service tab switching by name, copy/download buttons,
|
||||
* and websocket message feed tab.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { grantClipboardPermissions, readClipboard } from "../helpers/clipboard";
|
||||
|
||||
function logsJsonBody(lines: string[]) {
|
||||
return { lines, totalLines: lines.length };
|
||||
}
|
||||
|
||||
test.describe("Logs — service tabs @medium", () => {
|
||||
test("frigate tab renders by default with mocked log lines", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) =>
|
||||
route.fulfill({
|
||||
json: logsJsonBody([
|
||||
"[2026-04-06 10:00:00] INFO: Frigate started",
|
||||
"[2026-04-06 10:00:01] INFO: Cameras loaded",
|
||||
]),
|
||||
}),
|
||||
);
|
||||
// Silence the streaming fetch so it doesn't hang the test.
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate\?stream=true/, (route) =>
|
||||
route.fulfill({ status: 200, body: "" }),
|
||||
);
|
||||
test.describe("Logs Page - Service Tabs @medium", () => {
|
||||
test("logs page renders with named service tabs", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/logs");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
// Service tabs have aria-label="Select {service}"
|
||||
await expect(frigateApp.page.getByLabel("Select frigate")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
await expect(frigateApp.page.getByText(/Frigate started/)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("switching to go2rtc fires a GET to /logs/go2rtc", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
let go2rtcCalled = false;
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) =>
|
||||
route.fulfill({ json: logsJsonBody(["frigate line"]) }),
|
||||
);
|
||||
await frigateApp.page.route(/\/api\/logs\/go2rtc(\?|$)/, (route) => {
|
||||
if (!route.request().url().includes("stream=true")) {
|
||||
go2rtcCalled = true;
|
||||
}
|
||||
return route.fulfill({ json: logsJsonBody(["go2rtc line"]) });
|
||||
});
|
||||
await frigateApp.page.route(/\/api\/logs\/.*\?stream=true/, (route) =>
|
||||
route.fulfill({ status: 200, body: "" }),
|
||||
);
|
||||
|
||||
test("switching to go2rtc tab changes active tab", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/logs");
|
||||
await expect(frigateApp.page.getByLabel("Select frigate")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const go2rtcTab = frigateApp.page.getByLabel("Select go2rtc");
|
||||
await expect(go2rtcTab).toBeVisible();
|
||||
await go2rtcTab.click();
|
||||
await expect.poll(() => go2rtcCalled, { timeout: 5_000 }).toBe(true);
|
||||
await expect(go2rtcTab).toHaveAttribute("data-state", "on");
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Logs — actions @medium", () => {
|
||||
test("Copy button writes current logs to clipboard", async ({
|
||||
frigateApp,
|
||||
context,
|
||||
}) => {
|
||||
await grantClipboardPermissions(context);
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) =>
|
||||
route.fulfill({
|
||||
json: logsJsonBody([
|
||||
"[2026-04-06 10:00:00] INFO: Frigate started",
|
||||
"[2026-04-06 10:00:01] INFO: Cameras loaded",
|
||||
]),
|
||||
}),
|
||||
);
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate\?stream=true/, (route) =>
|
||||
route.fulfill({ status: 200, body: "" }),
|
||||
);
|
||||
await frigateApp.goto("/logs");
|
||||
await expect(frigateApp.page.getByText(/Frigate started/)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
|
||||
const copyBtn = frigateApp.page.getByLabel("Copy to Clipboard");
|
||||
await expect(copyBtn).toBeVisible({ timeout: 5_000 });
|
||||
await copyBtn.click();
|
||||
await expect
|
||||
.poll(() => readClipboard(frigateApp.page), { timeout: 5_000 })
|
||||
.toContain("Frigate started");
|
||||
if (await go2rtcTab.isVisible().catch(() => false)) {
|
||||
await go2rtcTab.click();
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
await expect(go2rtcTab).toHaveAttribute("data-state", "on");
|
||||
}
|
||||
});
|
||||
|
||||
test("Download button fires GET /logs/<service>?download=true", async ({
|
||||
test("switching to websocket tab shows message feed", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
let downloadCalled = false;
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) => {
|
||||
if (route.request().url().includes("download=true")) {
|
||||
downloadCalled = true;
|
||||
}
|
||||
return route.fulfill({ json: logsJsonBody(["frigate line"]) });
|
||||
});
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate\?stream=true/, (route) =>
|
||||
route.fulfill({ status: 200, body: "" }),
|
||||
);
|
||||
|
||||
await frigateApp.goto("/logs");
|
||||
const downloadBtn = frigateApp.page.getByLabel("Download Logs");
|
||||
await expect(downloadBtn).toBeVisible({ timeout: 5_000 });
|
||||
await downloadBtn.click();
|
||||
await expect.poll(() => downloadCalled, { timeout: 5_000 }).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Logs — websocket tab @medium", () => {
|
||||
test("switching to websocket tab renders WsMessageFeed container", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) =>
|
||||
route.fulfill({ json: logsJsonBody(["frigate line"]) }),
|
||||
);
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate\?stream=true/, (route) =>
|
||||
route.fulfill({ status: 200, body: "" }),
|
||||
);
|
||||
await frigateApp.goto("/logs");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const wsTab = frigateApp.page.getByLabel("Select websocket");
|
||||
await expect(wsTab).toBeVisible({ timeout: 5_000 });
|
||||
await wsTab.click();
|
||||
await expect(wsTab).toHaveAttribute("data-state", "on", { timeout: 5_000 });
|
||||
if (await wsTab.isVisible().catch(() => false)) {
|
||||
await wsTab.click();
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
await expect(wsTab).toHaveAttribute("data-state", "on");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Logs — streaming @medium", () => {
|
||||
test("streamed log lines appear in the viewport", async ({ frigateApp }) => {
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) => {
|
||||
if (route.request().url().includes("stream=true")) {
|
||||
// Intercepted below via addInitScript fetch override.
|
||||
return route.fallback();
|
||||
}
|
||||
return route.fulfill({
|
||||
json: logsJsonBody(["[2026-04-06 10:00:00] INFO: initial batch line"]),
|
||||
});
|
||||
});
|
||||
|
||||
// Override window.fetch so the /api/logs/frigate?stream=true request
|
||||
// resolves with a real ReadableStream that emits chunks over time.
|
||||
// This is the only way to validate streaming-append behavior through
|
||||
// Playwright — route.fulfill() cannot return a stream.
|
||||
// NOTE: The app calls fetch('api/logs/...') with a relative URL (no
|
||||
// leading slash), so we match both relative and absolute forms.
|
||||
await frigateApp.page.addInitScript(() => {
|
||||
const origFetch = window.fetch;
|
||||
window.fetch = async (input, init) => {
|
||||
const url =
|
||||
typeof input === "string"
|
||||
? input
|
||||
: input instanceof URL
|
||||
? input.toString()
|
||||
: (input as Request).url;
|
||||
if (url.includes("api/logs/frigate") && url.includes("stream=true")) {
|
||||
const encoder = new TextEncoder();
|
||||
const stream = new ReadableStream({
|
||||
async start(controller) {
|
||||
await new Promise((r) => setTimeout(r, 30));
|
||||
controller.enqueue(
|
||||
encoder.encode(
|
||||
"[2026-04-06 10:00:02] INFO: streamed line one\n",
|
||||
),
|
||||
);
|
||||
await new Promise((r) => setTimeout(r, 30));
|
||||
controller.enqueue(
|
||||
encoder.encode(
|
||||
"[2026-04-06 10:00:03] INFO: streamed line two\n",
|
||||
),
|
||||
);
|
||||
controller.close();
|
||||
},
|
||||
});
|
||||
return new Response(stream, { status: 200 });
|
||||
}
|
||||
return origFetch.call(window, input as RequestInfo, init);
|
||||
};
|
||||
});
|
||||
|
||||
test.describe("Logs Page - Actions @medium", () => {
|
||||
test("copy to clipboard button is present and clickable", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/logs");
|
||||
// The initial batch line is parsed by LogLineData and its content is
|
||||
// rendered in a .log-content cell — assert against that element.
|
||||
await expect(frigateApp.page.getByText("initial batch line")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(frigateApp.page.getByText(/streamed line one/)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(frigateApp.page.getByText(/streamed line two/)).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const copyBtn = frigateApp.page.getByLabel("Copy to Clipboard");
|
||||
if (await copyBtn.isVisible().catch(() => false)) {
|
||||
await copyBtn.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
// Should trigger clipboard copy (toast may appear)
|
||||
}
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Logs — mobile @medium @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("service tabs render at mobile viewport", async ({ frigateApp }) => {
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate(\?|$)/, (route) =>
|
||||
route.fulfill({ json: logsJsonBody(["frigate line"]) }),
|
||||
);
|
||||
await frigateApp.page.route(/\/api\/logs\/frigate\?stream=true/, (route) =>
|
||||
route.fulfill({ status: 200, body: "" }),
|
||||
);
|
||||
test("download logs button is present", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/logs");
|
||||
await expect(frigateApp.page.getByLabel("Select frigate")).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const downloadBtn = frigateApp.page.getByLabel("Download Logs");
|
||||
if (await downloadBtn.isVisible().catch(() => false)) {
|
||||
await expect(downloadBtn).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("logs page displays log content text", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/logs");
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const text = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(text?.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,78 +1,103 @@
|
||||
/**
|
||||
* Navigation tests -- CRITICAL tier.
|
||||
*
|
||||
* Covers sidebar (desktop) / bottombar (mobile) link set, conditional
|
||||
* nav items (faces, chat, classification), settings menu navigation,
|
||||
* unknown-route redirect to /, and mobile-specific nav behaviors.
|
||||
* Tests sidebar (desktop) and bottombar (mobile) navigation,
|
||||
* conditional nav items, settings menus, and their actual behaviors.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { BasePage } from "../pages/base.page";
|
||||
|
||||
const PRIMARY_ROUTES = ["/review", "/explore", "/export"] as const;
|
||||
test.describe("Navigation @critical", () => {
|
||||
test("app loads and renders page root", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/");
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
});
|
||||
|
||||
test.describe("Navigation — primary links @critical", () => {
|
||||
test("every primary link is visible and navigates", async ({
|
||||
test("logo is visible and links to home", async ({ frigateApp }) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
const base = new BasePage(frigateApp.page, true);
|
||||
const logo = base.sidebar.locator('a[href="/"]').first();
|
||||
await expect(logo).toBeVisible();
|
||||
});
|
||||
|
||||
test("all primary nav links are present and navigate", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/");
|
||||
for (const route of PRIMARY_ROUTES) {
|
||||
const routes = ["/review", "/explore", "/export"];
|
||||
for (const route of routes) {
|
||||
await expect(
|
||||
frigateApp.page.locator(`a[href="${route}"]`).first(),
|
||||
).toBeVisible();
|
||||
}
|
||||
// Verify clicking each one actually navigates
|
||||
const base = new BasePage(frigateApp.page, !frigateApp.isMobile);
|
||||
for (const route of PRIMARY_ROUTES) {
|
||||
for (const route of routes) {
|
||||
await base.navigateTo(route);
|
||||
await expect(frigateApp.page).toHaveURL(new RegExp(route));
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("logo links home on desktop", async ({ frigateApp }) => {
|
||||
test.skip(frigateApp.isMobile, "Sidebar logo is desktop-only");
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.locator("aside a[href='/']").first().click();
|
||||
await expect(frigateApp.page).toHaveURL(/\/$/);
|
||||
test("desktop sidebar is visible, mobile bottombar is visible", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/");
|
||||
const base = new BasePage(frigateApp.page, !frigateApp.isMobile);
|
||||
if (!frigateApp.isMobile) {
|
||||
await expect(base.sidebar).toBeVisible();
|
||||
} else {
|
||||
await expect(base.sidebar).not.toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("unknown route redirects to /", async ({ frigateApp }) => {
|
||||
test("navigate between all main pages without crash", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/");
|
||||
const base = new BasePage(frigateApp.page, !frigateApp.isMobile);
|
||||
const pageRoot = frigateApp.page.locator("#pageRoot");
|
||||
|
||||
await base.navigateTo("/review");
|
||||
await expect(pageRoot).toBeVisible({ timeout: 10_000 });
|
||||
await base.navigateTo("/explore");
|
||||
await expect(pageRoot).toBeVisible({ timeout: 10_000 });
|
||||
await base.navigateTo("/export");
|
||||
await expect(pageRoot).toBeVisible({ timeout: 10_000 });
|
||||
await base.navigateTo("/review");
|
||||
await expect(pageRoot).toBeVisible({ timeout: 10_000 });
|
||||
});
|
||||
|
||||
test("unknown route redirects to home", async ({ frigateApp }) => {
|
||||
await frigateApp.page.goto("/nonexistent-route");
|
||||
await frigateApp.page.waitForSelector("#pageRoot", { timeout: 10_000 });
|
||||
await expect(frigateApp.page).toHaveURL(/\/$/);
|
||||
await expect(
|
||||
frigateApp.page.locator("[data-camera='front_door']"),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const url = frigateApp.page.url();
|
||||
const hasPageRoot = await frigateApp.page
|
||||
.locator("#pageRoot")
|
||||
.isVisible()
|
||||
.catch(() => false);
|
||||
expect(url.endsWith("/") || hasPageRoot).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Navigation — conditional items @critical", () => {
|
||||
test("/faces is hidden when face_recognition.enabled is false", async ({
|
||||
test.describe("Navigation - Conditional Items @critical", () => {
|
||||
test("Faces nav hidden when face_recognition disabled", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/faces"]').first(),
|
||||
).toHaveCount(0);
|
||||
await expect(frigateApp.page.locator('a[href="/faces"]')).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("/faces is visible when face_recognition.enabled is true (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop sidebar");
|
||||
await frigateApp.installDefaults({
|
||||
config: { face_recognition: { enabled: true } },
|
||||
});
|
||||
await frigateApp.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/faces"]').first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("/chat is hidden when genai.model is none (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop sidebar");
|
||||
test("Chat nav hidden when genai model is none", async ({ frigateApp }) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.installDefaults({
|
||||
config: {
|
||||
genai: {
|
||||
@@ -84,83 +109,119 @@ test.describe("Navigation — conditional items @critical", () => {
|
||||
},
|
||||
});
|
||||
await frigateApp.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/chat"]').first(),
|
||||
).toHaveCount(0);
|
||||
await expect(frigateApp.page.locator('a[href="/chat"]')).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("/chat is visible when genai.model is set (desktop)", async ({
|
||||
test("Faces nav visible when face_recognition enabled on desktop", async ({
|
||||
frigateApp,
|
||||
page,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop sidebar");
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.installDefaults({
|
||||
config: { face_recognition: { enabled: true } },
|
||||
});
|
||||
await frigateApp.goto("/");
|
||||
await expect(page.locator('a[href="/faces"]')).toBeVisible();
|
||||
});
|
||||
|
||||
test("Chat nav visible when genai model set on desktop", async ({
|
||||
frigateApp,
|
||||
page,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.installDefaults({
|
||||
config: { genai: { enabled: true, model: "llava" } },
|
||||
});
|
||||
await frigateApp.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/chat"]').first(),
|
||||
).toBeVisible();
|
||||
await expect(page.locator('a[href="/chat"]')).toBeVisible();
|
||||
});
|
||||
|
||||
test("/classification is visible for admin on desktop", async ({
|
||||
test("Classification nav visible for admin on desktop", async ({
|
||||
frigateApp,
|
||||
page,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop sidebar");
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/classification"]').first(),
|
||||
).toBeVisible();
|
||||
await expect(page.locator('a[href="/classification"]')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Navigation — settings menu (desktop) @critical", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Sidebar settings menu is desktop-only",
|
||||
);
|
||||
test.describe("Navigation - Settings Menu @critical", () => {
|
||||
test("settings gear opens menu with navigation items (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
// Settings gear is in the sidebar bottom section, a div with cursor-pointer
|
||||
const sidebarBottom = frigateApp.page.locator("aside .mb-8");
|
||||
const gearIcon = sidebarBottom
|
||||
.locator("div[class*='cursor-pointer']")
|
||||
.first();
|
||||
await expect(gearIcon).toBeVisible({ timeout: 5_000 });
|
||||
await gearIcon.click();
|
||||
// Menu should open - look for the "Settings" menu item by aria-label
|
||||
await expect(frigateApp.page.getByLabel("Settings")).toBeVisible({
|
||||
timeout: 3_000,
|
||||
});
|
||||
});
|
||||
|
||||
const TARGETS = [
|
||||
{ label: "Settings", url: /\/settings/ },
|
||||
{ label: "System metrics", url: /\/system/ },
|
||||
{ label: "System logs", url: /\/logs/ },
|
||||
{ label: "Configuration Editor", url: /\/config/ },
|
||||
];
|
||||
|
||||
for (const target of TARGETS) {
|
||||
test(`menu → ${target.label} navigates`, async ({ frigateApp }) => {
|
||||
test("settings menu items navigate to correct routes (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
const targets = [
|
||||
{ label: "Settings", url: "/settings" },
|
||||
{ label: "System metrics", url: "/system" },
|
||||
{ label: "System logs", url: "/logs" },
|
||||
{ label: "Configuration Editor", url: "/config" },
|
||||
];
|
||||
for (const target of targets) {
|
||||
await frigateApp.goto("/");
|
||||
const gear = frigateApp.page
|
||||
const gearIcon = frigateApp.page
|
||||
.locator("aside .mb-8 div[class*='cursor-pointer']")
|
||||
.first();
|
||||
await gear.click();
|
||||
await frigateApp.page.getByLabel(target.label).click();
|
||||
await expect(frigateApp.page).toHaveURL(target.url);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test.describe("Navigation — mobile @critical @mobile", () => {
|
||||
test("mobile bottombar visible, sidebar not rendered", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only");
|
||||
await frigateApp.goto("/");
|
||||
await expect(frigateApp.page.locator("aside")).toHaveCount(0);
|
||||
for (const route of PRIMARY_ROUTES) {
|
||||
await expect(
|
||||
frigateApp.page.locator(`a[href="${route}"]`).first(),
|
||||
).toBeVisible();
|
||||
await gearIcon.click();
|
||||
await frigateApp.page.waitForTimeout(300);
|
||||
const menuItem = frigateApp.page.getByLabel(target.label);
|
||||
if (await menuItem.isVisible().catch(() => false)) {
|
||||
await menuItem.click();
|
||||
await expect(frigateApp.page).toHaveURL(
|
||||
new RegExp(target.url.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("mobile nav survives route change", async ({ frigateApp }) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile-only");
|
||||
test("account button in sidebar is clickable (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/");
|
||||
const reviewLink = frigateApp.page.locator('a[href="/review"]').first();
|
||||
await reviewLink.click();
|
||||
await expect(frigateApp.page).toHaveURL(/\/review/);
|
||||
await expect(
|
||||
frigateApp.page.locator('a[href="/review"]').first(),
|
||||
).toBeVisible();
|
||||
const sidebarBottom = frigateApp.page.locator("aside .mb-8");
|
||||
const items = sidebarBottom.locator("div[class*='cursor-pointer']");
|
||||
const count = await items.count();
|
||||
if (count >= 2) {
|
||||
await items.nth(1).click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
}
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
+11
-292
@@ -1,304 +1,23 @@
|
||||
/**
|
||||
* Replay page tests -- MEDIUM tier.
|
||||
* Replay page tests -- LOW tier.
|
||||
*
|
||||
* /replay is the admin debug replay page (not a recordings player).
|
||||
* Polls /api/debug_replay/status, renders a no-session state when
|
||||
* inactive, and a live camera image + debug toggles + Stop controls
|
||||
* when active.
|
||||
* Tests replay page rendering and basic interactivity.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import {
|
||||
activeSessionStatus,
|
||||
noSessionStatus,
|
||||
} from "../fixtures/mock-data/debug-replay";
|
||||
|
||||
async function installStatusRoute(
|
||||
app: { page: import("@playwright/test").Page },
|
||||
body: unknown,
|
||||
) {
|
||||
await app.page.route("**/api/debug_replay/status", (route) =>
|
||||
route.fulfill({ json: body }),
|
||||
);
|
||||
}
|
||||
|
||||
test.describe("Replay — no active session @medium", () => {
|
||||
test("empty state renders heading + Go to History button", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, noSessionStatus());
|
||||
test.describe("Replay Page @low", () => {
|
||||
test("replay page renders without crash", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
level: 2,
|
||||
name: /No Active Replay Session/i,
|
||||
}),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
const goButton = frigateApp.page.getByRole("button", {
|
||||
name: /Go to History|Go to Recordings/i,
|
||||
});
|
||||
await expect(goButton).toBeVisible();
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
});
|
||||
|
||||
test("clicking Go to History navigates to /review", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, noSessionStatus());
|
||||
test("replay page has interactive controls", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
level: 2,
|
||||
name: /No Active Replay Session/i,
|
||||
}),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /Go to History|Go to Recordings/i })
|
||||
.click();
|
||||
await expect(frigateApp.page).toHaveURL(/\/review/);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Replay — active session @medium", () => {
|
||||
test("active status renders the Debug Replay side panel", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
// Three tabs (Debug / Objects / Messages) in TabsList
|
||||
await expect(frigateApp.page.locator('[role="tab"]')).toHaveCount(3);
|
||||
});
|
||||
|
||||
test("debug toggles render with bbox ON by default", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
const bbox = frigateApp.page.locator("#debug-bbox");
|
||||
await expect(bbox).toBeVisible({ timeout: 10_000 });
|
||||
await expect(bbox).toHaveAttribute("aria-checked", "true");
|
||||
});
|
||||
|
||||
test("clicking bbox toggle flips aria-checked", async ({ frigateApp }) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
const bbox = frigateApp.page.locator("#debug-bbox");
|
||||
await expect(bbox).toBeVisible({ timeout: 10_000 });
|
||||
await expect(bbox).toHaveAttribute("aria-checked", "true");
|
||||
await bbox.click();
|
||||
await expect(bbox).toHaveAttribute("aria-checked", "false");
|
||||
});
|
||||
|
||||
test("Configuration button opens the configuration dialog (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(frigateApp.isMobile, "Desktop: button has visible text label");
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
// On desktop the span is visible and gives the button an accessible name.
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /configuration/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const dialog = frigateApp.page.getByRole("dialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test("Configuration button opens the configuration dialog (mobile)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.skip(!frigateApp.isMobile, "Mobile: button is icon-only");
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
// On mobile the Configuration button text span is hidden (md:inline).
|
||||
// It is the first button inside the right-side action group div
|
||||
// (the flex container that holds Config + Stop, sibling of the Back button).
|
||||
const actionGroup = frigateApp.page.locator(
|
||||
".flex.items-center.gap-2 button",
|
||||
);
|
||||
await actionGroup.first().click();
|
||||
|
||||
const dialog = frigateApp.page.getByRole("dialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 5_000 });
|
||||
});
|
||||
|
||||
test("Objects tab renders with the camera_activity objects list", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
// Send an activity payload with a person object on front_door.
|
||||
// Must be called after goto() so the WS connection is established.
|
||||
await frigateApp.ws.sendCameraActivity({
|
||||
front_door: {
|
||||
objects: [
|
||||
{
|
||||
label: "person",
|
||||
score: 0.95,
|
||||
box: [0.1, 0.1, 0.5, 0.8],
|
||||
area: 0.2,
|
||||
ratio: 0.6,
|
||||
region: [0.05, 0.05, 0.6, 0.85],
|
||||
current_zones: [],
|
||||
id: "obj-person-1",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
// Switch to Objects tab (labelled "Object List" in i18n).
|
||||
const objectsTab = frigateApp.page.getByRole("tab", {
|
||||
name: /object/i,
|
||||
});
|
||||
await objectsTab.click();
|
||||
await expect(objectsTab).toHaveAttribute("data-state", "active", {
|
||||
timeout: 3_000,
|
||||
});
|
||||
|
||||
// The object row renders the label.
|
||||
await expect(frigateApp.page.getByText(/person/i).first()).toBeVisible({
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("Messages tab renders WsMessageFeed container", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
const messagesTab = frigateApp.page.getByRole("tab", {
|
||||
name: /messages/i,
|
||||
});
|
||||
await messagesTab.click();
|
||||
await expect(messagesTab).toHaveAttribute("data-state", "active", {
|
||||
timeout: 3_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("bbox info popover opens and closes cleanly", async ({ frigateApp }) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
// The bbox row has an info icon popover trigger next to its label.
|
||||
// The trigger is a div (not button) wrapping LuInfo with an sr-only
|
||||
// "Info" span. Target it by the sr-only text content.
|
||||
const infoTrigger = frigateApp.page
|
||||
.locator("span.sr-only", { hasText: /info/i })
|
||||
.first();
|
||||
await expect(infoTrigger).toBeVisible({ timeout: 10_000 });
|
||||
// Click the parent div (the actual trigger)
|
||||
await infoTrigger.locator("..").click();
|
||||
|
||||
const popover = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper]",
|
||||
);
|
||||
await expect(popover.first()).toBeVisible({ timeout: 3_000 });
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await expect(popover.first()).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Replay — stop flow (desktop) @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Desktop button has accessible 'Stop Replay' name",
|
||||
);
|
||||
|
||||
test("Stop Replay opens confirm dialog; confirm POSTs debug_replay/stop", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
let stopCalled = false;
|
||||
await frigateApp.page.route("**/api/debug_replay/stop", async (route) => {
|
||||
if (route.request().method() === "POST") stopCalled = true;
|
||||
await route.fulfill({ json: { success: true } });
|
||||
});
|
||||
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: /stop replay/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
const dialog = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 3_000 });
|
||||
await dialog
|
||||
.getByRole("button", { name: /stop|confirm/i })
|
||||
.first()
|
||||
.click();
|
||||
await expect.poll(() => stopCalled, { timeout: 5_000 }).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Replay — stop button (mobile) @medium @mobile", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => !frigateApp.isMobile,
|
||||
"Mobile-only icon-button variant",
|
||||
);
|
||||
|
||||
test("tapping the icon-only stop button opens the confirm dialog", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, activeSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", { level: 3, name: /Debug Replay/i }),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
// On mobile the Stop button is an icon (LuSquare) inside an
|
||||
// AlertDialogTrigger. It's the last button in the top bar's
|
||||
// right-side action group (Back is on the left). Target by
|
||||
// position within the top-bar flex container.
|
||||
const topRightButtons = frigateApp.page
|
||||
.locator(".min-h-12 button, .md\\:min-h-16 button")
|
||||
.filter({ hasNot: frigateApp.page.getByLabel("Back") });
|
||||
const lastButton = topRightButtons.last();
|
||||
await expect(lastButton).toBeVisible({ timeout: 10_000 });
|
||||
await lastButton.click();
|
||||
|
||||
const dialog = frigateApp.page.getByRole("alertdialog");
|
||||
await expect(dialog).toBeVisible({ timeout: 3_000 });
|
||||
await dialog.getByRole("button", { name: /cancel/i }).click();
|
||||
await expect(dialog).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Replay — mobile @medium @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("no-session state renders at mobile viewport", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await installStatusRoute(frigateApp, noSessionStatus());
|
||||
await frigateApp.goto("/replay");
|
||||
await expect(
|
||||
frigateApp.page.getByRole("heading", {
|
||||
level: 2,
|
||||
name: /No Active Replay Session/i,
|
||||
}),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const buttons = frigateApp.page.locator("button");
|
||||
const count = await buttons.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
+157
-187
@@ -1,230 +1,200 @@
|
||||
/**
|
||||
* Review/Events page tests -- CRITICAL tier.
|
||||
*
|
||||
* Severity tabs, filter popovers, calendar, show-reviewed toggle,
|
||||
* timeline, and the nested-overlay regression migrated from
|
||||
* radix-overlay-regressions.spec.ts.
|
||||
* Tests severity tab switching by name (Alerts/Detections/Motion),
|
||||
* filter popover opening with camera names, show reviewed toggle,
|
||||
* calendar button, and filter button interactions.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import { BasePage } from "../pages/base.page";
|
||||
import { ReviewPage } from "../pages/review.page";
|
||||
import {
|
||||
expectBodyInteractive,
|
||||
waitForBodyInteractive,
|
||||
} from "../helpers/overlay-interaction";
|
||||
|
||||
test.describe("Review — severity tabs @critical", () => {
|
||||
test("tabs render with Alerts default-on", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, !frigateApp.isMobile);
|
||||
await expect(review.alertsTab).toBeVisible({ timeout: 10_000 });
|
||||
await expect(review.detectionsTab).toBeVisible();
|
||||
await expect(review.motionTab).toBeVisible();
|
||||
await expect(review.alertsTab).toHaveAttribute("data-state", "on");
|
||||
});
|
||||
|
||||
test("clicking Detections flips data-state", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, !frigateApp.isMobile);
|
||||
await expect(review.alertsTab).toBeVisible({ timeout: 10_000 });
|
||||
await review.detectionsTab.click();
|
||||
await expect(review.detectionsTab).toHaveAttribute("data-state", "on");
|
||||
await expect(review.alertsTab).toHaveAttribute("data-state", "off");
|
||||
});
|
||||
|
||||
test("clicking Motion flips data-state", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, !frigateApp.isMobile);
|
||||
await expect(review.alertsTab).toBeVisible({ timeout: 10_000 });
|
||||
await review.motionTab.click();
|
||||
await expect(review.motionTab).toHaveAttribute("data-state", "on");
|
||||
});
|
||||
|
||||
test("switching back to Alerts works", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, !frigateApp.isMobile);
|
||||
await review.detectionsTab.click();
|
||||
await expect(review.detectionsTab).toHaveAttribute("data-state", "on");
|
||||
await review.alertsTab.click();
|
||||
await expect(review.alertsTab).toHaveAttribute("data-state", "on");
|
||||
});
|
||||
|
||||
test("switching tabs updates active data-state (client-side filter)", async ({
|
||||
test.describe("Review Page - Severity Tabs @critical", () => {
|
||||
test("severity tabs render with Alerts, Detections, Motion", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// The severity tabs filter the already-fetched review data client-side;
|
||||
// they do not trigger a new /api/review network request. This test
|
||||
// verifies the state-change assertion that the tab switch takes effect.
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, !frigateApp.isMobile);
|
||||
await expect(review.alertsTab).toBeVisible({ timeout: 10_000 });
|
||||
await expect(review.alertsTab).toHaveAttribute("data-state", "on");
|
||||
await review.detectionsTab.click();
|
||||
await expect(review.detectionsTab).toHaveAttribute("data-state", "on");
|
||||
await expect(review.alertsTab).toHaveAttribute("data-state", "off");
|
||||
await expect(frigateApp.page.getByLabel("Alerts")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await expect(frigateApp.page.getByLabel("Detections")).toBeVisible();
|
||||
// Motion uses role="radio" to distinguish from other Motion elements
|
||||
await expect(
|
||||
frigateApp.page.getByRole("radio", { name: "Motion" }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("Alerts tab is active by default", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const alertsTab = frigateApp.page.getByLabel("Alerts");
|
||||
await expect(alertsTab).toHaveAttribute("data-state", "on");
|
||||
});
|
||||
|
||||
test("clicking Detections tab makes it active and deactivates Alerts", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const alertsTab = frigateApp.page.getByLabel("Alerts");
|
||||
const detectionsTab = frigateApp.page.getByLabel("Detections");
|
||||
|
||||
await detectionsTab.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
|
||||
await expect(detectionsTab).toHaveAttribute("data-state", "on");
|
||||
await expect(alertsTab).toHaveAttribute("data-state", "off");
|
||||
});
|
||||
|
||||
test("clicking Motion tab makes it active", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
const motionTab = frigateApp.page.getByRole("radio", { name: "Motion" });
|
||||
await motionTab.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
await expect(motionTab).toHaveAttribute("data-state", "on");
|
||||
});
|
||||
|
||||
test("switching back to Alerts from Detections works", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
|
||||
await frigateApp.page.getByLabel("Detections").click();
|
||||
await frigateApp.page.waitForTimeout(300);
|
||||
await frigateApp.page.getByLabel("Alerts").click();
|
||||
await frigateApp.page.waitForTimeout(300);
|
||||
|
||||
await expect(frigateApp.page.getByLabel("Alerts")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Review — filters (desktop) @critical", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Filter bar differs on mobile",
|
||||
);
|
||||
|
||||
test("Cameras popover lists configured camera names", async ({
|
||||
test.describe("Review Page - Filters @critical", () => {
|
||||
test("All Cameras filter button opens popover with camera names", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, true);
|
||||
await expect(review.camerasFilterTrigger).toBeVisible({ timeout: 5_000 });
|
||||
await review.camerasFilterTrigger.click();
|
||||
await expect(review.filterOverlay).toBeVisible({ timeout: 3_000 });
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
|
||||
const camerasBtn = frigateApp.page.getByRole("button", {
|
||||
name: /cameras/i,
|
||||
});
|
||||
await expect(camerasBtn).toBeVisible({ timeout: 5_000 });
|
||||
await camerasBtn.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
|
||||
// Popover should open with camera names from config
|
||||
const popover = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper]",
|
||||
);
|
||||
await expect(popover.first()).toBeVisible({ timeout: 3_000 });
|
||||
// Camera names should be present
|
||||
await expect(frigateApp.page.getByText("Front Door")).toBeVisible();
|
||||
});
|
||||
|
||||
test("closing the Cameras popover with Escape leaves body interactive", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Migrated from radix-overlay-regressions.spec.ts.
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, true);
|
||||
await review.camerasFilterTrigger.click();
|
||||
await expect(review.filterOverlay).toBeVisible({ timeout: 3_000 });
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
await expect(review.filterOverlay).not.toBeVisible({ timeout: 3_000 });
|
||||
await waitForBodyInteractive(frigateApp.page);
|
||||
await expectBodyInteractive(frigateApp.page);
|
||||
});
|
||||
|
||||
test("Labels are shown inside the General Filter dialog", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Labels are surfaced inside the "Filter" button's GeneralFilterContent
|
||||
// dialog, not as a standalone top-level button. We open that dialog and
|
||||
// confirm labels from the camera config are listed there.
|
||||
await frigateApp.goto("/review");
|
||||
const filterBtn = frigateApp.page
|
||||
.getByRole("button", { name: /^filter$/i })
|
||||
.first();
|
||||
await expect(filterBtn).toBeVisible({ timeout: 5_000 });
|
||||
await filterBtn.click();
|
||||
|
||||
const overlay = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper], [role='dialog']",
|
||||
);
|
||||
await expect(overlay.first()).toBeVisible({ timeout: 3_000 });
|
||||
// The default mock config for front_door tracks "person"
|
||||
await expect(overlay.first().getByText(/person/i)).toBeVisible();
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("Zones popover lists configured zones inside the General Filter dialog", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Override config to guarantee a known zone on front_door.
|
||||
await frigateApp.installDefaults({
|
||||
config: {
|
||||
cameras: {
|
||||
front_door: {
|
||||
zones: {
|
||||
front_yard: { coordinates: "0.1,0.1,0.9,0.1,0.9,0.9,0.1,0.9" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
test("Show Reviewed toggle is clickable", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
|
||||
const showReviewed = frigateApp.page.getByRole("button", {
|
||||
name: /reviewed/i,
|
||||
});
|
||||
await frigateApp.goto("/review");
|
||||
const filterBtn = frigateApp.page
|
||||
.getByRole("button", { name: /^filter$/i })
|
||||
.first();
|
||||
await expect(filterBtn).toBeVisible({ timeout: 5_000 });
|
||||
await filterBtn.click();
|
||||
|
||||
const overlay = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper], [role='dialog']",
|
||||
);
|
||||
await expect(overlay.first()).toBeVisible({ timeout: 3_000 });
|
||||
await expect(overlay.first().getByText(/front.?yard/i)).toBeVisible();
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
if (await showReviewed.isVisible().catch(() => false)) {
|
||||
await showReviewed.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
// Toggle should change state
|
||||
await expect(frigateApp.page.locator("body")).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("Calendar trigger opens a date picker popover", async ({
|
||||
test("Last 24 Hours calendar button opens date picker", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, true);
|
||||
await expect(review.calendarTrigger).toBeVisible({ timeout: 5_000 });
|
||||
await review.calendarTrigger.click();
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
|
||||
// react-day-picker v9 renders a role="grid" calendar with day cells
|
||||
// as buttons inside gridcells (e.g. "Wednesday, April 1st, 2026").
|
||||
// The calendar is placed directly in the DOM (not always inside a
|
||||
// Radix popper wrapper), so scope by the grid role instead.
|
||||
const calendarGrid = frigateApp.page.locator('[role="grid"]').first();
|
||||
await expect(calendarGrid).toBeVisible({ timeout: 3_000 });
|
||||
const dayButton = calendarGrid.locator('[role="gridcell"] button').first();
|
||||
await expect(dayButton).toBeVisible({ timeout: 3_000 });
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("Show Reviewed switch flips its checked state", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// "Show Reviewed" is a Radix Switch (role=switch), not a button.
|
||||
// It filters review data client-side; it does not trigger a new
|
||||
// /api/review network request. Verify the switch state toggles.
|
||||
await frigateApp.goto("/review");
|
||||
const showReviewedSwitch = frigateApp.page.getByRole("switch", {
|
||||
name: /show reviewed/i,
|
||||
const calendarBtn = frigateApp.page.getByRole("button", {
|
||||
name: /24 hours|calendar|date/i,
|
||||
});
|
||||
await expect(showReviewedSwitch).toBeVisible({ timeout: 5_000 });
|
||||
if (await calendarBtn.isVisible().catch(() => false)) {
|
||||
await calendarBtn.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
// Popover should open
|
||||
const popover = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper]",
|
||||
);
|
||||
if (
|
||||
await popover
|
||||
.first()
|
||||
.isVisible()
|
||||
.catch(() => false)
|
||||
) {
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Record initial checked state and click to toggle
|
||||
const initialChecked =
|
||||
await showReviewedSwitch.getAttribute("aria-checked");
|
||||
await showReviewedSwitch.click();
|
||||
const flippedChecked = initialChecked === "true" ? "false" : "true";
|
||||
await expect(showReviewedSwitch).toHaveAttribute(
|
||||
"aria-checked",
|
||||
flippedChecked,
|
||||
);
|
||||
test("Filter button opens filter popover", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
await frigateApp.page.waitForTimeout(1000);
|
||||
|
||||
const filterBtn = frigateApp.page.getByRole("button", {
|
||||
name: /^filter$/i,
|
||||
});
|
||||
if (await filterBtn.isVisible().catch(() => false)) {
|
||||
await filterBtn.click();
|
||||
await frigateApp.page.waitForTimeout(500);
|
||||
// Popover or dialog should open
|
||||
const popover = frigateApp.page.locator(
|
||||
"[data-radix-popper-content-wrapper], [role='dialog']",
|
||||
);
|
||||
if (
|
||||
await popover
|
||||
.first()
|
||||
.isVisible()
|
||||
.catch(() => false)
|
||||
) {
|
||||
await frigateApp.page.keyboard.press("Escape");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Review — timeline (desktop) @critical", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Timeline not shown on mobile",
|
||||
);
|
||||
|
||||
test("timeline renders time markers", async ({ frigateApp }) => {
|
||||
test.describe("Review Page - Timeline @critical", () => {
|
||||
test("review page has timeline with time markers (desktop)", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
if (frigateApp.isMobile) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
await frigateApp.goto("/review");
|
||||
await expect
|
||||
.poll(
|
||||
async () => (await frigateApp.page.textContent("#pageRoot")) ?? "",
|
||||
{ timeout: 10_000 },
|
||||
)
|
||||
.toMatch(/[AP]M|\d+:\d+/);
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
// Timeline renders time labels like "4:30 PM"
|
||||
const pageText = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(pageText).toMatch(/[AP]M/);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Review — mobile @critical @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("severity tabs render on mobile", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/review");
|
||||
const review = new ReviewPage(frigateApp.page, false);
|
||||
await expect(review.alertsTab).toBeVisible({ timeout: 10_000 });
|
||||
await expect(review.detectionsTab).toBeVisible();
|
||||
});
|
||||
|
||||
test("back navigation returns to Live", async ({ frigateApp }) => {
|
||||
test.describe("Review Page - Navigation @critical", () => {
|
||||
test("navigate to review from live page works", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/");
|
||||
const base = new BasePage(frigateApp.page, false);
|
||||
const base = new BasePage(frigateApp.page, !frigateApp.isMobile);
|
||||
await base.navigateTo("/review");
|
||||
await expect(frigateApp.page).toHaveURL(/\/review/);
|
||||
await base.navigateTo("/");
|
||||
await expect(frigateApp.page).toHaveURL(/\/$/);
|
||||
// Severity tabs should be visible
|
||||
await expect(frigateApp.page.getByLabel("Alerts")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+28
-175
@@ -1,21 +1,15 @@
|
||||
/**
|
||||
* System page tests -- MEDIUM tier (promoted to cover migrated
|
||||
* RestartDialog test from radix-overlay-regressions.spec.ts).
|
||||
* System page tests -- MEDIUM tier.
|
||||
*
|
||||
* Tab switching, version + last-refreshed display, and the
|
||||
* RestartDialog cancel flow.
|
||||
* Tests system page rendering with tabs and tab switching.
|
||||
* Navigates to /system#general explicitly so useHashState resolves
|
||||
* the tab state deterministically.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../fixtures/frigate-test";
|
||||
import {
|
||||
expectBodyInteractive,
|
||||
waitForBodyInteractive,
|
||||
} from "../helpers/overlay-interaction";
|
||||
|
||||
test.describe("System — tabs @medium", () => {
|
||||
test("general tab is active by default via #general hash", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
test.describe("System Page @medium", () => {
|
||||
test("system page renders with tab buttons", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
@@ -26,7 +20,7 @@ test.describe("System — tabs @medium", () => {
|
||||
await expect(frigateApp.page.getByLabel("Select cameras")).toBeVisible();
|
||||
});
|
||||
|
||||
test("Storage tab activates and deactivates General", async ({
|
||||
test("general tab is active when navigated via hash", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
@@ -35,6 +29,18 @@ test.describe("System — tabs @medium", () => {
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
});
|
||||
|
||||
test("clicking Storage tab activates it and deactivates General", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await frigateApp.page.getByLabel("Select storage").click();
|
||||
await expect(frigateApp.page.getByLabel("Select storage")).toHaveAttribute(
|
||||
"data-state",
|
||||
@@ -47,22 +53,29 @@ test.describe("System — tabs @medium", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("Cameras tab activates", async ({ frigateApp }) => {
|
||||
test("clicking Cameras tab activates it and deactivates General", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
|
||||
await frigateApp.page.getByLabel("Select cameras").click();
|
||||
await expect(frigateApp.page.getByLabel("Select cameras")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 5_000 },
|
||||
);
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"off",
|
||||
);
|
||||
});
|
||||
|
||||
test("general tab shows version and last-refreshed", async ({
|
||||
test("system page shows version and last refreshed", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
@@ -74,164 +87,4 @@ test.describe("System — tabs @medium", () => {
|
||||
await expect(frigateApp.page.getByText("0.15.0-test")).toBeVisible();
|
||||
await expect(frigateApp.page.getByText(/Last refreshed/)).toBeVisible();
|
||||
});
|
||||
|
||||
test("storage tab renders content after switching", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await frigateApp.page.getByLabel("Select storage").click();
|
||||
await expect(frigateApp.page.getByLabel("Select storage")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 5_000 },
|
||||
);
|
||||
// On desktop, tab buttons render text labels so the word "storage"
|
||||
// always appears in #pageRoot after switching. On mobile, tabs are
|
||||
// icon-only, so we verify the general-tab content disappears instead
|
||||
// (the storage tab's metrics section is hidden but general is gone).
|
||||
if (!frigateApp.isMobile) {
|
||||
await expect
|
||||
.poll(
|
||||
async () => (await frigateApp.page.textContent("#pageRoot")) ?? "",
|
||||
{ timeout: 10_000 },
|
||||
)
|
||||
.toMatch(/storage|mount|disk|used|free/i);
|
||||
} else {
|
||||
// Mobile: tab activation (data-state "on") already asserted above.
|
||||
// Additionally confirm general tab is no longer the active tab.
|
||||
await expect(
|
||||
frigateApp.page.getByLabel("Select general"),
|
||||
).toHaveAttribute("data-state", "off", { timeout: 5_000 });
|
||||
}
|
||||
});
|
||||
|
||||
test("cameras tab renders each configured camera", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await frigateApp.page.getByLabel("Select cameras").click();
|
||||
await expect(frigateApp.page.getByLabel("Select cameras")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 5_000 },
|
||||
);
|
||||
// Cameras tab lists every camera from config/stats. The default
|
||||
// mock has front_door, backyard, garage.
|
||||
for (const cam of ["front_door", "backyard", "garage"]) {
|
||||
await expect(
|
||||
frigateApp.page
|
||||
.getByText(new RegExp(cam.replace("_", ".?"), "i"))
|
||||
.first(),
|
||||
).toBeVisible({ timeout: 10_000 });
|
||||
}
|
||||
});
|
||||
|
||||
test("enrichments tab renders when semantic search is enabled", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
// Override config to guarantee the enrichments tab is present.
|
||||
// System.tsx shows the tab when semantic_search.enabled === true.
|
||||
await frigateApp.installDefaults({
|
||||
config: { semantic_search: { enabled: true } },
|
||||
});
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
const enrichTab = frigateApp.page.getByLabel(/select enrichments/i).first();
|
||||
await expect(enrichTab).toBeVisible({ timeout: 5_000 });
|
||||
await enrichTab.click();
|
||||
await expect(enrichTab).toHaveAttribute("data-state", "on", {
|
||||
timeout: 5_000,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("System — RestartDialog @medium", () => {
|
||||
test.skip(
|
||||
({ frigateApp }) => frigateApp.isMobile,
|
||||
"Sidebar menu is desktop-only",
|
||||
);
|
||||
|
||||
test("cancelling restart leaves body interactive", async ({ frigateApp }) => {
|
||||
// Migrated from radix-overlay-regressions.spec.ts.
|
||||
await frigateApp.goto("/");
|
||||
|
||||
const sidebarTriggers = frigateApp.page
|
||||
.locator('[role="complementary"] [aria-haspopup="menu"]')
|
||||
.or(frigateApp.page.locator('aside [aria-haspopup="menu"]'));
|
||||
const triggerCount = await sidebarTriggers.count();
|
||||
expect(triggerCount).toBeGreaterThan(0);
|
||||
|
||||
let opened = false;
|
||||
for (let i = 0; i < triggerCount; i++) {
|
||||
const trigger = sidebarTriggers.nth(i);
|
||||
await trigger.click().catch(() => {});
|
||||
const restartItem = frigateApp.page
|
||||
.getByRole("menuitem", { name: /restart/i })
|
||||
.first();
|
||||
const visible = await expect(restartItem)
|
||||
.toBeVisible({ timeout: 300 })
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (visible) {
|
||||
await restartItem.click();
|
||||
opened = true;
|
||||
break;
|
||||
}
|
||||
await frigateApp.page.keyboard.press("Escape").catch(() => {});
|
||||
}
|
||||
expect(opened).toBe(true);
|
||||
|
||||
const cancel = frigateApp.page.getByRole("button", { name: /cancel/i });
|
||||
await expect(cancel).toBeVisible({ timeout: 3_000 });
|
||||
await cancel.click();
|
||||
|
||||
await waitForBodyInteractive(frigateApp.page);
|
||||
await expectBodyInteractive(frigateApp.page);
|
||||
|
||||
const postCancelTrigger = sidebarTriggers.first();
|
||||
await postCancelTrigger.click();
|
||||
await expect(
|
||||
frigateApp.page
|
||||
.locator('[role="menu"], [data-radix-menu-content]')
|
||||
.first(),
|
||||
).toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("System — mobile @medium @mobile", () => {
|
||||
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
||||
|
||||
test("tabs render at mobile viewport", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toBeVisible({
|
||||
timeout: 15_000,
|
||||
});
|
||||
});
|
||||
|
||||
test("switching tabs works at mobile viewport", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/system#general");
|
||||
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 15_000 },
|
||||
);
|
||||
await frigateApp.page.getByLabel("Select storage").click();
|
||||
await expect(frigateApp.page.getByLabel("Select storage")).toHaveAttribute(
|
||||
"data-state",
|
||||
"on",
|
||||
{ timeout: 5_000 },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Generated
+284
-488
@@ -12,14 +12,14 @@
|
||||
"@cycjimmy/jsmpeg-player": "^6.1.2",
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
"@melloware/react-logviewer": "^6.1.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.6",
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.2",
|
||||
"@radix-ui/react-checkbox": "^1.1.4",
|
||||
"@radix-ui/react-collapsible": "^1.1.12",
|
||||
"@radix-ui/react-context-menu": "^2.2.16",
|
||||
"@radix-ui/react-context-menu": "^2.2.6",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
"@radix-ui/react-hover-card": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
||||
"@radix-ui/react-hover-card": "^1.1.6",
|
||||
"@radix-ui/react-label": "^2.1.2",
|
||||
"@radix-ui/react-popover": "^1.1.6",
|
||||
"@radix-ui/react-progress": "^1.1.8",
|
||||
@@ -49,7 +49,7 @@
|
||||
"framer-motion": "^12.38.0",
|
||||
"hls.js": "^1.6.15",
|
||||
"i18next": "^24.2.0",
|
||||
"i18next-http-backend": "^3.0.5",
|
||||
"i18next-http-backend": "^3.0.1",
|
||||
"idb-keyval": "^6.2.1",
|
||||
"immer": "^10.1.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
@@ -1515,17 +1515,17 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog": {
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.1.15.tgz",
|
||||
"integrity": "sha512-oTVLkEw5GpdRe29BqJ0LSDFWI3qu0vR1M0mUkOQWDIUnY/QIkLpgDMWuKxP94c2NAC2LGcgVhG1ImF3jkZ5wXw==",
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.1.6.tgz",
|
||||
"integrity": "sha512-p4XnPqgej8sZAAReCAKgz1REYZEBLR8hU9Pg27wFnCWIMc8g1ccCs0FjBcy05V15VTu8pAePw/VDYeOm/uZ6yQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-dialog": "1.1.15",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-dialog": "1.1.6",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-slot": "1.1.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -1542,17 +1542,126 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/primitive": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-context": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz",
|
||||
"integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==",
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-dialog": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.6.tgz",
|
||||
"integrity": "sha512-/IVhJV5AceX620DUJ4uYVMymzsipdKBzo3edo+omeskCKGm9FRHM0ebIdbPnlQVJqyuHbuBltQUOG2mOTq2IYw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-dismissable-layer": "1.1.5",
|
||||
"@radix-ui/react-focus-guards": "1.1.1",
|
||||
"@radix-ui/react-focus-scope": "1.1.2",
|
||||
"@radix-ui/react-id": "1.1.0",
|
||||
"@radix-ui/react-portal": "1.1.4",
|
||||
"@radix-ui/react-presence": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-slot": "1.1.2",
|
||||
"@radix-ui/react-use-controllable-state": "1.1.0",
|
||||
"aria-hidden": "^1.2.4",
|
||||
"react-remove-scroll": "^2.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-dismissable-layer": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.5.tgz",
|
||||
"integrity": "sha512-E4TywXY6UsXNRhFrECa5HAvE5/4BFcGyfTyK36gP+pAW1ed7UTK4vKwdr53gAJYwqbfCWC6ATvJa3J3R/9+Qrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0",
|
||||
"@radix-ui/react-use-escape-keydown": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-focus-scope": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.2.tgz",
|
||||
"integrity": "sha512-zxwE80FCU7lcXUGWkdt6XpTTCKPitG1XKOwViTxHVKIJhZl9MvIl2dVHeZENCWD9+EdWv05wlaEkRXUykU27RA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-portal": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.4.tgz",
|
||||
"integrity": "sha512-sn2O9k1rPFYVyKd5LAJfo96JlSGVFpa1fS6UuBJfrZadudiw5tAmru+n1x7aMRQ84qDM71Zh1+SzK5QwU0tJfA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-use-escape-keydown": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz",
|
||||
"integrity": "sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
@@ -1563,29 +1672,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-alert-dialog/node_modules/@radix-ui/react-primitive": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-arrow": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz",
|
||||
@@ -2027,17 +2113,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu": {
|
||||
"version": "2.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context-menu/-/react-context-menu-2.2.16.tgz",
|
||||
"integrity": "sha512-O8morBEW+HsVG28gYDZPTrT9UUovQUlJue5YO836tiTJhuIWBm/zQHc7j388sHWtdH/xUZurK9olD2+pcqx5ww==",
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context-menu/-/react-context-menu-2.2.6.tgz",
|
||||
"integrity": "sha512-aUP99QZ3VU84NPsHeaFt4cQUNgJqFsLLOt/RbbWXszZ6MP0DpDyjkFZORr4RpAEx3sUBk+Kc8h13yGtC5Qw8dg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-menu": "2.1.16",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.1",
|
||||
"@radix-ui/react-use-controllable-state": "1.2.2"
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-menu": "2.1.6",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0",
|
||||
"@radix-ui/react-use-controllable-state": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2054,99 +2140,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/primitive": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-context": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz",
|
||||
"integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-primitive": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-callback-ref": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz",
|
||||
"integrity": "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-controllable-state": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz",
|
||||
"integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-effect-event": "0.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-layout-effect": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz",
|
||||
"integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dialog": {
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.15.tgz",
|
||||
@@ -2204,6 +2197,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-guards": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz",
|
||||
"integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz",
|
||||
@@ -2390,18 +2398,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu": {
|
||||
"version": "2.1.16",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.16.tgz",
|
||||
"integrity": "sha512-1PLGQEynI/3OX/ftV54COn+3Sud/Mn8vALg2rWnBLnRaGtJDduNW/22XjlGgPdpcIbiQxjKtb7BkcjP00nqfJw==",
|
||||
"version": "2.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.6.tgz",
|
||||
"integrity": "sha512-no3X7V5fD487wab/ZYSHXq3H37u4NVeLDKI/Ks724X/eEFSSEFYZxWgsIlr1UBeEyDaM29HM5x9p1Nv8DuTYPA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-id": "1.1.1",
|
||||
"@radix-ui/react-menu": "2.1.16",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-controllable-state": "1.2.2"
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-id": "1.1.0",
|
||||
"@radix-ui/react-menu": "2.1.6",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-controllable-state": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2418,106 +2426,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/primitive": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-context": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz",
|
||||
"integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-id": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz",
|
||||
"integrity": "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz",
|
||||
"integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-effect-event": "0.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-layout-effect": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz",
|
||||
"integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-focus-guards": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz",
|
||||
"integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.1.tgz",
|
||||
"integrity": "sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2593,20 +2505,20 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card": {
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-hover-card/-/react-hover-card-1.1.15.tgz",
|
||||
"integrity": "sha512-qgTkjNT1CfKMoP0rcasmlH2r1DAiYicWsDsufxl940sT2wHNEWWv6FMWIQXWhVdmC1d/HYfbhQx60KYyAtKxjg==",
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-hover-card/-/react-hover-card-1.1.6.tgz",
|
||||
"integrity": "sha512-E4ozl35jq0VRlrdc4dhHrNSV0JqBb4Jy73WAhBEK7JoYnQ83ED5r0Rb/XdVKw89ReAJN38N492BAPBZQ57VmqQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-dismissable-layer": "1.1.11",
|
||||
"@radix-ui/react-popper": "1.2.8",
|
||||
"@radix-ui/react-portal": "1.1.9",
|
||||
"@radix-ui/react-presence": "1.1.5",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-controllable-state": "1.2.2"
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-dismissable-layer": "1.1.5",
|
||||
"@radix-ui/react-popper": "1.2.2",
|
||||
"@radix-ui/react-portal": "1.1.4",
|
||||
"@radix-ui/react-presence": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-controllable-state": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2623,35 +2535,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/primitive": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-context": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz",
|
||||
"integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-presence": {
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-dismissable-layer": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz",
|
||||
"integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.5.tgz",
|
||||
"integrity": "sha512-E4TywXY6UsXNRhFrECa5HAvE5/4BFcGyfTyK36gP+pAW1ed7UTK4vKwdr53gAJYwqbfCWC6ATvJa3J3R/9+Qrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0",
|
||||
"@radix-ui/react-use-escape-keydown": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2668,13 +2562,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-primitive": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-portal": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.4.tgz",
|
||||
"integrity": "sha512-sn2O9k1rPFYVyKd5LAJfo96JlSGVFpa1fS6UuBJfrZadudiw5tAmru+n1x7aMRQ84qDM71Zh1+SzK5QwU0tJfA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2691,14 +2586,13 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-use-controllable-state": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz",
|
||||
"integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==",
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-use-escape-keydown": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz",
|
||||
"integrity": "sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-effect-event": "0.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2710,21 +2604,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-use-layout-effect": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz",
|
||||
"integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-icons": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-icons/-/react-icons-1.3.2.tgz",
|
||||
@@ -2799,27 +2678,27 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu": {
|
||||
"version": "2.1.16",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.16.tgz",
|
||||
"integrity": "sha512-72F2T+PLlphrqLcAotYPp0uJMr5SjP5SL01wfEspJbru5Zs5vQaSHb4VB3ZMJPimgHHCHG7gMOeOB9H3Hdmtxg==",
|
||||
"version": "2.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.6.tgz",
|
||||
"integrity": "sha512-tBBb5CXDJW3t2mo9WlO7r6GTmWV0F0uzHZVFmlRmYpiSK1CDU5IKojP1pm7oknpBOrFZx/YgBRW9oorPO2S/Lg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-collection": "1.1.7",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-direction": "1.1.1",
|
||||
"@radix-ui/react-dismissable-layer": "1.1.11",
|
||||
"@radix-ui/react-focus-guards": "1.1.3",
|
||||
"@radix-ui/react-focus-scope": "1.1.7",
|
||||
"@radix-ui/react-id": "1.1.1",
|
||||
"@radix-ui/react-popper": "1.2.8",
|
||||
"@radix-ui/react-portal": "1.1.9",
|
||||
"@radix-ui/react-presence": "1.1.5",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-roving-focus": "1.1.11",
|
||||
"@radix-ui/react-slot": "1.2.3",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.1",
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-collection": "1.1.2",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-context": "1.1.1",
|
||||
"@radix-ui/react-direction": "1.1.0",
|
||||
"@radix-ui/react-dismissable-layer": "1.1.5",
|
||||
"@radix-ui/react-focus-guards": "1.1.1",
|
||||
"@radix-ui/react-focus-scope": "1.1.2",
|
||||
"@radix-ui/react-id": "1.1.0",
|
||||
"@radix-ui/react-popper": "1.2.2",
|
||||
"@radix-ui/react-portal": "1.1.4",
|
||||
"@radix-ui/react-presence": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-roving-focus": "1.1.2",
|
||||
"@radix-ui/react-slot": "1.1.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0",
|
||||
"aria-hidden": "^1.2.4",
|
||||
"react-remove-scroll": "^2.6.3"
|
||||
},
|
||||
@@ -2838,94 +2717,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/primitive": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-collection": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz",
|
||||
"integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-context": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz",
|
||||
"integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-direction": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.1.tgz",
|
||||
"integrity": "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-id": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz",
|
||||
"integrity": "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-presence": {
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-dismissable-layer": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz",
|
||||
"integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.5.tgz",
|
||||
"integrity": "sha512-E4TywXY6UsXNRhFrECa5HAvE5/4BFcGyfTyK36gP+pAW1ed7UTK4vKwdr53gAJYwqbfCWC6ATvJa3J3R/9+Qrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
"@radix-ui/primitive": "1.1.1",
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0",
|
||||
"@radix-ui/react-use-escape-keydown": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2942,13 +2744,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-primitive": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz",
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-focus-scope": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.2.tgz",
|
||||
"integrity": "sha512-zxwE80FCU7lcXUGWkdt6XpTTCKPitG1XKOwViTxHVKIJhZl9MvIl2dVHeZENCWD9+EdWv05wlaEkRXUykU27RA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.2.3"
|
||||
"@radix-ui/react-compose-refs": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2965,21 +2769,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-roving-focus": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.11.tgz",
|
||||
"integrity": "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==",
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-portal": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.4.tgz",
|
||||
"integrity": "sha512-sn2O9k1rPFYVyKd5LAJfo96JlSGVFpa1fS6UuBJfrZadudiw5tAmru+n1x7aMRQ84qDM71Zh1+SzK5QwU0tJfA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/primitive": "1.1.3",
|
||||
"@radix-ui/react-collection": "1.1.7",
|
||||
"@radix-ui/react-compose-refs": "1.1.2",
|
||||
"@radix-ui/react-context": "1.1.2",
|
||||
"@radix-ui/react-direction": "1.1.1",
|
||||
"@radix-ui/react-id": "1.1.1",
|
||||
"@radix-ui/react-primitive": "2.1.3",
|
||||
"@radix-ui/react-use-callback-ref": "1.1.1",
|
||||
"@radix-ui/react-use-controllable-state": "1.2.2"
|
||||
"@radix-ui/react-primitive": "2.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -2996,29 +2793,13 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-use-callback-ref": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz",
|
||||
"integrity": "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-use-controllable-state": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz",
|
||||
"integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==",
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-use-escape-keydown": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz",
|
||||
"integrity": "sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-use-effect-event": "0.0.2",
|
||||
"@radix-ui/react-use-layout-effect": "1.1.1"
|
||||
"@radix-ui/react-use-callback-ref": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
@@ -3030,21 +2811,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-use-layout-effect": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz",
|
||||
"integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-popover": {
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.15.tgz",
|
||||
@@ -3103,6 +2869,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-focus-guards": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz",
|
||||
"integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-id": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz",
|
||||
@@ -3936,6 +3717,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-focus-guards": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz",
|
||||
"integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-id": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz",
|
||||
@@ -7013,12 +6809,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/cross-fetch": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.1.0.tgz",
|
||||
"integrity": "sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==",
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",
|
||||
"integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.7.0"
|
||||
"node-fetch": "^2.6.12"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
@@ -8876,12 +8672,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/i18next-http-backend": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-3.0.5.tgz",
|
||||
"integrity": "sha512-QaWHnsxieEDcqKe+vo/RFqpiIFRi/KBqlOSPcUlvinBaISCeiTRCbtrazHAjtHtsLC66oDsROAH8frWkQzfMMQ==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-3.0.1.tgz",
|
||||
"integrity": "sha512-XT2lYSkbAtDE55c6m7CtKxxrsfuRQO3rUfHzj8ZyRtY9CkIX3aRGwXGTkUhpGWce+J8n7sfu3J0f2wTzo7Lw0A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-fetch": "4.1.0"
|
||||
"cross-fetch": "4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/i18next-resources-for-ts": {
|
||||
|
||||
+5
-5
@@ -26,14 +26,14 @@
|
||||
"@cycjimmy/jsmpeg-player": "^6.1.2",
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
"@melloware/react-logviewer": "^6.1.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.15",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.6",
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.2",
|
||||
"@radix-ui/react-checkbox": "^1.1.4",
|
||||
"@radix-ui/react-collapsible": "^1.1.12",
|
||||
"@radix-ui/react-context-menu": "^2.2.16",
|
||||
"@radix-ui/react-context-menu": "^2.2.6",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
"@radix-ui/react-hover-card": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
||||
"@radix-ui/react-hover-card": "^1.1.6",
|
||||
"@radix-ui/react-label": "^2.1.2",
|
||||
"@radix-ui/react-popover": "^1.1.6",
|
||||
"@radix-ui/react-progress": "^1.1.8",
|
||||
@@ -63,7 +63,7 @@
|
||||
"framer-motion": "^12.38.0",
|
||||
"hls.js": "^1.6.15",
|
||||
"i18next": "^24.2.0",
|
||||
"i18next-http-backend": "^3.0.5",
|
||||
"i18next-http-backend": "^3.0.1",
|
||||
"idb-keyval": "^6.2.1",
|
||||
"immer": "^10.1.1",
|
||||
"js-yaml": "^4.1.1",
|
||||
|
||||
@@ -50,77 +50,24 @@
|
||||
"placeholder": "Name the Export"
|
||||
},
|
||||
"case": {
|
||||
"newCaseOption": "Create new case",
|
||||
"newCaseNamePlaceholder": "New case name",
|
||||
"newCaseDescriptionPlaceholder": "Case description",
|
||||
"label": "Case",
|
||||
"nonAdminHelp": "A new case will be created for these exports.",
|
||||
"placeholder": "Select a case"
|
||||
},
|
||||
"select": "Select",
|
||||
"export": "Export",
|
||||
"queueing": "Queueing Export...",
|
||||
"selectOrExport": "Select or Export",
|
||||
"tabs": {
|
||||
"export": "Single Camera",
|
||||
"multiCamera": "Multi-Camera"
|
||||
},
|
||||
"multiCamera": {
|
||||
"timeRange": "Time range",
|
||||
"selectFromTimeline": "Select from Timeline",
|
||||
"cameraSelection": "Cameras",
|
||||
"cameraSelectionHelp": "Cameras with tracked objects in this time range are pre-selected",
|
||||
"checkingActivity": "Checking camera activity...",
|
||||
"noCameras": "No cameras available",
|
||||
"detectionCount_one": "1 tracked object",
|
||||
"detectionCount_other": "{{count}} tracked objects",
|
||||
"nameLabel": "Export name",
|
||||
"namePlaceholder": "Optional base name for these exports",
|
||||
"queueingButton": "Queueing Exports...",
|
||||
"exportButton_one": "Export 1 Camera",
|
||||
"exportButton_other": "Export {{count}} Cameras"
|
||||
},
|
||||
"multi": {
|
||||
"title_one": "Export 1 review",
|
||||
"title_other": "Export {{count}} reviews",
|
||||
"description": "Export each selected review. All exports will be grouped under a single case.",
|
||||
"descriptionNoCase": "Export each selected review.",
|
||||
"caseNamePlaceholder": "Review export - {{date}}",
|
||||
"exportButton_one": "Export 1 review",
|
||||
"exportButton_other": "Export {{count}} reviews",
|
||||
"exportingButton": "Exporting...",
|
||||
"toast": {
|
||||
"started_one": "Started 1 export. Opening the case now.",
|
||||
"started_other": "Started {{count}} exports. Opening the case now.",
|
||||
"startedNoCase_one": "Started 1 export.",
|
||||
"startedNoCase_other": "Started {{count}} exports.",
|
||||
"partial": "Started {{successful}} of {{total}} exports. Failed: {{failedItems}}",
|
||||
"failed": "Failed to start {{total}} exports. Failed: {{failedItems}}"
|
||||
}
|
||||
},
|
||||
"toast": {
|
||||
"success": "Successfully started export. View the file in the exports page.",
|
||||
"queued": "Export queued. View progress in the exports page.",
|
||||
"view": "View",
|
||||
"batchSuccess_one": "Started 1 export. Opening the case now.",
|
||||
"batchSuccess_other": "Started {{count}} exports. Opening the case now.",
|
||||
"batchPartial": "Started {{successful}} of {{total}} exports. Failed cameras: {{failedCameras}}",
|
||||
"batchFailed": "Failed to start {{total}} exports. Failed cameras: {{failedCameras}}",
|
||||
"batchQueuedSuccess_one": "Queued 1 export. Opening the case now.",
|
||||
"batchQueuedSuccess_other": "Queued {{count}} exports. Opening the case now.",
|
||||
"batchQueuedPartial": "Queued {{successful}} of {{total}} exports. Failed cameras: {{failedCameras}}",
|
||||
"batchQueueFailed": "Failed to queue {{total}} exports. Failed cameras: {{failedCameras}}",
|
||||
"error": {
|
||||
"failed": "Failed to queue export: {{error}}",
|
||||
"failed": "Failed to start export: {{error}}",
|
||||
"endTimeMustAfterStartTime": "End time must be after start time",
|
||||
"noVaildTimeSelected": "No valid time range selected"
|
||||
}
|
||||
},
|
||||
"fromTimeline": {
|
||||
"saveExport": "Save Export",
|
||||
"queueingExport": "Queueing Export...",
|
||||
"previewExport": "Preview Export",
|
||||
"useThisRange": "Use This Range"
|
||||
"previewExport": "Preview Export"
|
||||
}
|
||||
},
|
||||
"streaming": {
|
||||
@@ -152,14 +99,6 @@
|
||||
}
|
||||
},
|
||||
"recording": {
|
||||
"shareTimestamp": {
|
||||
"label": "Share Timestamp",
|
||||
"title": "Share Timestamp",
|
||||
"description": "Share a timestamped URL of current player position or choose a custom timestamp. Note that this is not a public share URL and is only accessible to users with access to Frigate and this camera.",
|
||||
"custom": "Custom Timestamp",
|
||||
"button": "Share Timestamp URL",
|
||||
"shareTitle": "Frigate Review Timestamp: {{camera}}"
|
||||
},
|
||||
"confirmDelete": {
|
||||
"title": "Confirm Delete",
|
||||
"desc": {
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
"noPreviewFoundFor": "No Preview Found for {{cameraName}}",
|
||||
"submitFrigatePlus": {
|
||||
"title": "Submit this frame to Frigate+?",
|
||||
"submit": "Submit",
|
||||
"previewError": "Could not load snapshot preview. The recording may not be available at this time."
|
||||
"submit": "Submit"
|
||||
},
|
||||
"livePlayerRequiredIOSVersion": "iOS 17.1 or greater is required for this live stream type.",
|
||||
"streamOffline": {
|
||||
|
||||
@@ -45,9 +45,7 @@
|
||||
},
|
||||
"documentTitle": "Review - Frigate",
|
||||
"recordings": {
|
||||
"documentTitle": "Recordings - Frigate",
|
||||
"invalidSharedLink": "Unable to open timestamped recording link due to parsing error.",
|
||||
"invalidSharedCamera": "Unable to open timestamped recording link due to an unknown or unauthorized camera."
|
||||
"documentTitle": "Recordings - Frigate"
|
||||
},
|
||||
"calendarFilter": {
|
||||
"last24Hours": "Last 24 Hours"
|
||||
|
||||
@@ -20,30 +20,14 @@
|
||||
"downloadVideo": "Download video",
|
||||
"editName": "Edit name",
|
||||
"deleteExport": "Delete export",
|
||||
"assignToCase": "Add to case",
|
||||
"removeFromCase": "Remove from case"
|
||||
},
|
||||
"toolbar": {
|
||||
"newCase": "New Case",
|
||||
"addExport": "Add Export",
|
||||
"editCase": "Edit Case",
|
||||
"deleteCase": "Delete Case"
|
||||
"assignToCase": "Add to case"
|
||||
},
|
||||
"toast": {
|
||||
"error": {
|
||||
"renameExportFailed": "Failed to rename export: {{errorMessage}}",
|
||||
"assignCaseFailed": "Failed to update case assignment: {{errorMessage}}",
|
||||
"caseSaveFailed": "Failed to save case: {{errorMessage}}",
|
||||
"caseDeleteFailed": "Failed to delete case: {{errorMessage}}"
|
||||
"assignCaseFailed": "Failed to update case assignment: {{errorMessage}}"
|
||||
}
|
||||
},
|
||||
"deleteCase": {
|
||||
"label": "Delete Case",
|
||||
"desc": "Are you sure you want to delete {{caseName}}?",
|
||||
"descKeepExports": "Exports will remain available as uncategorized exports.",
|
||||
"descDeleteExports": "All exports in this case will be permanently deleted.",
|
||||
"deleteExports": "Also delete exports"
|
||||
},
|
||||
"caseDialog": {
|
||||
"title": "Add to case",
|
||||
"description": "Choose an existing case or create a new one.",
|
||||
@@ -51,78 +35,5 @@
|
||||
"newCaseOption": "Create new case",
|
||||
"nameLabel": "Case name",
|
||||
"descriptionLabel": "Description"
|
||||
},
|
||||
"caseCard": {
|
||||
"emptyCase": "No exports yet"
|
||||
},
|
||||
"jobCard": {
|
||||
"defaultName": "{{camera}} export",
|
||||
"queued": "Queued",
|
||||
"running": "Running",
|
||||
"preparing": "Preparing",
|
||||
"copying": "Copying",
|
||||
"encoding": "Encoding",
|
||||
"encodingRetry": "Encoding (retry)",
|
||||
"finalizing": "Finalizing"
|
||||
},
|
||||
"caseView": {
|
||||
"noDescription": "No description",
|
||||
"createdAt": "Created {{value}}",
|
||||
"exportCount_one": "1 export",
|
||||
"exportCount_other": "{{count}} exports",
|
||||
"cameraCount_one": "1 camera",
|
||||
"cameraCount_other": "{{count}} cameras",
|
||||
"showMore": "Show more",
|
||||
"showLess": "Show less",
|
||||
"emptyTitle": "This case is empty",
|
||||
"emptyDescription": "Add existing uncategorized exports to keep the case organized.",
|
||||
"emptyDescriptionNoExports": "There are no uncategorized exports available to add yet."
|
||||
},
|
||||
"caseEditor": {
|
||||
"createTitle": "Create Case",
|
||||
"editTitle": "Edit Case",
|
||||
"namePlaceholder": "Case name",
|
||||
"descriptionPlaceholder": "Add notes or context for this case"
|
||||
},
|
||||
"addExportDialog": {
|
||||
"title": "Add Export to {{caseName}}",
|
||||
"searchPlaceholder": "Search uncategorized exports",
|
||||
"empty": "No uncategorized exports match this search.",
|
||||
"addButton_one": "Add 1 Export",
|
||||
"addButton_other": "Add {{count}} Exports",
|
||||
"adding": "Adding..."
|
||||
},
|
||||
"selected_one": "{{count}} selected",
|
||||
"selected_other": "{{count}} selected",
|
||||
"bulkActions": {
|
||||
"addToCase": "Add to Case",
|
||||
"moveToCase": "Move to Case",
|
||||
"removeFromCase": "Remove from Case",
|
||||
"delete": "Delete",
|
||||
"deleteNow": "Delete Now"
|
||||
},
|
||||
"bulkDelete": {
|
||||
"title": "Delete Exports",
|
||||
"desc_one": "Are you sure you want to delete {{count}} export?",
|
||||
"desc_other": "Are you sure you want to delete {{count}} exports?"
|
||||
},
|
||||
"bulkRemoveFromCase": {
|
||||
"title": "Remove from Case",
|
||||
"desc_one": "Remove {{count}} export from this case?",
|
||||
"desc_other": "Remove {{count}} exports from this case?",
|
||||
"descKeepExports": "Exports will be moved to uncategorized.",
|
||||
"descDeleteExports": "Exports will be permanently deleted.",
|
||||
"deleteExports": "Delete exports instead"
|
||||
},
|
||||
"bulkToast": {
|
||||
"success": {
|
||||
"delete": "Successfully deleted exports",
|
||||
"reassign": "Successfully updated case assignment",
|
||||
"remove": "Successfully removed exports from case"
|
||||
},
|
||||
"error": {
|
||||
"deleteFailed": "Failed to delete exports: {{errorMessage}}",
|
||||
"reassignFailed": "Failed to update case assignment: {{errorMessage}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +415,6 @@
|
||||
"audioCodecGood": "Audio codec is {{codec}}.",
|
||||
"resolutionHigh": "A resolution of {{resolution}} may cause increased resource usage.",
|
||||
"resolutionLow": "A resolution of {{resolution}} may be too low for reliable detection of small objects.",
|
||||
"resolutionUnknown": "The resolution of this stream could not be probed. This will cause issues on startup. You should manually set the detect resolution in Settings or your config.",
|
||||
"noAudioWarning": "No audio detected for this stream, recordings will not have audio.",
|
||||
"audioCodecRecordError": "The AAC audio codec is required to support audio in recordings.",
|
||||
"audioCodecRequired": "An audio stream is required to support audio detection.",
|
||||
|
||||
+3
-3
@@ -811,10 +811,10 @@ export function useTriggers(): { payload: TriggerStatus } {
|
||||
return { payload: parsed };
|
||||
}
|
||||
|
||||
export function useJobStatus<TResults = unknown>(
|
||||
export function useJobStatus(
|
||||
jobType: string,
|
||||
revalidateOnFocus: boolean = true,
|
||||
): { payload: Job<TResults> | null } {
|
||||
): { payload: Job | null } {
|
||||
const {
|
||||
value: { payload },
|
||||
send: sendCommand,
|
||||
@@ -846,7 +846,7 @@ export function useJobStatus<TResults = unknown>(
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [revalidateOnFocus]);
|
||||
|
||||
return { payload: currentJob as Job<TResults> | null };
|
||||
return { payload: currentJob as Job | null };
|
||||
}
|
||||
|
||||
export function useWsMessageSubscribe(callback: (msg: WsFeedMessage) => void) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import useStats, { useAutoFrigateStats } from "@/hooks/use-stats";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ProfilesApiResponse } from "@/types/profile";
|
||||
import { getProfileColor } from "@/utils/profileColors";
|
||||
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||
import { useContext, useEffect, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import useSWR from "swr";
|
||||
@@ -19,7 +18,6 @@ import { Link } from "react-router-dom";
|
||||
|
||||
export default function Statusbar() {
|
||||
const { t } = useTranslation(["views/system"]);
|
||||
const isAdmin = useIsAdmin();
|
||||
|
||||
const { messages, addMessage, clearMessages } = useContext(
|
||||
StatusBarMessagesContext,
|
||||
@@ -156,23 +154,9 @@ export default function Statusbar() {
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
{activeProfile &&
|
||||
(isAdmin ? (
|
||||
<Link to="/settings?page=profiles">
|
||||
<div className="flex cursor-pointer items-center gap-2 text-sm hover:underline">
|
||||
<span
|
||||
className={cn(
|
||||
"size-2 shrink-0 rounded-full",
|
||||
activeProfile.color.dot,
|
||||
)}
|
||||
/>
|
||||
<span className="max-w-[150px] truncate">
|
||||
{activeProfile.friendlyName}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
) : (
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
{activeProfile && (
|
||||
<Link to="/settings?page=profiles">
|
||||
<div className="flex cursor-pointer items-center gap-2 text-sm hover:underline">
|
||||
<span
|
||||
className={cn(
|
||||
"size-2 shrink-0 rounded-full",
|
||||
@@ -183,7 +167,8 @@ export default function Statusbar() {
|
||||
{activeProfile.friendlyName}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<div className="no-scrollbar flex h-full max-w-[50%] items-center gap-2 overflow-x-auto">
|
||||
{Object.entries(messages).length === 0 ? (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import ActivityIndicator from "../indicators/activity-indicator";
|
||||
import { Button } from "../ui/button";
|
||||
import { Progress } from "../ui/progress";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { FiMoreVertical } from "react-icons/fi";
|
||||
import { Skeleton } from "../ui/skeleton";
|
||||
@@ -14,7 +13,7 @@ import {
|
||||
} from "../ui/dialog";
|
||||
import { Input } from "../ui/input";
|
||||
import useKeyboardListener from "@/hooks/use-keyboard-listener";
|
||||
import { DeleteClipType, Export, ExportCase, ExportJob } from "@/types/export";
|
||||
import { DeleteClipType, Export, ExportCase } from "@/types/export";
|
||||
import { baseUrl } from "@/api/baseUrl";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { shareOrCopy } from "@/utils/browserUtil";
|
||||
@@ -28,10 +27,7 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "../ui/dropdown-menu";
|
||||
import { FaFolder, FaVideo } from "react-icons/fa";
|
||||
import { HiSquare2Stack } from "react-icons/hi2";
|
||||
import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name";
|
||||
import useContextMenu from "@/hooks/use-contextmenu";
|
||||
import { FaFolder } from "react-icons/fa";
|
||||
|
||||
type CaseCardProps = {
|
||||
className: string;
|
||||
@@ -45,15 +41,10 @@ export function CaseCard({
|
||||
exports,
|
||||
onSelect,
|
||||
}: CaseCardProps) {
|
||||
const { t } = useTranslation(["views/exports"]);
|
||||
const firstExport = useMemo(
|
||||
() => exports.find((exp) => exp.thumb_path && exp.thumb_path.length > 0),
|
||||
[exports],
|
||||
);
|
||||
const cameraCount = useMemo(
|
||||
() => new Set(exports.map((exp) => exp.camera)).size,
|
||||
[exports],
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -70,30 +61,10 @@ export function CaseCard({
|
||||
alt=""
|
||||
/>
|
||||
)}
|
||||
{!firstExport && (
|
||||
<div className="absolute inset-0 bg-gradient-to-br from-secondary via-secondary/80 to-muted" />
|
||||
)}
|
||||
<div className="pointer-events-none absolute inset-x-0 bottom-0 z-10 h-16 bg-gradient-to-t from-black/60 to-transparent" />
|
||||
<div className="absolute right-1 top-1 z-40 flex items-center gap-2 rounded-lg bg-black/50 px-2 py-1 text-xs text-white">
|
||||
<div className="flex items-center gap-1">
|
||||
<HiSquare2Stack className="size-3" />
|
||||
<div>{exports.length}</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<FaVideo className="size-3" />
|
||||
<div>{cameraCount}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="absolute inset-x-2 bottom-2 z-20 text-white">
|
||||
<div className="flex items-center justify-start gap-2">
|
||||
<FaFolder />
|
||||
<div className="truncate smart-capitalize">{exportCase.name}</div>
|
||||
</div>
|
||||
{exports.length === 0 && (
|
||||
<div className="mt-1 text-xs text-white/80">
|
||||
{t("caseCard.emptyCase")}
|
||||
</div>
|
||||
)}
|
||||
<div className="absolute bottom-2 left-2 z-20 flex items-center justify-start gap-2 text-white">
|
||||
<FaFolder />
|
||||
<div className="capitalize">{exportCase.name}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -102,26 +73,18 @@ export function CaseCard({
|
||||
type ExportCardProps = {
|
||||
className: string;
|
||||
exportedRecording: Export;
|
||||
isSelected?: boolean;
|
||||
selectionMode?: boolean;
|
||||
onSelect: (selected: Export) => void;
|
||||
onContextSelect?: (selected: Export) => void;
|
||||
onRename: (original: string, update: string) => void;
|
||||
onDelete: ({ file, exportName }: DeleteClipType) => void;
|
||||
onAssignToCase?: (selected: Export) => void;
|
||||
onRemoveFromCase?: (selected: Export) => void;
|
||||
};
|
||||
export function ExportCard({
|
||||
className,
|
||||
exportedRecording,
|
||||
isSelected,
|
||||
selectionMode,
|
||||
onSelect,
|
||||
onContextSelect,
|
||||
onRename,
|
||||
onDelete,
|
||||
onAssignToCase,
|
||||
onRemoveFromCase,
|
||||
}: ExportCardProps) {
|
||||
const { t } = useTranslation(["views/exports"]);
|
||||
const isAdmin = useIsAdmin();
|
||||
@@ -129,23 +92,6 @@ export function ExportCard({
|
||||
exportedRecording.thumb_path.length > 0,
|
||||
);
|
||||
|
||||
// Resync the skeleton state whenever the backing export changes. The
|
||||
// list keys by id now, so in practice the component remounts instead
|
||||
// of receiving new props — but this keeps the card honest if a parent
|
||||
// ever reuses the instance across different exports.
|
||||
useEffect(() => {
|
||||
setLoading(exportedRecording.thumb_path.length > 0);
|
||||
}, [exportedRecording.thumb_path]);
|
||||
|
||||
// selection
|
||||
|
||||
const cardRef = useRef<HTMLDivElement | null>(null);
|
||||
useContextMenu(cardRef, () => {
|
||||
if (!exportedRecording.in_progress && onContextSelect) {
|
||||
onContextSelect(exportedRecording);
|
||||
}
|
||||
});
|
||||
|
||||
// editing name
|
||||
|
||||
const [editName, setEditName] = useState<{
|
||||
@@ -234,18 +180,13 @@ export function ExportCard({
|
||||
</Dialog>
|
||||
|
||||
<div
|
||||
ref={cardRef}
|
||||
className={cn(
|
||||
"relative flex aspect-video cursor-pointer items-center justify-center rounded-lg bg-black md:rounded-2xl",
|
||||
className,
|
||||
)}
|
||||
onClick={(e) => {
|
||||
onClick={() => {
|
||||
if (!exportedRecording.in_progress) {
|
||||
if ((selectionMode || e.ctrlKey || e.metaKey) && onContextSelect) {
|
||||
onContextSelect(exportedRecording);
|
||||
} else {
|
||||
onSelect(exportedRecording);
|
||||
}
|
||||
onSelect(exportedRecording);
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -264,9 +205,9 @@ export function ExportCard({
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{!exportedRecording.in_progress && !selectionMode && (
|
||||
{!exportedRecording.in_progress && (
|
||||
<div className="absolute bottom-2 right-3 z-40">
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger>
|
||||
<BlurredIconButton
|
||||
aria-label={t("tooltip.editName")}
|
||||
@@ -313,18 +254,6 @@ export function ExportCard({
|
||||
{t("tooltip.assignToCase")}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{isAdmin && onRemoveFromCase && (
|
||||
<DropdownMenuItem
|
||||
className="cursor-pointer"
|
||||
aria-label={t("tooltip.removeFromCase")}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onRemoveFromCase(exportedRecording);
|
||||
}}
|
||||
>
|
||||
{t("tooltip.removeFromCase")}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{isAdmin && (
|
||||
<DropdownMenuItem
|
||||
className="cursor-pointer"
|
||||
@@ -363,97 +292,10 @@ export function ExportCard({
|
||||
<Skeleton className="absolute inset-0 aspect-video rounded-lg md:rounded-2xl" />
|
||||
)}
|
||||
<ImageShadowOverlay />
|
||||
<div
|
||||
className={cn(
|
||||
"pointer-events-none absolute inset-0 z-10 size-full rounded-lg outline outline-[3px] -outline-offset-[2.8px] md:rounded-2xl",
|
||||
isSelected
|
||||
? "shadow-selected outline-selected"
|
||||
: "outline-transparent duration-500",
|
||||
)}
|
||||
/>
|
||||
<div className="absolute bottom-2 left-3 right-12 z-30 text-white">
|
||||
<div className="truncate smart-capitalize">
|
||||
{exportedRecording.name.replaceAll("_", " ")}
|
||||
</div>
|
||||
<div className="absolute bottom-2 left-3 flex items-end text-white smart-capitalize">
|
||||
{exportedRecording.name.replaceAll("_", " ")}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
type ActiveExportJobCardProps = {
|
||||
className?: string;
|
||||
job: ExportJob;
|
||||
};
|
||||
|
||||
export function ActiveExportJobCard({
|
||||
className = "",
|
||||
job,
|
||||
}: ActiveExportJobCardProps) {
|
||||
const { t } = useTranslation(["views/exports", "common"]);
|
||||
const cameraName = useCameraFriendlyName(job.camera);
|
||||
const displayName = useMemo(() => {
|
||||
if (job.name && job.name.length > 0) {
|
||||
return job.name.replaceAll("_", " ");
|
||||
}
|
||||
|
||||
return t("jobCard.defaultName", {
|
||||
camera: cameraName,
|
||||
});
|
||||
}, [cameraName, job.name, t]);
|
||||
|
||||
const step = job.current_step
|
||||
? job.current_step
|
||||
: job.status === "queued"
|
||||
? "queued"
|
||||
: "preparing";
|
||||
const percent = Math.round(job.progress_percent ?? 0);
|
||||
|
||||
const stepLabel = useMemo(() => {
|
||||
switch (step) {
|
||||
case "queued":
|
||||
return t("jobCard.queued");
|
||||
case "preparing":
|
||||
return t("jobCard.preparing");
|
||||
case "copying":
|
||||
return t("jobCard.copying");
|
||||
case "encoding":
|
||||
return t("jobCard.encoding");
|
||||
case "encoding_retry":
|
||||
return t("jobCard.encodingRetry");
|
||||
case "finalizing":
|
||||
return t("jobCard.finalizing");
|
||||
default:
|
||||
return t("jobCard.running");
|
||||
}
|
||||
}, [step, t]);
|
||||
|
||||
const hasDeterminateProgress =
|
||||
step === "copying" || step === "encoding" || step === "encoding_retry";
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"relative flex aspect-video items-center justify-center overflow-hidden rounded-lg border border-dashed border-border bg-secondary/40 md:rounded-2xl",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="flex w-full max-w-xs flex-col items-center gap-2 space-y-2 px-6 text-center">
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{stepLabel}
|
||||
{hasDeterminateProgress && ` · ${percent}%`}
|
||||
</div>
|
||||
{step === "queued" ? (
|
||||
<ActivityIndicator className="size-5" />
|
||||
) : hasDeterminateProgress ? (
|
||||
<Progress value={percent} className="h-2 w-full" />
|
||||
) : (
|
||||
<div className="relative h-2 w-full overflow-hidden rounded-full bg-secondary">
|
||||
<div className="absolute inset-y-0 left-0 w-1/2 animate-pulse bg-primary" />
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm font-medium text-primary">{displayName}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export default function ReviewCard({
|
||||
|
||||
axios
|
||||
.post(
|
||||
`export/${event.camera}/start/${event.start_time - REVIEW_PADDING}/end/${endTime}`,
|
||||
`export/${event.camera}/start/${event.start_time + REVIEW_PADDING}/end/${endTime}`,
|
||||
{ playback: "realtime" },
|
||||
)
|
||||
.then((response) => {
|
||||
@@ -275,7 +275,7 @@ export default function ReviewCard({
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
<ContextMenu key={event.id}>
|
||||
<ContextMenu key={event.id} modal={false}>
|
||||
<ContextMenuTrigger asChild>{content}</ContextMenuTrigger>
|
||||
<ContextMenuContent>
|
||||
<ContextMenuItem>
|
||||
|
||||
@@ -322,7 +322,7 @@ export default function Step1NameAndDefine({
|
||||
<FormLabel className="text-primary-variant">
|
||||
{t("wizard.step1.classificationType")}
|
||||
</FormLabel>
|
||||
<Popover>
|
||||
<Popover modal={true}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -405,7 +405,7 @@ export default function Step1NameAndDefine({
|
||||
? t("wizard.step1.states")
|
||||
: t("wizard.step1.classes")}
|
||||
</FormLabel>
|
||||
<Popover>
|
||||
<Popover modal={true}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button variant="ghost" size="sm" className="h-4 w-4 p-0">
|
||||
<LuInfo className="size-3" />
|
||||
|
||||
@@ -238,7 +238,11 @@ export default function Step2StateArea({
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="text-sm font-medium">{t("wizard.step2.cameras")}</h3>
|
||||
{availableCameras.length > 0 ? (
|
||||
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
|
||||
<Popover
|
||||
open={isPopoverOpen}
|
||||
onOpenChange={setIsPopoverOpen}
|
||||
modal={true}
|
||||
>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
@@ -31,8 +31,6 @@ const ffmpeg: SectionConfigOverrides = {
|
||||
"inputs.output_args": "/configuration/ffmpeg_presets#output-args-presets",
|
||||
"output_args.record": "/configuration/ffmpeg_presets#output-args-presets",
|
||||
"inputs.roles": "/configuration/cameras/#setting-up-camera-inputs",
|
||||
apple_compatibility:
|
||||
"/configuration/camera_specific#h265-cameras-via-safari",
|
||||
},
|
||||
restartRequired: [],
|
||||
fieldOrder: [
|
||||
|
||||
@@ -27,12 +27,10 @@ const lpr: SectionConfigOverrides = {
|
||||
],
|
||||
fieldDocs: {
|
||||
enhancement: "/configuration/license_plate_recognition#enhancement",
|
||||
debug_save_plates:
|
||||
"/configuration/license_plate_recognition/#how-do-i-debug-lpr-issues",
|
||||
},
|
||||
restartRequired: [],
|
||||
fieldOrder: ["enabled", "min_area", "enhancement", "expire_time"],
|
||||
hiddenFields: ["expire_time"],
|
||||
hiddenFields: [],
|
||||
advancedFields: ["expire_time", "enhancement"],
|
||||
overrideFields: ["enabled", "min_area", "enhancement"],
|
||||
},
|
||||
|
||||
@@ -3,11 +3,6 @@ import type { SectionConfigOverrides } from "./types";
|
||||
const onvif: SectionConfigOverrides = {
|
||||
base: {
|
||||
sectionDocs: "/configuration/cameras#setting-up-camera-ptz-controls",
|
||||
fieldDocs: {
|
||||
autotracking: "/configuration/autotracking",
|
||||
"autotracking.calibrate_on_startup":
|
||||
"/configuration/autotracking#calibration",
|
||||
},
|
||||
fieldOrder: [
|
||||
"host",
|
||||
"port",
|
||||
|
||||
@@ -56,11 +56,6 @@ const record: SectionConfigOverrides = {
|
||||
},
|
||||
camera: {
|
||||
restartRequired: [],
|
||||
hiddenFields: [
|
||||
"enabled_in_config",
|
||||
"sync_recordings",
|
||||
"export.max_concurrent",
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -45,10 +45,6 @@ const review: SectionConfigOverrides = {
|
||||
fieldDocs: {
|
||||
"alerts.labels": "/configuration/review/#alerts-and-detections",
|
||||
"detections.labels": "/configuration/review/#alerts-and-detections",
|
||||
genai: "/configuration/genai/genai_review",
|
||||
"genai.image_source": "/configuration/genai/genai_review#image-source",
|
||||
"genai.additional_concerns":
|
||||
"/configuration/genai/genai_review#additional-concerns",
|
||||
},
|
||||
restartRequired: [],
|
||||
fieldOrder: ["alerts", "detections", "genai", "genai.enabled"],
|
||||
|
||||
@@ -218,7 +218,7 @@ export default function CameraReviewClassification({
|
||||
<Label
|
||||
className={cn(
|
||||
"flex flex-row items-center text-base",
|
||||
alertsZonesModified && "text-unsaved",
|
||||
alertsZonesModified && "text-danger",
|
||||
)}
|
||||
>
|
||||
<Trans ns="views/settings">cameraReview.review.alerts</Trans>
|
||||
@@ -286,7 +286,7 @@ export default function CameraReviewClassification({
|
||||
<Label
|
||||
className={cn(
|
||||
"flex flex-row items-center text-base",
|
||||
detectionsZonesModified && "text-unsaved",
|
||||
detectionsZonesModified && "text-danger",
|
||||
)}
|
||||
>
|
||||
<Trans ns="views/settings">
|
||||
|
||||
@@ -1012,7 +1012,7 @@ export function ConfigSection({
|
||||
>
|
||||
{hasChanges && (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm text-unsaved">
|
||||
<span className="text-sm text-danger">
|
||||
{t("unsavedChanges", {
|
||||
ns: "views/settings",
|
||||
defaultValue: "You have unsaved changes",
|
||||
@@ -1299,7 +1299,7 @@ export function ConfigSection({
|
||||
{hasChanges && (
|
||||
<Badge
|
||||
variant="secondary"
|
||||
className="cursor-default bg-unsaved text-xs text-black hover:bg-unsaved"
|
||||
className="cursor-default bg-danger text-xs text-white hover:bg-danger"
|
||||
>
|
||||
{t("button.modified", {
|
||||
ns: "common",
|
||||
|
||||
@@ -154,7 +154,7 @@ export function KnownPlatesField(props: FieldProps) {
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle
|
||||
className={cn("text-sm", isModified && "text-unsaved")}
|
||||
className={cn("text-sm", isModified && "text-danger")}
|
||||
>
|
||||
{title}
|
||||
</CardTitle>
|
||||
|
||||
@@ -142,7 +142,7 @@ export function ReplaceRulesField(props: FieldProps) {
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<CardTitle
|
||||
className={cn("text-sm", isModified && "text-unsaved")}
|
||||
className={cn("text-sm", isModified && "text-danger")}
|
||||
>
|
||||
{title}
|
||||
</CardTitle>
|
||||
|
||||
@@ -497,7 +497,7 @@ export function FieldTemplate(props: FieldTemplateProps) {
|
||||
htmlFor={id}
|
||||
className={cn(
|
||||
"text-sm font-medium",
|
||||
isModified && "text-unsaved",
|
||||
isModified && "text-danger",
|
||||
hasFieldErrors && "text-destructive",
|
||||
)}
|
||||
>
|
||||
@@ -516,7 +516,7 @@ export function FieldTemplate(props: FieldTemplateProps) {
|
||||
return (
|
||||
<Label
|
||||
htmlFor={id}
|
||||
className={cn("text-sm font-medium", isModified && "text-unsaved")}
|
||||
className={cn("text-sm font-medium", isModified && "text-danger")}
|
||||
>
|
||||
{finalLabel}
|
||||
{required && <span className="ml-1 text-destructive">*</span>}
|
||||
@@ -535,7 +535,7 @@ export function FieldTemplate(props: FieldTemplateProps) {
|
||||
htmlFor={id}
|
||||
className={cn(
|
||||
"text-sm font-medium",
|
||||
isModified && "text-unsaved",
|
||||
isModified && "text-danger",
|
||||
hasFieldErrors && "text-destructive",
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -9,13 +9,11 @@ import {
|
||||
import { Children, useState, useEffect, useRef } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import RestartRequiredIndicator from "@/components/indicators/RestartRequiredIndicator";
|
||||
import { LuChevronDown, LuChevronRight, LuExternalLink } from "react-icons/lu";
|
||||
import { LuChevronDown, LuChevronRight } from "react-icons/lu";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getTranslatedLabel } from "@/utils/i18n";
|
||||
import { requiresRestartForFieldPath } from "@/utils/configUtil";
|
||||
import { useDocDomain } from "@/hooks/use-doc-domain";
|
||||
import { ConfigFormContext } from "@/types/configForm";
|
||||
import {
|
||||
buildTranslationPath,
|
||||
@@ -180,7 +178,6 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
||||
"views/settings",
|
||||
"common",
|
||||
]);
|
||||
const { getLocaleDocUrl } = useDocDomain();
|
||||
const objectRequiresRestart = requiresRestartForFieldPath(
|
||||
fieldPath,
|
||||
restartRequired,
|
||||
@@ -303,17 +300,6 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
||||
schemaDescription;
|
||||
inferredDescription = inferredDescription ?? fallbackDescription;
|
||||
|
||||
const pathStringSegments =
|
||||
path?.filter((segment): segment is string => typeof segment === "string") ??
|
||||
[];
|
||||
const fieldDocsKey = translationPath || pathStringSegments.join(".");
|
||||
const fieldDocsPath = fieldDocsKey
|
||||
? formContext?.fieldDocs?.[fieldDocsKey]
|
||||
: undefined;
|
||||
const fieldDocsUrl = fieldDocsPath
|
||||
? getLocaleDocUrl(fieldDocsPath)
|
||||
: undefined;
|
||||
|
||||
const renderGroupedFields = (items: (typeof properties)[number][]) => {
|
||||
if (!items.length) {
|
||||
return null;
|
||||
@@ -467,7 +453,7 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
||||
<CardTitle
|
||||
className={cn(
|
||||
"flex items-center text-sm",
|
||||
hasModifiedDescendants && "text-unsaved",
|
||||
hasModifiedDescendants && "text-danger",
|
||||
)}
|
||||
>
|
||||
{inferredLabel}
|
||||
@@ -480,20 +466,6 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
||||
{inferredDescription}
|
||||
</p>
|
||||
)}
|
||||
{fieldDocsUrl && (
|
||||
<div className="mt-1 flex items-center text-xs text-primary-variant">
|
||||
<Link
|
||||
to={fieldDocsUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{t("readTheDocumentation", { ns: "common" })}
|
||||
<LuExternalLink className="ml-2 inline-flex size-3" />
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{isOpen ? (
|
||||
<LuChevronDown className="h-4 w-4 shrink-0" />
|
||||
|
||||
@@ -89,7 +89,6 @@ export function CameraGroupSelector({ className }: CameraGroupSelectorProps) {
|
||||
const { t } = useTranslation(["components/camera"]);
|
||||
const { data: config } = useSWR<FrigateConfig>("config");
|
||||
const allowedCameras = useAllowedCameras();
|
||||
const hasFullCameraAccess = useHasFullCameraAccess();
|
||||
const isAdmin = useIsAdmin();
|
||||
|
||||
// tooltip
|
||||
@@ -126,7 +125,7 @@ export function CameraGroupSelector({ className }: CameraGroupSelectorProps) {
|
||||
const allGroups = Object.entries(config.camera_groups);
|
||||
|
||||
// If custom role, filter out groups where user has no accessible cameras
|
||||
if (!hasFullCameraAccess) {
|
||||
if (!isAdmin) {
|
||||
return allGroups
|
||||
.filter(([, groupConfig]) => {
|
||||
// Check if user has access to at least one camera in this group
|
||||
@@ -138,7 +137,7 @@ export function CameraGroupSelector({ className }: CameraGroupSelectorProps) {
|
||||
}
|
||||
|
||||
return allGroups.sort((a, b) => a[1].order - b[1].order);
|
||||
}, [config, allowedCameras, hasFullCameraAccess]);
|
||||
}, [config, allowedCameras, isAdmin]);
|
||||
|
||||
// add group
|
||||
|
||||
@@ -592,7 +591,7 @@ export function CameraGroupRow({
|
||||
|
||||
{isMobile && !isReadOnly && (
|
||||
<>
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={!isDesktop}>
|
||||
<DropdownMenuTrigger>
|
||||
<HiOutlineDotsVertical className="size-5" />
|
||||
</DropdownMenuTrigger>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user