From 470f82897dd56cbf249e5a8783861ab9b28dd978 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 19 Oct 2023 10:04:42 +0300 Subject: CaseAttribute: List out the diffs List out the diffs and create placeholders for active elements that do not yet have the back-end code that handles them. --- .../templates/list_case_attribute_diffs.html | 27 ++++++++++++++++ .../templates/list_case_attribute_diffs_error.html | 37 ++++++++++++++++++++++ wqflask/wqflask/views.py | 14 ++++++-- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 wqflask/wqflask/templates/list_case_attribute_diffs_error.html diff --git a/wqflask/wqflask/templates/list_case_attribute_diffs.html b/wqflask/wqflask/templates/list_case_attribute_diffs.html index 391b8c99..6882a3fb 100644 --- a/wqflask/wqflask/templates/list_case_attribute_diffs.html +++ b/wqflask/wqflask/templates/list_case_attribute_diffs.html @@ -39,6 +39,33 @@ {%for diff in diffs%} + + + {{diff.editor}} + + + {{diff.time_stamp}} + + + {{diff.filename}} + + + + + Approve + + + + + Reject + + {%else%} diff --git a/wqflask/wqflask/templates/list_case_attribute_diffs_error.html b/wqflask/wqflask/templates/list_case_attribute_diffs_error.html new file mode 100644 index 00000000..6ca70984 --- /dev/null +++ b/wqflask/wqflask/templates/list_case_attribute_diffs_error.html @@ -0,0 +1,37 @@ +{%extends "base.html"%} +{%block title%}List Case Attribute Diffs{%endblock%} + +{%block css%} + + + + + +{%endblock%} + +{%block content%} +
+

List Diffs

+ + {{flash_me()}} + + {%set the_error = error.json()%} + +

+ + + {{error.status_code}}: {{the_error["error"]}} + {{the_error.error_description}} +

+{%endblock%} + +{%block js%} + +{%endblock%} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index bf9148c7..f1d5d71c 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -1232,5 +1232,15 @@ def edit_case_attributes(inbredset_id: int) -> Response: @app.route("/case-attribute//list-diffs", methods=["GET"]) def list_case_attribute_diffs(inbredset_id: int) -> Response: """List any diffs awaiting review.""" - return render_template( - "list_case_attribute_diffs.html", inbredset_id=inbredset_id, diffs=[]) + return monad_requests.get(urljoin( + current_app.config["GN_SERVER_URL"], + f"/api/case-attribute/{inbredset_id}/diff/list")).then( + lambda resp: resp.json()).either( + lambda err: render_template( + "list_case_attribute_diffs_error.html", + inbredset_id=inbredset_id, + error=err), + lambda diffs: render_template( + "list_case_attribute_diffs.html", + inbredset_id=inbredset_id, + diffs=diffs)) -- cgit v1.2.3