add results column to build_lists table

This commit is contained in:
Vokhmin Alexey V 2012-11-27 18:22:17 +04:00
parent c7adea14ce
commit 3d6269da9b
7 changed files with 40 additions and 24 deletions

View File

@ -112,6 +112,7 @@ class BuildList < ActiveRecord::Base
serialize :additional_repos
serialize :include_repos
serialize :results, Array
after_commit :place_build
after_destroy :delete_container
@ -246,7 +247,7 @@ class BuildList < ActiveRecord::Base
include_repos_hash = {}.tap do |h|
include_repos.each do |r|
repo = Repository.find r
h[repo.name] = repo.platform.public_downloads_url(nil, arch, repo.name)
h[repo.name] = repo.platform.public_downloads_url(nil, arch.name, repo.name)
end
end
options = {

View File

@ -0,0 +1,18 @@
%h3= t("layout.product_build_lists.results")
- unless pbl.results.present?
%h4.nomargin= t("layout.product_build_lists.no_results")
- else
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th= t("activerecord.attributes.product_build_list/results.file_name")
%th= t("activerecord.attributes.product_build_list/results.sha1")
%th= t("activerecord.attributes.product_build_list/results.size")
%tbody
- pbl.results.each do |item|
%tr
- sha1 = item['sha1']
%td= link_to item['file_name'], "http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}"
%td= sha1
%td= item['size']
.both

View File

@ -30,25 +30,7 @@
.both
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }
%h3= t("layout.product_build_lists.results")
- unless pbl.results.present?
%h4.nomargin= t("layout.product_build_lists.no_results")
- else
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th= t("activerecord.attributes.product_build_list/results.file_name")
%th= t("activerecord.attributes.product_build_list/results.sha1")
%th= t("activerecord.attributes.product_build_list/results.size")
%tbody
- pbl.results.each do |item|
%tr
- sha1 = item['sha1']
%td= link_to item['file_name'], "http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}"
%td= sha1
%td= item['size']
.both
= render 'results', :pbl => pbl
:javascript
$(function(){

View File

@ -124,8 +124,8 @@
var r = new Rosa.Routers.BuildListsAdvisoriesRouter();
});
- if BuildList::HUMAN_STATUSES[@build_list.status].in? [:build_started, :build_error, :success]
= render 'shared/log', { :build_started => @build_list.build_started?, :download_log_url => build_list_log_url(:build), :get_log_path => log_build_list_path(@build_list) }
- if BuildList::HUMAN_STATUSES[@build_list.status].in? [:build_started, :build_error]
= render 'shared/log', { :build_started => @build_list.build_started?, :get_log_path => log_build_list_path(@build_list) }
- if (can_publish = @build_list.can_publish? && can?(:publish, @build_list))
@ -173,6 +173,8 @@
%td= package.release
.both
= render 'platforms/product_build_lists/results', :pbl => @build_list
:javascript
$('article .all').addClass('bigpadding');

View File

@ -0,0 +1,5 @@
class AddResultsToBuildList < ActiveRecord::Migration
def change
add_column :build_lists, :results, :text
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121106113338) do
ActiveRecord::Schema.define(:version => 20121127122032) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -130,6 +130,7 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
t.integer "advisory_id"
t.integer "mass_build_id"
t.integer "save_to_repository_id"
t.text "results"
end
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"

View File

@ -4,14 +4,21 @@ module AbfWorker
def self.perform(options)
bl = BuildList.find options['id']
case options['status'].to_i
status = options['status'].to_i
case status
when 0
bl.build_success
when 1
bl.build_error
when 3
bl.bs_id = bl.id
bl.save
bl.start_build
end
if status != 3
bl.results = options['results']
bl.save
end
end
end