[refs #442] Add rep_name field. Add cancel builds ability
This commit is contained in:
parent
10aed58bdd
commit
ce163f89a9
|
@ -31,6 +31,13 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
render :action => :build_all
|
||||
end
|
||||
|
||||
def cancel_mass_build
|
||||
@mass_build = MassBuild.find params[:mass_build_id]
|
||||
@mass_build.cancel_all
|
||||
flash[:notice] = t("flash.platform.cancel_mass_build")
|
||||
redirect_to mass_builds_platform_path(@mass_build.platform)
|
||||
end
|
||||
|
||||
def failed_builds_list
|
||||
@mass_build = MassBuild.find params[:mass_build_id]
|
||||
render :text => @mass_build.generate_failed_builds_list
|
||||
|
|
|
@ -7,7 +7,7 @@ class MassBuild < ActiveRecord::Base
|
|||
|
||||
attr_accessor :repositories, :arches
|
||||
|
||||
validates :platform_id, :arch_names, :name, :user_id, :repositories, :presence => true
|
||||
validates :platform_id, :arch_names, :name, :user_id, :repositories, :rep_names, :presence => true
|
||||
validates_inclusion_of :auto_publish, :in => [true, false]
|
||||
|
||||
after_create :build_all
|
||||
|
@ -25,8 +25,8 @@ class MassBuild < ActiveRecord::Base
|
|||
super
|
||||
|
||||
if new_record?
|
||||
rep_names = Repository.where(:id => self.repositories).map(&:name).join(", ")
|
||||
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{platform.name}(#{rep_names})"
|
||||
self.rep_names = Repository.where(:id => self.repositories).map(&:name).join(", ")
|
||||
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{platform.name}"
|
||||
self.arch_names = Arch.where(:id => self.arches).map(&:name).join(", ")
|
||||
end
|
||||
end
|
||||
|
@ -50,4 +50,10 @@ class MassBuild < ActiveRecord::Base
|
|||
end
|
||||
report
|
||||
end
|
||||
|
||||
def cancel_all
|
||||
self.build_lists.find_each do |bl|
|
||||
bl.cancel
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
%th.lpadding16= t('activerecord.attributes.mass_build.name')
|
||||
%th.lpadding16= t("layout.mass_builds.statuses")
|
||||
%th.lpadding16= t("layout.mass_builds.failed_builds_list")
|
||||
%th.lpadding16= t("layout.mass_builds.cancel_mass_build")
|
||||
%th.lpadding16= t("layout.mass_builds.extended_data")
|
||||
- @mass_builds.each do |mass_build|
|
||||
%tr
|
||||
|
@ -43,12 +44,16 @@
|
|||
= mass_build.read_attribute "#{status}_count"
|
||||
.both
|
||||
%td= link_to t("layout.mass_builds.failed_builds_list"), failed_builds_list_platforms_path(:mass_build_id => mass_build.id), :target => "_blank"
|
||||
%td= link_to t("layout.mass_builds.cancel_mass_build"), cancel_mass_build_platforms_path(:mass_build_id => mass_build.id), :method => :post, :confirm => t("layout.mass_builds.cancel_confirm")
|
||||
%td
|
||||
%a.toggle_btn{:href => "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data")
|
||||
.toggle{:id => "toggle_#{ mass_build.id }"}
|
||||
= t('activerecord.attributes.mass_build.arch_names') + ": "
|
||||
= mass_build.arch_names
|
||||
.both
|
||||
= t('activerecord.attributes.mass_build.rep_names') + ": "
|
||||
= mass_build.rep_names
|
||||
.both
|
||||
= t('activerecord.attributes.mass_build.user') + ": "
|
||||
= link_to mass_build.user.fullname, mass_build.user
|
||||
.both
|
||||
|
|
|
@ -5,6 +5,8 @@ en:
|
|||
extended_data: Extended data
|
||||
failed_builds_list: Failed Builds List
|
||||
statuses: Statuses
|
||||
cancel_mass_build: Cancel
|
||||
cancel_confirm: Are you sure you want to cancel all builds?
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Mass Build
|
||||
|
@ -18,3 +20,4 @@ en:
|
|||
user: User
|
||||
auto_publish: Auto Publish
|
||||
repositories: Repositories
|
||||
rep_names: Repository names
|
||||
|
|
|
@ -5,6 +5,8 @@ ru:
|
|||
extended_data: Параметры задания
|
||||
failed_builds_list: Список ошибок сборок
|
||||
statuses: Статусы
|
||||
cancel_mass_build: Отмена
|
||||
cancel_confirm: Вы уверены, что хотите отменить все сборки?
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Массовая Сборка
|
||||
|
@ -18,3 +20,4 @@ ru:
|
|||
user: Пользователь
|
||||
auto_publish: Авто Публикация
|
||||
repositories: Репозитории
|
||||
rep_names: Названия репозиториев
|
||||
|
|
|
@ -59,6 +59,7 @@ en:
|
|||
destroyed: Platform deleted
|
||||
build_all_success: All project build in progress
|
||||
build_all_error: Mass build failed
|
||||
cancel_mass_build: Mass build canceled
|
||||
clone_success: Cloned successfully
|
||||
members:
|
||||
already_added: "%{name} is already a member of platform"
|
||||
|
|
|
@ -59,6 +59,7 @@ ru:
|
|||
destroyed: Платформа успешно удалена
|
||||
build_all_success: Все проекты успешно отправлены на сборку
|
||||
build_all_error: Сборка не удалась!
|
||||
cancel_mass_build: Массовая сборка отменена
|
||||
clone_success: Клонирование успешно
|
||||
members:
|
||||
already_added: "%{name} уже является участником платформы"
|
||||
|
|
|
@ -57,6 +57,7 @@ Rosa::Application.routes.draw do
|
|||
end
|
||||
collection do
|
||||
get :failed_builds_list
|
||||
post :cancel_mass_build
|
||||
end
|
||||
get :autocomplete_user_uname, :on => :collection
|
||||
resources :repositories do
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
class AddCountersToMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :build_lists_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_published_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_pending_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_started_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_publish_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_error_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_lists_count, :integer, :default => 0, :null => false
|
||||
add_column :mass_builds, :build_published_count, :integer, :default => 0, :null => false
|
||||
add_column :mass_builds, :build_pending_count, :integer, :default => 0, :null => false
|
||||
add_column :mass_builds, :build_started_count, :integer, :default => 0, :null => false
|
||||
add_column :mass_builds, :build_publish_count, :integer, :default => 0, :null => false
|
||||
add_column :mass_builds, :build_error_count, :integer, :default => 0, :null => false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddRepNamesToMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :rep_names, :string
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120622092725) do
|
||||
ActiveRecord::Schema.define(:version => 20120628142723) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -210,6 +210,7 @@ ActiveRecord::Schema.define(:version => 20120622092725) do
|
|||
t.integer "build_started_count", :default => 0
|
||||
t.integer "build_publish_count", :default => 0
|
||||
t.integer "build_error_count", :default => 0
|
||||
t.string "rep_names"
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue