Skip to content

GitLab Version - Refactor into version app

Zack Cuddy requested to merge 379130_01-refactor-version-check-naming into master

What does this MR do and why?

Split off from !102450 (merged)
Refactor in preparation for: #379130 (closed)

This change is a refactor to prepare us to expand the Version Check Application. Right now the app simply shows a badge when a status is returned. Moving forward we will be showing an Alert and/or Modal for a Security related upgrade. To do so we need to shift a few things around with how we import this file and fetch the HTTP response.

This change does the following:

  1. Renames GitlabVersionCheck => GitlabVersionCheckBadge
    • This is for clarity. GitLabVersionCheck will now reference the entire suite of components while the GitLabVersionCheckBadge will represent just the badge.
  2. Moves VersionCheck from vue-shared to gitlab_version
    • Since this application is expanding and becoming more singularly focused it doesn't make as much since to "share" this component any longer.
  3. Prefetches the API response before deciding to render the component
    • This will allow us to determine if future components need to be rendered. (ex. Security Upgrade Alert)
    • This also allows us to only need to make the API request once (ex. Admin Dashboard makes 2 requests right now since the badge is in 2 places).
  4. Splits test logic between the index file and the component
    • Since we move the API request out of the component this made logical sense.

About Version Check Badge

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)

Screenshots or screen recordings

No visual changes

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.

Testing Instructions

  1. Repeat these steps for the following views
    • /help
    • /admin
    • Help Dropdown (? in top nav)
  2. Find the Version Check badge
    • /help => At top of page
    • /admin => In the components card
    • Help Dropdown => First list item
  3. Ensure that when the badge is rendered the correct tracking event is fired
  4. Ensure when clicking the badge/link the correct tracking event is fired

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 Zack Cuddy

Merge request reports