From dfb56175278409fc56298890b1ca617d0e00992c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 2 Jun 2022 09:58:05 +0300 Subject: Add an error display to the progress status report Enable the progress status page to show all the errors found at any point during the processing of the file. --- qc_app/templates/errors_display.html | 43 ++++++++++++++++++++++++++++++++++++ qc_app/templates/job_progress.html | 5 +++++ qc_app/templates/parse_results.html | 41 ++-------------------------------- 3 files changed, 50 insertions(+), 39 deletions(-) create mode 100644 qc_app/templates/errors_display.html (limited to 'qc_app/templates') diff --git a/qc_app/templates/errors_display.html b/qc_app/templates/errors_display.html new file mode 100644 index 0000000..0c9a212 --- /dev/null +++ b/qc_app/templates/errors_display.html @@ -0,0 +1,43 @@ +{%macro errors_display(errors, no_error_msg, error_message)%} + +{%if errors | length == 0 %} +{{no_error_msg}} +{%else %} +

{{error_message}}

+ + + + + + + + + + + + + {%for error in errors%} + + + + + + + {%endfor%} + +
line numbercolumn(s)errorerror message
{{error["line"]}} + {%if isinvalidvalue(error):%} + {{error.column}} + {%else: %} + {{error.columns}} + {%endif %} + + {%if isinvalidvalue(error):%} + Invalid Value + {%else: %} + Duplicate Header + {%endif %} + {{error["message"]}}
+{%endif%} + +{%endmacro%} diff --git a/qc_app/templates/job_progress.html b/qc_app/templates/job_progress.html index 8a9256f..accdc1c 100644 --- a/qc_app/templates/job_progress.html +++ b/qc_app/templates/job_progress.html @@ -1,4 +1,5 @@ {%extends "base.html"%} +{%from "errors_display.html" import errors_display%} {%block extrameta%} @@ -16,4 +17,8 @@ {{progress}} {{"%.2f" | format(progress)}}% +
+ {{errors_display(errors, "No errors found so far", "We have found the following errors so far")}} +
+ {%endblock%} diff --git a/qc_app/templates/parse_results.html b/qc_app/templates/parse_results.html index a750bb5..8d39359 100644 --- a/qc_app/templates/parse_results.html +++ b/qc_app/templates/parse_results.html @@ -1,48 +1,11 @@ {%extends "base.html"%} +{%from "errors_display.html" import errors_display%} {%block title%}Parse Results{%endblock%} {%block contents%}

{{job_name}}: parse results

-{%if errors | length == 0 %} -No errors found in the file -{%else %} -

We found the following errors

- - - - - - - - - - - - - {%for error in errors%} - - - - - - - {%endfor%} - -
line numbercolumn(s)errorerror message
{{error["line"]}} - {%if isinvalidvalue(error):%} - {{error.column}} - {%else: %} - {{error.columns}} - {%endif %} - - {%if isinvalidvalue(error):%} - Invalid Value - {%else: %} - Duplicate Header - {%endif %} - {{error["message"]}}
-{%endif%} +{{errors_display(errors, "No errors found in the file", "We found the following errors")}} {%endblock%} -- cgit v1.2.3