Commit 51ceb380 authored by Jacob Schatz's avatar Jacob Schatz Committed by Phil Hughes

Adds JSON callback, which is currently not working.

parent 91880e13
...@@ -33,15 +33,13 @@ class @MergeRequestWidget ...@@ -33,15 +33,13 @@ class @MergeRequestWidget
getBuildStatus: -> getBuildStatus: ->
urlToCiCheck = @opts.url_to_ci_check urlToCiCheck = @opts.url_to_ci_check
ciEnabled = @opts.ci_enable console.log('checking')
console.log(ciEnabled)
setInterval (-> setInterval (->
if ciEnabled $.getJSON urlToCiCheck, (data) ->
$.getJSON urlToCiCheck, (data) -> console.log("data",data);
console.log("data",data);
return
return return
), 5000 return
), 5000
getCiStatus: -> getCiStatus: ->
$.get @opts.url_to_ci_check, (data) => $.get @opts.url_to_ci_check, (data) =>
......
...@@ -218,6 +218,14 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -218,6 +218,14 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
end end
def st
@ci_commit = @merge_request.ci_commit
@statuses = @ci_commit.statuses if @ci_commit
render json: {
statuses: @statuses
}
end
def ci_status def ci_status
ci_service = @merge_request.source_project.ci_service ci_service = @merge_request.source_project.ci_service
status = ci_service.commit_status(merge_request.last_commit.sha, merge_request.source_branch) status = ci_service.commit_status(merge_request.last_commit.sha, merge_request.source_branch)
...@@ -228,8 +236,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -228,8 +236,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
response = { response = {
status: status, status: status,
coverage: coverage, coverage: coverage
ci_status: @merge_request.ci_commit.status
} }
render json: response render json: response
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
merge_request_widget = new MergeRequestWidget({ merge_request_widget = new MergeRequestWidget({
url_to_automerge_check: "#{merge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", url_to_automerge_check: "#{merge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
check_enable: #{@merge_request.unchecked? ? "true" : "false"}, check_enable: #{@merge_request.unchecked? ? "true" : "false"},
url_to_ci_check: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", url_to_ci_check: "#{st_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
ci_enable: #{@project.ci_service ? "true" : "false"}, ci_enable: #{@project.ci_service ? "true" : "false"},
current_status: "#{@merge_request.gitlab_merge_status}" current_status: "#{@merge_request.gitlab_merge_status}"
}); });
......
...@@ -620,6 +620,7 @@ Rails.application.routes.draw do ...@@ -620,6 +620,7 @@ Rails.application.routes.draw do
post :merge post :merge
post :cancel_merge_when_build_succeeds post :cancel_merge_when_build_succeeds
get :ci_status get :ci_status
get :st
post :toggle_subscription post :toggle_subscription
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