Commit 214470ca authored by Tiago Botelho's avatar Tiago Botelho

Improves mirror force update button transparency

parent 310c1f12
...@@ -84,11 +84,18 @@ module EE ...@@ -84,11 +84,18 @@ module EE
mirror? && self.mirror_last_update_at mirror? && self.mirror_last_update_at
end end
def updating_mirror? def mirror_with_content?
return false unless mirror? && !empty_repo? mirror? && !empty_repo
return true if import_in_progress? end
def scheduled_mirror?
enqueued = self.mirror_data.next_execution_timestamp < Time.now
self.mirror_data.next_execution_timestamp < Time.now mirror_with_content? && import_scheduled? && enqueued
end
def updating_mirror?
mirror_with_content? && import_started?
end end
def mirror_last_update_status def mirror_last_update_status
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
= expanded ? 'Collapse' : 'Expand' = expanded ? 'Collapse' : 'Expand'
%p %p
Set up your project to automatically have its branches, tags, and commits Set up your project to automatically have its branches, tags, and commits
updated from an upstream repository every hour. updated from an upstream repository.
= link_to 'Read more', help_page_path('workflow/repository_mirroring', anchor: 'pulling-from-a-remote-repository'), target: '_blank' = link_to 'Read more', help_page_path('workflow/repository_mirroring', anchor: 'pulling-from-a-remote-repository'), target: '_blank'
.settings-content.no-animate{ class: ('expanded' if expanded) } .settings-content.no-animate{ class: ('expanded' if expanded) }
= form_for @project, url: namespace_project_mirror_path(@project.namespace, @project) do |f| = form_for @project, url: namespace_project_mirror_path(@project.namespace, @project) do |f|
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
= f.check_box :mirror, class: "pull-left" = f.check_box :mirror, class: "pull-left"
.prepend-left-20 .prepend-left-20
= f.label :mirror, "Mirror repository", class: "label-light append-bottom-0" = f.label :mirror, "Mirror repository", class: "label-light append-bottom-0"
%p.light.append-bottom-0
Automatically update this project's branches, tags, and commits from the upstream repository every hour.
.form-group .form-group
= f.label :import_url, "Git repository URL", class: "label-light" = f.label :import_url, "Git repository URL", class: "label-light"
= f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git' = f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
......
- if @project.mirror? && can?(current_user, :push_code, @project) - if @project.mirror? && can?(current_user, :push_code, @project)
.append-bottom-default .append-bottom-default
- if @project.updating_mirror? - if @project.scheduled_mirror?
= icon("refresh spin")
Update Scheduled&hellip;
- elsif @project.updating_mirror?
%span.btn.disabled %span.btn.disabled
= icon("refresh spin") = icon("refresh spin")
Updating&hellip; Updating&hellip;
......
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