#31: update UI, add #autostart_iso_builds method into Product model
This commit is contained in:
parent
a5e122dc63
commit
8f32460609
|
@ -182,6 +182,9 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
later :destroy, :queue => :clone_build
|
||||
|
||||
def default_host
|
||||
EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
@ -189,9 +192,6 @@ class Platform < ActiveRecord::Base
|
|||
system("mkdir -p -m 0777 #{build_path([name, 'repository'])}")
|
||||
end
|
||||
|
||||
def default_host
|
||||
EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
|
||||
end
|
||||
|
||||
def build_path(dir)
|
||||
File.join(APP_CONFIG['root_path'], 'platforms', dir)
|
||||
|
|
|
@ -52,8 +52,17 @@ class Product < ActiveRecord::Base
|
|||
I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}")
|
||||
end
|
||||
|
||||
# def self.autostart_iso_builds(autostart_status)
|
||||
# Product.where(:autostart_status => autostart_status)
|
||||
# end
|
||||
def self.autostart_iso_builds(autostart_status)
|
||||
Product.where(:autostart_status => autostart_status).each do |product|
|
||||
pbl = product.product_build_lists.new(:autostarted => true)
|
||||
[:params, :main_script, :time_living, :project].each do |k|
|
||||
pbl.send "#{k}=", product.send(k)
|
||||
end
|
||||
owner = product.platform.owner
|
||||
pbl.user = owner.is_a?(User) ? owner : owner.owner
|
||||
pbl.base_url = "http://#{product.platform.default_host}"
|
||||
pbl.save
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
= render 'show_field', :key => :time_living, :value => (pbl.time_living / 60)
|
||||
|
||||
= render 'show_field', :key => :autostarted, :value => t("layout.#{pbl.autostarted}_")
|
||||
|
||||
= render 'show_field', :key => :notified_at, :value => l(pbl.updated_at, :format => :long)
|
||||
|
||||
- if pbl.can_cancel? && can?(:cancel, pbl)
|
||||
|
|
|
@ -31,6 +31,7 @@ en:
|
|||
activerecord:
|
||||
attributes:
|
||||
product_build_list:
|
||||
autostarted: Autostart
|
||||
not_delete: Not delete
|
||||
id: Id
|
||||
user: User
|
||||
|
|
|
@ -31,6 +31,7 @@ ru:
|
|||
activerecord:
|
||||
attributes:
|
||||
product_build_list:
|
||||
autostarted: Автоматически запущен
|
||||
not_delete: Не удалять
|
||||
id: Id
|
||||
user: Пользователь
|
||||
|
|
Loading…
Reference in New Issue