#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 {
|
||||
overflow: hidden;
|
||||
padding-top: 10px;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
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 << "onblur=\"if(this.value==''){this.value='#{txt}';this.className='gray';}\""
|
||||
str << "onclick=\"if(this.value=='#{txt}'){this.value='';this.className='black';}\" class=\"gray\">"
|
||||
str << "onblur=\"if(this.value==''){this.value='#{txt}';this.className='gray #{classes}';}\""
|
||||
str << "onclick=\"if(this.value=='#{txt}'){this.value='';this.className='black #{classes}';}\" class=\"gray #{classes}\">"
|
||||
str.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,7 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
UPDATE_TYPES = %w[bugfix security enhancement recommended newpackage]
|
||||
RELEASE_UPDATE_TYPES = %w[bugfix security]
|
||||
EXTRA_PARAMS = %w[cfg_options build_src_rpm build_rpm]
|
||||
|
||||
validates :project_id, :project_version, :arch, :include_repos,
|
||||
: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 :prepare_extra_repositories, :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,
|
||||
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
||||
: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
|
||||
MAX_LIVE_TIME = 3.month # for published
|
||||
|
||||
|
@ -136,6 +138,7 @@ class BuildList < ActiveRecord::Base
|
|||
serialize :results, Array
|
||||
serialize :extra_repositories, Array
|
||||
serialize :extra_build_lists, Array
|
||||
serialize :extra_params, Hash
|
||||
|
||||
after_commit :place_build, :on => :create
|
||||
after_destroy :remove_container
|
||||
|
@ -525,4 +528,14 @@ class BuildList < ActiveRecord::Base
|
|||
self.extra_build_lists = bls.pluck('build_lists.id')
|
||||
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
|
|
@ -36,6 +36,12 @@
|
|||
:subject => build_list,
|
||||
: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")
|
||||
- [:auto_publish, :auto_create_container].each do |kind|
|
||||
.both
|
||||
|
@ -43,6 +49,7 @@
|
|||
= hidden_field_tag field, false, :id => nil
|
||||
= check_box_tag field, true, checked
|
||||
= f.label kind
|
||||
|
||||
%br
|
||||
= 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')}
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
.rightlist= t("layout.#{@build_list.new_core?}_")
|
||||
.both
|
||||
- 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
|
||||
- Repository.where(:id => @build_list.extra_repositories).each do |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
|
||||
.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?
|
||||
.leftlist= t("activerecord.attributes.mass_build_id")
|
||||
.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
|
||||
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:
|
||||
name: Name
|
||||
level: Level
|
||||
|
|
|
@ -36,6 +36,12 @@ ru:
|
|||
commit_hash: Хэш коммита
|
||||
logs: Логи
|
||||
|
||||
extra_params:
|
||||
label: Дополнительные параметры
|
||||
cfg_options: Параметры для *.cfg файла
|
||||
build_src_rpm: Сборка src.rpm
|
||||
build_rpm: Сборка rpm
|
||||
|
||||
build_list/item:
|
||||
name: Название
|
||||
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.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130918164616) do
|
||||
ActiveRecord::Schema.define(:version => 20130920133720) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -138,6 +138,7 @@ ActiveRecord::Schema.define(:version => 20130918164616) do
|
|||
t.text "extra_build_lists"
|
||||
t.integer "publisher_id"
|
||||
t.integer "group_id"
|
||||
t.text "extra_params"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
|
|
Loading…
Reference in New Issue