[refs #442] Add mass build select to monitoring. Remove build lists from build_all action

This commit is contained in:
konstantin.grabar 2012-05-22 17:40:27 +04:00
parent 9aefce6b68
commit 7c45263799
11 changed files with 36 additions and 65 deletions

View File

@ -8,7 +8,7 @@ class Platforms::PlatformsController < Platforms::BaseController
def build_all
@build_lists = BuildList.for_platform(@platform)
@build_lists = @build_lists.by_mass_build(MassBuild.find(params[:mass_build_id])) unless params[:mass_build_id].blank?
@build_lists = @build_lists.by_mass_build(params[:mass_build_id]) unless params[:mass_build_id].blank?
if request.post?
mass_build = MassBuild.create(:platform => @platform)
@ -18,7 +18,7 @@ class Platforms::PlatformsController < Platforms::BaseController
:arches => params[:arches],
:auto_publish => params[:auto_publish]
)
redirect_to(build_all_platform_path(@platform), :notice => t("flash.platform.build_all_success"))
redirect_to(build_lists_path, :notice => t("flash.platform.build_all_success"))
end
end

View File

@ -8,6 +8,8 @@ module ApplicationHelper
'right slim'
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
nil
when controller_name == 'platforms' && action_name == 'build_all'
nil
when controller_name == 'platforms' && action_name == 'show'
'right bigpadding'
when controller_name == 'platforms' && action_name == 'clone'

View File

@ -74,7 +74,7 @@ class BuildList < ActiveRecord::Base
scope :for_status, lambda {|status| where(:status => status) }
scope :for_user, lambda { |user| where(:user_id => user.id) }
scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform.id) }
scope :by_mass_build, lambda { |mass_build| where(:mass_build_id => mass_build.id) }
scope :by_mass_build, lambda { |mass_build| where(:mass_build_id => mass_build) }
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
scope :scoped_to_project_version, lambda {|project_version| where(:project_version => project_version) }
scope :scoped_to_is_circle, lambda {|is_circle| where(:is_circle => is_circle) }

View File

@ -18,6 +18,7 @@ class BuildList::Filter
build_lists = build_lists.scoped_to_project_version(@options[:project_version]) if @options[:project_version]
build_lists = build_lists.scoped_to_is_circle(@options[:is_circle]) if @options[:is_circle].present?
build_lists = build_lists.scoped_to_project_name(@options[:project_name]) if @options[:project_name]
build_lists = build_lists.by_mass_build(@options[:mass_build_id]) if @options[:mass_build_id]
if @options[:created_at_start] || @options[:created_at_end]
build_lists = build_lists.for_creation_date_period(@options[:created_at_start], @options[:created_at_end])
@ -53,7 +54,8 @@ class BuildList::Filter
:is_circle => nil,
:project_version => nil,
:bs_id => nil,
:project_name => nil
:project_name => nil,
:mass_build_id => nil
}))
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'index' : 'owned')
@ -67,6 +69,7 @@ class BuildList::Filter
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
@options[:bs_id] = @options[:bs_id].presence
@options[:project_name] = @options[:project_name].presence
@options[:mass_build_id] = @options[:mass_build_id].presence
end
def build_date_from_params(field_name, params)

View File

@ -1,5 +1,6 @@
class MassBuild < ActiveRecord::Base
belongs_to :platform
has_many :build_lists
scope :by_platform, lambda { |platform| where(:platform_id => platform.id) }

View File

@ -1,63 +1,20 @@
- content_for(:sidebar) do
= form_for :build, :url => build_all_platform_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
.bordered.nopadding
.table
%section.left
%h3= t("activerecord.attributes.build_list.build_for_platform")
- @platform.repositories.each do |rep|
.lefter
= check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}"
= label_tag "repositories_#{rep.id}", rep.name
.both
.both
.table
%section.right
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|
.lefter
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
= label_tag "arches_#{arch.id}", arch.name
.both
.both
.table
%h3= t("activerecord.attributes.build_list.preferences")
.lefter
.both
= check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : true, :id => 'auto_publish'
= label_tag :auto_publish
.both
.both
%br
= f.submit t("layout.projects.build_button")
%br
%br
.bordered.nopadding
.table
- ['BuildList::BUILD_PUBLISHED', 'BuildServer::SUCCESS', 'BuildServer::BUILD_STARTED', 'BuildList::BUILD_PENDING', 'BuildServer::BUILD_ERROR'].each do |state|
.lefter
= t("layout.build_lists.statuses.#{state.demodulize.downcase}")
.righter
= BuildList.for_status(state.constantize).for_user(current_user).for_platform(@platform).count
.both
%br
= link_to t("layout.activity_feed.all_my_builds"), build_lists_path
%h3.fix= t("layout.platforms.mass_build")
- if MassBuild.exists? :platform_id => @platform.id
%br
= form_for :build, :url => build_all_platform_path(@platform), :html => { :class => :form, :method => :get } do |f|
= select_tag "mass_build_id", options_from_collection_for_select( MassBuild.by_platform(@platform), :id, :name ), :include_blank => true
= f.submit t("layout.platforms.refresh_button")
%table.tablesorter.unbordered
%thead
%tr
%th.lpadding16= t('layout.platforms.mass_build')
%th.lpadding16= t('layout.platforms.project')
%th.lpadding16= t('layout.platforms.arch')
%th.lpadding16= t('layout.platforms.build_task')
- @build_lists.each do |build_list|
%tr{:class => "#{build_list_status_color(build_list.status)}"}
%td= build_list.mass_build_id ? build_list.mass_build.name : ""
%td= link_to build_list.project.name, project_path(build_list.project)
%td= build_list.arch.name
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list

View File

@ -1,5 +1,6 @@
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
%td= build_list.mass_build_id ? build_list.mass_build.name : ""
%td= build_list.human_status
%td= link_to build_list.project.name, build_list.project
%td= link_to build_list.project_version, "#"

View File

@ -37,6 +37,8 @@
%br
= f.submit t("layout.search.header")
.block
%h3.small= t("activerecord.attributes.build_list.mass_build")
.lineForm.aside= f.select :mass_build_id, options_from_collection_for_select( MassBuild.all, :id, :name, @filter.mass_build_id ), {:include_blank => true}
%h3.small= t("activerecord.attributes.build_list.status")
.lineForm.aside= f.select :status, BuildList::STATUSES.collect{|status| [BuildList.human_status(status), status]}, {:include_blank => true, :selected => @filter.status}, {:class => 'sel80 aside', :id => 'status', :tabindex => 2}
%h3.small= t("activerecord.attributes.build_list.is_circle")

View File

@ -4,6 +4,7 @@
%thead
%tr
%th.lpadding16= t("activerecord.attributes.build_list.bs_id")
%th.lpadding16= t('activerecord.attributes.mass_build_id')
%th.lpadding16= t("activerecord.attributes.build_list.status")
%th.lpadding16= t("activerecord.attributes.build_list.project")
%th.lpadding16= t("activerecord.attributes.build_list.project_version")

View File

@ -28,6 +28,8 @@ en:
preferences: Preferences
started_at: Build started at
duration: Build duration in seconds
mass_build_id: Mass Build
mass_build: Mass Build
build_list/item:
name: Name

View File

@ -27,6 +27,8 @@ ru:
user: Пользователь
preferences: Настройки
duration: Длительность билда в секундах
mass_build_id: Массовая Сборка
mass_build: Массовая Сборка
build_list/item:
name: Название