From 92b87b9d21eeea4de2685af2f411652ffc4d2991 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 7 Jun 2015 14:09:49 -0700 Subject: [PATCH] Fixed: Improved error messaging for manual import --- .../EpisodeImport/ImportDecisionMaker.cs | 2 +- src/UI/Cells/ApprovalStatusCell.js | 2 +- src/UI/Episode/Search/ManualLayout.js | 3 +- src/UI/ManualImport/ManualImportLayout.js | 36 ++++++++++++++++++- src/UI/Release/ReleaseLayout.js | 3 +- 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs index df5d6cc18..8bfdea47e 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs @@ -93,7 +93,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport if (localEpisode.Episodes.Empty()) { - decision = new ImportDecision(localEpisode, new Rejection("Unable to find episodes")); + decision = new ImportDecision(localEpisode, new Rejection("Unable to parse episode(s) from filename")); } else { diff --git a/src/UI/Cells/ApprovalStatusCell.js b/src/UI/Cells/ApprovalStatusCell.js index 14ee10530..08c6ba575 100644 --- a/src/UI/Cells/ApprovalStatusCell.js +++ b/src/UI/Cells/ApprovalStatusCell.js @@ -23,7 +23,7 @@ module.exports = Backgrid.Cell.extend({ content : html, html : true, trigger : 'hover', - title : 'Release Rejected', + title : this.column.get('title'), placement : 'left', container : this.$el }); diff --git a/src/UI/Episode/Search/ManualLayout.js b/src/UI/Episode/Search/ManualLayout.js index cb13c5b4b..58c792063 100644 --- a/src/UI/Episode/Search/ManualLayout.js +++ b/src/UI/Episode/Search/ManualLayout.js @@ -59,7 +59,8 @@ module.exports = Marionette.Layout.extend({ cell : ApprovalStatusCell, sortable : true, sortType : 'fixed', - direction : 'ascending' + direction : 'ascending', + title : 'Release Rejected' }, { name : 'download', diff --git a/src/UI/ManualImport/ManualImportLayout.js b/src/UI/ManualImport/ManualImportLayout.js index f1949d97d..f0738a550 100644 --- a/src/UI/ManualImport/ManualImportLayout.js +++ b/src/UI/ManualImport/ManualImportLayout.js @@ -16,6 +16,7 @@ var QualityCell = require('./Cells/QualityCell'); var FileSizeCell = require('../Cells/FileSizeCell'); var ApprovalStatusCell = require('../Cells/ApprovalStatusCell'); var ManualImportCollection = require('./ManualImportCollection'); +var Messenger = require('../Shared/Messenger'); module.exports = Marionette.Layout.extend({ className : 'modal-lg', @@ -84,7 +85,8 @@ module.exports = Marionette.Layout.extend({ cell : ApprovalStatusCell, sortable : false, sortType : 'fixed', - direction : 'ascending' + direction : 'ascending', + title : 'Import Rejected' } ], @@ -170,6 +172,30 @@ module.exports = Marionette.Layout.extend({ return; } + if (_.any(selected, function (model) { + return !model.has('series'); + })) { + + this._showErrorMessage('Series must be chosen for each selected file'); + return; + } + + if (_.any(selected, function (model) { + return !model.has('season'); + })) { + + this._showErrorMessage('Season must be chosen for each selected file'); + return; + } + + if (_.any(selected, function (model) { + return !model.has('episodes') || model.get('episodes').length === 0; + })) { + + this._showErrorMessage('One or more episodes must be chosen for each selected file'); + return; + } + CommandController.Execute('manualImport', { name : 'manualImport', files : _.map(selected, function (file) { @@ -214,5 +240,13 @@ module.exports = Marionette.Layout.extend({ else { this.ui.importButton.removeAttr('disabled'); } + }, + + _showErrorMessage : function (message) { + Messenger.show({ + message : message, + type : 'error', + hideAfter : 5 + }); } }); \ No newline at end of file diff --git a/src/UI/Release/ReleaseLayout.js b/src/UI/Release/ReleaseLayout.js index b17dd01f1..07f4a1af6 100644 --- a/src/UI/Release/ReleaseLayout.js +++ b/src/UI/Release/ReleaseLayout.js @@ -50,7 +50,8 @@ module.exports = Marionette.Layout.extend({ { name : 'rejections', label : '', - cell : ApprovalStatusCell + cell : ApprovalStatusCell, + title : 'Release Rejected' } ],