aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranicet2015-06-16 10:35:39 +0200
committeranicet2015-06-16 10:45:54 +0200
commit5528857e90c5accb252768519f82bb500db74ac2 (patch)
treeb8741455708ef1db0183c01f57dd639a3b4eeda9
parent9b74d771ba328aee61450cec2122dbbd55d879f0 (diff)
downloadchouette-core-5528857e90c5accb252768519f82bb500db74ac2.tar.bz2
Ie report : display files in html table
-rw-r--r--app/assets/javascripts/partials/ie_report.js.coffee.erb36
-rw-r--r--app/models/concerns/report_concern.rb2
-rw-r--r--app/views/shared/_ie_report_file.html.erb45
-rw-r--r--config/locales/ie_report.en.yml5
-rw-r--r--config/locales/ie_report.fr.yml7
5 files changed, 29 insertions, 66 deletions
diff --git a/app/assets/javascripts/partials/ie_report.js.coffee.erb b/app/assets/javascripts/partials/ie_report.js.coffee.erb
index 8087071cb..579335521 100644
--- a/app/assets/javascripts/partials/ie_report.js.coffee.erb
+++ b/app/assets/javascripts/partials/ie_report.js.coffee.erb
@@ -1,41 +1,5 @@
$(".imports.show, .exports.show, .compliance_checks.show").ready ->
- getFileResults = (html_container, html_element) ->
- html_container.children().each ->
- if($(this).is(html_element))
- $(this).show()
- else
- $(this).hide()
-
- getFileStatistics = (id)->
- Morris.Donut({
- element: id,
- data: [
- {
- label: $(".files_error").data('label'),
- value: $('.files_error span.file_name').size()
- },
- {
- label: $(".files_ignored").data('label'),
- value: $('.files_ignored span.file_name').size()
- },
- {
- label: $(".files_ok").data('label'),
- value: $('.files_ok span.file_name').size()
- }
- ],
- colors: [ "#e22b1b", "#898e7f", "#8fc861" ]
- }).on('click', update = (i, row) ->
- switch i
- when 0 then getFileResults($(".results"), $(".files_error"))
- when 1 then getFileResults($(".results"), $(".files_ignored"))
- when 2 then getFileResults($(".results"), $(".files_ok"))
- )
- getFileResults($(".results"), $(".files_error"))
-
- if $( "#files_statistics" ).length
- getFileStatistics('files_statistics')
-
refreshInterval = $(".report").data("refresh-interval")
if refreshInterval > 0
reloadPage = () -> window.location.reload()
diff --git a/app/models/concerns/report_concern.rb b/app/models/concerns/report_concern.rb
index e8e2078bd..b0157fec3 100644
--- a/app/models/concerns/report_concern.rb
+++ b/app/models/concerns/report_concern.rb
@@ -51,7 +51,7 @@ module ReportConcern
end
def files
- datas.files || []
+ @files ||= datas.files || []
end
def error_files
diff --git a/app/views/shared/_ie_report_file.html.erb b/app/views/shared/_ie_report_file.html.erb
index 78c363446..3d28b19bb 100644
--- a/app/views/shared/_ie_report_file.html.erb
+++ b/app/views/shared/_ie_report_file.html.erb
@@ -1,26 +1,23 @@
-<div class="caption"><%= t(".graph.files.title_default", {:job => job.class.model_name.human, :extension => job.filename_extension} ) %></div>
-<div id="files_statistics"></div>
-
+<p class="lead">
+<p class="caption"><%= t(".graph.files.title_default", {:job => job.class.model_name.human, :extension => job.filename_extension} ) %></p>
+</p>
<div class="report results" data-refresh-interval="<%= job_refresh_interval(job) %>">
- <div class="files files_error" data-label="<%= t('.graph.files.error') %>">
- <% job.report.error_files.each_with_index do |file, index| %>
- <div class="col-md-6">
- <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span>
- </div>
- <% end %>
- </div>
- <div class="files files_ignored" data-label="<%= t('.graph.files.ignored') %>">
- <% job.report.ignored_files.each_with_index do |file, index| %>
- <div class="col-md-6">
- <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span>
- </div>
- <% end %>
- </div>
- <div class="files files_ok" data-label="<%= t('.graph.files.ok') %>">
- <% job.report.ok_files.each_with_index do |file, index| %>
- <div class="col-md-6">
- <%= image_tag "icons/file_xml_md.png" %><span class="file_name" title='<%= file.name %>'><%= truncate(file.name, :length => 40) %></span>
- </div>
- <% end %>
- </div>
+ <table class="table table-hover table-striped">
+ <thead>
+ <tr>
+ <th class="state"><%= t(".table.line.state") %></th>
+ <th class="name"><%= t(".table.line.name") %></th>
+ <th class="error"><%= t(".table.line.error") %></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% job.report.files.each do |file| %>
+ <tr class="<%= file.status == 'ERROR' ? 'danger' : nil %>">
+ <td><%= t(".graph.files.#{file.status.downcase}") %></td>
+ <td><%= file.name %></td>
+ <td><%= file.errors.map{|e| "#{e.code} : #{e.description}"}.join(' | ') if file.errors.present? %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
</div>
diff --git a/config/locales/ie_report.en.yml b/config/locales/ie_report.en.yml
index af12e35d6..a66209820 100644
--- a/config/locales/ie_report.en.yml
+++ b/config/locales/ie_report.en.yml
@@ -1,9 +1,10 @@
en:
shared:
ie_report:
+ html:
tab:
- file: 'File'
- line: 'Line'
+ file: 'Files'
+ line: 'Lines'
ie_report_line:
read_lines: 'Read lines'
saved_lines: 'Saved lines'
diff --git a/config/locales/ie_report.fr.yml b/config/locales/ie_report.fr.yml
index c02c4dd32..20ebae722 100644
--- a/config/locales/ie_report.fr.yml
+++ b/config/locales/ie_report.fr.yml
@@ -1,9 +1,10 @@
fr:
shared:
ie_report:
- tab:
- file: 'File'
- line: 'Line'
+ html:
+ tab:
+ file: 'Fichiers'
+ line: 'Lignes'
ie_report_line:
read_lines: 'Lignes lues'
saved_lines: 'Lignes sauvegardés'