[refs #442] Add new page for mass rebuild, new fields and new functional
This commit is contained in:
parent
7c45263799
commit
c74de8b84d
|
@ -7,19 +7,20 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
autocomplete :user, :uname
|
||||
|
||||
def build_all
|
||||
@build_lists = BuildList.for_platform(@platform)
|
||||
@build_lists = @build_lists.by_mass_build(params[:mass_build_id]) unless params[:mass_build_id].blank?
|
||||
|
||||
if request.post?
|
||||
mass_build = MassBuild.create(:platform => @platform)
|
||||
mass_build = MassBuild.create!(:platform => @platform, :user => current_user)
|
||||
mass_build.delay.build_all(
|
||||
#mass_build.build_all(
|
||||
:user => current_user,
|
||||
:repositories => params[:repositories],
|
||||
:arches => params[:arches],
|
||||
:auto_publish => params[:auto_publish]
|
||||
)
|
||||
redirect_to(build_lists_path, :notice => t("flash.platform.build_all_success"))
|
||||
redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success"))
|
||||
end
|
||||
|
||||
def mass_builds
|
||||
@mass_builds = MassBuild.paginate(:page => params[:page], :per_page => 20)
|
||||
render :action => :build_all
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
|
@ -8,8 +8,8 @@ module ApplicationHelper
|
|||
'right slim'
|
||||
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
|
||||
nil
|
||||
when controller_name == 'platforms' && action_name == 'build_all'
|
||||
nil
|
||||
#when controller_name == 'platforms' && action_name == 'build_all'
|
||||
# nil
|
||||
when controller_name == 'platforms' && action_name == 'show'
|
||||
'right bigpadding'
|
||||
when controller_name == 'platforms' && action_name == 'clone'
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
class MassBuild < ActiveRecord::Base
|
||||
belongs_to :platform
|
||||
has_many :build_lists
|
||||
belongs_to :user
|
||||
has_many :build_lists, :dependent => :destroy
|
||||
|
||||
scope :by_platform, lambda { |platform| where(:platform_id => platform.id) }
|
||||
|
||||
def build_all(opts={})
|
||||
set_name opts[:repositories]
|
||||
auto_publish = opts[:auto_publish] || false
|
||||
set_data opts[:repositories], opts[:arches], auto_publish
|
||||
|
||||
platform.build_all opts.merge({:mass_build_id => self.id})
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_name(repositories_ids)
|
||||
def set_data(repositories_ids, arches, auto_publish=false)
|
||||
rep_names = Repository.where(:id => repositories_ids).map(&:name).join(", ")
|
||||
self.name = "#{Date.today.strftime("%d.%b")}-#{platform.name}(#{rep_names})"
|
||||
self.save!
|
||||
self.arch_names = Arch.where(:id => arches).map(&:name).join(", ")
|
||||
self.auto_publish = auto_publish
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -161,7 +161,7 @@ class Platform < ActiveRecord::Base
|
|||
# Set options to build all need
|
||||
repositories = opts[:repositories] ? self.repositories.where(:id => opts[:repositories]) : self.repositories
|
||||
arches = opts[:arches] ? Arch.where(:id => opts[:arches]) : Arch.all
|
||||
auto_publish = opts[:auto_publish] || true
|
||||
auto_publish = opts[:auto_publish] || false
|
||||
user = opts[:user]
|
||||
mass_build_id = opts[:mass_build_id]
|
||||
|
||||
|
@ -174,6 +174,7 @@ class Platform < ActiveRecord::Base
|
|||
p.build_for(self, user, arch, auto_publish, mass_build_id)
|
||||
rescue RuntimeError, Exception
|
||||
p.delay.build_for(self, user, arch, auto_publish, mass_build_id)
|
||||
#p.build_for(self, user, arch, auto_publish, mass_build_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,7 +86,7 @@ class Project < ActiveRecord::Base
|
|||
bl.project_version = "latest_#{platform.name}"
|
||||
bl.build_requires = false # already set as db default
|
||||
bl.user = user
|
||||
bl.auto_publish = true # already set as db default
|
||||
bl.auto_publish = auto_publish # already set as db default
|
||||
bl.include_repos = build_ids
|
||||
bl.priority = priority
|
||||
bl.mass_build_id = mass_build_id
|
||||
|
|
|
@ -1,20 +1,60 @@
|
|||
- content_for(:sidebar) do
|
||||
= form_for :build, :url => build_all_platform_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
|
||||
%section.left
|
||||
.bordered.nopadding
|
||||
.table
|
||||
%h3= t("activerecord.attributes.build_list.build_for_platform")
|
||||
- @platform.repositories.each do |rep|
|
||||
.lefter
|
||||
= check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}"
|
||||
= label_tag "repositories_#{rep.id}", rep.name
|
||||
.both
|
||||
%section.right
|
||||
.both
|
||||
.table
|
||||
%h3= t("activerecord.attributes.build_list.arch")
|
||||
- Arch.recent.each do |arch|
|
||||
.lefter
|
||||
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
|
||||
= label_tag "arches_#{arch.id}", arch.name
|
||||
.both
|
||||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
.both
|
||||
.table
|
||||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
.lefter
|
||||
= check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : true, :id => 'auto_publish'
|
||||
= label_tag :auto_publish
|
||||
= label_tag t('activerecord.attributes.mass_build.auto_publish')
|
||||
.both
|
||||
.both
|
||||
%br
|
||||
= f.submit t("layout.projects.build_button")
|
||||
|
||||
%br
|
||||
%br
|
||||
.bordered.nopadding
|
||||
.table
|
||||
- ['BuildList::BUILD_PUBLISHED', 'BuildServer::SUCCESS', 'BuildServer::BUILD_STARTED', 'BuildList::BUILD_PENDING', 'BuildServer::BUILD_ERROR'].each do |state|
|
||||
.lefter
|
||||
= t("layout.build_lists.statuses.#{state.demodulize.downcase}")
|
||||
.righter
|
||||
= BuildList.for_status(state.constantize).for_user(current_user).for_platform(@platform).count
|
||||
.both
|
||||
%br
|
||||
= link_to t("layout.activity_feed.all_my_builds"), build_lists_path
|
||||
|
||||
%h3.fix= t("layout.platforms.mass_build")
|
||||
|
||||
%table.tablesorter.unbordered
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.name')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.arch_names')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.user')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.auto_publish')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.created_at')
|
||||
- @mass_builds.each do |mass_build|
|
||||
%tr
|
||||
%td= link_to mass_build.name, build_lists_path(:filter => {:mass_build_id => mass_build.id})
|
||||
%td= mass_build.arch_names
|
||||
%td= mass_build.user.name
|
||||
%td= mass_build.auto_publish
|
||||
%td= mass_build.created_at
|
||||
= will_paginate @mass_builds
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
en:
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Mass Build
|
||||
attributes:
|
||||
mass_build:
|
||||
name: Name
|
||||
created_at: Created
|
||||
updated_at: Updated
|
||||
arch_names: Architectures
|
||||
user: User
|
||||
auto_publish: Auto Publish
|
|
@ -0,0 +1,12 @@
|
|||
ru:
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Массовая Сборка
|
||||
attributes:
|
||||
mass_build:
|
||||
name: Название
|
||||
created_at: Создан
|
||||
updated_at: Обновлен
|
||||
arch_names: Архитектуры
|
||||
user: Пользователь
|
||||
auto_publish: Авто Публикация
|
|
@ -48,7 +48,7 @@ Rosa::Application.routes.draw do
|
|||
post :add_member
|
||||
post :make_clone
|
||||
post :build_all
|
||||
get :build_all
|
||||
get :mass_builds
|
||||
end
|
||||
get :autocomplete_user_uname, :on => :collection
|
||||
resources :repositories do
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class AddArchNamesToMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :arch_names, :string
|
||||
add_column :mass_builds, :user_id, :integer
|
||||
add_column :mass_builds, :auto_publish, :boolean
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120518105225) do
|
||||
ActiveRecord::Schema.define(:version => 20120523113925) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -217,6 +217,9 @@ ActiveRecord::Schema.define(:version => 20120518105225) do
|
|||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "arch_names"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish"
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
@ -230,7 +233,7 @@ ActiveRecord::Schema.define(:version => 20120518105225) do
|
|||
t.string "owner_type"
|
||||
t.string "visibility", :default => "open", :null => false
|
||||
t.string "platform_type", :default => "main", :null => false
|
||||
t.string "distrib_type", :null => false
|
||||
t.string "distrib_type"
|
||||
end
|
||||
|
||||
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||
|
|
Loading…
Reference in New Issue