Commit 91880e13 authored by Jacob Schatz's avatar Jacob Schatz Committed by Phil Hughes

initial ajax build

parent fde975fa
...@@ -9,6 +9,7 @@ class @MergeRequestWidget ...@@ -9,6 +9,7 @@ class @MergeRequestWidget
# #
constructor: (@opts) -> constructor: (@opts) ->
modal = $('#modal_merge_info').modal(show: false) modal = $('#modal_merge_info').modal(show: false)
@getBuildStatus()
mergeInProgress: (deleteSourceBranch = false)-> mergeInProgress: (deleteSourceBranch = false)->
$.ajax $.ajax
...@@ -30,13 +31,24 @@ class @MergeRequestWidget ...@@ -30,13 +31,24 @@ class @MergeRequestWidget
$.get @opts.url_to_automerge_check, (data) -> $.get @opts.url_to_automerge_check, (data) ->
$('.mr-state-widget').replaceWith(data) $('.mr-state-widget').replaceWith(data)
getBuildStatus: ->
urlToCiCheck = @opts.url_to_ci_check
ciEnabled = @opts.ci_enable
console.log(ciEnabled)
setInterval (->
if ciEnabled
$.getJSON urlToCiCheck, (data) ->
console.log("data",data);
return
return
), 5000
getCiStatus: -> getCiStatus: ->
if @opts.ci_enable $.get @opts.url_to_ci_check, (data) =>
$.get @opts.url_to_ci_check, (data) => this.showCiState data.status
this.showCiState data.status if data.coverage
if data.coverage this.showCiCoverage data.coverage
this.showCiCoverage data.coverage , 'json'
, 'json'
showCiState: (state) -> showCiState: (state) ->
$('.ci_widget').hide() $('.ci_widget').hide()
......
...@@ -228,7 +228,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -228,7 +228,8 @@ 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
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
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: "#{ci_status_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}"
}); });
var cici = "#{@project}"
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