2018-01-21 19:07:43 +01:00
|
|
|
function queryStatus(appendix, secret)
|
|
|
|
{
|
|
|
|
jQuery.ajax({
|
2019-12-28 22:42:25 +01:00
|
|
|
url: '/api/extendedgitgraph::status?secret='+secret,
|
2018-01-21 19:07:43 +01:00
|
|
|
success: function(result)
|
|
|
|
{
|
2019-12-28 23:52:19 +01:00
|
|
|
let ajaxOutput = $('#egg_ajaxOutput');
|
2018-01-21 19:07:43 +01:00
|
|
|
ajaxOutput.val(result + '\r\n' + appendix);
|
|
|
|
ajaxOutput.scrollTop(ajaxOutput[0].scrollHeight);
|
|
|
|
},
|
|
|
|
async: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function startAjaxRefresh(secret)
|
|
|
|
{
|
2019-12-28 22:42:25 +01:00
|
|
|
$('#egg_ajaxOutput').val("Started.");
|
2018-01-21 19:07:43 +01:00
|
|
|
val = setInterval(function(){ queryStatus('', secret); }, 500);
|
|
|
|
|
|
|
|
jQuery.ajax({
|
2019-12-28 22:42:25 +01:00
|
|
|
url: '/api/extendedgitgraph::refresh?secret='+secret,
|
2018-01-21 19:07:43 +01:00
|
|
|
success: function(result)
|
|
|
|
{
|
|
|
|
clearInterval(val);
|
|
|
|
queryStatus('Finished.', secret);
|
|
|
|
},
|
|
|
|
error: function( jqXHR, textStatus, errorThrown)
|
|
|
|
{
|
|
|
|
clearInterval(val);
|
|
|
|
queryStatus('AN ERROR OCCURED:' + '\r\n' + textStatus, secret);
|
|
|
|
},
|
|
|
|
async: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function startAjaxRedraw(secret)
|
|
|
|
{
|
2019-12-28 22:42:25 +01:00
|
|
|
$('#egg_ajaxOutput').val("Started.");
|
2018-01-21 19:07:43 +01:00
|
|
|
val = setInterval(function(){ queryStatus('', secret); }, 500);
|
|
|
|
|
|
|
|
jQuery.ajax({
|
2019-12-28 22:42:25 +01:00
|
|
|
url: '/api/extendedgitgraph::redraw?secret='+secret,
|
2018-01-21 19:07:43 +01:00
|
|
|
success: function(result)
|
|
|
|
{
|
|
|
|
clearInterval(val);
|
|
|
|
queryStatus('Finished.', secret);
|
|
|
|
},
|
|
|
|
error: function( jqXHR, textStatus, errorThrown)
|
|
|
|
{
|
|
|
|
clearInterval(val);
|
|
|
|
queryStatus('AN ERROR OCCURED:' + '\r\n' + textStatus, secret);
|
|
|
|
},
|
|
|
|
async: true
|
|
|
|
});
|
2018-01-27 00:28:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function startAjaxReplace(target, url)
|
|
|
|
{
|
|
|
|
$(target).html("Waiting ...");
|
|
|
|
jQuery.ajax({
|
|
|
|
url: url,
|
|
|
|
success: function(result)
|
|
|
|
{
|
|
|
|
$(target).html(result);
|
|
|
|
},
|
|
|
|
error: function( jqXHR, textStatus, errorThrown)
|
|
|
|
{
|
|
|
|
$(target).html('AN ERROR OCCURED:' + '<br/>' + textStatus);
|
|
|
|
},
|
|
|
|
async: true
|
|
|
|
});
|
2020-01-19 01:22:06 +01:00
|
|
|
}
|
|
|
|
|
2020-01-20 20:44:39 +01:00
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-01-20 19:02:31 +01:00
|
|
|
function refreshConsistencyDisplaySequential(skip)
|
2020-01-19 01:22:06 +01:00
|
|
|
{
|
|
|
|
let i = 0;
|
2020-01-20 20:44:39 +01:00
|
|
|
for (let apibutton of $('.selftest_sequential .consistence_ajax_handler').toArray())
|
2020-01-19 01:22:06 +01:00
|
|
|
{
|
|
|
|
if (i++ !== skip) continue;
|
|
|
|
|
2020-01-20 21:19:55 +01:00
|
|
|
refreshSingle(apibutton, () => setTimeout(() => refreshConsistencyDisplaySequential(skip+1), 10));
|
2020-01-19 01:22:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-20 20:44:39 +01:00
|
|
|
function refreshConsistencyDisplayParallel()
|
2020-01-20 19:02:31 +01:00
|
|
|
{
|
2020-01-20 20:44:39 +01:00
|
|
|
for (let apibutton of $('.selftest_parallel .consistence_ajax_handler').toArray())
|
2020-01-20 19:02:31 +01:00
|
|
|
{
|
2020-01-20 21:19:55 +01:00
|
|
|
refreshSingle(apibutton, () => {});
|
2020-01-20 19:02:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-20 21:19:55 +01:00
|
|
|
function refreshSingle(apibutton, then)
|
|
|
|
{
|
|
|
|
const filter = $(apibutton).data('filter');
|
|
|
|
const outdiv = $($(apibutton).data('stid'));
|
|
|
|
|
|
|
|
$(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);
|
|
|
|
$(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);
|
|
|
|
outdiv.text(json.long);
|
|
|
|
|
|
|
|
then();
|
|
|
|
})
|
|
|
|
.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).text(("" + err).substr(0, 48));
|
|
|
|
|
|
|
|
//$(apibutton).attr('title', json.long);
|
|
|
|
outdiv.text(err);
|
|
|
|
|
|
|
|
then();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-01-19 01:22:06 +01:00
|
|
|
$(function()
|
|
|
|
{
|
2020-01-20 20:44:39 +01:00
|
|
|
for (let apibutton of $('.selftest_sequential').toArray()) setTimeout(() => refreshConsistencyDisplaySequential(0), 200);
|
|
|
|
for (let apibutton of $('.selftest_parallel').toArray()) setTimeout(() => refreshConsistencyDisplayParallel(), 200);
|
2020-01-19 01:22:06 +01:00
|
|
|
});
|