1
0

adminpanel: run all selftests in parallel

This commit is contained in:
Mike Schwörer 2020-01-20 19:02:31 +01:00
parent e529b2dca3
commit 0adad66b6e
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 38 additions and 3 deletions

View File

@ -71,7 +71,7 @@ function startAjaxReplace(target, url)
}); });
} }
function refreshConsistencyDisplay(skip) function refreshConsistencyDisplaySequential(skip)
{ {
let i = 0; let i = 0;
for (let apibutton of $('.consistence_ajax_handler').toArray()) for (let apibutton of $('.consistence_ajax_handler').toArray())
@ -113,7 +113,42 @@ function refreshConsistencyDisplay(skip)
} }
} }
function refreshConsistencyDisplayParallel(skip)
{
for (let apibutton of $('.consistence_ajax_handler').toArray())
{
const filter = $(apibutton).data('filter');
$(apibutton).removeClass('consistency_result_intermed');
$(apibutton).addClass('consistency_result_running');
$.ajax('/api/site::selftest?filter=' + filter)
.done((data, status, xhr) =>
{
let json = JSON.parse(data);
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).removeClass('consistency_result_running');
$(apibutton).text(json.message);
$(apibutton).attr('title', json.long);
})
.fail((xhr, status, err) =>
{
$(apibutton).removeClass('consistency_result_intermed');
$(apibutton).removeClass('consistency_result_running');
$(apibutton).addClass('consistency_result_err');
$(apibutton).text(err);
});
}
}
$(function() $(function()
{ {
setTimeout(() => refreshConsistencyDisplay(0), 200); //setTimeout(() => refreshConsistencyDisplaySequential(0), 200);
setTimeout(() => refreshConsistencyDisplayParallel(), 200);
}); });

View File

@ -278,7 +278,7 @@ class SelfTest implements IWebsiteModule
return return
[ [
'result' => self::STATUS_OK, 'result' => self::STATUS_OK,
'message' => "$count requests succeeded\n" . $message, 'message' => "$count requests succeeded\n" . rtrim($message, "\n"),
'long' => null, 'long' => null,
'exception' => null, 'exception' => null,
]; ];