1
0

fix admin.js (3)

This commit is contained in:
Mike Schwörer 2020-01-20 21:19:55 +01:00
parent 469066590f
commit 39abc59567
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -94,6 +94,20 @@ function refreshConsistencyDisplaySequential(skip)
{ {
if (i++ !== skip) continue; if (i++ !== skip) continue;
refreshSingle(apibutton, () => setTimeout(() => refreshConsistencyDisplaySequential(skip+1), 10));
}
}
function refreshConsistencyDisplayParallel()
{
for (let apibutton of $('.selftest_parallel .consistence_ajax_handler').toArray())
{
refreshSingle(apibutton, () => {});
}
}
function refreshSingle(apibutton, then)
{
const filter = $(apibutton).data('filter'); const filter = $(apibutton).data('filter');
const outdiv = $($(apibutton).data('stid')); const outdiv = $($(apibutton).data('stid'));
@ -116,7 +130,7 @@ function refreshConsistencyDisplaySequential(skip)
//$(apibutton).attr('title', json.long); //$(apibutton).attr('title', json.long);
outdiv.text(json.long); outdiv.text(json.long);
setTimeout(() => refreshConsistencyDisplaySequential(skip+1), 10); then();
}) })
.fail((xhr, status, err) => .fail((xhr, status, err) =>
{ {
@ -130,49 +144,8 @@ function refreshConsistencyDisplaySequential(skip)
//$(apibutton).attr('title', json.long); //$(apibutton).attr('title', json.long);
outdiv.text(err); outdiv.text(err);
setTimeout(() => refreshConsistencyDisplaySequential(skip+1), 10); then();
}); });
}
}
function refreshConsistencyDisplayParallel()
{
for (let apibutton of $('.selftest_parallel .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).addClass('consistency_result_fin');
$(apibutton).text(json.message);
//$(apibutton).attr('title', json.long);
outdiv.text(json.long);
})
.fail((xhr, status, err) =>
{
$(apibutton).removeClass('consistency_result_intermed');
$(apibutton).removeClass('consistency_result_running');
$(apibutton).addClass('consistency_result_err');
$(apibutton).addClass('consistency_result_fin');
//$(apibutton).attr('title', json.long);
outdiv.text(err);
});
}
} }
$(function() $(function()