From da699133d6285e9f7696bfa0fb8f898227abd1e2 Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Thu, 3 Oct 2024 06:57:35 -0300 Subject: [PATCH] Apply enhacements to error handler page --- .../quarkus/runtime/TemplateHtmlBuilder.java | 114 +++++++++++++----- .../META-INF/template-html-builder.css | 65 +++++++++- 2 files changed, 145 insertions(+), 34 deletions(-) diff --git a/core/runtime/src/main/java/io/quarkus/runtime/TemplateHtmlBuilder.java b/core/runtime/src/main/java/io/quarkus/runtime/TemplateHtmlBuilder.java index 0a312ed871bd4..196a709a76e00 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/TemplateHtmlBuilder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/TemplateHtmlBuilder.java @@ -15,33 +15,82 @@ public class TemplateHtmlBuilder { private static String CSS = null; - private static final String SCRIPT_STACKTRACE_MANIPULATION = "\n"; + private static final String SCRIPT_STACKTRACE_MANIPULATION = """ + + """; + + private static final String UTILITIES = """ +
+

+ Change view mode + +

+

+ Copy stacktrace to clipboard + + + +

+
+ """; private static final String HTML_TEMPLATE_START_NO_STACK = "" + "\n" + @@ -60,7 +109,7 @@ public class TemplateHtmlBuilder { " \n" + SCRIPT_STACKTRACE_MANIPULATION + "\n" + - "\n" + + "\n" + "
\n" + " \n" + @@ -165,11 +214,11 @@ public class TemplateHtmlBuilder { private static final String OPEN_IDE_LINK = "
"; - private static final String ERROR_STACK = "
\n" + + private static final String ORIGINAL_STACK_TRACE = "
\n" + "

The stacktrace below is the original. " + - "See the stacktrace in reversed order (root-cause first)

" + "See the stacktrace in reversed order (root-cause first)" + - "
%1$s
\n" +
+            "        
%1$s
\n" + "
\n"; private static final String ERROR_STACK_REVERSED = "
\n" + @@ -308,7 +357,8 @@ public TemplateHtmlBuilder stack(final Throwable throwable, List knowCla rootFirst = rootFirst.replace(ERSTI, "
"); } - result.append(String.format(ERROR_STACK, original)); + result.append(UTILITIES); + result.append(String.format(ORIGINAL_STACK_TRACE, original)); result.append(String.format(ERROR_STACK_REVERSED, rootFirst)); result.append(STACKTRACE_DISPLAY_DIV); diff --git a/core/runtime/src/main/resources/META-INF/template-html-builder.css b/core/runtime/src/main/resources/META-INF/template-html-builder.css index 862efa60e5b2a..77a86dbc4f47d 100644 --- a/core/runtime/src/main/resources/META-INF/template-html-builder.css +++ b/core/runtime/src/main/resources/META-INF/template-html-builder.css @@ -123,8 +123,18 @@ h3 { font-size: 1.3em; line-height: 1.5; color: hsla(3, 89%, 42%, 1.0); - overflow-x: scroll; +} + +.wrap-code { + display: block; + white-space: initial; + word-wrap: break-word; + overflow-wrap: break-word; +} + +.scroll-code { display: block; + overflow-x: scroll; } .rel-stacktrace-item { @@ -252,4 +262,55 @@ a:hover { .configValue { border: 1px inset rgba(28,110,164,0.41); -} \ No newline at end of file +} + +.tooltip { + position: relative; + display: inline-block; +} + +.tooltip .tooltip-text { + visibility: hidden; + width: 120px; + background-color: #555; + color: #fff; + text-align: center; + padding: 10px; + border-radius: 6px; + position: absolute; + z-index: 1; +} + +.tooltip:hover .tooltip-text { + visibility: visible; + top: -10px; + left: 110%;; +} + +#utilities-container { + display: flex; + flex-direction: row; + width: 100%; + justify-content: end; + margin: 0; + gap: 12px; +} + +#utilities-container .clipboard { + display: flex; + flex-direction: row; + align-items: center; + justify-items: center; + gap: 4px; + color: #555; + cursor: pointer; +} + +#utilities-container svg { + width: 24px; + height: 24px; +} + + + +