Skip to content

Fix thumbnails on vehicle setup page#3853

Merged
joaomariolago merged 2 commits intobluerobotics:masterfrom
joaoantoniocardoso:fix-video-overview-thumbnail
Mar 27, 2026
Merged

Fix thumbnails on vehicle setup page#3853
joaomariolago merged 2 commits intobluerobotics:masterfrom
joaoantoniocardoso:fix-video-overview-thumbnail

Conversation

@joaoantoniocardoso
Copy link
Member

@joaoantoniocardoso joaoantoniocardoso commented Mar 24, 2026

Closes #3851

Summary

  • Add autoplay prop to VideoThumbnail so thumbnails fetch automatically on mount (used in vehicle setup tooltip on hover)
  • Only show devices with configured streams in the vehicle setup Video overview
  • Make register prop dynamic based on stream availability instead of hardcoded

Test plan

  • Hover over camera icon on /vehicle/setup — thumbnail should start fetching automatically
  • Devices without streams should not appear in the Video section of /vehicle/setup

Summary by Sourcery

Update vehicle setup video overview to only show devices with available streams and ensure video thumbnails can autoplay when appropriate.

New Features:

  • Allow video thumbnails to autoplay fetching on mount when enabled.

Bug Fixes:

  • Prevent registration of video thumbnails for devices without available streams.
  • Exclude devices without configured streams from the vehicle setup video overview.

Summary by Sourcery

Update vehicle setup video overview to only show devices with available video streams and enable video thumbnails to autoplay fetching on mount when appropriate.

New Features:

  • Add optional autoplay behavior to video thumbnails so they can begin fetching on component mount when enabled.

Bug Fixes:

  • Prevent registration and display of video thumbnails for devices without available video streams in the vehicle setup overview.

Enhancements:

  • Filter vehicle setup video devices to exclude those without configured streams, ensuring only valid video sources are shown.

Automatically starts continuous thumbnail fetching on mount when both
autoplay and register are true. Used in the vehicle setup page tooltip
so thumbnails appear on hover without manual interaction.
…with streams

Filter out video devices that have no streams configured from the
vehicle setup overview, so duplicate sources from the same camera
don't appear.
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the vehicle setup video overview to only show devices with available streams and enhances VideoThumbnail to support autoplayed thumbnail fetching based on stream availability, avoiding registration and polling for unsupported devices.

Sequence diagram for autoplay video thumbnail fetching on vehicle setup hover

sequenceDiagram
  actor User
  participant VehicleSetupPage
  participant VideoOverview
  participant VTooltip
  participant VideoThumbnail
  participant VideoService

  User->>VehicleSetupPage: Navigate to /vehicle/setup
  VehicleSetupPage->>VideoOverview: Render video overview
  VideoOverview->>VideoThumbnail: Create instance
  Note over VideoOverview,VideoThumbnail: Props: width=280, source=device.source,
  Note over VideoOverview,VideoThumbnail: register=streams_for_device[device.name] !== undefined,
  Note over VideoOverview,VideoThumbnail: autoplay=true

  User->>VTooltip: Hover camera icon
  VTooltip->>VideoThumbnail: Mount thumbnail component

  VideoThumbnail->>VideoThumbnail: mounted()
  VideoThumbnail->>VideoThumbnail: update_task.setAction(updateThumbnail)
  alt autoplay enabled and register true
    VideoThumbnail->>VideoThumbnail: continuous_mode = true
    VideoThumbnail->>VideoService: startGetThumbnailForDevice(source)
  else autoplay disabled or register false
    VideoThumbnail->>VideoThumbnail: Wait for manual trigger
  end
Loading

Updated class diagram for VideoOverview and VideoThumbnail components

classDiagram
  class VideoOverview {
    +computed valid_visible_video_devices
    +methods available_streams_from_device(video_available_streams, device)
    +methods has_supported_encode(device)
  }

  class VideoThumbnail {
    +prop source
    +prop width
    +prop register
    +prop disabled
    +prop autoplay
    +data continuous_mode
    +data stopDebounceTimer
    +data update_task
    +mounted mounted()
    +beforeDestroy beforeDestroy()
    +methods updateThumbnail()
  }

  VideoOverview --> VideoThumbnail : uses
  VideoOverview : filters devices
  VideoOverview : requires available streams
  VideoThumbnail : if autoplay && register
  VideoThumbnail : continuous_mode = true
  VideoThumbnail : video.startGetThumbnailForDevice(source)
Loading

File-Level Changes

Change Details Files
Filter vehicle setup video overview to only show devices with configured streams and pass dynamic registration/autoplay props to thumbnails.
  • Change VideoOverview to pass a numeric width value to VideoThumbnail instead of a CSS string.
  • Bind the VideoThumbnail register prop to whether the current device has entries in streams_for_device.
  • Enable the autoplay prop on VideoThumbnail instances so thumbnails start fetching on mount when applicable.
  • Extend the valid_devices computation to exclude devices that have no available video streams using available_streams_from_device(...).isEmpty().
core/frontend/src/components/vehiclesetup/overview/VideoOverview.vue
Add autoplay support and mount-time behavior to VideoThumbnail so thumbnails automatically start fetching when allowed.
  • Introduce a new Boolean autoplay prop on VideoThumbnail.
  • On component mount, when both autoplay and register are true, set continuous_mode to true and invoke video.startGetThumbnailForDevice(this.source) to begin thumbnail polling.
  • Retain existing lifecycle handling, including task registration and debounce timer cleanup.
core/frontend/src/components/video-manager/VideoThumbnail.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#3851 Ensure that video thumbnails are fetched and displayed correctly on the vehicle setup page (e.g., when hovering over the camera icon).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@joaoantoniocardoso joaoantoniocardoso changed the title frontend: fix video thumbnail autoplay and filter devices without streams Fix thumbnails on vehicle setup page Mar 24, 2026
@joaoantoniocardoso joaoantoniocardoso marked this pull request as ready for review March 24, 2026 18:00
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Changing width from "280px" to "280" may alter how the VideoThumbnail renders (string vs number and missing units); double‑check that the underlying component handles bare numeric values correctly and still applies the intended pixel width.
  • The :register="streams_for_device[device.name] !== undefined" check assumes undefined is the only non-available state; consider using a more explicit existence check (e.g. key presence or a truthiness test) to avoid edge cases with null or inherited properties.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing `width` from `"280px"` to `"280"` may alter how the `VideoThumbnail` renders (string vs number and missing units); double‑check that the underlying component handles bare numeric values correctly and still applies the intended pixel width.
- The `:register="streams_for_device[device.name] !== undefined"` check assumes undefined is the only non-available state; consider using a more explicit existence check (e.g. key presence or a truthiness test) to avoid edge cases with `null` or inherited properties.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@joaomariolago joaomariolago merged commit 8904c7c into bluerobotics:master Mar 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thumbnails are not being fetched on vehicle setup page

2 participants