Background Migrations - Mutli DB Admin UI
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 | ||
w/ Single |
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
- Navigate to your
/gitlab
directory in your terminal - Run the command
gdk config set gitlab.rails.multiple_databases true
- Run
gdk reconfigure
Seed some data
- Navigate to your
/gitlab
directory in your terminal - Run the command
rails c
- 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
- Navigate to the background migrations tab (ex.
http://127.0.0.1:3000/admin/background_migrations
). - Ensure you see the dropdown in the top right of the view.
- Toggle the dropdown and navigate tabs.
- 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.
-
I have evaluated the MR acceptance checklist for this MR.