All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.xxl-job-admin.static.js.joblog.detail.1.js Maven / Gradle / Ivy

The newest version!
$(function() {

    // trigger fail, end
    if ( !(triggerCode == 200 || handleCode != 0) ) {
        $('#logConsoleRunning').hide();
        $('#logConsole').append(''+ I18n.joblog_rolling_log_triggerfail +'');
        return;
    }

    // pull log
    var fromLineNum = 1;    // [from, to], start as 1
    var pullFailCount = 0;
    function pullLog() {
        // pullFailCount, max=20
        if (pullFailCount++ > 20) {
            logRunStop(''+ I18n.joblog_rolling_log_failoften +'');
            return;
        }

        // load
        console.log("pullLog, fromLineNum:" + fromLineNum);

        $.ajax({
            type : 'POST',
            async: false,   // sync, make log ordered
            url : base_url + '/joblog/logDetailCat',
            data : {
                "executorAddress":executorAddress,
                "triggerTime":triggerTime,
                "logId":logId,
                "fromLineNum":fromLineNum
            },
            dataType : "json",
            success : function(data){

                if (data.code == 200) {
                    if (!data.content) {
                        console.log('pullLog fail');
                        return;
                    }
                    if (fromLineNum != data.content.fromLineNum) {
                        console.log('pullLog fromLineNum not match');
                        return;
                    }
                    if (fromLineNum > data.content.toLineNum ) {
                        console.log('pullLog already line-end');

                        // valid end
                        if (data.content.end) {
                            logRunStop('
[Rolling Log Finish]'); return; } return; } // append content fromLineNum = data.content.toLineNum + 1; $('#logConsole').append(data.content.logContent); pullFailCount = 0; // scroll to bottom scrollTo(0, document.body.scrollHeight); // $('#logConsolePre').scrollTop( document.body.scrollHeight + 300 ); } else { console.log('pullLog fail:'+data.msg); } } }); } // pull first page pullLog(); // handler already callback, end if (handleCode > 0) { logRunStop('
[Load Log Finish]'); return; } // round until end var logRun = setInterval(function () { pullLog() }, 3000); function logRunStop(content){ $('#logConsoleRunning').hide(); logRun = window.clearInterval(logRun); $('#logConsole').append(content); } });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy