Commit 2e5596bb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'auto_reload_rebase_page' into 'master'

Page is not reloaded periodically to check if rebase is finished

https://gitlab.com/gitlab-org/gitlab-ee/issues/55

See merge request !43
parents 0528ac63 83473a4f
v 8.2.0
- Invalidate stored jira password if the endpoint URL is changed
- Fix: Page is not reloaded periodically to check if rebase is finished
v 8.1.0 (unreleased)
- added an issues template (Hannes Rosenögger)
......
......@@ -23,6 +23,18 @@ class @MergeRequestWidget
setTimeout(merge_request_widget.mergeInProgress, 2000)
dataType: 'json'
rebaseInProgress: ->
$.ajax
type: 'GET'
url: $('.merge-request').data('url')
success: (data) =>
debugger
if data["rebase_in_progress?"]
setTimeout(merge_request_widget.rebaseInProgress, 2000)
else
location.reload()
dataType: 'json'
getMergeStatus: ->
$.get @opts.url_to_automerge_check, (data) ->
$('.mr-state-widget').replaceWith(data)
......
......@@ -48,7 +48,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to do |format|
format.html
format.json { render json: @merge_request }
format.json { render json: @merge_request, methods: :rebase_in_progress? }
format.diff { render text: @merge_request.to_diff(current_user) }
format.patch { render text: @merge_request.to_patch(current_user) }
end
......@@ -241,8 +241,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return render_404 unless @merge_request.approved?
RebaseWorker.perform_async(@merge_request.id, current_user.id)
redirect_to merge_request_path(@merge_request), notice: 'Rebase started. It will take some time'
end
protected
......
:plain
$('.mr-widget-body').html("#{escape_javascript(render('projects/merge_requests/widget/open/ff_accept'))}")
merge_request_widget.rebaseInProgress();
......@@ -10,7 +10,7 @@
Fast-forward merge without creating merge commit
- else
= form_for [:rebase, @project.namespace.becomes(Namespace), @project, @merge_request],
remote: false, method: :post, html: { class: 'accept-mr-form js-requires-input' } do |f|
remote: true, method: :post, html: { class: 'accept-mr-form js-requires-input' } do |f|
= hidden_field_tag :authenticity_token, form_authenticity_token
.accept-merge-holder.clearfix.js-toggle-container
- if @merge_request.target_project.merge_requests_rebase_enabled && can_rebase?(@merge_request.source_project, @merge_request.source_branch)
......@@ -32,4 +32,8 @@
$('.rebase-mr-form').on 'ajax:before', ->
btn = $('.rebase-mr')
btn.disable()
btn.html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress. It could take some time")
\ No newline at end of file
btn.html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress. It could take some time")
- if #{@merge_request.rebase_in_progress?}
$ ->
merge_request_widget.rebaseInProgress()
......@@ -11,6 +11,7 @@ Feature: Project Ff Merge Requests
When I visit merge request page "Bug NS-05"
Then I should see ff-only merge button
@javascript
Scenario: I do rebase before ff-only merge
Given rebase before merge enabled
When I visit merge request page "Bug NS-05"
......
......@@ -73,11 +73,12 @@ class Spinach::Features::ProjectFfMergeRequests < Spinach::FeatureSteps
end
step 'I press rebase button' do
allow(RebaseWorker).to receive(:perform_async){ true }
click_button "Rebase"
end
step "I should see rebase in progress message" do
expect(page).to have_content("Rebase started. It will take some time")
expect(page).to have_content("Rebase in progress")
end
def merge_request
......
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