Skip to content
Snippets Groups Projects
Verified Commit 7f0412ad authored by Tomas Bulva's avatar Tomas Bulva Committed by GitLab
Browse files

Improved how the status of reindexing is presented

Chnagelog: changed
parent 52e75593
No related branches found
No related tags found
3 merge requests!181325Fix ambiguous `created_at` in project.rb,!179611Draft: Rebase CR approach for zoekt assignments,!174587Improve clarity around Reindexing Status in the UI
...@@ -13,6 +13,7 @@ module ApplicationSettingsController ...@@ -13,6 +13,7 @@ module ApplicationSettingsController
include MicrosoftApplicationActions include MicrosoftApplicationActions
before_action :elasticsearch_reindexing_task, only: [:advanced_search] before_action :elasticsearch_reindexing_task, only: [:advanced_search]
before_action :elasticsearch_reindexing_state, only: [:advanced_search]
before_action :elasticsearch_index_settings, only: [:advanced_search] before_action :elasticsearch_index_settings, only: [:advanced_search]
before_action :elasticsearch_warn_if_not_using_aliases, only: [:advanced_search] before_action :elasticsearch_warn_if_not_using_aliases, only: [:advanced_search]
before_action :elasticsearch_warn_if_obsolete_migrations, only: [:advanced_search] before_action :elasticsearch_warn_if_obsolete_migrations, only: [:advanced_search]
...@@ -45,6 +46,15 @@ def elasticsearch_index_settings ...@@ -45,6 +46,15 @@ def elasticsearch_index_settings
@elasticsearch_index_settings = Elastic::IndexSetting.order_by_name @elasticsearch_index_settings = Elastic::IndexSetting.order_by_name
end end
def elasticsearch_reindexing_state
human_states = ::Search::Elastic::ReindexingTask::HUMAN_STATES
human_state_colors = ::Search::Elastic::ReindexingTask::HUMAN_STATE_COLORS
normalized_status = @last_elasticsearch_reindexing_task&.state || 'initial'
@elasticsearch_reindexing_human_state = human_states[normalized_status]
@elasticsearch_reindexing_human_state_color = human_state_colors[normalized_status]
end
def elasticsearch_warn_if_not_using_aliases def elasticsearch_warn_if_not_using_aliases
@elasticsearch_warn_if_not_using_aliases = ::Gitlab::Elastic::Helper.default.alias_missing? && @elasticsearch_warn_if_not_using_aliases = ::Gitlab::Elastic::Helper.default.alias_missing? &&
::Gitlab::Elastic::Helper.default.index_exists? ::Gitlab::Elastic::Helper.default.index_exists?
......
...@@ -5,6 +5,24 @@ module Elastic ...@@ -5,6 +5,24 @@ module Elastic
class ReindexingTask < ApplicationRecord class ReindexingTask < ApplicationRecord
include EachBatch include EachBatch
HUMAN_STATES = {
"initial" => "starting",
"indexing_paused" => "in progress",
"reindexing" => "reindexing",
"success" => "successfully indexed",
"failure" => "indexing failed",
"original_index_deleted" => "original index deleted"
}.freeze
HUMAN_STATE_COLORS = {
"initial" => "tip",
"indexing_paused" => "info",
"reindexing" => "info",
"success" => "success",
"failure" => "danger",
"original_index_deleted" => "info"
}.freeze
self.table_name = 'elastic_reindexing_tasks' self.table_name = 'elastic_reindexing_tasks'
validates :max_slices_running, presence: true validates :max_slices_running, presence: true
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
- first_pending_migration = Elastic::DataMigrationService.pending_migrations.first if elasticsearch_available && Elastic::DataMigrationService.pending_migrations? - first_pending_migration = Elastic::DataMigrationService.pending_migrations.first if elasticsearch_available && Elastic::DataMigrationService.pending_migrations?
- pending_migration_running_and_pauses_indexing = first_pending_migration&.running? && first_pending_migration&.pause_indexing? - pending_migration_running_and_pauses_indexing = first_pending_migration&.running? && first_pending_migration&.pause_indexing?
- disable_checkbox = !Gitlab::CurrentSettings.elasticsearch_indexing? || pending_migration_running_and_pauses_indexing || @last_elasticsearch_reindexing_task&.in_progress? - disable_checkbox = !Gitlab::CurrentSettings.elasticsearch_indexing? || pending_migration_running_and_pauses_indexing || @last_elasticsearch_reindexing_task&.in_progress?
= f.gitlab_ui_checkbox_component :elasticsearch_pause_indexing, s_('AdminSettings|Pause Elasticsearch indexing'), checkbox_options: { disabled: disable_checkbox }, help_text: pending_migration_running_and_pauses_indexing ? s_('AdminSettings|There are Advanced Search migrations pending that require indexing to pause. Indexing must remain paused until GitLab completes the migrations.') : s_('AdminSettings|Use for cluster and index migrations. When indexing is paused, GitLab still tracks changes.') = f.gitlab_ui_checkbox_component :elasticsearch_pause_indexing, s_('AdminSettings|Pause Elasticsearch indexing'), checkbox_options: { disabled: disable_checkbox }, help_text: pending_migration_running_and_pauses_indexing ? s_('AdminSettings|There are Advanced Search migrations pending that require indexing to pause. Indexing must remain paused until GitLab completes the migrations.') : s_('AdminSettings|Use for cluster and index migrations. When indexing is paused, GitLab still tracks changes.')
.form-group .form-group
...@@ -240,28 +241,70 @@ ...@@ -240,28 +241,70 @@
= html_escape(_('Set the maximum number of slices allowed to run concurrently during Elasticsearch reindexing. Learn more about %{max_slices_running_link_start}maximum running slices configuration%{max_slices_link_end}.')) % { max_slices_running_link_start: max_slices_running_link_start, max_slices_link_end: '</a>'.html_safe } = html_escape(_('Set the maximum number of slices allowed to run concurrently during Elasticsearch reindexing. Learn more about %{max_slices_running_link_start}maximum running slices configuration%{max_slices_link_end}.')) % { max_slices_running_link_start: max_slices_running_link_start, max_slices_link_end: '</a>'.html_safe }
= f.submit _('Trigger cluster reindexing'), pajamas_button: true, disabled: @last_elasticsearch_reindexing_task&.in_progress?, data: { confirm: _('Are you sure you want to reindex?') } = f.submit _('Trigger cluster reindexing'), pajamas_button: true, disabled: @last_elasticsearch_reindexing_task&.in_progress?, data: { confirm: _('Are you sure you want to reindex?') }
.form-text.gl-text-subtle .form-text.gl-text-subtle.gl-mt-5
- Search::Elastic::ReindexingTask.old_indices_scheduled_for_deletion.each do |task|
.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 - 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 } %hr
- if @last_elasticsearch_reindexing_task.error_message
%p= _('Error: %{error_message}') % { error_message: @last_elasticsearch_reindexing_task.error_message } - title = _('Status: %{status}') % { status: @elasticsearch_reindexing_human_state }
- @last_elasticsearch_reindexing_task.subtasks.order_by_alias_name_asc.each do |subtask| = render Pajamas::AlertComponent.new(variant: @elasticsearch_reindexing_human_state_color, title: title, dismissible: false, alert_options: { id: 'error_explanation', class: 'gl-mb-5' }) do |c|
.gl-card-body.form-group - if @last_elasticsearch_reindexing_task&.error_message
%h5= subtask.alias_name - c.with_body do
- expected_documents = subtask.documents_count = _('Error: %{error_message}') % { error_message: @last_elasticsearch_reindexing_task&.error_message }
- if subtask.elastic_task
%p= _('Task ID: %{elastic_task}') % { elastic_task: subtask.elastic_task } - elsif @last_elasticsearch_reindexing_task&.subtasks&.any?
- if expected_documents %p= _('(Slice multiplier: %{multiplier}, Maximum running slices: %{max_slices})') % { max_slices: @last_elasticsearch_reindexing_task.max_slices_running, multiplier: @last_elasticsearch_reindexing_task.slice_multiplier }
- processed_documents = subtask.documents_count_target - component_params = { card_options: { class: 'gl-h-full' }, header_options: { class: 'gl-flex gl-justify-between gl-items-start' }, body_options: { class: 'gl-h-full gl-pt-0' } }
%p= _('Expected documents: %{expected_documents}') % { expected_documents: expected_documents } = render Pajamas::CardComponent.new(**component_params) do |c|
- if processed_documents && expected_documents - c.with_header do
%h3.gl-self-center.gl-text-base.gl-inline-flex.gl-gap-2.gl-items-center.gl-m-0
- approximate_index_count = @last_elasticsearch_reindexing_task.subtasks.count
= s_('GlobalSearch|Overview')
= render Pajamas::BadgeComponent.new(approximate_index_count, variant: :muted)
- c.with_body do
.gl-flex.gl-flex-col.gl-h-full.gl-items-stretch
- ordered_subtasks = @last_elasticsearch_reindexing_task.subtasks.order_by_alias_name_asc
- ordered_subtasks.each do |subtask|
- expected_documents = subtask.documents_count
- processed_documents = subtask.documents_count_target.nil? ? 0 : subtask.documents_count_target
- percentage = expected_documents > 0 ? ((processed_documents / expected_documents.to_f) * 100).round(2) : 100 - percentage = expected_documents > 0 ? ((processed_documents / expected_documents.to_f) * 100).round(2) : 100
%p= _('Documents reindexed: %{processed_documents} (%{percentage}%%)') % { processed_documents: processed_documents, percentage: percentage } - formatted_percentage = percentage % 1 == 0 ? percentage.to_i : percentage
= render Pajamas::ProgressComponent.new(value: percentage)
.gl-flex.gl-justify-between.gl-items-center.gl-py-4{ class: ('gl-border-b' if subtask != ordered_subtasks.last) }
.gl-w-40.gl-truncat.gl-h-auto
= subtask.alias_name
%span.gl-mx-auto.gl-whitespace-nowrap.gl-text-left.gl-text-sm.gl-text-subtle
%p.gl-text-left{ class: '!gl-mb-0' }
= _('Indexed documents: %{processed_documents}/%{expected_documents}') % { expected_documents: expected_documents, processed_documents: processed_documents }
.gl-flex.gl-text-right.gl-justify-end.gl-items-center{ class: 'gl-w-2/3' }
- if percentage < 100
= render Pajamas::ProgressComponent.new(value: percentage)
- else
= render Pajamas::BadgeComponent.new(_('%{percentage}%%') % { percentage: formatted_percentage }, variant: 'success')
- if Search::Elastic::ReindexingTask.old_indices_scheduled_for_deletion.any?
- component_params = { card_options: { class: 'gl-h-full gl-mt-6' }, header_options: { class: 'gl-flex gl-justify-between gl-items-start' }, body_options: { class: 'gl-h-full gl-pt-0' }, footer_options: { class: 'gl-pt-4' } }
= render Pajamas::CardComponent.new(**component_params) do |c|
- c.with_header do
%h3.gl-self-center.gl-text-base.gl-inline-flex.gl-gap-2.gl-items-center.gl-m-0
- unused_indices_count = Search::Elastic::ReindexingTask.old_indices_scheduled_for_deletion.sum { |task| task.subtasks.size }
= _('Unused indices scheduled for deletion')
= render Pajamas::BadgeComponent.new(unused_indices_count, variant: :muted)
- c.with_body do
.gl-flex.gl-flex-col.gl-h-full.gl-items-stretch
- Search::Elastic::ReindexingTask.old_indices_scheduled_for_deletion.each do |task|
- task.subtasks.each_with_index do |subtask, index|
.gl-flex.gl-justify-between.gl-items-center.gl-py-4{ class: ('gl-border-b' if index != task.subtasks.size - 1) }
.gl-w-40.gl-truncate.gl-h-auto
= subtask.index_name_from
.gl-flex.gl-text-sm.gl-text-subtle
= _('Deletion scheduled at: %{time}') % { time: task.delete_original_index_at }
- c.with_footer do
.gl-flex.gl-justify-end
= render Pajamas::ButtonComponent.new(variant: :danger, href: admin_elasticsearch_cancel_index_deletion_path, method: :post) do
= _('Cancel deletion for all indices')
= render ::Layouts::SettingsBlockComponent.new(_('Indexing status'), = render ::Layouts::SettingsBlockComponent.new(_('Indexing status'),
id: 'js-indexing-status', id: 'js-indexing-status',
......
...@@ -652,7 +652,7 @@ ...@@ -652,7 +652,7 @@
get :advanced_search get :advanced_search
expect(assigns(:last_elasticsearch_reindexing_task)).to eq(task) expect(assigns(:last_elasticsearch_reindexing_task)).to eq(task)
expect(response.body).to include("Reindexing Status: #{task.state}") expect(response.body).to have_selector('[role="alert"]', text: /Status: starting/)
end end
end end
......
...@@ -9,4 +9,34 @@ ...@@ -9,4 +9,34 @@
subtasks { [association(:elastic_reindexing_subtask)] } subtasks { [association(:elastic_reindexing_subtask)] }
end end
end end
factory :elasticsearch_reindexing_state do
state { :in_progress } # default state
error_message { nil } # default error message
trait :initial do
state { :initial }
end
trait :indexing_paused do
state { :indexing_paused }
end
trait :reindexing do
state { :reindexing }
end
trait :success do
state { :success }
end
trait :failure do
state { :failure }
error_message { "An error occurred" }
end
trait :original_index_deleted do
state { :original_index_deleted }
end
end
end end
...@@ -56,9 +56,40 @@ ...@@ -56,9 +56,40 @@
context 'Elasticsearch settings', :elastic_delete_by_query, feature_category: :global_search do context 'Elasticsearch settings', :elastic_delete_by_query, feature_category: :global_search do
let(:elastic_search_license) { true } let(:elastic_search_license) { true }
let(:admin) { create(:admin) }
let(:task) do
create(:elastic_reindexing_task).tap do |t|
allow(t).to receive_messages(
in_progress?: false,
error_message: nil,
state: :in_progress
)
end
end
let(:subtask) do
create(:elastic_reindexing_subtask,
documents_count: 0,
documents_count_target: 0,
reindexing_task: task
)
end
before do before do
stub_licensed_features(elastic_search: elastic_search_license) stub_licensed_features(elastic_search: elastic_search_license)
allow(::Search::Elastic::ReindexingTask)
.to receive(:last)
.and_return(task)
sign_in(admin)
enable_admin_mode!(admin)
allow(task).to receive_messages(
human_state_name: "Reindexing",
human_state_color: "gl-text-blue-400"
)
end end
it 'changes elasticsearch settings' do it 'changes elasticsearch settings' do
......
...@@ -17,11 +17,33 @@ ...@@ -17,11 +17,33 @@
let(:projects_not_indexed_count) { 0 } let(:projects_not_indexed_count) { 0 }
let(:projects_not_indexed) { [] } let(:projects_not_indexed) { [] }
let(:subtask) do
build_stubbed(
:elastic_reindexing_subtask,
documents_count: 0,
documents_count_target: 0
)
end
let(:fake_subtasks) { [subtask] }
let(:task) do
build_stubbed(:elastic_reindexing_task).tap do |t|
allow(t).to receive(:subtasks).and_return(fake_subtasks)
allow(fake_subtasks).to receive(:order_by_alias_name_asc).and_return(fake_subtasks)
allow(t).to receive(:in_progress?).and_return(true)
allow(t).to receive(:error_message).and_return(nil)
allow(t).to receive(:state).and_return(:in_progress)
end
end
before do before do
assign(:application_setting, application_setting) assign(:application_setting, application_setting)
assign(:elasticsearch_reindexing_task, elastic_reindexing_task) assign(:elasticsearch_reindexing_task, elastic_reindexing_task)
assign(:projects_not_indexed_count, projects_not_indexed_count) assign(:projects_not_indexed_count, projects_not_indexed_count)
assign(:projects_not_indexed, projects_not_indexed) assign(:projects_not_indexed, projects_not_indexed)
assign(:last_elasticsearch_reindexing_task, task)
allow(Elastic::DataMigrationService).to receive(:halted_migrations?).and_return(halted_migrations) allow(Elastic::DataMigrationService).to receive(:halted_migrations?).and_return(halted_migrations)
allow(Elastic::DataMigrationService).to receive(:pending_migrations?).and_return(pending_migrations) allow(Elastic::DataMigrationService).to receive(:pending_migrations?).and_return(pending_migrations)
...@@ -46,11 +68,28 @@ ...@@ -46,11 +68,28 @@
expect(rendered).to have_css('a.btn-confirm', text: button_text) expect(rendered).to have_css('a.btn-confirm', text: button_text)
end end
it 'renders an enabled pause checkbox' do context 'indexing is enabled' do
render let(:es_indexing) { true }
let(:pause_indexing) { false }
let(:task) do
build_stubbed(:elastic_reindexing_task).tap do |t|
allow(t).to receive(:in_progress?).and_return(false) # Ensure task is not in progress
end
end
before do
assign(:last_elasticsearch_reindexing_task, task)
expect(rendered).to have_css('input[id=application_setting_elasticsearch_pause_indexing]') allow(Gitlab::CurrentSettings).to receive(:elasticsearch_indexing?).and_return(es_indexing)
expect(rendered).not_to have_css('input[id=application_setting_elasticsearch_pause_indexing][disabled="disabled"]') allow(Gitlab::CurrentSettings).to receive(:elasticsearch_pause_indexing?).and_return(pause_indexing)
end
it 'renders an enabled pause checkbox' do
render
expect(rendered).to have_css('input[id=application_setting_elasticsearch_pause_indexing]')
expect(rendered).not_to have_css('input[id=application_setting_elasticsearch_pause_indexing][disabled="disabled"]')
end
end end
context 'pending migrations' do context 'pending migrations' do
...@@ -59,11 +98,15 @@ ...@@ -59,11 +98,15 @@
let(:elasticsearch_available) { true } let(:elasticsearch_available) { true }
let(:pending_migrations) { true } let(:pending_migrations) { true }
let(:migration) { Elastic::DataMigrationService.migrations.first } let(:migration) { Elastic::DataMigrationService.migrations.first }
let(:task) do
build_stubbed(:elastic_reindexing_task, state: :success, in_progress: false)
end
before do before do
allow(Elastic::DataMigrationService).to receive(:pending_migrations).and_return([migration]) allow(Elastic::DataMigrationService).to receive(:pending_migrations).and_return([migration])
allow(migration).to receive(:running?).and_return(running) allow(migration).to receive(:running?).and_return(running)
allow(migration).to receive(:pause_indexing?).and_return(pause_indexing) allow(migration).to receive(:pause_indexing?).and_return(pause_indexing)
assign(:last_elasticsearch_reindexing_task, task)
end end
where(:running, :pause_indexing, :disabled) do where(:running, :pause_indexing, :disabled) do
...@@ -136,12 +179,18 @@ ...@@ -136,12 +179,18 @@
context 'zero-downtime elasticsearch reindexing' do context 'zero-downtime elasticsearch reindexing' do
let(:application_setting) { build(:application_setting) } let(:application_setting) { build(:application_setting) }
let(:task) { build_stubbed(:elastic_reindexing_task) } let(:subtask) { build_stubbed(:elastic_reindexing_subtask) }
let(:subtask) { build_stubbed(:elastic_reindexing_subtask, elastic_reindexing_task: task) } let(:task) do
build_stubbed(:elastic_reindexing_task).tap do |t|
allow(t).to receive_message_chain(:subtasks, :order_by_alias_name_asc).and_return([subtask])
allow(t).to receive(:in_progress?).and_return(true)
allow(t).to receive(:error_message).and_return(nil)
end
end
before do before do
assign(:application_setting, application_setting)
assign(:last_elasticsearch_reindexing_task, task) assign(:last_elasticsearch_reindexing_task, task)
allow(task).to receive_message_chain(:subtasks, :order_by_alias_name_asc).and_return([subtask])
end end
context 'when task is in progress' do context 'when task is in progress' do
...@@ -162,55 +211,102 @@ ...@@ -162,55 +211,102 @@
context 'without extended details' do context 'without extended details' do
let(:task) { build(:elastic_reindexing_task) } let(:task) { build(:elastic_reindexing_task) }
let(:application_setting) { build_stubbed(:application_setting) }
before do
assign(:application_setting, application_setting)
assign(:last_elasticsearch_reindexing_task, task)
assign(:elasticsearch_reindexing_human_state, "starting")
assign(:elasticsearch_reindexing_human_state_color, "tip")
allow(view).to receive(:expanded) { true }
end
it 'renders the task' do it 'renders the task' do
render render
expect(rendered).to include("Reindexing Status: #{task.state}") expect(rendered).to have_selector('[role="alert"]', text: /Status: starting/)
expect(rendered).not_to include("Task ID:") expect(rendered).not_to have_selector('[role="alert"]', text: /Error: error-message/)
expect(rendered).not_to include("Error:")
expect(rendered).not_to include("Expected documents:")
expect(rendered).not_to include("Documents reindexed:")
end end
end end
context 'with extended details' do context 'with extended details' do
let(:task) { build_stubbed(:elastic_reindexing_task, state: :reindexing, error_message: 'error-message') } let(:application_setting) { build(:application_setting) }
let(:subtask) { build_stubbed(:elastic_reindexing_subtask, elastic_reindexing_task: task, documents_count_target: 5, documents_count: 10) } let(:task) do
build_stubbed(:elastic_reindexing_task, state: :reindexing, error_message: 'error-message').tap do |t|
it 'renders the task information' do allow(t).to receive(:in_progress?).and_return(true)
render allow(t).to receive(:state).and_return(:reindexing)
allow(t).to receive(:documents_count).and_return(50)
allow(t).to receive(:documents_count_target).and_return(100)
end
end
expect(rendered).to include("Reindexing Status: #{task.state}") let(:subtask) do
expect(rendered).to include("Error: #{task.error_message}") build_stubbed(:elastic_reindexing_subtask,
expect(rendered).to include("Expected documents: #{subtask.documents_count}") elastic_reindexing_task: task,
expect(rendered).to include("Documents reindexed: #{subtask.documents_count_target} (50.0%)") documents_count_target: 100,
documents_count: 50
)
end end
end
context 'with extended details, but without documents_count_target' do let(:ordered_subtasks) { [subtask] }
let(:task) { build_stubbed(:elastic_reindexing_task, state: :reindexing) } let(:elasticsearch_available) { true }
let(:subtask) { build_stubbed(:elastic_reindexing_subtask, elastic_reindexing_task: task, documents_count: 10) }
before do
assign(:application_setting, application_setting)
assign(:last_elasticsearch_reindexing_task, task)
allow(task).to receive(:subtasks).and_return(ordered_subtasks)
allow(ordered_subtasks).to receive(:count).and_return(1)
allow(ordered_subtasks).to receive(:any?).and_return(true)
allow(ordered_subtasks).to receive(:order_by_alias_name_asc).and_return(ordered_subtasks)
assign(:elasticsearch_reindexing_human_state, "reindexing")
assign(:elasticsearch_reindexing_human_state_color, "info")
allow(License).to receive(:feature_available?).with(:elastic_search).and_return(true)
allow(License).to receive(:current).and_return(true)
allow(Elastic::IndexSetting).to receive(:exists?).and_return(true)
end
it 'renders the task information' do it 'renders the task information' do
render render
expect(rendered).to have_selector('[role="alert"]', text: /Status: reindexing/)
expect(rendered).to include("Reindexing Status: #{task.state}") expect(rendered).to have_selector('[role="alert"]', text: /Error: error-message/)
expect(rendered).to include("Expected documents: #{subtask.documents_count}")
expect(rendered).not_to include("Error:")
expect(rendered).not_to include("Documents reindexed:")
end end
end end
context 'when there are 0 documents expected' do context 'when there are 0 documents expected' do
let(:task) { build_stubbed(:elastic_reindexing_task, state: :reindexing) } let(:task) do
let(:subtask) { build_stubbed(:elastic_reindexing_subtask, elastic_reindexing_task: task, documents_count_target: 0, documents_count: 0) } build_stubbed(:elastic_reindexing_task, state: :reindexing)
end
it 'renders 100% completed progress' do let(:subtask) do
build_stubbed(
:elastic_reindexing_subtask,
elastic_reindexing_task: task,
documents_count_target: 0,
documents_count: 0
)
end
before do
allow(task).to receive_message_chain(:subtasks, :order_by_alias_name_asc).and_return([subtask])
allow(task.subtasks).to receive(:any?).and_return(true)
allow(task.subtasks).to receive(:count).and_return(1)
assign(:last_elasticsearch_reindexing_task, task)
assign(:application_setting, build(:application_setting))
assign(:projects_not_indexed_count, 0)
assign(:projects_not_indexed, [])
assign(:elasticsearch_reindexing_human_state, "successfully indexed")
assign(:elasticsearch_reindexing_human_state_color, "success")
end
it 'renders successfully indexed' do
render render
expect(rendered).to include('Expected documents: 0') expect(rendered).to have_selector('[role="alert"]', text: /Status: successfully indexed/)
expect(rendered).to include('Documents reindexed: 0 (100%)') expect(rendered).not_to have_selector('[role="alert"]', text: /Error: error-message/)
end end
end end
end end
...@@ -279,6 +375,10 @@ ...@@ -279,6 +375,10 @@
end end
context 'when there is no reindexing' do context 'when there is no reindexing' do
before do
allow(task).to receive(:in_progress?).and_return(false)
end
it 'shows the retry migration card' do it 'shows the retry migration card' do
render render
......
...@@ -1141,6 +1141,9 @@ msgstr "" ...@@ -1141,6 +1141,9 @@ msgstr ""
msgid "%{path} on %{ref}" msgid "%{path} on %{ref}"
msgstr "" msgstr ""
   
msgid "%{percentage}%%"
msgstr ""
msgid "%{percentage}%% complete" msgid "%{percentage}%% complete"
msgstr "" msgstr ""
   
...@@ -1654,6 +1657,9 @@ msgstr "" ...@@ -1654,6 +1657,9 @@ msgstr ""
msgid "(Limited to %{quota} compute minutes per month)" msgid "(Limited to %{quota} compute minutes per month)"
msgstr "" msgstr ""
   
msgid "(Slice multiplier: %{multiplier}, Maximum running slices: %{max_slices})"
msgstr ""
msgid "(UTC %{offset})" msgid "(UTC %{offset})"
msgstr "" msgstr ""
   
...@@ -11333,13 +11339,13 @@ msgstr "" ...@@ -11333,13 +11339,13 @@ msgstr ""
msgid "Cancel and close" msgid "Cancel and close"
msgstr "" msgstr ""
   
msgid "Cancel downstream pipeline" msgid "Cancel deletion for all indices"
msgstr "" msgstr ""
   
msgid "Cancel editing" msgid "Cancel downstream pipeline"
msgstr "" msgstr ""
   
msgid "Cancel index deletion" msgid "Cancel editing"
msgstr "" msgstr ""
   
msgid "Cancel pipeline" msgid "Cancel pipeline"
...@@ -19134,6 +19140,9 @@ msgstr "" ...@@ -19134,6 +19140,9 @@ msgstr ""
msgid "Deleting this group also deletes all child projects, including archived projects, and their resources." msgid "Deleting this group also deletes all child projects, including archived projects, and their resources."
msgstr "" msgstr ""
   
msgid "Deletion scheduled at: %{time}"
msgstr ""
msgid "DeletionSettings|Deletion protection" msgid "DeletionSettings|Deletion protection"
msgstr "" msgstr ""
   
...@@ -20819,9 +20828,6 @@ msgstr "" ...@@ -20819,9 +20828,6 @@ msgstr ""
msgid "Documentation pages URL" msgid "Documentation pages URL"
msgstr "" msgstr ""
   
msgid "Documents reindexed: %{processed_documents} (%{percentage}%%)"
msgstr ""
msgid "Domain" msgid "Domain"
msgstr "" msgstr ""
   
...@@ -23480,9 +23486,6 @@ msgstr "" ...@@ -23480,9 +23486,6 @@ msgstr ""
msgid "Expand sidebar" msgid "Expand sidebar"
msgstr "" msgstr ""
   
msgid "Expected documents: %{expected_documents}"
msgstr ""
msgid "Experiment" msgid "Experiment"
msgstr "" msgstr ""
   
...@@ -26362,6 +26365,9 @@ msgstr "" ...@@ -26362,6 +26365,9 @@ msgstr ""
msgid "GlobalSearch|Open file in repository" msgid "GlobalSearch|Open file in repository"
msgstr "" msgstr ""
   
msgid "GlobalSearch|Overview"
msgstr ""
msgid "GlobalSearch|Pages or actions" msgid "GlobalSearch|Pages or actions"
msgstr "" msgstr ""
   
...@@ -29958,6 +29964,9 @@ msgstr "" ...@@ -29958,6 +29964,9 @@ msgstr ""
msgid "Index the instance" msgid "Index the instance"
msgstr "" msgstr ""
   
msgid "Indexed documents: %{processed_documents}/%{expected_documents}"
msgstr ""
msgid "Indexing CPU to tasks multiplier" msgid "Indexing CPU to tasks multiplier"
msgstr "" msgstr ""
   
...@@ -46664,9 +46673,6 @@ msgstr "" ...@@ -46664,9 +46673,6 @@ msgstr ""
msgid "Registry setup" msgid "Registry setup"
msgstr "" msgstr ""
   
msgid "Reindexing Status: %{status} (Slice multiplier: %{multiplier}, Maximum running slices: %{max_slices})"
msgstr ""
msgid "Reject" msgid "Reject"
msgstr "" msgstr ""
   
...@@ -56167,9 +56173,6 @@ msgstr "" ...@@ -56167,9 +56173,6 @@ msgstr ""
msgid "Task" msgid "Task"
msgstr "" msgstr ""
   
msgid "Task ID: %{elastic_task}"
msgstr ""
msgid "Task list" msgid "Task list"
msgstr "" msgstr ""
   
...@@ -60712,7 +60715,7 @@ msgstr "" ...@@ -60712,7 +60715,7 @@ msgstr ""
msgid "Unused" msgid "Unused"
msgstr "" msgstr ""
   
msgid "Unused, previous indices: %{index_names} will be deleted after %{time} automatically." msgid "Unused indices scheduled for deletion"
msgstr "" msgstr ""
   
msgid "Unverified" msgid "Unverified"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment