Skip to content

Add dropdown button text component for vulnerability report

What does this MR do and why?

This MR adds a DropdownButtonText component that's currently unused, but will be used by a future MR to set the text in the dropdown button on the vulnerability report filters:

ksnip_20221105-233818

GlDropdown will automatically truncate text, but we need custom behavior:

  1. We show Item 1 +x more, where Item 1 is the name of the item and +x more is how many items are selected past the first one.

  2. The +x more part should never be truncated; the first item's name should be truncated instead, e.g. Really long selected item name +2 more should be truncated to Really long sel... +2 more.

There's enough custom behavior to warrant creating a separate component to handle this, and each vulnerability filter will be using it.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #376324 (closed)

Merge request reports