From d22df7fd3cdf9ec24d121dd6eeb6191b1b83d0c0 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Thu, 16 Nov 2023 22:36:04 +0100 Subject: [PATCH] Show/hide stack frames --- events/templates/events/event_detail.html | 56 +++++++++++++---------- static/js/issue.js | 13 ++++++ theme/static/css/dist/styles.css | 8 ++++ theme/templates/base.html | 6 ++- 4 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 static/js/issue.js diff --git a/events/templates/events/event_detail.html b/events/templates/events/event_detail.html index caa5ece..fde92f9 100644 --- a/events/templates/events/event_detail.html +++ b/events/templates/events/event_detail.html @@ -1,4 +1,5 @@ {% extends "events/base.html" %} +{% load static %} {% block content %}
@@ -24,46 +25,47 @@ {#
Stacktrace:
I think this is obvious?#} {% for exception in exceptions %} {# option: make multi-exception stacktraces more clear
}#} -

{{ exception.type }}

{# potentially: hide this whole block if there is only a single exception #} -
{{ exception.value }}
+

{{ exception.type }}

{# potentially: hide this whole block if there is only a single exception #} +
{{ exception.value }}
{% for frame in exception.stacktrace.frames %} -
+
-
+
+ {{ frame.filename }} in {{ frame.function }} line {{ frame.lineno }}. +
-
-
- {{ frame.filename }} in {{ frame.function }} line {{ frame.lineno }}. +
-
- - {% for var, value in frame.vars.items %} -
-
{{ var }}
-
{{ value }}
-
- {% endfor %} - -
- -
{% endfor %} {#
#} {# per-exception div in the multi-exception case #} {% if not forloop.last %} -
During handling of the above exception, another exception occurred:
+
During handling of the above exception, another exception occurred:
{# note: the above is specific to Python. In Python there's also "The above exception was the direct cause of the following exception:" (raise ... from) but we cannot distinguish those at this level because the info is lost #} {% endif %} @@ -129,3 +131,7 @@ Issue grouper: "{{ issue_grouper }}"Event 55 out of 55 which occured at {{ event.timestamp }} (most recent)
{# the border #} {% endblock %} + +{% block extra_js %} + +{% endblock %} diff --git a/static/js/issue.js b/static/js/issue.js new file mode 100644 index 0000000..bdd398c --- /dev/null +++ b/static/js/issue.js @@ -0,0 +1,13 @@ +"use strict"; + +function toggleFrameVisibility(frameHeader) { + const frameDetails = frameHeader.parentNode.querySelector(".js-frame-details"); + console.log("FD", frameDetails); + if (frameDetails.classList.contains("hidden")) { + frameDetails.classList.remove("hidden"); + frameDetails.classList.add("xl:flex"); // add back + } else { + frameDetails.classList.add("hidden"); + frameDetails.classList.remove("xl:flex"); // this appears to be necessary, not sure why + } +} diff --git a/theme/static/css/dist/styles.css b/theme/static/css/dist/styles.css index b261a0f..4972f12 100644 --- a/theme/static/css/dist/styles.css +++ b/theme/static/css/dist/styles.css @@ -755,6 +755,10 @@ select { visibility: visible; } +.invisible { + visibility: hidden; +} + .collapse { visibility: collapse; } @@ -940,6 +944,10 @@ select { border-left-width: 4px; } +.border-t-2 { + border-top-width: 2px; +} + .border-slate-300 { --tw-border-opacity: 1; border-color: rgb(203 213 225 / var(--tw-border-opacity)); diff --git a/theme/templates/base.html b/theme/templates/base.html index 7a9a3f9..9ab6b27 100644 --- a/theme/templates/base.html +++ b/theme/templates/base.html @@ -1,10 +1,10 @@ -{% load static tailwind_tags %} - +{% load static tailwind_tags %} {% block title %}Bugsink{% endblock %} + {% tailwind_css %} @@ -17,5 +17,7 @@
{% block content %}{% endblock %}
+ + {% block extra_js %}{% endblock %}