Skip to content

Background Migrations - Mutli DB Admin UI

Zack Cuddy requested to merge cuddyz-multi-db-batched-migrations-ui into master

What does this MR do and why?

frontend for !85207 (merged)
Closes #358895 (closed)

This change adds Multi-Database support to the Background Migrations Admin UI. This is done by adding a GlDropdown that allows users to switch between which database's migrations they are viewing. This is managed by the URL query parameter.

Additionally this change also adds a Page Title and help text to better illustrate what the View does. The documentation linked is https://docs.gitlab.com/ee/development/database/batched_background_migrations.html

Some related conversations about the UI decisions made here: !85207 (comment 920077407)

Screenshots or screen recordings

Desktop Mobile
w/ Multi Screen_Shot_2022-04-21_at_12.18.24_PM Screen_Shot_2022-04-21_at_12.23.40_PM
w/ Single Screen_Shot_2022-04-21_at_12.25.39_PM Screen_Shot_2022-04-21_at_12.25.44_PM

How to set up and validate locally

Some GDK setup is required before you can test this locally on your GDK:

Enable Multi DB support

  1. Navigate to your /gitlab directory in your terminal
  2. Run the command gdk config set gitlab.rails.multiple_databases true
  3. Run gdk reconfigure

Seed some data

  1. Navigate to your /gitlab directory in your terminal
  2. Run the command rails c
  3. Copy and paste the following code in the rails console that appears:
Gitlab::Database::EachDatabase.each_database_connection do
  active_migration = FactoryBot.create(:batched_background_migration, :active)
  finished_migration = FactoryBot.create(:batched_background_migration, :finished)
  failed_migration = FactoryBot.create(:batched_background_migration, :failed)

  FactoryBot.create(:batched_background_migration_job, :succeeded, batched_migration: active_migration)
  FactoryBot.create(:batched_background_migration_job, :running, batched_migration: active_migration)
  FactoryBot.create(:batched_background_migration_job, :succeeded, batched_migration: finished_migration)
  FactoryBot.create(:batched_background_migration_job, :succeeded, batched_migration: finished_migration)
  FactoryBot.create(:batched_background_migration_job, :succeeded, batched_migration: finished_migration)
  FactoryBot.create(:batched_background_migration_job, :failed, batched_migration: failed_migration)
end

Test

  1. Navigate to the background migrations tab (ex. http://127.0.0.1:3000/admin/background_migrations).
  2. Ensure you see the dropdown in the top right of the view.
  3. Toggle the dropdown and navigate tabs.
  4. Ensure the url params are properly updated.

MR acceptance checklist

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

cc/ @alexives @pbair

Edited by Zack Cuddy

Merge request reports

Loading