show long error message in selftest admin panel
This commit is contained in:
parent
96494c9f55
commit
cf6c496b34
@ -115,6 +115,10 @@ body {
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
.generic_nodisplay {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.boxedcontent {
|
||||
color: #333333;
|
||||
border: 1px solid #444444;
|
||||
@ -853,12 +857,32 @@ html, body {
|
||||
min-width: 300px;
|
||||
}
|
||||
|
||||
.selftest_parent {
|
||||
width: 800px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.selftest_outputchild {
|
||||
border: 1px solid #888;
|
||||
background: #F8F8F8;
|
||||
color: #000000;
|
||||
font-family: Consolas, Monaco, "Courier New", Menlo, monospace;
|
||||
white-space: pre;
|
||||
max-height: 600px;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.consistency_result_fin {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.consistency_result {
|
||||
width: 500px;
|
||||
color: #222222;
|
||||
border: 1px solid #888;
|
||||
padding: 0 5px;
|
||||
margin: 1px 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.consistency_result:after {
|
||||
|
6
www/data/css/styles.min.css
vendored
6
www/data/css/styles.min.css
vendored
@ -18,6 +18,7 @@
|
||||
.blockcontent{display:block;width:100%}
|
||||
.generic_hidden{visibility:hidden !important}
|
||||
.generic_collapsed{visibility:collapse !important;display:none !important;width:0 !important;height:0 !important}
|
||||
.generic_nodisplay{display:none !important}
|
||||
.boxedcontent{color:#333;border:1px solid #444;background:#e0e0e0;width:100%;margin-left:auto;margin-right:auto}
|
||||
.boxedcontent .bc_header{background-color:#bbb;color:#222;padding:0 4px}
|
||||
.boxedcontent .bc_data{padding:8px}
|
||||
@ -167,7 +168,10 @@ html,body{margin:0;padding:0;height:100%}
|
||||
.kvl_100 div span:first-child{min-width:100px}
|
||||
.kvl_200 div span:first-child{min-width:200px}
|
||||
.kvl_300 div span:first-child{min-width:300px}
|
||||
.consistency_result{width:500px;color:#222;border:1px solid #888;padding:0 5px;margin:1px 0}
|
||||
.selftest_parent{width:800px;max-width:100%}
|
||||
.selftest_outputchild{border:1px solid #888;background:#f8f8f8;color:#000;font-family:Consolas,Monaco,"Courier New",Menlo,monospace;white-space:pre;max-height:600px;overflow-x:auto;overflow-y:auto}
|
||||
.consistency_result_fin{cursor:pointer}
|
||||
.consistency_result{color:#222;border:1px solid #888;padding:0 5px;margin:1px 0;flex-grow:1}
|
||||
.consistency_result:after{content:" "}
|
||||
.consistency_result_ok{background:#0f0}
|
||||
.consistency_result_warn{background:#ff0}
|
||||
|
@ -41,12 +41,32 @@
|
||||
.kvl_200 div span:first-child { min-width: 200px; }
|
||||
.kvl_300 div span:first-child { min-width: 300px; }
|
||||
|
||||
.selftest_parent {
|
||||
width: 800px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.selftest_outputchild {
|
||||
border: $COL_ADMIN_STATUS_BORDER;
|
||||
background: $LAYER2_CODE_BG;
|
||||
color: $LAYER2_CODE_FG;
|
||||
font-family: $FONT_CODE;
|
||||
white-space: pre;
|
||||
max-height: 600px;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.consistency_result_fin {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.consistency_result {
|
||||
width: 500px;
|
||||
color: $COL_ADMIN_STATUS_FG;
|
||||
border: $COL_ADMIN_STATUS_BORDER;
|
||||
padding: 0 5px;
|
||||
margin: 1px 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.consistency_result:after { content: '\00a0' }
|
||||
|
@ -85,6 +85,10 @@ body {
|
||||
height:0 !important;
|
||||
}
|
||||
|
||||
.generic_nodisplay {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.boxedcontent {
|
||||
color: $LAYER1_FG;
|
||||
border: $LAYER1_BORDER;
|
||||
|
@ -71,14 +71,31 @@ function startAjaxReplace(target, url)
|
||||
});
|
||||
}
|
||||
|
||||
function showSelfTestOutput(id1, id2)
|
||||
{
|
||||
if (!$(id1).hasClass('consistency_result_fin')) return;
|
||||
|
||||
if ($(id2).hasClass('generic_nodisplay'))
|
||||
{
|
||||
$('.selftest_outputchild').addClass('generic_nodisplay');
|
||||
$(id2).removeClass('generic_nodisplay');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.selftest_outputchild').addClass('generic_nodisplay');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function refreshConsistencyDisplaySequential(skip)
|
||||
{
|
||||
let i = 0;
|
||||
for (let apibutton of $('.consistence_ajax_handler').toArray())
|
||||
for (let apibutton of $('.selftest_sequential .consistence_ajax_handler').toArray())
|
||||
{
|
||||
if (i++ !== skip) continue;
|
||||
|
||||
const filter = $(apibutton).data('filter');
|
||||
const outdiv = $($(apibutton).data('stid'));
|
||||
|
||||
$(apibutton).removeClass('consistency_result_intermed');
|
||||
$(apibutton).addClass('consistency_result_running');
|
||||
@ -89,15 +106,17 @@ function refreshConsistencyDisplaySequential(skip)
|
||||
let json = JSON.parse(data);
|
||||
$(apibutton).removeClass('consistency_result_intermed');
|
||||
$(apibutton).removeClass('consistency_result_running');
|
||||
$(apibutton).addClass('consistency_result_fin');
|
||||
|
||||
if (json.result === 0) $(apibutton).addClass('consistency_result_ok');
|
||||
if (json.result === 1) $(apibutton).addClass('consistency_result_warn');
|
||||
if (json.result === 2) $(apibutton).addClass('consistency_result_err');
|
||||
|
||||
$(apibutton).text(json.message);
|
||||
$(apibutton).attr('title', json.long);
|
||||
//$(apibutton).attr('title', json.long);
|
||||
outdiv.text(json.long);
|
||||
|
||||
setTimeout(() => refreshConsistencyDisplay(skip+1), 10);
|
||||
setTimeout(() => refreshConsistencyDisplaySequential(skip+1), 10);
|
||||
})
|
||||
.fail((xhr, status, err) =>
|
||||
{
|
||||
@ -105,17 +124,21 @@ function refreshConsistencyDisplaySequential(skip)
|
||||
$(apibutton).removeClass('consistency_result_running');
|
||||
|
||||
$(apibutton).addClass('consistency_result_err');
|
||||
$(apibutton).text(err);
|
||||
$(apibutton).addClass('consistency_result_fin');
|
||||
$(apibutton).text(("" + err).substr(0, 48));
|
||||
|
||||
setTimeout(() => refreshConsistencyDisplay(skip+1), 10);
|
||||
//$(apibutton).attr('title', json.long);
|
||||
outdiv.text(err);
|
||||
|
||||
setTimeout(() => refreshConsistencyDisplaySequential(skip+1), 10);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function refreshConsistencyDisplayParallel(skip)
|
||||
function refreshConsistencyDisplayParallel()
|
||||
{
|
||||
for (let apibutton of $('.consistence_ajax_handler').toArray())
|
||||
for (let apibutton of $('.selftest_parallel .consistence_ajax_handler').toArray())
|
||||
{
|
||||
const filter = $(apibutton).data('filter');
|
||||
|
||||
@ -149,6 +172,6 @@ function refreshConsistencyDisplayParallel(skip)
|
||||
|
||||
$(function()
|
||||
{
|
||||
//setTimeout(() => refreshConsistencyDisplaySequential(0), 200);
|
||||
setTimeout(() => refreshConsistencyDisplayParallel(), 200);
|
||||
for (let apibutton of $('.selftest_sequential').toArray()) setTimeout(() => refreshConsistencyDisplaySequential(0), 200);
|
||||
for (let apibutton of $('.selftest_parallel').toArray()) setTimeout(() => refreshConsistencyDisplayParallel(), 200);
|
||||
});
|
@ -259,17 +259,21 @@ class SelfTest implements IWebsiteModule
|
||||
|
||||
$message = '';
|
||||
$count = 0;
|
||||
$i = 0;
|
||||
foreach ($supdata as $d)
|
||||
{
|
||||
$i++;
|
||||
$sxname = $xname . '-' . $i;
|
||||
|
||||
$url = 'https://' . $_SERVER['HTTP_HOST'] . str_replace('{0}', $d, $path);
|
||||
$r = curl_http_request($url);
|
||||
$count++;
|
||||
if ($r['statuscode'] === $status) { $message .= "{".$xname."} succeeded" . "\n"; continue; }
|
||||
if ($r['statuscode'] === $status) { $message .= " {".$sxname."} succeeded" . "\n"; continue; }
|
||||
|
||||
return
|
||||
[
|
||||
'result' => self::STATUS_ERROR,
|
||||
'message' => '{'.$xname.'} failed: Request returned wrong statuscode',
|
||||
'message' => '{'.$sxname.'} failed: Request returned wrong statuscode',
|
||||
'long' => 'Wrong HTTP Statuscode (Expected: ['.$status.']; Found: ['.$r['statuscode'].'])' . "\n".
|
||||
"URL: $url\n".
|
||||
"Redirect: " . $r['redirect'] . "\n" .
|
||||
@ -282,7 +286,7 @@ class SelfTest implements IWebsiteModule
|
||||
return
|
||||
[
|
||||
'result' => self::STATUS_OK,
|
||||
'message' => "$count requests succeeded\n" . rtrim($message, "\n"),
|
||||
'message' => "$count requests succeeded\n" . trim($message, "\n"),
|
||||
'long' => null,
|
||||
'exception' => null,
|
||||
];
|
||||
|
@ -245,7 +245,6 @@ function formatException($e)
|
||||
$xdbg = str_replace('<br>', "\n", $xdbg);
|
||||
$xdbg = str_replace('><', "> <", $xdbg);
|
||||
$xdbg = strip_tags($xdbg);
|
||||
$xdbg = htmlspecialchars($xdbg);
|
||||
$r .= $xdbg . "\n";
|
||||
}
|
||||
return $r;
|
||||
|
@ -11,8 +11,8 @@ $FRAME_OPTIONS->title = 'Admin';
|
||||
$FRAME_OPTIONS->canonical_url = 'https://www.mikescher.com/admin';
|
||||
$FRAME_OPTIONS->activeHeader = 'admin';
|
||||
|
||||
$FRAME_OPTIONS->addScript('https://code.jquery.com/jquery-latest.min.js', true);
|
||||
$FRAME_OPTIONS->addScript('/data/javascript/admin.js', true);
|
||||
$FRAME_OPTIONS->addScript('https://code.jquery.com/jquery-latest.min.js', false);
|
||||
$FRAME_OPTIONS->addScript('/data/javascript/admin.js', false);
|
||||
|
||||
|
||||
$connected = true; try { $SITE->modules->Database(); } catch (Exception $e) { $connected = false; }
|
||||
@ -54,9 +54,13 @@ $connected = true; try { $SITE->modules->Database(); } catch (Exception $e) { $c
|
||||
<div class="bc_header">Self test</div>
|
||||
|
||||
<div class="bc_data">
|
||||
<div class="keyvaluelist kvl_200">
|
||||
<?php foreach ($SITE->modules->SelfTest()->listMethodGroups() as $group): ?>
|
||||
<div><span><?php echo $group['name']; ?></span><span class='consistency_result consistency_result_intermed consistence_ajax_handler' data-filter="<?php echo $group['filter']; ?>"> </span></div>
|
||||
<div class="keyvaluelist kvl_200 selftest_parent <?php echo $SITE->isProd() ? 'selftest_parallel' : 'selftest_sequential' ?>">
|
||||
<?php $stid=1000; foreach ($SITE->modules->SelfTest()->listMethodGroups() as $group): $stid++; ?>
|
||||
<div class="selftest_tabchild" onclick="showSelfTestOutput('#selftest_tab_<?php echo $stid; ?>', '#selftest_out_<?php echo $stid; ?>')">
|
||||
<span><?php echo $group['name']; ?></span>
|
||||
<span class='consistency_result consistency_result_intermed consistence_ajax_handler' id="selftest_tab_<?php echo $stid; ?>" data-filter="<?php echo $group['filter']; ?>" data-stid="#selftest_out_<?php echo $stid; ?>"></span>
|
||||
</div>
|
||||
<div class="selftest_outputchild generic_nodisplay" id="selftest_out_<?php echo $stid; ?>"> </div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<br/>
|
||||
|
@ -22,6 +22,6 @@ $debuginfo = $ROUTE->parameter['debuginfo'];
|
||||
<div class="ev_code">500</div>
|
||||
<div class="ev_msg"><?php echo $message; ?></div>
|
||||
<?php if ($debuginfo !== null && strlen($debuginfo)>0 && ($SITE != null && !$SITE->isProd())): ?>
|
||||
<p class="ev_statusmore"><?php echo nl2br($debuginfo); ?></p>
|
||||
<p class="ev_statusmore"><?php echo nl2br(htmlspecialchars($debuginfo)); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user