GitLab Version - Refactor into version app
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:
- Renames
GitlabVersionCheck
=>GitlabVersionCheckBadge
- This is for clarity.
GitLabVersionCheck
will now reference the entire suite of components while theGitLabVersionCheckBadge
will represent just the badge.
- This is for clarity.
- Moves VersionCheck from
vue-shared
togitlab_version
- Since this application is expanding and becoming more singularly focused it doesn't make as much since to "share" this component any longer.
- 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).
- 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:
- Help Dropdown (? in top right of nav)
- Admin Dashboard (/admin)
- Help Page (/help)
Screenshots or screen recordings
No visual changes
How to set up and validate locally
Important
- Ensure
Gitlab::CurrentSettings.version_check_enabled
is set to true (it defaults to true) - 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
- Repeat these steps for the following views
/help
/admin
- Help Dropdown (? in top nav)
- Find the Version Check badge
-
/help
=> At top of page -
/admin
=> In the components card - Help Dropdown => First list item
-
- Ensure that when the badge is rendered the correct tracking event is fired
- 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.
-
I have evaluated the MR acceptance checklist for this MR.