diff options
| author | Bruno Perles | 2015-12-23 15:28:18 +0100 |
|---|---|---|
| committer | Bruno Perles | 2015-12-23 15:41:14 +0100 |
| commit | 588d11f0f848624eb2c09544038486f3a145ee98 (patch) | |
| tree | 411cf752011a358332faadbe77b57fb3e01332da | |
| parent | 41f97d147fc8e2d79c4724476c43a3f657d87e64 (diff) | |
| download | chouette-core-588d11f0f848624eb2c09544038486f3a145ee98.tar.bz2 | |
Add test on compliance test - See #41601
| -rw-r--r-- | app/views/compliance_checks/_compliance_check_results.erb | 86 | ||||
| -rw-r--r-- | app/views/compliance_checks/report.html.erb | 2 | ||||
| -rw-r--r-- | config/locales/compliance_check_results.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/compliance_check_results.fr.yml | 1 |
4 files changed, 49 insertions, 41 deletions
diff --git a/app/views/compliance_checks/_compliance_check_results.erb b/app/views/compliance_checks/_compliance_check_results.erb index acc60e1fa..28d5a289e 100644 --- a/app/views/compliance_checks/_compliance_check_results.erb +++ b/app/views/compliance_checks/_compliance_check_results.erb @@ -40,51 +40,57 @@ </tr> </thead> <tbody> - <% compliance_check_validation_report.tests.each_with_index do |test, index| %> - <tr class='<%= "#{test.result}_#{test.severity}" %>'> - <td data-value="<%="status-#{test.result}"%>"><%= status_icon( test.result, test.severity ) %> </td> - <td data-value="<%="severity-#{test.severity}"%>"><%= t("compliance_check_result.severities.#{test.severity}_txt") %></td> - <td data-value="<%= "#{test.result}_#{test.severity}" %>"> - <%= link_to test.test_id, test_definition(test.test_id), title: ComplianceCheckResult.human_attribute_name(test.test_id), target: "compliance_check" %> - </td> - <td> - <%= ("#{test.error_count || 0} #{ComplianceCheckResult.human_attribute_name(:violation_count)}") if test.errors.present? %> - </td> - <td> - <%= truncate(t("activemodel.attributes.compliance_check_result.#{test.test_id}"), length: 50)%> - </td> - <td> - <p><b><%=t("activemodel.attributes.compliance_check_result.#{test.test_id}")%></b></p> - <% if test.errors.present? %> - <% test.errors.first(10).each do |error| %> - <dl class="inline"> - <dt> - <% if error["source"].present? %> - <% if error[:source].object_path.present? %> - <% if error[:source].label.present? %> - <%= link_to error[:source].label, object_url(@referential.id, error), target: :_blank %> - <% else %> - <%= link_to "#{error[:source].object_path.type} (#{error[:source].object_path.id})", object_url(@referential.id, error), target: :_blank %> + <% if compliance_check_validation_report %> + <% compliance_check_validation_report.tests.each_with_index do |test, index| %> + <tr class='<%= "#{test.result}_#{test.severity}" %>'> + <td data-value="<%="status-#{test.result}"%>"><%= status_icon( test.result, test.severity ) %> </td> + <td data-value="<%="severity-#{test.severity}"%>"><%= t("compliance_check_result.severities.#{test.severity}_txt") %></td> + <td data-value="<%= "#{test.result}_#{test.severity}" %>"> + <%= link_to test.test_id, test_definition(test.test_id), title: ComplianceCheckResult.human_attribute_name(test.test_id), target: "compliance_check" %> + </td> + <td> + <%= ("#{test.error_count || 0} #{ComplianceCheckResult.human_attribute_name(:violation_count)}") if test.errors.present? %> + </td> + <td> + <%= truncate(t("activemodel.attributes.compliance_check_result.#{test.test_id}"), length: 50)%> + </td> + <td> + <p><b><%=t("activemodel.attributes.compliance_check_result.#{test.test_id}")%></b></p> + <% if test.errors.present? %> + <% test.errors.first(10).each do |error| %> + <dl class="inline"> + <dt> + <% if error["source"].present? %> + <% if error[:source].object_path.present? %> + <% if error[:source].label.present? %> + <%= link_to error[:source].label, object_url(@referential.id, error), target: :_blank %> + <% else %> + <%= link_to "#{error[:source].object_path.type} (#{error[:source].object_path.id})", object_url(@referential.id, error), target: :_blank %> + <% end %> + <% end %> + <% if error[:source].file.present? %> + <%= error[:source].objectid if error[:source].objectid.present? %> <% end %> <% end %> - <% if error[:source].file.present? %> - <%= error[:source].objectid if error[:source].objectid.present? %> - <% end %> + </dt> + <dd><%=t("compliance_check_result.details.detail_#{error[:error_id]}", object_labels_hash(error))%></dd> + </dl> + <% if error[:source].file.present? %> + <p class="file_error"> + <%= error[:source].file.filename %> + <%= ", li: #{error[:source].file.line_number}" if error[:source].file.line_number.present? %> + <%= ", co: #{error[:source].file.column_number}" if error[:source].file.column_number.present? %> + </p> <% end %> - </dt> - <dd><%=t("compliance_check_result.details.detail_#{error[:error_id]}", object_labels_hash(error))%></dd> - </dl> - <% if error[:source].file.present? %> - <p class="file_error"> - <%= error[:source].file.filename %> - <%= ", li: #{error[:source].file.line_number}" if error[:source].file.line_number.present? %> - <%= ", co: #{error[:source].file.column_number}" if error[:source].file.column_number.present? %> - </p> <% end %> <% end %> - <% end %> - </td> - </tr> + </td> + </tr> + <% end %> + <% else %> + <tr> + <td colspan="6"><%= t('compliance_check_results.in_progress') %></td> + </tr> <% end %> </tbody> <tfoot class="hide-if-no-paging"> diff --git a/app/views/compliance_checks/report.html.erb b/app/views/compliance_checks/report.html.erb index 28abd4cbb..7bd0d7a92 100644 --- a/app/views/compliance_checks/report.html.erb +++ b/app/views/compliance_checks/report.html.erb @@ -30,7 +30,7 @@ </div> <% content_for :sidebar do %> - <% if @compliance_check.compliance_check_validation_report.nok_error.blank? %> + <% if @compliance_check.compliance_check_validation_report && @compliance_check.compliance_check_validation_report.nok_error.blank? %> <div class="row"> <%=font_awesome_classic_tag('fa-thumbs-up fa-5x col-md-3')%> <p class='col-md-7' id='validation_success'><%=t('.validation_success')%></p> diff --git a/config/locales/compliance_check_results.en.yml b/config/locales/compliance_check_results.en.yml index 72a87e17f..dcc0f4598 100644 --- a/config/locales/compliance_check_results.en.yml +++ b/config/locales/compliance_check_results.en.yml @@ -8,6 +8,7 @@ en: index: line: "Li" column: "Col" + in_progress: "Compliance check in progress..." compliance_check_result: severities: error: "Required" diff --git a/config/locales/compliance_check_results.fr.yml b/config/locales/compliance_check_results.fr.yml index bfca568dd..c630e3e83 100644 --- a/config/locales/compliance_check_results.fr.yml +++ b/config/locales/compliance_check_results.fr.yml @@ -8,6 +8,7 @@ fr: index: line: "Li" column: "Col" + in_progress: "Validation en cours..." compliance_check_result: severities: error: "Obligatoires" |
