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