Merge pull request #562 from warpc/561-build_lists_page_change

[issue #561] New look for BuildList pages:

* Removed mass_build, cancel and updated_at fields from list;
* Added link to commit in list (instead of version);
* Added platform field in list;
* Added filter by main platforms;
* Added cancel button and mass_build field to BuildList#show.
This commit is contained in:
Vladimir Sharshov 2012-07-09 14:17:14 -07:00
commit fcdda10be6
10 changed files with 33 additions and 16 deletions

View File

@ -25,7 +25,8 @@ class Projects::BuildListsController < Projects::BaseController
def index
@action_url = @project ? search_project_build_lists_path(@project) : search_build_lists_path
@filter = BuildList::Filter.new(@project, current_user, params[:filter] || {})
@build_lists = @filter.find.recent.paginate :page => params[:page]
@build_lists = @filter.find.scoped(:include => [:save_to_platform, :project, :user, :arch])
@build_lists = @build_lists.recent.paginate :page => params[:page]
@build_server_status = begin
BuildServer.get_status

View File

@ -34,4 +34,13 @@ module BuildListsHelper
return advisoriable + nonadvisoriable
end
def build_list_version_link(build_list, str_version = false)
if build_list.commit_hash.present?
link_to str_version ? "#{shortest_hash_id @build_list.commit_hash} ( #{@build_list.project_version} )" : shortest_hash_id(build_list.commit_hash),
commit_path(build_list.project.owner, build_list.project, build_list.commit_hash)
else
build_list.project_version
end
end
end

View File

@ -76,6 +76,7 @@ class BuildList < ActiveRecord::Base
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) }
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
scope :scoped_to_save_platform, lambda {|pl_id| where(:save_to_platform_id => pl_id) }
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) }
scope :for_creation_date_period, lambda{|start_date, end_date|

View File

@ -15,6 +15,7 @@ class BuildList::Filter
build_lists = build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
build_lists = build_lists.for_status(@options[:status]) if @options[:status]
build_lists = build_lists.scoped_to_arch(@options[:arch_id]) if @options[:arch_id]
build_lists = build_lists.scoped_to_save_platform(@options[:platform_id]) if @options[:platform_id]
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]
@ -51,6 +52,7 @@ class BuildList::Filter
:updated_at_start => nil,
:updated_at_end => nil,
:arch_id => nil,
:platform_id => nil,
:is_circle => nil,
:project_version => nil,
:bs_id => nil,
@ -66,6 +68,7 @@ class BuildList::Filter
@options[:updated_at_end] = build_date_from_params(:updated_at_end, @options)
@options[:project_version] = @options[:project_version].presence
@options[:arch_id] = @options[:arch_id].present? ? @options[:arch_id].to_i : nil
@options[:platform_id] = @options[:platform_id].present? ? @options[:platform_id].to_i : nil
@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

View File

@ -1,10 +1,8 @@
%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 ? link_to(build_list.mass_build.name, platform_mass_builds_path(build_list.save_to_platform)) : ""
%td= build_list.human_status
%td= link_to build_list.project.name_with_owner, build_list.project
%td= link_to build_list.project_version, "#"
%td= build_list_version_link(build_list)
%td= build_list.arch.name
%td= link_to build_list.save_to_platform.name, build_list.save_to_platform
%td= link_to build_list.user.try(:fullname), build_list.user
%td= link_to image_tag('x.png', :class => 'delete-row', :id => "delete-row#{build_list_counter}"), cancel_build_list_path(build_list), :method => :put, :confirm => t('layout.confirm') if build_list.can_cancel? and can?(:cancel, build_list)
%td= build_list.updated_at

View File

@ -45,6 +45,8 @@
.lineForm.aside= f.select :is_circle, [[t("layout.yes_"), 1], [t("layout.no_"), 0]], {:include_blank => true, :selected => @filter.is_circle.present? ? (@filter.is_circle ? "1" : "0") : nil}, {:class => 'sel80 aside', :id => 'recurrent', :tabindex => 2}
%h3.small= t("activerecord.attributes.build_list.arch")
.lineForm.aside= f.select :arch_id, Arch.recent.collect{|arch| [arch.name, arch.id]}, {:include_blank => true, :selected => @filter.arch_id}, {:class => 'sel80 aside', :id => 'architecture', :tabindex => 2}
%h3.small= t("activerecord.models.platform")
.lineForm.aside= f.select :platform_id, Platform.main.collect{|pl| [pl.name, pl.id]}, {:include_blank => true, :selected => @filter.platform_id}, {:class => 'sel80 aside', :id => 'platform', :tabindex => 2}
%h3.small= t("layout.build_lists.created_at_start")
.date_select= f.date_select(:created_at_start, :include_blank => true, :selected => @filter.created_at_start)
%h3.small= t("layout.build_lists.created_at_end")

View File

@ -4,14 +4,12 @@
%thead
%tr
%th.lpadding16= t("activerecord.attributes.build_list.bs_id")
%th.lpadding16= t('activerecord.attributes.build_list.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")
%th.lpadding16= t("activerecord.attributes.build_list.arch")
%th.lpadding16= t("activerecord.models.platform")
%th.lpadding16= t("activerecord.attributes.build_list.user")
%th= t("layout.build_lists.action")
%th.lpadding16= t("activerecord.attributes.build_list.updated_at")
%tbody= render :partial => 'projects/build_lists/build_list', :collection => @build_lists
.both

View File

@ -43,7 +43,7 @@
.rightlist= t("layout.#{@build_list.auto_publish}_")
.both
.leftlist= t("activerecord.attributes.build_list.project_version")
.rightlist= @build_list.project_version
.rightlist= build_list_version_link(@build_list, true)
.both
.leftlist= t("activerecord.attributes.build_list.arch")
.rightlist= @build_list.arch.name
@ -55,6 +55,12 @@
.rightlist= t("layout.#{@build_list.is_circle?}_")
.both
- if @build_list.mass_build_id.present?
.leftlist= t("activerecord.attributes.mass_build_id")
.rightlist= link_to build_list.mass_build.name, platform_mass_builds_path(build_list.save_to_platform)
.both
- if @build_list.advisory.present?
.leftlist= t("layout.build_lists.attached_advisory")
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
@ -71,6 +77,10 @@
= "#{@build_list.human_current_duration} / #{@build_list.project.human_average_build_time}"
.both
- if @build_list.can_cancel? and can?(:cancel, @build_list)
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
- if @build_list.can_publish? and @build_list.save_to_platform.released and @build_list.advisory.nil?
#advisory_block
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
@ -90,13 +100,6 @@
.info{:class => el}
%p= t("layout.advisories.banners.#{el}")
-#.info.advisory_not_found
%p= t("layout.advisories.banners.advisory_not_found")
-#.info.server_error
%p= t("layout.advisories.banners.server_error")
-#.info.continue_input
%p= t("layout.advisories.banners.continue_input")
#new_advisory_form
= f.fields_for @build_list.build_advisory do |f|
= render :partial => 'advisories/form', :locals => {:f => f}

View File

@ -58,6 +58,7 @@ en:
packages_header: Container data
no_items_data: No data
show: Show
cancel: Cancel build
cancel_success: 'Build canceled'
cancel_fail: 'Errors during build cancelation!'
publish_success: 'Build is queued for publishing'

View File

@ -57,6 +57,7 @@ ru:
packages_header: Данные о контейнере
no_items_data: Данных нет
show: Просмотр
cancel: Отменить сборку
cancel_success: 'Сборка отменена.'
cancel_fail: 'При отмене сборки произошла ошибка!'
publish_success: 'Сборка поставлена в очередь на публикацию.'