Fixed: Improved error messaging for manual import

This commit is contained in:
Mark McDowall 2015-06-07 14:09:49 -07:00
parent c9f1039ab4
commit 92b87b9d21
5 changed files with 41 additions and 5 deletions

View File

@ -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
{

View File

@ -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
});

View File

@ -59,7 +59,8 @@ module.exports = Marionette.Layout.extend({
cell : ApprovalStatusCell,
sortable : true,
sortType : 'fixed',
direction : 'ascending'
direction : 'ascending',
title : 'Release Rejected'
},
{
name : 'download',

View File

@ -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
});
}
});

View File

@ -50,7 +50,8 @@ module.exports = Marionette.Layout.extend({
{
name : 'rejections',
label : '',
cell : ApprovalStatusCell
cell : ApprovalStatusCell,
title : 'Release Rejected'
}
],