Skip to content

Hide expand button for empty simple widgets

What does this MR do and why?

For #350881 (closed)

This MR hides the expand button on widgets that are completely empty when expanded. The accessibility widget and the metrics widget are still shown when they are empty, and they derive their fullData from their collapsedData (instead of making an additional HTTP request), so we know whether they're empty before the expand button is clicked to trigger fetchFullData.

The load performance and browser performance widgets are not shown when they are empty, so this does not apply to them. Similarly, for the test report widget, there is no completely empty state - either the widget is not shown at all, or it will show a parsing error if the report is incomplete (has no suites), or it will show a list of suites even when all the suites are empty.

Screenshots or screen recordings

before after
Screen_Recording_2022-07-07_at_14.07.41 Screen_Shot_2022-07-07_at_14.03.33

How to set up and validate locally

  1. git checkout 350881-hide-expand-button-when-data-empty
  2. echo "Feature.enable(:refactor_mr_widgets_extensions)" | bundle exec rails console
  3. to enable metrics reports, have a GitLab Premium or higher licence
  4. set up metrics reports and accessibility reports for a project, but have them find no results - you can use this .gitlab-ci.yml snippet:
include:
  - template: "Verify/Accessibility.gitlab-ci.yml"

stages:
  - test
  - accessibility

metrics:
  stage: test
  script:
    - echo "" >> metrics.txt
  artifacts:
    reports:
      metrics: metrics.txt

a11y:
  stage: accessibility
  rules:
  - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    when: never
  - changes:
    - foo/**/*
    - foo_scenarios/**/*
    - .gitlab-ci.yml
    when: always
  variables:
    a11y_urls: "http://pa11y.org"
  1. open a merge request and ensure pipelines ran for the base commit and head commit of the merge request's branch
  2. navigate to the merge request once the pipelines have finished and test out the metrics and accessibility widgets

MR acceptance checklist

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

Edited by Miranda Fluharty

Merge request reports