From: Tim Düsterhus Date: Tue, 23 Jun 2020 14:18:11 +0000 (+0200) Subject: Collapse duplicated exceptions on ExceptionLogViewPage X-Git-Tag: 5.3.0_Alpha_1~191^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f9ec45efdeb13bd5be47d36830e1496ff10bbaf0;p=GitHub%2FWoltLab%2FWCF.git Collapse duplicated exceptions on ExceptionLogViewPage Closes #3044 --- diff --git a/wcfsetup/install/files/acp/style/layout.scss b/wcfsetup/install/files/acp/style/layout.scss index b0ced58e06..704b3e7368 100644 --- a/wcfsetup/install/files/acp/style/layout.scss +++ b/wcfsetup/install/files/acp/style/layout.scss @@ -523,3 +523,9 @@ $wcfAcpSubMenuWidth: 300px; @include wcfFontHeadline; } + +.exceptionContainer { + &.collapsed .exceptionDetails { + display: none; + } +} diff --git a/wcfsetup/install/files/acp/templates/exceptionLogView.tpl b/wcfsetup/install/files/acp/templates/exceptionLogView.tpl index a52593dea8..7a26735b76 100644 --- a/wcfsetup/install/files/acp/templates/exceptionLogView.tpl +++ b/wcfsetup/install/files/acp/templates/exceptionLogView.tpl @@ -15,6 +15,20 @@ $('.jsCopyException').click(function () { $(this).select(); }); + + elBySelAll('.exceptionContainer', undefined, function (container) { + var button = elBySel('.collapsibleButton', container); + button.addEventListener('click', function (event) { + if (container.classList.toggle('collapsed')) { + button.classList.add('fa-chevron-right'); + button.classList.remove('fa-chevron-down'); + } + else { + button.classList.remove('fa-chevron-right'); + button.classList.add('fa-chevron-down'); + } + }); + }) }); @@ -74,66 +88,71 @@ {if !$logFiles|empty} {if $logFile} {foreach from=$exceptions item='exception' key='exceptionKey'} -
-

{$exception[message]}

- -
-
{lang}wcf.acp.exceptionLog.exception.date{/lang}
-
{$exception[date]|plainTime}
-
+
+

+ + {$exception[message]} +

-
-
{lang}wcf.acp.exceptionLog.exception.requestURI{/lang}
-
{$exception[requestURI]}
-
-
-
{lang}wcf.acp.exceptionLog.exception.referrer{/lang}
-
{$exception[referrer]}
-
-
-
{lang}wcf.acp.exceptionLog.exception.userAgent{/lang}
-
{$exception[userAgent]}
-
-
-
{lang}wcf.acp.exceptionLog.exception.memory{/lang}
-
{$exception[peakMemory]|filesizeBinary} / {if $exception[maxMemory] == -1}∞{else}{$exception[maxMemory]|filesizeBinary}{/if}
-
- {foreach from=$exception[chain] item=chain} -
-
{lang}wcf.acp.exceptionLog.exception.message{/lang}
-
{$chain[message]}
-
-
-
{lang}wcf.acp.exceptionLog.exception.class{/lang}
-
{$chain[class]}
-
-
-
{lang}wcf.acp.exceptionLog.exception.file{/lang}
-
{$chain[file]} ({$chain[line]})
-
- {if !$chain[information]|empty} - {foreach from=$chain[information] item=extraInformation} -
-
{$extraInformation[0]}
-
{$extraInformation[1]}
-
+
+
+
{lang}wcf.acp.exceptionLog.exception.date{/lang}
+
{$exception[date]|plainTime}
+
+ +
+
{lang}wcf.acp.exceptionLog.exception.requestURI{/lang}
+
{$exception[requestURI]}
+
+
+
{lang}wcf.acp.exceptionLog.exception.referrer{/lang}
+
{$exception[referrer]}
+
+
+
{lang}wcf.acp.exceptionLog.exception.userAgent{/lang}
+
{$exception[userAgent]}
+
+
+
{lang}wcf.acp.exceptionLog.exception.memory{/lang}
+
{$exception[peakMemory]|filesizeBinary} / {if $exception[maxMemory] == -1}∞{else}{$exception[maxMemory]|filesizeBinary}{/if}
+
+ {foreach from=$exception[chain] item=chain} +
+
{lang}wcf.acp.exceptionLog.exception.message{/lang}
+
{$chain[message]}
+
+
+
{lang}wcf.acp.exceptionLog.exception.class{/lang}
+
{$chain[class]}
+
+
+
{lang}wcf.acp.exceptionLog.exception.file{/lang}
+
{$chain[file]} ({$chain[line]})
+
+ {if !$chain[information]|empty} + {foreach from=$chain[information] item=extraInformation} +
+
{$extraInformation[0]}
+
{$extraInformation[1]}
+
+ {/foreach} + {/if} +
+
{lang}wcf.acp.exceptionLog.exception.stacktrace{/lang}
+
+
    + {foreach from=$chain[stack] item=stack} +
  1. {$stack[file]} ({$stack[line]}): {$stack[class]}{$stack[type]}{$stack[function]}(…)
  2. + {/foreach} +
+
+
{/foreach} - {/if} -
-
{lang}wcf.acp.exceptionLog.exception.stacktrace{/lang}
-
-
    - {foreach from=$chain[stack] item=stack} -
  1. {$stack[file]} ({$stack[line]}): {$stack[class]}{$stack[type]}{$stack[function]}(…)
  2. - {/foreach} -
-
-
- {/foreach} -
-
-
-
+
+
+
+
+
{/foreach} diff --git a/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php b/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php index a6e8447a08..38ce4eb580 100644 --- a/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php @@ -141,15 +141,22 @@ class ExceptionLogViewPage extends MultipleLinkPage { $this->calculateNumberOfPages(); $i = 0; - + $seenHashes = []; foreach ($this->exceptions as $key => $val) { $i++; + + $parsed = ExceptionLogUtil::parseException($val); + if (isset($seenHashes[$parsed['stackHash']])) { + $parsed['collapsed'] = true; + } + $seenHashes[$parsed['stackHash']] = true; + if ($i < $this->startIndex || $i > $this->endIndex) { unset($this->exceptions[$key]); continue; } try { - $this->exceptions[$key] = ExceptionLogUtil::parseException($val); + $this->exceptions[$key] = $parsed; } catch (\InvalidArgumentException $e) { unset($this->exceptions[$key]);