Skip to content

GitLab Version - Properly import on dashboard

Zack Cuddy requested to merge 369442-fix-version-badge-analytics into master

What does this MR do and why?

Related to #369442 (closed)

The GitLab Version check badge is a badge that informs users of their instance's version status and the severity of an upgrade if they are behind versions. This badge exists in three places:

  1. Help Dropdown (? in top right of nav)
  2. Admin Dashboard (/admin)
  3. Help Page (/help)

The Vue Application is bootstrapped to the element when the page is loaded for Admin and Help pages but only when the ? is clicked for the Help Dropdown. However, the HAML element still exists until it is replaced by Vue.

The Issue

The problem is that when adding the Vue application at the admin/index.js level it tries to bootstrap the element on EVERY admin route. Since the element is technically in the help dropdown it then renders it for every admin page even though it isn't needed. Moving the import to admin/dashboard/index.js will ensure it only renders on the Admin Dashboard page and then for all other admin pages it would only render IF a user clicks the ? dropdown.

Screenshots or screen recordings

N/A

How to set up and validate locally

Important

  1. Ensure Gitlab::CurrentSettings.version_check_enabled is set to true (it defaults to true)
  2. Version Check uses ReactiveCache so the first time you navigate to a place where the badge should be, it may not be in the cache and required a single reload.
  3. Please read note above in the first section about my issues with setting up snowplow locally.

Testing Instructions

  1. Go to /admin and check the network logs for version_check.json in the requests (it will fire twice since it will find the element hidden in the help dropdown, the results are cached so this should be okay)
  2. Go to any other admin path /admin/users for example. Ensure no version_check.json call is made on load
  3. Click the ? dropdown
  4. Ensure now a version_check.json call is made

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 #369442 (closed)

Merge request reports

Loading