#31: add UI for save product_build_list
This commit is contained in:
parent
6a9e270a5c
commit
3865332e8a
|
@ -6,7 +6,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
load_and_authorize_resource :platform, :except => :index
|
||||
load_and_authorize_resource :product, :through => :platform, :except => :index
|
||||
load_and_authorize_resource :product_build_list, :through => :product, :except => :index
|
||||
load_and_authorize_resource :only => [:index, :show, :log, :cancel]
|
||||
load_and_authorize_resource :only => [:index, :show, :log, :cancel, :update]
|
||||
|
||||
def new
|
||||
product = @product_build_list.product
|
||||
|
@ -23,6 +23,16 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
def show
|
||||
end
|
||||
|
||||
def update
|
||||
if @product_build_list.update_attributes(params[:product_build_list])
|
||||
flash[:notice] = t('flash.product_build_list.updated')
|
||||
else
|
||||
flash[:error] = t('flash.product_build_list.update_error')
|
||||
flash[:warning] = @product_build_list.errors.full_messages.join('. ')
|
||||
end
|
||||
redirect_to platform_product_product_build_list_path(@platform, @product, @product_build_list)
|
||||
end
|
||||
|
||||
def cancel
|
||||
if @product_build_list.cancel
|
||||
notice = t('layout.build_lists.will_be_canceled')
|
||||
|
|
|
@ -117,7 +117,7 @@ class Ability
|
|||
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?}
|
||||
can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform and product.platform.main?}
|
||||
|
||||
can([:create, :cancel], ProductBuildList) {|pbl| can?(:update, pbl.product)}
|
||||
can([:create, :cancel, :update], ProductBuildList) {|pbl| can?(:update, pbl.product)}
|
||||
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
|
||||
|
||||
can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||
|
|
|
@ -54,7 +54,8 @@ class ProductBuildList < ActiveRecord::Base
|
|||
:commit_hash,
|
||||
:arch_id,
|
||||
:product_id,
|
||||
:not_delete
|
||||
:not_delete,
|
||||
:autostarted
|
||||
attr_readonly :product_id
|
||||
serialize :results, Array
|
||||
|
||||
|
|
|
@ -35,6 +35,24 @@
|
|||
- if pbl.build_started? || pbl.build_canceling?
|
||||
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }
|
||||
|
||||
- if pbl.build_completed? && can?(:update, pbl)
|
||||
= form_for pbl, :url => platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) do |f|
|
||||
.leftlist= f.label :not_delete
|
||||
.rightlist
|
||||
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
|
||||
.both
|
||||
%br
|
||||
= submit_tag t('layout.update')
|
||||
.both
|
||||
- unless pbl.not_delete
|
||||
.flash_notify
|
||||
.alert.alert-error
|
||||
- if pbl.autostarted?
|
||||
= t('layout.product_build_lists.will_be_exist_2_weeks')
|
||||
- else
|
||||
= t('layout.product_build_lists.will_be_exist_3_months')
|
||||
.both
|
||||
|
||||
= render 'results', :subject => pbl
|
||||
|
||||
:javascript
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
en:
|
||||
layout:
|
||||
product_build_lists:
|
||||
will_be_exist_2_weeks: Product build list will be exist in two weeks
|
||||
will_be_exist_3_months: Product build list will be exist in three months
|
||||
logs: Logs (last 100 lines)
|
||||
work_env: Work environment
|
||||
iso_builder_folder: folder with contents of the GIT project
|
||||
|
@ -29,6 +31,7 @@ en:
|
|||
activerecord:
|
||||
attributes:
|
||||
product_build_list:
|
||||
not_delete: Not delete
|
||||
id: Id
|
||||
user: User
|
||||
product: Product
|
||||
|
@ -52,4 +55,6 @@ en:
|
|||
product_build_list:
|
||||
no_project: Project for build should be exist
|
||||
delete: Product build list deleted
|
||||
delete_error: Unable to delete product build list
|
||||
delete_error: Unable to delete product build list
|
||||
updated: Product build list updated
|
||||
update_error: Unable to update product build list
|
|
@ -1,6 +1,8 @@
|
|||
ru:
|
||||
layout:
|
||||
product_build_lists:
|
||||
will_be_exist_2_weeks: Cборочный лист продукта будет доступен в течение двух недель
|
||||
will_be_exist_3_months: Cборочный лист продукта будет доступен в течение трех месяцев
|
||||
logs: Логи (последнии 100 строк)
|
||||
work_env: Рабочее пространство
|
||||
iso_builder_folder: папка с содержимым GIT проекта
|
||||
|
@ -29,6 +31,7 @@ ru:
|
|||
activerecord:
|
||||
attributes:
|
||||
product_build_list:
|
||||
not_delete: Не удалять
|
||||
id: Id
|
||||
user: Пользователь
|
||||
product: Продукт
|
||||
|
@ -52,4 +55,6 @@ ru:
|
|||
product_build_list:
|
||||
no_project: Проект для сборки должен присутствовать
|
||||
delete: Сборочный лист продукта удален
|
||||
delete_error: Не удалось удалить cборочный лист продукта
|
||||
delete_error: Не удалось удалить cборочный лист продукта
|
||||
updated: Cборочный лист продукта успешно обновлен
|
||||
update_error: Не удалось обновить cборочный лист продукта
|
|
@ -162,7 +162,7 @@ Rosa::Application.routes.draw do
|
|||
end
|
||||
resources :key_pairs, :only => [:create, :index, :destroy]
|
||||
resources :products do
|
||||
resources :product_build_lists, :only => [:create, :destroy, :new, :show] do
|
||||
resources :product_build_lists, :only => [:create, :destroy, :new, :show, :update] do
|
||||
member {
|
||||
get :log
|
||||
put :cancel
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class AddAutostartAndNotDeleteToProductAndProductBuildList < ActiveRecord::Migration
|
||||
class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :products, :autostart, :integer, :default => nil
|
||||
add_column :product_build_lists, :not_delete, :boolean, :default => false
|
||||
add_column :product_build_lists, :autostarted, :boolean, :default => false
|
||||
end
|
||||
end
|
|
@ -315,6 +315,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do
|
|||
t.integer "time_living"
|
||||
t.integer "user_id"
|
||||
t.boolean "not_delete", :default => false
|
||||
t.boolean "autostarted", :default => false
|
||||
end
|
||||
|
||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
|
|
Loading…
Reference in New Issue