From 7262a8e91ca8bb14bf58af8f8cf89e351aff288e Mon Sep 17 00:00:00 2001 From: Peter Grassberger Date: Mon, 22 Feb 2016 18:21:52 +0100 Subject: show import error in jingles and musicpools diff --git a/www/js/importer.js b/www/js/importer.js index bac23f6..06caa1c 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -80,7 +80,9 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, Rivendell.Importer.prototype.cancelAllUploads = function() { $.each(this.uploads, function(index, upload){ - upload.cancel(); + if (upload) { + upload.cancel(); + } }); }; diff --git a/www/js/jingles.js b/www/js/jingles.js index 0bb586c..ea010d0 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -148,10 +148,38 @@ Rivendell.JingleGroupView.prototype.uploadProgress = function(upload, file) { }; Rivendell.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { - // todo + 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($('').html(' ' + errorString)); + + var dismiss_button = ''; + + var status = $('') + .addClass('label-danger').html(''); + + var $errorRow = $('') + .attr('id', 'jingle-' + file.cartNumber + '-' + file.cutNumber) + .append($('').html(status)) + .append($('').text(file.cartNumber)) + .append($('').addClass('file-name').text(file.name)) + .append($('').append($('').text('Import Fehler'))) + .append($('').append(reason)) + .append($('').css('text-align', 'center').append(dismiss_button)); + + $('button', $errorRow).on('click', function() { + acknowledge(); + }); - // to this on ok click. - acknowledge(); + $('#jingle-' + file.cartNumber + '-' + file.cutNumber).replaceWith($errorRow); }; Rivendell.JingleCartView = function(model, groupView, active) { @@ -196,6 +224,13 @@ Rivendell.JingleCutView.prototype.render = function() { } var deleteButton = $(''); + if (this.model.length == 0) { + status + .removeClass('label-success') + .addClass('label-danger') + .html(''); + } + var self = this; moveButton.on('click', function() { self.move(); diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 3a694b9..1a2c78d 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -183,10 +183,34 @@ Rivendell.MusicpoolView.prototype.uploadProgress = function(upload, file) { }; Rivendell.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { - // todo + 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($('').html(' ' + errorString)); + + var dismiss_button = ''; + + var $errorRow = $('') + .attr('id', 'musicpool-' + file.cartNumber) + .append($('').text(file.cartNumber)) + .append($('').addClass('file-name').text(file.name)) + .append($('').append($('').text('Import Fehler'))) + .append($('').append(reason)) + .append($('').css('text-align', 'center').append(dismiss_button)); + + $('button', $errorRow).on('click', function() { + acknowledge(); + }); - // to this on ok click. - acknowledge(); + $('#musicpool-' + file.cartNumber).replaceWith($errorRow); }; Rivendell.MusicpoolCartView = function(model) { diff --git a/www/js/shows.js b/www/js/shows.js index 1897352..1ba86b9 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -24,19 +24,9 @@ var Rivendell = Rivendell || {}; -/*var shows_currentid = null; -var shows_list = []; -var shows_current; -var shows_group_carts = {}; -var shows_log_carts = [];*/ - var showListView = null; function shows_init() { - /*shows_currentid = sessionStorage.getItem("shows_currentid"); - shows_list = []; - rdxport.listDropboxes('show', shows_updateList);*/ - var showList = new Rivendell.GroupList(); showListView = new Rivendell.ShowListView(showList); @@ -47,12 +37,6 @@ function shows_init() { function shows_cleanup() { $('#show-carts tbody').find('tr').remove(); importer.cancelAllUploads(); - - /*sessionStorage.removeItem("shows_currentid"); - shows_currentid = null; - shows_list = []; - shows_group_carts = {}; - shows_log_carts = [];*/ } Rivendell.ShowListView = function(model) { @@ -277,15 +261,12 @@ Rivendell.ShowView.prototype.uploadError = function(upload, file, msg, xhr, ackn var $errorRow = $('') .attr("id", "show-cart-" + file.cartNumber) .append($('').text(file.cartNumber)) - .append($('').addClass('file-name').text('-')) + .append($('').addClass('file-name').text(file.name)) .append($('').append($('').text('Import Fehler'))) - .append($('').append(reason)) + .append($('').append(reason)) .append($('').css('text-align', 'center').append(dismiss_button)); - var self = this; $('button', $errorRow).on('click', function() { - var $emptyRow = Rivendell.ShowCartView.renderEmpty(self.model, self, file.cartNumber); - $('#show-cart-' + file.cartNumber).replaceWith($emptyRow); acknowledge(); }); @@ -360,4 +341,3 @@ Rivendell.ShowCartView.prototype.delete = function() { self.$el.replaceWith($empty); }); }; - -- cgit v0.10.2