fix(ui): hide disabled media browser buttons - #3383
Conversation
Marijn0
left a comment
There was a problem hiding this comment.
Thanks for working on this. I think the idea of hiding irrelevant buttons makes sense (IMO).
However, I have a concern with the current implementation. The buttons are hidden purely based on whether still images or movies are enabled in the camera configuration, but this doesn't account for existing media files.
Consider this scenario: a user had still images or movies enabled for some time, then disables them. They still have photos and/or movies on disk that they may want to view, download, or delete. With this PR, the buttons would be hidden, leaving them with no way to access those existing files through the UI.
My suggestion would be to hide the button only when both of these conditions are true:
- The corresponding capture mode is disabled (as implemented now).
- There are no existing files of that type.
That way, the button disappears only when it truly serves no purpose.
Per @Marijn0's review: hiding a media-browser button purely on the capture-mode flag also cut off access to media recorded before the mode was disabled. Now, when a capture mode is disabled, the button is hidden only after an async check of the existing list endpoint (with_stat=false) finds no files of that type. Enabled modes issue no request, and simple MJPEG cameras still hide both buttons. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Good point — thanks! Addressed in c154a74. A media-browser button is now hidden only when its capture mode is disabled and the list endpoint returns no files of that type, so media recorded before disabling capture stays accessible:
One note: this reuses the existing list endpoint, which builds the full media list just to test emptiness (only for disabled-capture cameras). A dedicated lightweight |
|
Heads up: this PR was closed by accident when its branch got deleted during a rebase. The work continues in #3387, which carries the same change plus the review fix @Marijn0 requested here (hide a media button only when its capture mode is disabled and there are no existing files of that type). Please follow #3387 — sorry for the noise! |
Summary
Why
The camera overlay currently exposes media browser buttons even when the corresponding media capture feature is disabled. This makes the top-button state inconsistent with the camera settings.
Fixes #2731.
Validation
motioneye/static/js/main.jspytestis not installed (python3 -m pytestreportsNo module named pytest)