coalescing_panda 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f18d398d32a7166699f5cafcebca6ccbb35d0ca
4
- data.tar.gz: 94285d0a4e50341365467f98418d5131b4a594fb
3
+ metadata.gz: 99ae7fd46a00f12688336f1d8013bc68d6ed58fd
4
+ data.tar.gz: 7cff2c9b34463d0dc575a4703c7fba4e95792415
5
5
  SHA512:
6
- metadata.gz: 067319e46cb04d23ec3733bd7094896276036381b50f0a7344c570da66ff750d3edd1d7e8cf2aed6310838a8a3dcfd36e9f6aa8921e9f4eb703cf74256a4890b
7
- data.tar.gz: 95fbed62454dea53465765c965558088381fc16aeb24b9f42cc08ee7512065c7ec70dfbe16b77ac99324d1445c7f3dc1c2eaf73889368cc330e7800a92bfa544
6
+ metadata.gz: 67ce91be318eb336ec0a1da1402e0f27c064ff221f5b2a6d45d4b8ec2aa8cb2afc8516c3207088813e634f0378adfd93dba2dbd672b1be577b471359c8816fbf
7
+ data.tar.gz: 3534590ee35db4ee8deed87d9ac95a06b36d9cb3148eec8ea0d9584397ae09d50835c5cb86422260e4b652790f465b9bccced8bf65f5825eb0b180ffe9301019
@@ -1,22 +1,25 @@
1
- class CanvasBatchProgress
2
- constructor: ->
1
+ window.CoalescingPanda or= {}
2
+
3
+ window.CoalescingPanda.CanvasBatchProgress = class CanvasBatchProgress
4
+ constructor: (successCallback, errorCallback) ->
3
5
  batch = $('#batch-progress').data('batch')
4
6
  url = $('#batch-progress').data('url')
5
7
  window.clearPath = $('#batch-progress').data('clear-path')
6
8
  if batch && batch.status != "Completed" || batch.status != "Error"
7
- window.batchInterval = setInterval(getBatchStatus, 3000, batch.id, url)
9
+ window.batchInterval = setInterval(getBatchStatus, 3000, batch.id, url, successCallback, errorCallback)
8
10
 
9
- getBatchStatus = (id, url) ->
11
+ getBatchStatus = (id, url, successCallback, errorCallback) ->
10
12
  $.ajax
11
13
  url: url
12
14
  success: (data) ->
13
15
  $('#batch-progress').html(data)
14
16
  batch = $('#batch-info').data('batch')
15
- if batch.status == "Completed" || batch.status == "Error"
16
- clearInterval(window.batchInterval)
17
- $('#batch-progress').html(data)
18
- clearBatchFromSession(batch.id)
19
- window.location.reload() if $('#batch-container').data('refresh')
17
+ if batch.status == "Completed"
18
+ clearIntervalAndBatch(data, batch)
19
+ successCallback() if successCallback != undefined
20
+ else if batch.status == 'Error'
21
+ clearIntervalAndBatch(data, batch)
22
+ errorCallback() if errorCallback != undefined
20
23
 
21
24
  error: (message) ->
22
25
  $('#batch-progress').html('Batch status request failed')
@@ -34,8 +37,11 @@ class CanvasBatchProgress
34
37
 
35
38
  delay = (ms, func) -> setTimeout func, ms
36
39
 
37
- $ ->
38
- new CanvasBatchProgress() if $('#batch-progress').length > 0
40
+ clearIntervalAndBatch = (data, batch) ->
41
+ clearInterval(window.batchInterval)
42
+ $('#batch-progress').html(data)
43
+ clearBatchFromSession(batch.id)
39
44
 
45
+ $ ->
40
46
  $("#batch-container").unbind().bind "batchStarted", (event, data) ->
41
47
  new CanvasBatchProgress()
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '3.1.4'
2
+ VERSION = '3.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-11-25 00:00:00.000000000 Z
13
+ date: 2014-11-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -307,7 +307,7 @@ files:
307
307
  - app/assets/javascripts/bootstrap/bootstrap-datepicker.js
308
308
  - app/assets/javascripts/bootstrap/bootstrap.js
309
309
  - app/assets/javascripts/coalescing_panda/application.js
310
- - app/assets/javascripts/coalescing_panda/canvas_batch.js.coffee.erb
310
+ - app/assets/javascripts/coalescing_panda/canvas_batch.js.coffee
311
311
  - app/assets/javascripts/coalescing_panda/oauth2.js.coffee
312
312
  - app/assets/stylesheets/bootstrap/bootstrap-datepicker.css
313
313
  - app/assets/stylesheets/bootstrap/bootstrap-overrides.css.scss