diff --git a/app/views/platforms/product_build_lists/show.json.jbuilder b/app/views/platforms/product_build_lists/show.json.jbuilder index e0d1270c0..f14e27667 100644 --- a/app/views/platforms/product_build_lists/show.json.jbuilder +++ b/app/views/platforms/product_build_lists/show.json.jbuilder @@ -10,6 +10,10 @@ json.product_build_list do json.file_name result['file_name'] json.sha1 result['sha1'] json.size result['size'] + + timestamp = result['timestamp'] + json.created_at Time.zone.at(result['timestamp']).to_s if timestamp + json.url file_store_results_url(result['sha1'], result['file_name']) end if @product_build_list.results.present? diff --git a/app/views/projects/build_lists/show.json.jbuilder b/app/views/projects/build_lists/show.json.jbuilder index 95a492056..c502fc670 100644 --- a/app/views/projects/build_lists/show.json.jbuilder +++ b/app/views/projects/build_lists/show.json.jbuilder @@ -42,6 +42,10 @@ json.build_list do json.file_name result['file_name'] json.sha1 result['sha1'] json.size result['size'] + + timestamp = result['timestamp'] + json.created_at Time.zone.at(result['timestamp']).to_s if timestamp + json.url file_store_results_url(result['sha1'], result['file_name']) end if @build_list.new_core? && @build_list.results.present? diff --git a/app/views/shared/_build_results.html.haml b/app/views/shared/_build_results.html.haml index 6d859dc9b..d0bd968e6 100644 --- a/app/views/shared/_build_results.html.haml +++ b/app/views/shared/_build_results.html.haml @@ -1,15 +1,17 @@ %h3= subject.class.human_attribute_name(subject.is_a?(BuildList) ? 'logs' : 'results') %h4.nomargin{'ng-hide' => 'subject.results'}= t('layout.no_') -%table.tablesorter.width565{cellpadding: "0", cellspacing: "0", 'ng-show' => 'subject.results'} +%table.tablesorter{cellpadding: "0", cellspacing: "0", 'ng-show' => 'subject.results'} %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") + %th= t("activerecord.attributes.product_build_list/results.created_at") %tbody %tr{'ng-repeat' => 'item in subject.results'} %td %a{'ng-href' => '{{item.url}}' } {{item.file_name}} %td {{item.sha1}} %td {{item.size}} + %td {{item.created_at}} .both \ No newline at end of file diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index 79003c2a3..4bd04c5ee 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -51,6 +51,7 @@ en: file_name: File name sha1: SHA1 size: Size (MB) + created_at: Created on flash: product_build_list: diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index aac415f32..6d7c27ba7 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -51,6 +51,7 @@ ru: file_name: Имя файла sha1: SHA1 size: Размер (МБ) + created_at: Создан flash: product_build_list: diff --git a/lib/abf_worker/base_observer.rb b/lib/abf_worker/base_observer.rb index 0b8912a1c..2e2b68d2f 100644 --- a/lib/abf_worker/base_observer.rb +++ b/lib/abf_worker/base_observer.rb @@ -10,9 +10,9 @@ module AbfWorker attr_accessor :status, :options def initialize(options, subject_class) - @status = options['status'].to_i - @options = options - @subject_class = subject_class + @status = options['status'].to_i + @options = options + @subject_class = subject_class end def perform @@ -22,16 +22,19 @@ module AbfWorker protected def subject - @subject ||= @subject_class.find options['id'] + @subject ||= @subject_class.find(options['id']) end def update_results - results = (subject.results || []) + (options['results'] || []) - sort_results_and_save results + now = Time.zone.now.to_i + results = options['results'] || [] + results.each{ |r| r['timestamp'] = now } + results += subject.results || [] + sort_results_and_save(results) end def sort_results_and_save(results, item = subject) - item.results = results.sort_by{ |r| r['file_name'] } + item.results = results.sort_by{ |r| [r['timestamp'], r['file_name']] } item.save(validate: false) end