Sha256: 50b60a9c67d72aeb20570171d9c8cf520aae6019f0e3e3fcd082211f08c534ae
Contents?: true
Size: 1.64 KB
Versions: 4
Compression:
Stored size: 1.64 KB
Contents
window.CoalescingPanda or= {} window.CoalescingPanda.CanvasBatchProgress = class CanvasBatchProgress constructor: (successCallback, errorCallback) -> batch = $('#batch-progress').data('batch') url = $('#batch-progress').data('url') window.clearPath = $('#batch-progress').data('clear-path') if batch && batch.status != "Completed" || batch.status != "Error" window.batchInterval = setInterval(getBatchStatus, 3000, batch.id, url, successCallback, errorCallback) getBatchStatus = (id, url, successCallback, errorCallback) -> $.ajax url: url success: (data) -> $('#batch-progress').html(data) batch = $('#batch-info').data('batch') if batch.status == "Completed" clearIntervalAndBatch(data, batch) successCallback() if successCallback != undefined else if batch.status == 'Error' clearIntervalAndBatch(data, batch) errorCallback() if errorCallback != undefined error: (message) -> $('#batch-progress').html('Batch status request failed') clearInterval(window.batchInterval) clearBatchFromSession = (id) -> $.ajax url: window.clearPath type: 'POST' success: (data) -> delay 3000, -> $('#batch-progress').fadeOut(1000) $('#batch-progress').html("") $('#batch-progress').show() delay = (ms, func) -> setTimeout func, ms clearIntervalAndBatch = (data, batch) -> clearInterval(window.batchInterval) $('#batch-progress').html(data) clearBatchFromSession(batch.id) $ -> $("#batch-container").unbind().bind "batchStarted", (event, data) -> new CanvasBatchProgress()
Version data entries
4 entries across 4 versions & 1 rubygems