// Hide object text box var queueOriginEl = document.getElementById('ao-ccss-queue' ); if (queueOriginEl) { queueOriginEl.style.display = 'none'; // Get queue object and call table renderer jQuery(document).ready(function() { // Instance and parse queue object var aoCssQueueRaw = document.getElementById('ao-ccss-queue').value; var aoCssQueue = aoCssQueueRaw.indexOf('{"') === 0 ? JSON.parse(aoCssQueueRaw) : ""; var aoCssQueueLog = aoCssQueue === "" ? "empty" : aoCssQueue; // hook up "remove all jobs" button to the JS action. jQuery("#removeAllJobs").click(function(){removeAllJobs();}); // Render queue table drawQueueTable(aoCssQueue); // Make queue table sortable if there are any elements var queueBodyEl = jQuery('#queue > tr').length; if (queueBodyEl > 0) { jQuery('#queue-tbl').tablesorter({ sortList: [[0,0]], headers: {6: {sorter: false}} }); } }); } // Render the queue in a table function drawQueueTable(queue) { jQuery('#queue').empty(); rowNumber=0; jQuery.each(queue, function(path, keys) { // Prepare commom job values ljid = keys.ljid; targetArr = keys.rtarget.split('|' ); target = targetArr[1]; type = keys.ptype; ctime = EpochToDate(keys.jctime); rbtn = false; dbtn = false; hbtn = false; // Prepare job statuses if (keys.jqstat === 'NEW') { // Status: NEW (N, sort order 1) status = 'N'; statusClass = 'new'; title = 'New (' + ljid + ')'; buttons = 'None'; } else if (keys.jqstat === 'JOB_QUEUED' || keys.jqstat === 'JOB_ONGOING') { // Status: PENDING (P, sort order 2) status = 'P'; statusClass = 'pending'; title = 'PENDING (' + ljid + ')'; buttons = 'None'; } else if (keys.jqstat === 'JOB_DONE' && keys.jrstat === 'GOOD' && (keys.jvstat === 'WARN' || keys.jvstat === 'BAD')) { // Status: REVIEW (R, sort order 5) status = 'R'; statusClass = 'review'; title = "REVIEW (" + ljid + ")\nInfo from criticalcss.com:\n- Job ID: " + keys.jid + "\n- Status: " + keys.jqstat + "\n- Result: " + keys.jrstat + "\n- Validation: " + keys.jvstat; buttons = ''; dbtn = true; } else if (keys.jqstat === 'JOB_DONE') { // Status: DONE (D, sort order 6) status = 'D'; statusClass = 'done'; title = 'DONE (' + ljid + ')'; buttons = ''; dbtn = true; } else if (keys.jqstat === 'JOB_FAILED' || keys.jqstat === 'STATUS_JOB_BAD' || keys.jqstat === 'INVALID_JWT_TOKEN' || keys.jqstat === 'NO_CSS' || keys.jqstat === 'NO_RESPONSE') { // Status: ERROR (E, sort order 4) status = 'E'; statusClass = 'error'; title = "ERROR (" + ljid + ")\nInfo from criticalcss.com:\n- Job ID: " + keys.jid + "\n- Status: " + keys.jqstat + "\n- Result: " + keys.jrstat + "\n- Validation: " + keys.jvstat; buttons = ''; rbtn = true; dbtn = true; hbtn = true; } else { // Status: UNKNOWN (U, sort order 5) status = 'U'; statusClass = 'unknown'; title = "UNKNOWN (" + ljid + ")\nInfo from criticalcss.com:\n- Job ID: " + keys.jid + "\n- Status: " + keys.jqstat + "\n- Result: " + keys.jrstat + "\n- Validation: " + keys.jvstat; buttons = ''; dbtn = true; hbtn = true; } // Prepare job finish time if (keys.jftime === null) { ftime = 'N/A'; } else { ftime = EpochToDate(keys.jftime); } // Append job entry jQuery("#queue").append("" + status + "" + target.replace(/(woo_|template_|custom_post_|edd_|bp_|bbp_)/,'') + "" + path + "" + type.replace(/(woo_|template_|custom_post_|edd_|bp_|bbp_)/,'') + "" + ctime + "" + ftime + "" + buttons + ""); // Attach button actions if (rbtn) { jQuery('#' + ljid + '_retry').click(function(){retryJob(queue, this.id, path);}); } if (dbtn) { jQuery('#' + ljid + '_remove').click(function(){delJob(queue, this.id, path);}); } if (hbtn) { jQuery('#' + ljid + '_help').click(function(){jid=this.id.split('_' );window.open('https://criticalcss.com/faq?aoid=' + jid[0], '_blank' );}); } }); } // Delete a job from the queue function delJob(queue, jid, jpath) { jid = jid.split('_' ); jQuery('#queue-confirm-rm').dialog({ resizable: false, height: 180, modal: true, buttons: { "Delete": function() { delete queue[jpath]; updateQueue(queue); jQuery(this).dialog('close' ); }, "Cancel": function() { jQuery(this).dialog('close' ); } } }); } function removeAllJobs() { jQuery( "#queue-confirm-rm-all" ).dialog({ resizable: false, height:235, modal: true, buttons: { "Delete all jobs?": function() { queue=[]; updateQueue(queue); jQuery( this ).dialog( "close" ); }, "Cancel": function() { jQuery( this ).dialog( "close" ); } } }); } // Retry jobs with error function retryJob(queue, jid, jpath) { jid = jid.split('_' ); jQuery('#queue-confirm-retry').dialog({ resizable: false, height: 180, modal: true, buttons: { "Retry": function() { queue[jpath].jid = null; queue[jpath].jqstat = 'NEW'; queue[jpath].jrstat = null; queue[jpath].jvstat = null; queue[jpath].jctime = (new Date).getTime() / 1000; queue[jpath].jftime = null; updateQueue(queue); jQuery(this).dialog('close' ); }, "Cancel": function() { jQuery(this).dialog('close' ); } } }); } // Refresh queue function updateQueue(queue) { document.getElementById('ao-ccss-queue').value=JSON.stringify(queue); drawQueueTable(queue); jQuery('#unSavedWarning').show(); document.getElementById('ao_title_and_button').scrollIntoView(); } // Convert epoch to date for job times function EpochToDate(epoch) { if (epoch < 10000000000) epoch *= 1000; var epoch = epoch + (new Date().getTimezoneOffset() * -1); //for timeZone var sdate = new Date(epoch); var ldate = sdate.toLocaleString(); return ldate; } Swami Ayurvedic Store

Home

Featured Products

Get Maximum Discount
on Bulk Purchasing

Last chance to buy

Dhootpapeshwar Swamala

651.001,238.00
(0)

Dhootpapeshwar Shilapravang

652.00
(0)

Zandu Siddh Makardwaj

1,080.00
(0)

Dahnvantari Vasant Kusmakar Ras

684.001,620.00
(0)

SHIPPING WORLD WIDE

SUPPORT 10 AM TO 6 PM

ORDER PROTECTION