Add timestamp into logs
This commit is contained in:
parent
8ddfd281a2
commit
9e031b63cd
|
@ -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?
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
||||
|
|
|
@ -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
|
|
@ -51,6 +51,7 @@ en:
|
|||
file_name: File name
|
||||
sha1: SHA1
|
||||
size: Size (MB)
|
||||
created_at: Created on
|
||||
|
||||
flash:
|
||||
product_build_list:
|
||||
|
|
|
@ -51,6 +51,7 @@ ru:
|
|||
file_name: Имя файла
|
||||
sha1: SHA1
|
||||
size: Размер (МБ)
|
||||
created_at: Создан
|
||||
|
||||
flash:
|
||||
product_build_list:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue