diff options
| author | anicet | 2015-06-16 10:35:39 +0200 | 
|---|---|---|
| committer | anicet | 2015-06-16 10:45:54 +0200 | 
| commit | 5528857e90c5accb252768519f82bb500db74ac2 (patch) | |
| tree | b8741455708ef1db0183c01f57dd639a3b4eeda9 /app | |
| parent | 9b74d771ba328aee61450cec2122dbbd55d879f0 (diff) | |
| download | chouette-core-5528857e90c5accb252768519f82bb500db74ac2.tar.bz2 | |
Ie report : display files in html table
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/javascripts/partials/ie_report.js.coffee.erb | 36 | ||||
| -rw-r--r-- | app/models/concerns/report_concern.rb | 2 | ||||
| -rw-r--r-- | app/views/shared/_ie_report_file.html.erb | 45 | 
3 files changed, 22 insertions, 61 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>  | 
