diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-01-21 07:24:02 -0500 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-03-18 10:26:48 +0000 |
commit | 51ceb3802f07d82fe9fa606382cf2f1074e1cfb5 (patch) | |
tree | 8feaa132224482c603276b315a45f435dda2c06a /app | |
parent | 91880e13df19ed312bfa0a2e06743dd8a71aa1ad (diff) | |
download | gitlab-ce-51ceb3802f07d82fe9fa606382cf2f1074e1cfb5.tar.gz |
Adds JSON callback, which is currently not working.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/merge_request_widget.js.coffee | 12 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 11 | ||||
-rw-r--r-- | app/views/projects/merge_requests/widget/_show.html.haml | 2 |
3 files changed, 15 insertions, 10 deletions
diff --git a/app/assets/javascripts/merge_request_widget.js.coffee b/app/assets/javascripts/merge_request_widget.js.coffee index 98f200f9b8a..b1daa1f34eb 100644 --- a/app/assets/javascripts/merge_request_widget.js.coffee +++ b/app/assets/javascripts/merge_request_widget.js.coffee @@ -33,15 +33,13 @@ 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 + $.getJSON urlToCiCheck, (data) -> + console.log("data",data); return - ), 5000 + return + ), 5000 getCiStatus: -> $.get @opts.url_to_ci_check, (data) => diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 861ae7ee2f7..259e25c91ab 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -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 diff --git a/app/views/projects/merge_requests/widget/_show.html.haml b/app/views/projects/merge_requests/widget/_show.html.haml index a86677c23ad..268171fde08 100644 --- a/app/views/projects/merge_requests/widget/_show.html.haml +++ b/app/views/projects/merge_requests/widget/_show.html.haml @@ -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}" }); |