Rename delete_build_list to cancel_build_list. Rescue XML get_status exception. Refs #2261
This commit is contained in:
parent
4ea4d7f56e
commit
e45ba6692a
|
@ -20,14 +20,14 @@ class BuildListsController < ApplicationController
|
|||
end
|
||||
@action_url = all_build_lists_path
|
||||
|
||||
@build_server_status = BuildServer.get_status
|
||||
@build_server_status = BuildServer.get_status rescue {}
|
||||
|
||||
render :action => 'index'
|
||||
end
|
||||
|
||||
def cancel
|
||||
build_list = BuildList.find(params[:id])
|
||||
if build_list.delete_build_list
|
||||
if build_list.cancel_build_list
|
||||
redirect_to :back, :notice => t('layout.build_lists.cancel_successed')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.cancel_failed')
|
||||
|
|
|
@ -112,7 +112,7 @@ class BuildList < ActiveRecord::Base
|
|||
self.status == BuildServer::SUCCESS
|
||||
end
|
||||
|
||||
def delete_build_list
|
||||
def cancel_build_list
|
||||
has_canceled = BuildServer.delete_build_list bs_id
|
||||
update_attribute(:status, BUILD_CANCELED) if has_canceled == 0
|
||||
|
||||
|
@ -120,7 +120,7 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
#TODO: Share this checking on product owner.
|
||||
def can_canceled?
|
||||
def can_cancel?
|
||||
self.status == BUILD_PENDING && bs_id
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
%td= build_list.arch.name
|
||||
%td= t("layout.#{build_list.is_circle?}_")
|
||||
- if controller.action_name = 'all'
|
||||
%td= link_to t("layout.build_lists.cancel_button"), build_list_cancel_path(build_list) if build_list.can_canceled?
|
||||
%td= link_to t("layout.build_lists.cancel_button"), build_list_cancel_path(build_list) if build_list.can_cancel?
|
||||
%td.last= build_list.notified_at
|
||||
|
||||
= will_paginate build_lists
|
|
@ -1,28 +0,0 @@
|
|||
/ .block
|
||||
/ - if controller.action_name != 'all'
|
||||
/ .secondary-navigation
|
||||
/ %ul.wat-cf
|
||||
/ %li.first= link_to t("layout.build_lists.current"), project_path(@project) + "#build_lists"
|
||||
/ %li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project)
|
||||
/
|
||||
/ .content
|
||||
/ - if controller.action_name == 'all'
|
||||
/ .inner
|
||||
/ %h2= t('layout.build_lists.build_server_status.header')
|
||||
/ .field
|
||||
/ %span= t('layout.build_lists.build_server_status.client_count') + ":"
|
||||
/ %span= @build_server_status['client_count']
|
||||
/ .field
|
||||
/ %span= t('layout.build_lists.build_server_status.count_new_task') + ":"
|
||||
/ %span= @build_server_status['count_new_task']
|
||||
/ .field
|
||||
/ %span= t('layout.build_lists.build_server_status.count_build_task') + ":"
|
||||
/ %span= @build_server_status['count_build_task']
|
||||
/
|
||||
/ .inner
|
||||
/ = render :partial => "build_lists/filter", :action_url => @action_url
|
||||
/
|
||||
/ .inner
|
||||
/ = render :partial => "build_lists/build_lists", :object => @build_lists
|
||||
/
|
||||
/ - content_for :sidebar, render(:partial => 'sidebar') if controller.action_name != 'all'
|
|
@ -32,7 +32,7 @@ module XMLRPC
|
|||
# raise args.inspect
|
||||
case
|
||||
when args.first == 'get_status'
|
||||
{:client_count => '1', :count_new_task => '2', :count_build_task => 3}
|
||||
{'client_count' => 1, 'count_new_task' => 2, 'count_build_task' => 3}
|
||||
else; 0
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue