code to support import existing series.
This commit is contained in:
parent
fa224cc59c
commit
13aa79d5f9
|
@ -94,7 +94,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Extentions\NancyJsonSerializer.cs" />
|
||||
<Compile Include="Extentions\Serializer.cs" />
|
||||
<Compile Include="QualityProfiles\RootFolderModule.cs" />
|
||||
<Compile Include="RootFolders\RootFolderModule.cs" />
|
||||
<Compile Include="Series\SeriesModule.cs" />
|
||||
<Compile Include="Series\SeriesLookupModule.cs" />
|
||||
<Compile Include="ErrorManagment\ApiException.cs" />
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using Nancy;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extentions;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Api.QualityType;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Api.QualityProfiles
|
||||
namespace NzbDrone.Api.RootFolders
|
||||
{
|
||||
public class RootDirModule : NzbDroneApiModule
|
||||
{
|
|
@ -85,6 +85,7 @@ namespace NzbDrone.Core.Providers
|
|||
foreach (var rootDir in rootDirs)
|
||||
{
|
||||
rootDir.FreeSpace = _diskProvider.FreeDiskSpace(new DirectoryInfo(rootDir.Path));
|
||||
rootDir.UnmappedFolders = GetUnmappedFolders(rootDir.Path);
|
||||
}
|
||||
|
||||
return rootDirs;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using PetaPoco;
|
||||
using System.Collections.Generic;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Repository
|
||||
{
|
||||
|
@ -12,5 +13,8 @@ namespace NzbDrone.Core.Repository
|
|||
|
||||
[ResultColumn]
|
||||
public ulong FreeSpace { get; set; }
|
||||
|
||||
[Ignore]
|
||||
public List<string> UnmappedFolders { get; set; }
|
||||
}
|
||||
}
|
|
@ -183,6 +183,8 @@
|
|||
<Compile Include="App_Start\DataTablesMvc.cs" />
|
||||
<Compile Include="App_Start\MiniProfiler.cs" />
|
||||
<Content Include="_backboneApp\AddSeries\AddNewSeries\SearchResultView.js" />
|
||||
<Content Include="_backboneApp\AddSeries\ImportExistingSeries\ImportSeriesView.js" />
|
||||
<Content Include="_backboneApp\AddSeries\ImportExistingSeries\ImportSeriesTemplate.html" />
|
||||
<Content Include="_backboneApp\AddSeries\RootDir\RootDirTemplate.html" />
|
||||
<Content Include="_backboneApp\AddSeries\RootDir\RootDirView.js" />
|
||||
<Content Include="_backboneApp\AddSeries\RootDir\RootDirItemTemplate.html" />
|
||||
|
@ -391,9 +393,9 @@
|
|||
<Content Include="_backboneApp\JsLibraries\backbone.marionette.js" />
|
||||
<Content Include="_backboneApp\AddSeries\addSeriesLayoutTemplate.html" />
|
||||
<Content Include="_backboneApp\Series\SeriesModel.js" />
|
||||
<Content Include="_backboneApp\Shared\ErrorModel.js" />
|
||||
<Content Include="_backboneApp\Shared\ErrorTemplate.html" />
|
||||
<Content Include="_backboneApp\Shared\ErrorView.js" />
|
||||
<Content Include="_backboneApp\Shared\NotificationModel.js" />
|
||||
<Content Include="_backboneApp\Shared\NotificationTemplate.html" />
|
||||
<Content Include="_backboneApp\Shared\NotificationView.js" />
|
||||
<Content Include="_backboneApp\Shared\SpinnerTemplate.html" />
|
||||
<Content Include="_backboneApp\Shared\SpinnerView.js" />
|
||||
<None Include="_backboneApp\JsLibraries\jquery-1.8.2.intellisense.js" />
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
/// <reference path="RootDir/RootDirView.js" />
|
||||
/// <reference path="../Quality/qualityProfileCollection.js" />
|
||||
/// <reference path="../Shared/SpinnerView.js" />
|
||||
/// <reference path="ImportExistingSeries/ImportSeriesView.js" />
|
||||
|
||||
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||
template: "AddSeries/addSeriesLayoutTemplate",
|
||||
|
@ -33,7 +34,7 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
|||
this.qualityProfileCollection.fetch();
|
||||
|
||||
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
|
||||
//this.importExisting.show(new NzbDrone.ImportExistingView());
|
||||
this.importExisting.show(new NzbDrone.AddSeries.ExistingFolderListView({ collection: this.rootFolderCollection }));
|
||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
||||
|
||||
NzbDrone.vent.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this);
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{{#each unmappedFolders}}
|
||||
<div>
|
||||
{{this}}
|
||||
</div>
|
||||
{{/each}}
|
|
@ -0,0 +1,28 @@
|
|||
/// <reference path="../../app.js" />
|
||||
/// <reference path="../../Series/SeriesModel.js" />
|
||||
/// <reference path="../SearchResultCollection.js" />
|
||||
|
||||
NzbDrone.AddSeries.ExistingFolderItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: "AddSeries/ImportExistingSeries/ImportSeriesTemplate",
|
||||
|
||||
events: {
|
||||
//'click .x-add': 'add'
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.ExistingFolderListView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.AddSeries.ExistingFolderItemView,
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
if (this.collection === undefined) {
|
||||
throw "root folder collection is required.";
|
||||
}
|
||||
|
||||
this.listenTo(this.collection, 'reset', this.render, this);
|
||||
},
|
||||
|
||||
});
|
|
@ -31,7 +31,7 @@ namespace NzbDrone.Web.Backbone.NzbDrone
|
|||
|
||||
bundles.Add<ScriptBundle>(NZBDRONE, new[]{
|
||||
APP_PATH + "\\AddSeries\\AddSeriesLayout.js",
|
||||
APP_PATH + "\\Shared\\ErrorView.js",
|
||||
APP_PATH + "\\Shared\\NotificationView.js",
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/// <reference path="../app.js" />
|
||||
|
||||
NzbDrone.Shared.ErrorCollection = Backbone.Collection.extend({
|
||||
|
||||
model: NzbDrone.Shared.ErrorModel,
|
||||
|
||||
});
|
||||
|
||||
|
||||
NzbDrone.Shared.ErrorModel = Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
pre: function () {
|
||||
return this.get('message').lines().lenght > 1;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
defaults: {
|
||||
"title": "NO_TITLE",
|
||||
"message": "NO_MESSAGE",
|
||||
}
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
<div class="alert alert-error">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<i class="icon-warning-sign" /><strong>{{title}}</strong>
|
||||
{{#if preFormatted}}
|
||||
<pre> {{message}}</pre>
|
||||
{{else}}
|
||||
{{message}}
|
||||
{{/if}}
|
||||
</div>
|
|
@ -1,66 +0,0 @@
|
|||
/// <reference path="../app.js" />
|
||||
/// <reference path="ErrorModel.js" />
|
||||
|
||||
NzbDrone.Shared.ErrorItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: "Shared/ErrorTemplate",
|
||||
});
|
||||
|
||||
NzbDrone.Shared.ErrorView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.Shared.ErrorItemView,
|
||||
|
||||
initialize: function () {
|
||||
|
||||
this.collection = new NzbDrone.Shared.ErrorCollection();
|
||||
this.listenTo(this.collection, 'reset', this.render);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
NzbDrone.addInitializer(function (options) {
|
||||
|
||||
console.log("initializing error handler");
|
||||
|
||||
NzbDrone.Shared.ErrorView.instance = new NzbDrone.Shared.ErrorView();
|
||||
|
||||
NzbDrone.errorRegion.show(NzbDrone.Shared.ErrorView.instance);
|
||||
|
||||
});
|
||||
|
||||
|
||||
window.onerror = function (msg, url, line) {
|
||||
|
||||
var errorView = NzbDrone.Shared.ErrorView.instance;
|
||||
|
||||
if (errorView) {
|
||||
var model = new NzbDrone.Shared.ErrorModel();
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
model.set('title', a.pathname.split('/').pop() + " : " + line);
|
||||
model.set('message', msg);
|
||||
errorView.collection.add(model);
|
||||
} else {
|
||||
alert("Error: " + msg + "\nurl: " + url + "\nline #: " + line);
|
||||
}
|
||||
|
||||
var suppressErrorAlert = false;
|
||||
return suppressErrorAlert;
|
||||
};
|
||||
|
||||
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
||||
|
||||
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) return;
|
||||
|
||||
var errorView = NzbDrone.Shared.ErrorView.instance;
|
||||
|
||||
var model = new NzbDrone.Shared.ErrorModel();
|
||||
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
||||
model.set('message', xmlHttpRequest.responseText);
|
||||
errorView.collection.add(model);
|
||||
|
||||
var suppressErrorAlert = false;
|
||||
return suppressErrorAlert;
|
||||
});
|
|
@ -0,0 +1,42 @@
|
|||
/// <reference path="../app.js" />
|
||||
|
||||
NzbDrone.Shared.NotificationCollection = Backbone.Collection.extend({
|
||||
|
||||
model: NzbDrone.Shared.NotificationModel,
|
||||
|
||||
});
|
||||
|
||||
|
||||
NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
pre: function () {
|
||||
return this.get('message').lines().lenght > 1;
|
||||
},
|
||||
iconClass: function () {
|
||||
|
||||
if (this.has('icon')) {
|
||||
return "icon";
|
||||
}
|
||||
|
||||
if (this.get('level') == 'info') {
|
||||
return "icon-info-sign";
|
||||
}
|
||||
else if (this.get('level') == 'success') {
|
||||
return 'icon-ok-sign';
|
||||
}
|
||||
else if (this.get('level') == 'error') {
|
||||
return 'icon-warning-sign';
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
defaults: {
|
||||
"level": "info",
|
||||
"title": "",
|
||||
"message": "",
|
||||
}
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
<div class="alert alert-{{level}}">
|
||||
<button type="button" class="close x-close">×</button>
|
||||
<i class="{{iconClass}}" /><strong>{{title}}</strong>
|
||||
{{#if preFormatted}}
|
||||
<pre> {{message}}</pre>
|
||||
{{else}}
|
||||
{{message}}
|
||||
{{/if}}
|
||||
</div>
|
|
@ -0,0 +1,72 @@
|
|||
/// <reference path="../app.js" />
|
||||
/// <reference path="NotificationModel.js" />
|
||||
|
||||
NzbDrone.Shared.NotificationItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: "Shared/NotificationTemplate",
|
||||
|
||||
events: {
|
||||
'click .x-close': 'kill'
|
||||
},
|
||||
|
||||
kill: function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
$.Deferred(function () {
|
||||
self.$el.slideUp('slow');
|
||||
}).done(function () {
|
||||
self.model.destroy();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
NzbDrone.Shared.NotificationCollectionView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.Shared.NotificationItemView,
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new NzbDrone.Shared.NotificationCollection();
|
||||
},
|
||||
});
|
||||
|
||||
NzbDrone.addInitializer(function (options) {
|
||||
NzbDrone.errorRegion.show(NzbDrone.Shared.NotificationCollectionView.Instance);
|
||||
});
|
||||
|
||||
|
||||
NzbDrone.Shared.NotificationCollectionView.Instance = new NzbDrone.Shared.NotificationCollectionView();
|
||||
|
||||
window.onerror = function (msg, url, line) {
|
||||
|
||||
try {
|
||||
var model = new NzbDrone.Shared.NotificationModel();
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
model.set('title', a.pathname.split('/').pop() + " : " + line);
|
||||
model.set('message', msg);
|
||||
model.set('level', 'error');
|
||||
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model);
|
||||
} catch (error) {
|
||||
alert("Couldn't report JS error. " + error);
|
||||
}
|
||||
|
||||
var suppressErrorAlert = false;
|
||||
return suppressErrorAlert;
|
||||
};
|
||||
|
||||
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
||||
|
||||
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) return;
|
||||
var model = new NzbDrone.Shared.NotificationModel();
|
||||
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
||||
model.set('message', xmlHttpRequest.responseText);
|
||||
model.set('level', 'error');
|
||||
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model);
|
||||
|
||||
var suppressErrorAlert = false;
|
||||
return suppressErrorAlert;
|
||||
});
|
Loading…
Reference in New Issue