Commit 70a513db authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'fix-retry-migration-button' into 'master'

Fix retry migration button

See merge request gitlab-org/gitlab!63012
parents dfb19b64 aace51ef
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
= link_to _('Learn more.'), help_page_path('integration/elasticsearch', anchor: 'advanced-search-migrations') = link_to _('Learn more.'), help_page_path('integration/elasticsearch', anchor: 'advanced-search-migrations')
.gl-alert-actions .gl-alert-actions
- migration = Elastic::DataMigrationService.halted_migration - migration = Elastic::DataMigrationService.halted_migration
= link_to _('Retry migration'), admin_elasticsearch_retry_migration_path(version: migration.version), class: 'btn gl-alert-action btn-warning gl-button', disabled: @elasticsearch_reindexing_task&.in_progress?, data: { confirm: _('Are you sure you want to retry this migration?') }, method: :post = link_to _('Retry migration'), admin_elasticsearch_retry_migration_path(version: migration.version), class: 'btn gl-alert-action btn-warning gl-button', disabled: @last_elasticsearch_reindexing_task&.in_progress?, data: { confirm: _('Are you sure you want to retry this migration?') }, method: :post
.form-group .form-group
.form-check .form-check
......
...@@ -228,11 +228,27 @@ RSpec.describe 'admin/application_settings/_elasticsearch_form' do ...@@ -228,11 +228,27 @@ RSpec.describe 'admin/application_settings/_elasticsearch_form' do
allow(Elastic::DataMigrationService).to receive(:halted_migration).and_return(migration) allow(Elastic::DataMigrationService).to receive(:halted_migration).and_return(migration)
end end
it 'shows the retry migration card' do context 'when there is no reindexing' do
render it 'shows the retry migration card' do
render
expect(rendered).to include('There is a halted Elasticsearch migration')
expect(rendered).to have_css('a', text: 'Retry migration')
expect(rendered).not_to have_css('a[disabled="disabled"]', text: 'Retry migration')
end
end
expect(rendered).to include('There is a halted Elasticsearch migration') context 'when there is a reindexing task in progress' do
expect(rendered).to include('Retry migration') before do
assign(:last_elasticsearch_reindexing_task, build(:elastic_reindexing_task))
end
it 'shows the retry migration card with retry button disabled' do
render
expect(rendered).to include('There is a halted Elasticsearch migration')
expect(rendered).to have_css('a[disabled="disabled"]', text: 'Retry migration')
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment