diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-07-14 00:24:43 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-07-14 00:25:00 (GMT) |
commit | 8950c5830665de3c20a0d142f69f8bd33ef74183 (patch) | |
tree | e66b462f56a52191bbb3ea306a7fd4ec68435307 /www | |
parent | 3dde5e42704bb5633827f0b7ba4a403d98365c22 (diff) |
import errors are now somehow handled - still needs love
Diffstat (limited to 'www')
-rw-r--r-- | www/js/importer.js | 14 | ||||
-rw-r--r-- | www/js/jingles.js | 11 | ||||
-rw-r--r-- | www/js/musicpools.js | 11 | ||||
-rw-r--r-- | www/js/shows.js | 11 |
4 files changed, 15 insertions, 32 deletions
diff --git a/www/js/importer.js b/www/js/importer.js index 1da9d1a..c813f1a 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -338,7 +338,7 @@ Rdxport.Upload.prototype.onerror = function(error) { var file = { cartNumber: this.cartNumber || this.newCartNumber }; - this.importFileUploadError(file, error); + this.importFileUploadError(file, 500, error); }; Rdxport.Upload.prototype.onmessage = function(event) { @@ -350,7 +350,7 @@ Rdxport.Upload.prototype.onmessage = function(event) { switch (data.TYPE.toLowerCase()) { case Rdxport.Importer.TYPE_ERROR: console.log(data); - this.importFileUploadError(file, data.ERROR_STRING); + this.importFileUploadError(file, data.RESPONSE_CODE, data.ERROR_STRING); break; case Rdxport.Importer.TYPE_PROGRESS: this.uploadprogress.current = data.CURRENT; @@ -362,7 +362,11 @@ Rdxport.Upload.prototype.onmessage = function(event) { break; case Rdxport.Importer.TYPE_DONE: console.log(data); - this.importFileUploadSuccess(); + if(data.RESPONSE_CODE < 400) { + this.importFileUploadSuccess(); + } else { + this.importFileUploadError(file, data.RESPONSE_CODE, data.ERROR_STRING); + } break; } @@ -472,9 +476,9 @@ Rdxport.Upload.prototype.importFileUploadSuccess = function() { this.group.fetchCarts(); }; -Rdxport.Upload.prototype.importFileUploadError = function(file, msg, xhr) { +Rdxport.Upload.prototype.importFileUploadError = function(file, status, errorString) { var self = this; - this.groupView.uploadError(this, file, msg, xhr, function() { + this.groupView.uploadError(this, file, status, errorString, function() { self.cancel(); }); }; diff --git a/www/js/jingles.js b/www/js/jingles.js index 64735f0..eeb3927 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -133,18 +133,11 @@ Rdxport.JingleGroupView.prototype.uploadProgress = function(upload, file) { updateProgressBar($cut, upload); }; -Rdxport.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { +Rdxport.JingleGroupView.prototype.uploadError = function(upload, file, status, errorString, acknowledge) { if (!file.cartNumber || !file.cutNumber) { return; } - var responseCode = xhr.status; - var errorString = xhr.statusText; - - //var xmlDoc = $.parseXML(msg); - //var msg = $(xmlDoc); - //var responseCode = msg.find('ResponseCode').text(); - //var errorString = msg.find('ErrorString').text(); - var reason = $('<span>').addClass('label').addClass('label-danger').text(responseCode).after($('<b>').text(' ' + errorString)); + var reason = $('<span>').addClass('label').addClass('label-danger').text(status).after($('<b>').text(' ' + errorString)); var dismiss_button = '<button class="btn btn-info btn-xs">' + '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; diff --git a/www/js/musicpools.js b/www/js/musicpools.js index db295c7..e3a9118 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -205,18 +205,11 @@ Rdxport.MusicpoolView.prototype.uploadProgress = function(upload, file) { updateProgressBar($cart, upload); }; -Rdxport.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { +Rdxport.MusicpoolView.prototype.uploadError = function(upload, file, status, errorString, acknowledge) { if (!file.cartNumber) { return; } - var responseCode = xhr.status; - var errorString = xhr.statusText; - - //var xmlDoc = $.parseXML(msg); - //var msg = $(xmlDoc); - //var responseCode = msg.find('ResponseCode').text(); - //var errorString = msg.find('ErrorString').text(); - var reason = $('<span>').addClass('label').addClass('label-danger').text(responseCode).after($('<b>').text(' ' + errorString)); + var reason = $('<span>').addClass('label').addClass('label-danger').text(status).after($('<b>').text(' ' + errorString)); var dismiss_button = '<button class="btn btn-info btn-xs">' + '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; diff --git a/www/js/shows.js b/www/js/shows.js index 1ec986d..fb54ea5 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -281,18 +281,11 @@ Rdxport.ShowView.prototype.uploadProgress = function(upload, file) { updateProgressBar($cart, upload); }; -Rdxport.ShowView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { +Rdxport.ShowView.prototype.uploadError = function(upload, file, status, errorString, acknowledge) { if (!file.cartNumber) { return; } - var responseCode = xhr.status; - var errorString = xhr.statusText; - - //var xmlDoc = $.parseXML(msg); - //var msg = $(xmlDoc); - //var responseCode = msg.find('ResponseCode').text(); - //var errorString = msg.find('ErrorString').text(); - var reason = $('<span>').addClass('label').addClass('label-danger').text(responseCode).after($('<b>').text(' ' + errorString)); + var reason = $('<span>').addClass('label').addClass('label-danger').text(status).after($('<b>').text(' ' + errorString)); var dismiss_button = '<button class="btn btn-info btn-xs">' + '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; |