From 8950c5830665de3c20a0d142f69f8bd33ef74183 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 14 Jul 2016 02:24:43 +0200 Subject: import errors are now somehow handled - still needs love 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 = $('').addClass('label').addClass('label-danger').text(responseCode).after($('').text(' ' + errorString)); + var reason = $('').addClass('label').addClass('label-danger').text(status).after($('').text(' ' + errorString)); var dismiss_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 = $('').addClass('label').addClass('label-danger').text(responseCode).after($('').text(' ' + errorString)); + var reason = $('').addClass('label').addClass('label-danger').text(status).after($('').text(' ' + errorString)); var dismiss_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 = $('').addClass('label').addClass('label-danger').text(responseCode).after($('').text(' ' + errorString)); + var reason = $('').addClass('label').addClass('label-danger').text(status).after($('').text(' ' + errorString)); var dismiss_button = ''; -- cgit v0.10.2