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.file_name result['file_name']
|
||||||
json.sha1 result['sha1']
|
json.sha1 result['sha1']
|
||||||
json.size result['size']
|
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'])
|
json.url file_store_results_url(result['sha1'], result['file_name'])
|
||||||
end if @product_build_list.results.present?
|
end if @product_build_list.results.present?
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ json.build_list do
|
||||||
json.file_name result['file_name']
|
json.file_name result['file_name']
|
||||||
json.sha1 result['sha1']
|
json.sha1 result['sha1']
|
||||||
json.size result['size']
|
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'])
|
json.url file_store_results_url(result['sha1'], result['file_name'])
|
||||||
end if @build_list.new_core? && @build_list.results.present?
|
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')
|
%h3= subject.class.human_attribute_name(subject.is_a?(BuildList) ? 'logs' : 'results')
|
||||||
%h4.nomargin{'ng-hide' => 'subject.results'}= t('layout.no_')
|
%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
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= t("activerecord.attributes.product_build_list/results.file_name")
|
%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.sha1")
|
||||||
%th= t("activerecord.attributes.product_build_list/results.size")
|
%th= t("activerecord.attributes.product_build_list/results.size")
|
||||||
|
%th= t("activerecord.attributes.product_build_list/results.created_at")
|
||||||
%tbody
|
%tbody
|
||||||
%tr{'ng-repeat' => 'item in subject.results'}
|
%tr{'ng-repeat' => 'item in subject.results'}
|
||||||
%td
|
%td
|
||||||
%a{'ng-href' => '{{item.url}}' } {{item.file_name}}
|
%a{'ng-href' => '{{item.url}}' } {{item.file_name}}
|
||||||
%td {{item.sha1}}
|
%td {{item.sha1}}
|
||||||
%td {{item.size}}
|
%td {{item.size}}
|
||||||
|
%td {{item.created_at}}
|
||||||
.both
|
.both
|
|
@ -51,6 +51,7 @@ en:
|
||||||
file_name: File name
|
file_name: File name
|
||||||
sha1: SHA1
|
sha1: SHA1
|
||||||
size: Size (MB)
|
size: Size (MB)
|
||||||
|
created_at: Created on
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
product_build_list:
|
product_build_list:
|
||||||
|
|
|
@ -51,6 +51,7 @@ ru:
|
||||||
file_name: Имя файла
|
file_name: Имя файла
|
||||||
sha1: SHA1
|
sha1: SHA1
|
||||||
size: Размер (МБ)
|
size: Размер (МБ)
|
||||||
|
created_at: Создан
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
product_build_list:
|
product_build_list:
|
||||||
|
|
|
@ -10,9 +10,9 @@ module AbfWorker
|
||||||
attr_accessor :status, :options
|
attr_accessor :status, :options
|
||||||
|
|
||||||
def initialize(options, subject_class)
|
def initialize(options, subject_class)
|
||||||
@status = options['status'].to_i
|
@status = options['status'].to_i
|
||||||
@options = options
|
@options = options
|
||||||
@subject_class = subject_class
|
@subject_class = subject_class
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
|
@ -22,16 +22,19 @@ module AbfWorker
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def subject
|
def subject
|
||||||
@subject ||= @subject_class.find options['id']
|
@subject ||= @subject_class.find(options['id'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_results
|
def update_results
|
||||||
results = (subject.results || []) + (options['results'] || [])
|
now = Time.zone.now.to_i
|
||||||
sort_results_and_save results
|
results = options['results'] || []
|
||||||
|
results.each{ |r| r['timestamp'] = now }
|
||||||
|
results += subject.results || []
|
||||||
|
sort_results_and_save(results)
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_results_and_save(results, item = subject)
|
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)
|
item.save(validate: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue