Skip to content

Migrates the progress bars in elastic search to use pajamas

Sam Beckham requested to merge 439748-progress-bar-migration into master

What does this MR do and why?

This MR migrates the progress bars in the elastic search settings to use pajamas. Visually, nothing has changed.

Note: This is an example of something being pajamas adopted, but not compliant. However, once we update the progress bar component to fully match the design system, this usage will get that upgrade for free.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2024-01-30_at_17.08.54 Screenshot_2024-01-30_at_17.11.34

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Head over to the admin setting page at http://gdk.test:3443/admin/application_settings/advanced_search
  2. Expand the Elasticsearch zero-downtime reindexing section.
  3. If you have the correct data, you should see the progress bars. If not, apply the attached patch and reload the page.
diff --git a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
index 69c599ce3be0..538bf0d6e6ba 100644
--- a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
+++ b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
@@ -243,11 +243,12 @@
           .form-text.gl-text-red-500.gl-mt-0
             = _("Unused, previous indices: %{index_names} will be deleted after %{time} automatically.") % { index_names: task.subtasks.map(&:index_name_from).join(', '), time: task.delete_original_index_at }
             = link_to _('Cancel index deletion'), admin_elasticsearch_cancel_index_deletion_path(task_id: task.id), class: 'gl-mb-2', method: :post
-        - if @last_elasticsearch_reindexing_task
-          %h5= _('Reindexing Status: %{status} (Slice multiplier: %{multiplier}, Maximum running slices: %{max_slices})') % { status: @last_elasticsearch_reindexing_task.state, max_slices: @last_elasticsearch_reindexing_task.max_slices_running, multiplier: @last_elasticsearch_reindexing_task.slice_multiplier }
-          - if @last_elasticsearch_reindexing_task.error_message
-            %p= _('Error: %{error_message}') % { error_message: @last_elasticsearch_reindexing_task.error_message }
-          - @last_elasticsearch_reindexing_task.subtasks.order_by_alias_name_asc.each do |subtask|
+        - @last_elasticsearch_reindexing_task2 = OpenStruct.new( state: 'InProgress', max_slices_running: 5, slice_multiplier: 2, error_message: nil, subtasks: [ OpenStruct.new( alias_name: 'Subtask 1', documents_count: 1000, elastic_task: 'elastic_task_1', documents_count_target: 500 ), OpenStruct.new( alias_name: 'Subtask 2', documents_count: 1500, elastic_task: 'elastic_task_2', documents_count_target: 1200 ) ] )
+        - if @last_elasticsearch_reindexing_task2
+          %h5= _('Reindexing Status: %{status} (Slice multiplier: %{multiplier}, Maximum running slices: %{max_slices})') % { status: @last_elasticsearch_reindexing_task2.state, max_slices: @last_elasticsearch_reindexing_task2.max_slices_running, multiplier: @last_elasticsearch_reindexing_task2.slice_multiplier }
+          - if @last_elasticsearch_reindexing_task2.error_message
+            %p= _('Error: %{error_message}') % { error_message: @last_elasticsearch_reindexing_task2.error_message }
+          - @last_elasticsearch_reindexing_task2.subtasks.each do |subtask|
             .gl-card-body.form-group
               %h5= subtask.alias_name
               - expected_documents = subtask.documents_count

Related to #439748 (closed)

Edited by Sam Beckham

Merge request reports