Skip to content

Show zero counts in embedded views

What does this MR do and why?

Adds the ability for embedded views (GLQL tables) to display "0" in their collapsed title, making it easy to scan multiple tables and quickly identify which ones have no results without expanding them.

Technical Investigation

During investigation with #575103 (comment 2829392633) we discovered that crud_component's zero display logic was tied to having an icon prop: this.icon && !this.count ? '0' : this.count

We searched the codebase and found:

  • 55+ components use crud_component
  • Only 3-4 components actually pass an icon prop (child items, linked items, list_selector)
  • This meant most components couldn't display zero counts

Solution

Added an explicit showZeroCount prop to crud_component that:

  1. Provides a semantic way to control zero count display
  2. Maintains backward compatibility with existing icon-based logic
  3. Allows embedded views to show "0" for empty results when collapsed

Known Consideration

There's a potential brief flicker during initial page load if loading state isn't properly initialized in parent components.

Discussing optimal pattern with reviewer.

Screenshots

Before After
No count shown for empty results Shows "0" for empty results
CleanShot 2025-10-24 at 10.45.30@2x.png CleanShot 2025-10-22 at 17.46.01@2x.png

MR checklist

  • Added showZeroCount prop to crud_component
  • Updated GLQL facade to use the new prop
  • Tested with both zero and non-zero results
  • Added comprehensive unit tests for both components
  • Verified backward compatibility with existing components
  • Added screenshots

@himkp @mmacfarlane FYI

Edited by Alex Fracazo

Merge request reports

Loading