From bcc449eb3419738130a720bcf870f5a9c0ce8a4d Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 24 Mar 2025 10:19:43 +0000 Subject: [PATCH] tidy up some cimar stuff --- anatomy/static/js/anatomy.js | 11 ++++++- atlas/templates/atlas/case_display_block.html | 1 - templates/base.html | 7 ++++ templates/cimar_login.html | 32 +++++++++++++------ 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/anatomy/static/js/anatomy.js b/anatomy/static/js/anatomy.js index 6a044b79..c92ef75e 100644 --- a/anatomy/static/js/anatomy.js +++ b/anatomy/static/js/anatomy.js @@ -13,8 +13,17 @@ window.control_pressed = false; $(document).ready(function () { document.body.addEventListener("htmx:responseError", function(e) { - let error = e.detail.xhr.response; let el = document.getElementById("htmx-error"); + var error; + if (e.detail.pathInfo.requestPath.includes("cimar") && e.detail.xhr.status == 403) { + error = "Cimar permission error, please login and refresh the page."; + //document.getElementById("cimar-login-form").focus(); + htmx.trigger("#cimar-login-needed", "cimar-login-needed"); + + + } else { + error = e.detail.xhr.response; + } el.innerHTML = error; el.classList.remove("hidden"); }); diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index ed767142..da0c9950 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -24,7 +24,6 @@ {% if case.cimar_uuid %}
Details -
Case uuid: {{case.cimar_uuid}}
diff --git a/templates/base.html b/templates/base.html index 86190d63..32956f8d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -161,6 +161,13 @@
+ + + {% block content %} {% endblock %}
diff --git a/templates/cimar_login.html b/templates/cimar_login.html index fb4dabd0..27d70f52 100644 --- a/templates/cimar_login.html +++ b/templates/cimar_login.html @@ -1,14 +1,9 @@ {% extends 'base.html' %} +{% load partials %} -{% block content %} -
- - -

CIMAR login

-Login status: {{ login_status }} ({{cimar_sid}})
- +{% partialdef login-block %} Logging in here allows your account to be linked with CIMAR. You may periodically need to re-login to keep the link active. -
+ Username:
Password:
- +{% endpartialdef %} + + +{% block content %} +
+ + +

CIMAR login

+Login status: {{ login_status }} ({{cimar_sid}}) + +{% if login_status %} + +{% endif %} +
+ +{% partial login-block %}
{% endblock %} \ No newline at end of file