#309: added extra_params into BuildList
This commit is contained in:
parent
2b3838e6b2
commit
3b3ca4f7ea
|
@ -1192,6 +1192,13 @@ form.mass_build {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#new_build_list section.right {
|
||||||
|
width: 300px;
|
||||||
|
margin-right: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-size { width: 100%; }
|
||||||
|
|
||||||
.toggle {
|
.toggle {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
module IssuesHelper
|
module IssuesHelper
|
||||||
def tracker_search_field(name, txt)
|
def tracker_search_field(name, txt, classes = nil)
|
||||||
str = "<input name='#{name}' id='#{name}' type='text' value='#{txt}'"
|
str = "<input name='#{name}' id='#{name}' type='text' value='#{txt}'"
|
||||||
str << "onblur=\"if(this.value==''){this.value='#{txt}';this.className='gray';}\""
|
str << "onblur=\"if(this.value==''){this.value='#{txt}';this.className='gray #{classes}';}\""
|
||||||
str << "onclick=\"if(this.value=='#{txt}'){this.value='';this.className='black';}\" class=\"gray\">"
|
str << "onclick=\"if(this.value=='#{txt}'){this.value='';this.className='black #{classes}';}\" class=\"gray #{classes}\">"
|
||||||
str.html_safe
|
str.html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,6 +20,7 @@ class BuildList < ActiveRecord::Base
|
||||||
|
|
||||||
UPDATE_TYPES = %w[bugfix security enhancement recommended newpackage]
|
UPDATE_TYPES = %w[bugfix security enhancement recommended newpackage]
|
||||||
RELEASE_UPDATE_TYPES = %w[bugfix security]
|
RELEASE_UPDATE_TYPES = %w[bugfix security]
|
||||||
|
EXTRA_PARAMS = %w[cfg_options build_src_rpm build_rpm]
|
||||||
|
|
||||||
validates :project_id, :project_version, :arch, :include_repos,
|
validates :project_id, :project_version, :arch, :include_repos,
|
||||||
:build_for_platform_id, :save_to_platform_id, :save_to_repository_id, :presence => true
|
:build_for_platform_id, :save_to_platform_id, :save_to_repository_id, :presence => true
|
||||||
|
@ -46,11 +47,12 @@ class BuildList < ActiveRecord::Base
|
||||||
before_validation lambda { self.include_repos = include_repos.uniq if include_repos.present? }, :on => :create
|
before_validation lambda { self.include_repos = include_repos.uniq if include_repos.present? }, :on => :create
|
||||||
before_validation :prepare_extra_repositories, :on => :create
|
before_validation :prepare_extra_repositories, :on => :create
|
||||||
before_validation :prepare_extra_build_lists, :on => :create
|
before_validation :prepare_extra_build_lists, :on => :create
|
||||||
|
before_validation :prepare_extra_params, :on => :create
|
||||||
|
|
||||||
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
|
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
|
||||||
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
||||||
:save_to_platform_id, :project_version, :auto_create_container,
|
:save_to_platform_id, :project_version, :auto_create_container,
|
||||||
:extra_repositories, :extra_build_lists
|
:extra_repositories, :extra_build_lists, :extra_params
|
||||||
LIVE_TIME = 4.week # for unpublished
|
LIVE_TIME = 4.week # for unpublished
|
||||||
MAX_LIVE_TIME = 3.month # for published
|
MAX_LIVE_TIME = 3.month # for published
|
||||||
|
|
||||||
|
@ -136,6 +138,7 @@ class BuildList < ActiveRecord::Base
|
||||||
serialize :results, Array
|
serialize :results, Array
|
||||||
serialize :extra_repositories, Array
|
serialize :extra_repositories, Array
|
||||||
serialize :extra_build_lists, Array
|
serialize :extra_build_lists, Array
|
||||||
|
serialize :extra_params, Hash
|
||||||
|
|
||||||
after_commit :place_build, :on => :create
|
after_commit :place_build, :on => :create
|
||||||
after_destroy :remove_container
|
after_destroy :remove_container
|
||||||
|
@ -525,4 +528,14 @@ class BuildList < ActiveRecord::Base
|
||||||
self.extra_build_lists = bls.pluck('build_lists.id')
|
self.extra_build_lists = bls.pluck('build_lists.id')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def prepare_extra_params
|
||||||
|
if extra_params.present?
|
||||||
|
params = extra_params.slice(*BuildList::EXTRA_PARAMS)
|
||||||
|
params.update(params) do |k,v|
|
||||||
|
v.strip.gsub(I18n.t("activerecord.attributes.build_list.extra_params.#{k}"), '').gsub(/[^\w\s-]/, '')
|
||||||
|
end
|
||||||
|
self.extra_params = params.select{ |k,v| v.present? }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -36,6 +36,12 @@
|
||||||
:subject => build_list,
|
:subject => build_list,
|
||||||
:autocomplete_path => autocomplete_extra_build_list_autocompletes_path
|
:autocomplete_path => autocomplete_extra_build_list_autocompletes_path
|
||||||
|
|
||||||
|
%h3= t('activerecord.attributes.build_list.extra_params.label')
|
||||||
|
- BuildList::EXTRA_PARAMS.each do |field|
|
||||||
|
- text = @build_list.extra_params[field] || t("activerecord.attributes.build_list.extra_params.#{field}")
|
||||||
|
= tracker_search_field "build_list[extra_params][#{field}]", text, 'full-size'
|
||||||
|
.both
|
||||||
|
|
||||||
%h3= t("activerecord.attributes.build_list.preferences")
|
%h3= t("activerecord.attributes.build_list.preferences")
|
||||||
- [:auto_publish, :auto_create_container].each do |kind|
|
- [:auto_publish, :auto_create_container].each do |kind|
|
||||||
.both
|
.both
|
||||||
|
@ -43,6 +49,7 @@
|
||||||
= hidden_field_tag field, false, :id => nil
|
= hidden_field_tag field, false, :id => nil
|
||||||
= check_box_tag field, true, checked
|
= check_box_tag field, true, checked
|
||||||
= f.label kind
|
= f.label kind
|
||||||
|
|
||||||
%br
|
%br
|
||||||
= hidden_field_tag :from_build_list_id, params[:build_list_id] if params[:build_list_id].present?
|
= hidden_field_tag :from_build_list_id, params[:build_list_id] if params[:build_list_id].present?
|
||||||
= f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')}
|
= f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')}
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
.rightlist= t("layout.#{@build_list.new_core?}_")
|
.rightlist= t("layout.#{@build_list.new_core?}_")
|
||||||
.both
|
.both
|
||||||
- if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present?
|
- if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present?
|
||||||
.leftlist= t("activerecord.attributes.build_list.extra_repos")
|
.leftlist= t("activerecord.attributes.build_list.extra_repositories")
|
||||||
.rightlist
|
.rightlist
|
||||||
- Repository.where(:id => @build_list.extra_repositories).each do |repo|
|
- Repository.where(:id => @build_list.extra_repositories).each do |repo|
|
||||||
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
|
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
|
||||||
|
@ -82,6 +82,17 @@
|
||||||
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
|
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
|
||||||
.both
|
.both
|
||||||
|
|
||||||
|
- if @build_list.extra_params.present?
|
||||||
|
.leftlist
|
||||||
|
%h4.nomargin= t('activerecord.attributes.build_list.extra_params.label')
|
||||||
|
.rightlist
|
||||||
|
.both
|
||||||
|
- @build_list.extra_params.each do |k, v|
|
||||||
|
.leftlist= t("activerecord.attributes.build_list.extra_params.#{k}")
|
||||||
|
.rightlist= v
|
||||||
|
.both
|
||||||
|
|
||||||
|
|
||||||
- if @build_list.mass_build_id.present?
|
- if @build_list.mass_build_id.present?
|
||||||
.leftlist= t("activerecord.attributes.mass_build_id")
|
.leftlist= t("activerecord.attributes.mass_build_id")
|
||||||
.rightlist= link_to @build_list.mass_build.name, platform_mass_builds_path(@build_list.save_to_platform)
|
.rightlist= link_to @build_list.mass_build.name, platform_mass_builds_path(@build_list.save_to_platform)
|
||||||
|
|
|
@ -37,6 +37,12 @@ en:
|
||||||
commit_hash: Commit hash
|
commit_hash: Commit hash
|
||||||
logs: Logs
|
logs: Logs
|
||||||
|
|
||||||
|
extra_params:
|
||||||
|
label: Extra params
|
||||||
|
cfg_options: Options for *.cfg file
|
||||||
|
build_src_rpm: Build src.rpm
|
||||||
|
build_rpm: Build rpm
|
||||||
|
|
||||||
build_list/item:
|
build_list/item:
|
||||||
name: Name
|
name: Name
|
||||||
level: Level
|
level: Level
|
||||||
|
|
|
@ -36,6 +36,12 @@ ru:
|
||||||
commit_hash: Хэш коммита
|
commit_hash: Хэш коммита
|
||||||
logs: Логи
|
logs: Логи
|
||||||
|
|
||||||
|
extra_params:
|
||||||
|
label: Дополнительные параметры
|
||||||
|
cfg_options: Параметры для *.cfg файла
|
||||||
|
build_src_rpm: Сборка src.rpm
|
||||||
|
build_rpm: Сборка rpm
|
||||||
|
|
||||||
build_list/item:
|
build_list/item:
|
||||||
name: Название
|
name: Название
|
||||||
level: Уровень
|
level: Уровень
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddExtraParamsToBuildList < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :build_lists, :extra_params, :text
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130918164616) do
|
ActiveRecord::Schema.define(:version => 20130920133720) do
|
||||||
|
|
||||||
create_table "activity_feeds", :force => true do |t|
|
create_table "activity_feeds", :force => true do |t|
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
|
@ -138,6 +138,7 @@ ActiveRecord::Schema.define(:version => 20130918164616) do
|
||||||
t.text "extra_build_lists"
|
t.text "extra_build_lists"
|
||||||
t.integer "publisher_id"
|
t.integer "publisher_id"
|
||||||
t.integer "group_id"
|
t.integer "group_id"
|
||||||
|
t.text "extra_params"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||||
|
|
Loading…
Reference in New Issue