#766: add filter to /build_lists page
This commit is contained in:
parent
c677e37c20
commit
62a761a7c9
|
@ -13,6 +13,13 @@ module BuildListsHelper
|
||||||
'nocolor'
|
'nocolor'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def build_list_options_for_new_core
|
||||||
|
[
|
||||||
|
[I18n.t("layout.true_"), 1],
|
||||||
|
[I18n.t("layout.false_"), 0]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
def build_list_item_status_color(status)
|
def build_list_item_status_color(status)
|
||||||
if BuildServer::SUCCESS == status
|
if BuildServer::SUCCESS == status
|
||||||
return 'success'
|
return 'success'
|
||||||
|
|
|
@ -112,6 +112,7 @@ class BuildList < ActiveRecord::Base
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
scope :scoped_to_project_name, lambda {|project_name| joins(:project).where('projects.name LIKE ?', "%#{project_name}%")}
|
scope :scoped_to_project_name, lambda {|project_name| joins(:project).where('projects.name LIKE ?', "%#{project_name}%")}
|
||||||
|
scope :scoped_to_new_core, lambda {|new_core| where(:new_core => new_core)}
|
||||||
scope :outdated, where('created_at < ? AND status <> ? OR created_at < ?', Time.now - LIVE_TIME, BUILD_PUBLISHED, Time.now - MAX_LIVE_TIME)
|
scope :outdated, where('created_at < ? AND status <> ? OR created_at < ?', Time.now - LIVE_TIME, BUILD_PUBLISHED, Time.now - MAX_LIVE_TIME)
|
||||||
|
|
||||||
serialize :additional_repos
|
serialize :additional_repos
|
||||||
|
|
|
@ -13,6 +13,7 @@ class BuildList::Filter
|
||||||
build_lists = build_lists.where(:bs_id => @options[:bs_id])
|
build_lists = build_lists.where(:bs_id => @options[:bs_id])
|
||||||
else
|
else
|
||||||
build_lists = build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
|
build_lists = build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
|
||||||
|
build_lists = build_lists.scoped_to_new_core(@options[:new_core] == '0' ? nil : true) if @options[:new_core].present?
|
||||||
build_lists = build_lists.for_status(@options[:status]) if @options[:status]
|
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_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_save_platform(@options[:platform_id]) if @options[:platform_id]
|
||||||
|
@ -49,7 +50,8 @@ class BuildList::Filter
|
||||||
:project_version => nil,
|
:project_version => nil,
|
||||||
:bs_id => nil,
|
:bs_id => nil,
|
||||||
:project_name => nil,
|
:project_name => nil,
|
||||||
:mass_build_id => nil
|
:mass_build_id => nil,
|
||||||
|
:new_core => nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'everything' : 'owned')
|
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'everything' : 'owned')
|
||||||
|
@ -65,6 +67,7 @@ class BuildList::Filter
|
||||||
@options[:bs_id] = @options[:bs_id].presence
|
@options[:bs_id] = @options[:bs_id].presence
|
||||||
@options[:project_name] = @options[:project_name].presence
|
@options[:project_name] = @options[:project_name].presence
|
||||||
@options[:mass_build_id] = @options[:mass_build_id].presence
|
@options[:mass_build_id] = @options[:mass_build_id].presence
|
||||||
|
@options[:new_core] = @options[:new_core].presence
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_date_from_params(field_name, params)
|
def build_date_from_params(field_name, params)
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
%br
|
%br
|
||||||
= f.submit t("layout.search.header")
|
= f.submit t("layout.search.header")
|
||||||
.block
|
.block
|
||||||
|
%h3.small= t("activerecord.attributes.build_list.new_core")
|
||||||
|
.lineForm.aside= f.select :new_core, build_list_options_for_new_core, {:include_blank => true, :selected => @filter.new_core}, {:class => 'sel80 aside', :id => 'new_core', :tabindex => 2}
|
||||||
%h3.small= t("activerecord.attributes.build_list.status")
|
%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}
|
.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.models.platform")
|
%h3.small= t("activerecord.models.platform")
|
||||||
|
|
Loading…
Reference in New Issue