Sha256: 2050c3ae780e2372b1bbd4ecb52ce24affffb6a2e151340a2fba428e442de3b9
Contents?: true
Size: 1.8 KB
Versions: 82
Compression:
Stored size: 1.8 KB
Contents
window.CoalescingPanda or= {} window.CoalescingPanda.CanvasBatchProgress = class CanvasBatchProgress constructor: (successCallback, errorCallback, messages) -> window.messages = messages if messages != undefined setFlashMessages() 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) setFlashMessages() batch = $('#batch-info').data('batch') if batch && batch.status == "Completed" clearIntervalAndBatch(data, batch) successCallback() if successCallback != undefined else if batch && batch.status == 'Error' clearIntervalAndBatch(data, batch) errorCallback() if errorCallback != undefined else if batch && batch.status == "Canceled" clearIntervalAndBatch(data, batch) error: (message) -> $('#batch-progress').html('Batch status request failed') clearInterval(window.batchInterval) clearBatchFromSession = (id) -> $.ajax url: window.clearPath type: 'POST' success: (data) -> # Don't need to do anything clearIntervalAndBatch = (data, batch) -> clearInterval(window.batchInterval) $('#batch-progress').html(data) setFlashMessages() clearBatchFromSession(batch.id) setFlashMessages = -> if window.messages != undefined for key of window.messages $(".batch-message-#{key}").text("#{window.messages[key]}")
Version data entries
82 entries across 82 versions & 1 rubygems