Commit bfd3e6d3 authored by David Kim's avatar David Kim Committed by Phil Hughes

Disable Update now button when project is archived with a tooltip

- also, fix up a spec that doesn't really test what it says
parent 065f3e03
......@@ -22,7 +22,9 @@
= clipboard_button(text: ssh_public_key, class: 'btn btn-default rspec-copy-ssh-public-key', title: _('Copy SSH public key'), qa_selector: 'copy_public_key_button')
- if import_state.mirror_update_due? || import_state.updating_mirror?
%button.btn.disabled{ type: 'button', data: { container: 'body', toggle: 'tooltip', qa_selector: 'updating_button' }, title: _('Updating') }= icon("refresh spin")
- elsif !@project.archived?
- elsif @project.archived?
%button.btn.disabled{ type: 'button', data: { container: 'body', toggle: 'tooltip', qa_selector: 'update_now_button' }, title: _('This Project is currently archived and read-only. Please unarchive the project first if you want to resume Pull mirroring') }= icon("refresh")
- else
= link_to update_now_project_mirror_path(@project), method: :post, class: 'btn js-force-update-mirror', data: { container: 'body', toggle: 'tooltip', qa_selector: 'update_now_button' }, title: _('Update now') do
= icon("refresh")
%button.js-delete-mirror.js-delete-pull-mirror.btn.btn-danger{ type: 'button', data: { toggle: 'tooltip', container: 'body' }, title: _('Remove') }= icon('trash-o')
......@@ -24,8 +24,6 @@ describe 'Project mirror', :js do
context 'when able to force update' do
it 'forces import' do
import_state.update(last_update_at: timestamp - 8.minutes)
expect_any_instance_of(EE::ProjectImportState).to receive(:force_import_job!)
Timecop.freeze(timestamp) do
......@@ -37,17 +35,32 @@ describe 'Project mirror', :js do
end
context 'when unable to force update' do
it 'does not force import' do
import_state.update(last_update_at: timestamp - 3.minutes)
before do
import_state.update(next_execution_timestamp: timestamp - 1.minute)
end
expect_any_instance_of(EE::ProjectImportState).not_to receive(:force_import_job!)
let(:disabled_updating_button) { '[data-qa-selector="updating_button"].disabled' }
it 'disables Update now button' do
Timecop.freeze(timestamp) do
visit project_mirror_path(project)
end
expect(page).to have_selector('.js-force-update-mirror')
expect(page).to have_selector('.btn.disabled')
expect(page).to have_selector(disabled_updating_button)
end
end
context 'when the project is archived' do
let(:disabled_update_now_button) { '[data-qa-selector="update_now_button"].disabled' }
before do
project.update!(archived: true)
end
it 'disables Update now button' do
visit project_mirror_path(project)
expect(page).to have_selector(disabled_update_now_button)
end
end
end
......
......@@ -19227,6 +19227,9 @@ msgstr ""
msgid "This GitLab instance is licensed at the %{insufficient_license} tier. Geo is only available for users who have at least a Premium license."
msgstr ""
msgid "This Project is currently archived and read-only. Please unarchive the project first if you want to resume Pull mirroring"
msgstr ""
msgid "This action can lead to data loss. To prevent accidental actions we ask you to confirm your intention."
msgstr ""
......
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