1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

New: Remove old UI

This commit is contained in:
Qstick 2018-11-23 02:06:23 -05:00
parent ac0d1c92c3
commit 4d3bfe3cf2
985 changed files with 0 additions and 110503 deletions

View File

@ -1 +0,0 @@
NzbDrone.UI

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jQuery-1.9.1" level="application" />
<orderEntry type="library" name="backbone.backgrid.filter.js" level="project" />
</component>
</module>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="LINE_SEPARATOR" value="&#13;&#10;" />
<option name="RIGHT_MARGIN" value="190" />
<option name="HTML_ATTRIBUTE_WRAP" value="0" />
<option name="HTML_KEEP_LINE_BREAKS" value="false" />
<option name="HTML_KEEP_BLANK_LINES" value="1" />
<option name="HTML_ALIGN_ATTRIBUTES" value="false" />
<option name="HTML_INLINE_ELEMENTS" value="" />
<option name="HTML_DONT_ADD_BREAKS_IF_INLINE_CONTENT" value="" />
<CssCodeStyleSettings>
<option name="HEX_COLOR_LOWER_CASE" value="true" />
<option name="HEX_COLOR_LONG_FORMAT" value="true" />
<option name="VALUE_ALIGNMENT" value="1" />
</CssCodeStyleSettings>
<JSCodeStyleSettings>
<option name="SPACE_BEFORE_PROPERTY_COLON" value="true" />
<option name="ALIGN_OBJECT_PROPERTIES" value="2" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="OBJECT_LITERAL_WRAP" value="2" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
</JSCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="true" />
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="SPACE_BEFORE_METHOD_PARENTHESES" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="2" />
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@ -1,20 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="Keivan">
<words>
<w>deps</w>
<w>mixins</w>
<w>nzbdrone</w>
<w>rootdir</w>
<w>rootfolder</w>
<w>rootfolders</w>
<w>signalr</w>
<w>sonarr</w>
<w>templated</w>
<w>thetvdb</w>
<w>trakt</w>
<w>tvdb</w>
<w>xlarge</w>
<w>yyyy</w>
</words>
</dictionary>
</component>

View File

@ -1,13 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="Keivan.Beigi">
<words>
<w>backgrid</w>
<w>bnzbd</w>
<w>clickable</w>
<w>couldn</w>
<w>mouseenter</w>
<w>mouseleave</w>
<w>navbar</w>
</words>
</dictionary>
</component>

View File

@ -1,3 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="Mark" />
</component>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/System/Logs/Files/LogFileModel.js" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -1,117 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="AssignmentResultUsedJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AssignmentToForLoopParameterJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="AssignmentToFunctionParameterJS" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="BadExpressionStatementJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="BreakStatementJS" enabled="true" level="SERVER PROBLEM" enabled_by_default="true" />
<inspection_tool class="BreakStatementWithLabelJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ChainedEqualityJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConditionalExpressionWithIdenticalBranchesJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ConstantIfStatementJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ConstantOnLHSOfComparisonJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ContinueStatementWithLabelJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CssMissingSemicolonInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CyclomaticComplexityJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_limit" value="10" />
</inspection_tool>
<inspection_tool class="DefaultNotLastCaseInSwitchJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="DuplicateCaseLabelJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="DuplicateConditionJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="DynamicallyGeneratedCodeJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="EmptyTryBlockJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ExceptionCaughtLocallyJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ForLoopReplaceableByWhileJS" enabled="true" level="INFO" enabled_by_default="true">
<option name="m_ignoreLoopsWithoutConditions" value="false" />
</inspection_tool>
<inspection_tool class="FunctionNamingConventionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_regex" value="[a-z][A-Za-z]*" />
<option name="m_minLength" value="4" />
<option name="m_maxLength" value="32" />
</inspection_tool>
<inspection_tool class="FunctionWithInconsistentReturnsJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="HtmlFormInputWithoutLabel" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlPresentationalElement" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="name" />
<item index="1" class="java.lang.String" itemvalue="validation-name" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="8">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="icon" />
<item index="7" class="java.lang.String" itemvalue="p" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="IfStatementWithIdenticalBranchesJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="IfStatementWithTooManyBranchesJS" enabled="true" level="ERROR" enabled_by_default="true">
<option name="m_limit" value="3" />
</inspection_tool>
<inspection_tool class="JSDuplicatedDeclaration" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JSLastCommaInArrayLiteral" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JSPotentiallyInvalidUsageOfThis" enabled="true" level="SERVER PROBLEM" enabled_by_default="true" />
<inspection_tool class="JSUndeclaredVariable" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JSUnnecessarySemicolon" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="JSUnresolvedFunction" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JSUnresolvedVariable" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JSUnusedGlobalSymbols" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myReportUnusedDefinitions" value="true" />
<option name="myReportUnusedProperties" value="true" />
</inspection_tool>
<inspection_tool class="LabeledStatementJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="LocalVariableNamingConventionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_regex" value="[a-z][A-Za-z]*" />
<option name="m_minLength" value="1" />
<option name="m_maxLength" value="32" />
</inspection_tool>
<inspection_tool class="NegatedIfStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NestedAssignmentJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NestedFunctionCallJS" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="NestedSwitchStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NestingDepthJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_limit" value="5" />
</inspection_tool>
<inspection_tool class="NonBlockStatementBodyJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ParameterNamingConventionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_regex" value="[a-z][A-Za-z]*" />
<option name="m_minLength" value="1" />
<option name="m_maxLength" value="32" />
</inspection_tool>
<inspection_tool class="ParametersPerFunctionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_limit" value="4" />
</inspection_tool>
<inspection_tool class="ReservedWordUsedAsNameJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ReuseOfLocalVariableJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="StatementsPerFunctionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_limit" value="30" />
</inspection_tool>
<inspection_tool class="SwitchStatementWithNoDefaultBranchJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TailRecursionJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ThisExpressionReferencesGlobalObjectJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="ThreeNegationsPerFunctionJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnterminatedStatementJS" enabled="true" level="ERROR" enabled_by_default="true">
<option name="ignoreSemicolonAtEndOfBlock" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<excludedPredefinedLibrary name="HTML" />
<excludedPredefinedLibrary name="HTML5 / EcmaScript 5" />
</component>
</project>

View File

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.6.0" use-config-file="false">
<option asi="false" />
<option bitwise="true" />
<option boss="false" />
<option browser="true" />
<option camelcase="true" />
<option couch="false" />
<option curly="true" />
<option debug="false" />
<option devel="true" />
<option dojo="false" />
<option eqeqeq="true" />
<option eqnull="false" />
<option es3="false" />
<option esnext="false" />
<option evil="false" />
<option expr="false" />
<option forin="true" />
<option freeze="false" />
<option funcscope="false" />
<option gcl="false" />
<option globalstrict="true" />
<option immed="true" />
<option iterator="false" />
<option jquery="false" />
<option lastsemic="false" />
<option latedef="true" />
<option laxbreak="false" />
<option laxcomma="false" />
<option loopfunc="false" />
<option maxdepth="3" />
<option maxerr="50" />
<option mootools="false" />
<option moz="false" />
<option multistr="false" />
<option newcap="true" />
<option noarg="true" />
<option node="true" />
<option noempty="false" />
<option nomen="false" />
<option nonbsp="false" />
<option nonew="true" />
<option nonstandard="false" />
<option notypeof="false" />
<option noyield="false" />
<option onevar="false" />
<option passfail="false" />
<option phantom="false" />
<option plusplus="false" />
<option predef="window, define, require, module" />
<option proto="false" />
<option prototypejs="false" />
<option quotmark="single" />
<option rhino="false" />
<option scripturl="false" />
<option shadow="false" />
<option smarttabs="false" />
<option strict="false" />
<option sub="false" />
<option supernew="false" />
<option trailing="false" />
<option undef="true" />
<option unused="true" />
<option validthis="false" />
<option white="false" />
<option worker="false" />
<option wsh="false" />
<option yui="false" />
</component>
</project>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSLintConfiguration" html="true" json="true">
<option browser="true" />
<option devel="true" />
<option indent="4" />
<option maxerr="50" />
<option plusplus="true" />
<option todo="true" />
<option white="true" />
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectKey">
<option name="state" value="git@github.com:NzbDrone/NzbDrone.git" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/NzbDrone.UI.iml" filepath="$PROJECT_DIR$/.idea/NzbDrone.UI.iml" />
</modules>
</component>
</project>

View File

@ -1,19 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Debug - Chrome" type="JavascriptDebugType" factoryName="JavaScript Debug" singleton="true" engineId="98ca6316-2f89-46d9-a9e5-fa9e2b0625b3" uri="http://localhost:7878">
<mapping url="http://localhost:8989/Config.js" local-file="$PROJECT_DIR$/Config.js" />
<mapping url="http://localhost:8989" local-file="$PROJECT_DIR$" />
<mapping url="http://localhost:8989/Wanted" local-file="$PROJECT_DIR$/Wanted" />
<mapping url="http://localhost:8989/app.js" local-file="$PROJECT_DIR$/app.js" />
<mapping url="http://localhost:8989/Mixins" local-file="$PROJECT_DIR$/Mixins" />
<mapping url="http://localhost:8989/Quality" local-file="$PROJECT_DIR$/Quality" />
<mapping url="http://localhost:8989/Shared" local-file="$PROJECT_DIR$/Shared" />
<mapping url="http://localhost:8989/Calendar" local-file="$PROJECT_DIR$/Calendar" />
<mapping url="http://localhost:8989/Controller.js" local-file="$PROJECT_DIR$/Controller.js" />
<mapping url="http://localhost:8989/Series" local-file="$PROJECT_DIR$/Series" />
<mapping url="http://localhost:8989/AddSeries" local-file="$PROJECT_DIR$/AddSeries" />
<mapping url="http://localhost:8989/Settings" local-file="$PROJECT_DIR$/Settings" />
<RunnerSettings RunnerId="JavascriptDebugRunner" />
<ConfigurationWrapper RunnerId="JavascriptDebugRunner" />
<method />
</configuration>
</component>

View File

@ -1,3 +0,0 @@
<component name="DependencyValidationManager">
<scope name="NzbDrone" pattern="!file:JsLibraries//*" />
</component>

View File

@ -1,5 +0,0 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

View File

@ -1,20 +0,0 @@
{
"-W030": false,
"-W064": false,
"-W097": false,
"-W100": false,
"undef": true,
"curly": true,
"immed": true,
"eqeqeq": true,
"latedef": true,
"globals": {
"module": true,
"require": true,
"define": true,
"window": true,
"document": true,
"console": true,
"_": true
}
}

View File

@ -1,84 +0,0 @@
var Marionette = require('marionette');
var Backbone = require('backbone');
var Backgrid = require('backgrid');
var HistoryLayout = require('./History/HistoryLayout');
var BlacklistLayout = require('./Blacklist/BlacklistLayout');
var QueueLayout = require('./Queue/QueueLayout');
module.exports = Marionette.Layout.extend({
template : 'Activity/ActivityLayoutTemplate',
regions : {
queueRegion : '#queue',
history : '#history',
blacklist : '#blacklist'
},
ui : {
queueTab : '.x-queue-tab',
historyTab : '.x-history-tab',
blacklistTab : '.x-blacklist-tab'
},
events : {
'click .x-queue-tab' : '_showQueue',
'click .x-history-tab' : '_showHistory',
'click .x-blacklist-tab' : '_showBlacklist'
},
initialize : function(options) {
if (options.action) {
this.action = options.action.toLowerCase();
}
},
onShow : function() {
switch (this.action) {
case 'history':
this._showHistory();
break;
case 'blacklist':
this._showBlacklist();
break;
default:
this._showQueue();
}
},
_navigate : function(route) {
Backbone.history.navigate(route, {
trigger : false,
replace : true
});
},
_showHistory : function(e) {
if (e) {
e.preventDefault();
}
this.history.show(new HistoryLayout());
this.ui.historyTab.tab('show');
this._navigate('/activity/history');
},
_showBlacklist : function(e) {
if (e) {
e.preventDefault();
}
this.blacklist.show(new BlacklistLayout());
this.ui.blacklistTab.tab('show');
this._navigate('/activity/blacklist');
},
_showQueue : function(e) {
if (e) {
e.preventDefault();
}
this.queueRegion.show(new QueueLayout());
this.ui.queueTab.tab('show');
this._navigate('/activity/queue');
}
});

View File

@ -1,11 +0,0 @@
<ul class="nav nav-tabs">
<li><a href="#queue" class="x-queue-tab no-router">Queue</a></li>
<li><a href="#history" class="x-history-tab no-router">History</a></li>
<li><a href="#blacklist" class="x-blacklist-tab no-router">Blacklist</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="queue"></div>
<div class="tab-pane" id="history"></div>
<div class="tab-pane" id="blacklist"></div>
</div>

View File

@ -1,28 +0,0 @@
var vent = require('vent');
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var BlacklistDetailsLayout = require('./Details/BlacklistDetailsLayout');
module.exports = NzbDroneCell.extend({
className : 'blacklist-actions-cell',
events : {
'click .x-details' : '_details',
'click .x-delete' : '_delete'
},
render : function() {
this.$el.empty();
this.$el.html('<i class="icon-radarr-info x-details"></i>' +
'<i class="icon-radarr-delete x-delete"></i>');
return this;
},
_details : function() {
vent.trigger(vent.Commands.OpenModalCommand, new BlacklistDetailsLayout({ model : this.model }));
},
_delete : function() {
this.model.destroy();
}
});

View File

@ -1,47 +0,0 @@
var BlacklistModel = require('./BlacklistModel');
var PageableCollection = require('backbone.pageable');
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
var AsPersistedStateCollection = require('../../Mixins/AsPersistedStateCollection');
var Collection = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/blacklist',
model : BlacklistModel,
state : {
pageSize : 15,
sortKey : 'date',
order : 1
},
queryParams : {
totalPages : null,
totalRecords : null,
pageSize : 'pageSize',
sortKey : 'sortKey',
order : 'sortDir',
directions : {
'-1' : 'asc',
'1' : 'desc'
}
},
sortMappings : {
'movie' : { sortKey : 'movie.title' }
},
parseState : function(resp) {
return { totalRecords : resp.totalRecords };
},
parseRecords : function(resp) {
if (resp) {
return resp.records;
}
return resp;
}
});
Collection = AsSortedCollection.call(Collection);
Collection = AsPersistedStateCollection.call(Collection);
module.exports = Collection;

View File

@ -1,115 +0,0 @@
var vent = require('vent');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var BlacklistCollection = require('./BlacklistCollection');
var MovieTitleCell = require('../../Cells/MovieTitleCell');
var QualityCell = require('../../Cells/QualityCell');
var RelativeDateCell = require('../../Cells/RelativeDateCell');
var BlacklistActionsCell = require('./BlacklistActionsCell');
var GridPager = require('../../Shared/Grid/Pager');
var LoadingView = require('../../Shared/LoadingView');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
module.exports = Marionette.Layout.extend({
template : 'Activity/Blacklist/BlacklistLayoutTemplate',
regions : {
blacklist : '#x-blacklist',
toolbar : '#x-toolbar',
pager : '#x-pager'
},
columns : [
{
name : 'movie',
label : 'Movie Title',
cell : MovieTitleCell
},
{
name : 'sourceTitle',
label : 'Source Title',
cell : 'string'
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
sortable : false
},
{
name : 'date',
label : 'Date',
cell : RelativeDateCell
},
{
name : 'this',
label : '',
cell : BlacklistActionsCell,
sortable : false
}
],
initialize : function() {
this.collection = new BlacklistCollection({ tableName : 'blacklist' });
this.listenTo(this.collection, 'sync', this._showTable);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
onShow : function() {
this.blacklist.show(new LoadingView());
this._showToolbar();
this.collection.fetch();
},
_showTable : function(collection) {
this.blacklist.show(new Backgrid.Grid({
columns : this.columns,
collection : collection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection : collection
}));
},
_showToolbar : function() {
var leftSideButtons = {
type : 'default',
storeState : false,
collapse: true,
items : [
{
title : 'Clear Blacklist',
icon : 'icon-radarr-clear',
command : 'clearBlacklist'
}
]
};
this.toolbar.show(new ToolbarLayout({
left : [
leftSideButtons
],
context : this
}));
},
_refreshTable : function(buttonContext) {
this.collection.state.currentPage = 1;
var promise = this.collection.fetch({ reset : true });
if (buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_commandComplete : function(options) {
if (options.command.get('name') === 'clearblacklist') {
this._refreshTable();
}
}
});

View File

@ -1,11 +0,0 @@
<div id="x-toolbar"/>
<div class="row">
<div class="col-md-12">
<div id="x-blacklist" class="table-responsive"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="x-pager"/>
</div>
</div>

View File

@ -1,16 +0,0 @@
var Backbone = require('backbone');
var MovieModel = require('../../Movies/MovieModel');
var MoviesCollection = require('../../Movies/FullMovieCollection');
module.exports = Backbone.Model.extend({
parse : function(model) {
//if (model.movie) {
// model.movie = new MovieModel(model.movie);
//}
model.movie = MoviesCollection.get(model.movieId);
return model;
}
});

View File

@ -1,14 +0,0 @@
var Marionette = require('marionette');
var BlacklistDetailsView = require('./BlacklistDetailsView');
module.exports = Marionette.Layout.extend({
template : 'Activity/Blacklist/Details/BlacklistDetailsLayoutTemplate',
regions : {
bodyRegion : '.modal-body'
},
onShow : function() {
this.bodyRegion.show(new BlacklistDetailsView({ model : this.model }));
}
});

View File

@ -1,18 +0,0 @@
<div class="modal-content">
<div class="history-detail-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>
Blacklisted
</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">Close</button>
</div>
</div>
</div>

View File

@ -1,5 +0,0 @@
var Marionette = require('marionette');
module.exports = Marionette.ItemView.extend({
template : 'Activity/Blacklist/Details/BlacklistDetailsViewTemplate'
});

View File

@ -1,23 +0,0 @@
<dl class="dl-horizontal info">
<dt>Name:</dt>
<dd>{{sourceTitle}}</dd>
{{#if protocol}}
{{#unless_eq protocol compare="unknown"}}
<dt>Protocol:</dt>
<dd>{{protocol}}</dd>
{{/unless_eq}}
{{/if}}
{{#if indexer}}
<dt>Indexer:</dt>
<dd>{{indexer}}</dd>
{{/if}}
{{#if message}}
<dt>Message:</dt>
<dd>{{message}}</dd>
{{/if}}
</dl>

View File

@ -1,22 +0,0 @@
var Handlebars = require('handlebars');
var FormatHelpers = require('../../../Shared/FormatHelpers');
Handlebars.registerHelper('historyAge', function() {
var age = this.age;
var unit = FormatHelpers.plural(Math.round(age), 'day');
var ageHours = parseFloat(this.ageHours);
var ageMinutes = this.ageMinutes ? parseFloat(this.ageMinutes) : null;
if (age < 2) {
age = ageHours.toFixed(1);
unit = FormatHelpers.plural(Math.round(ageHours), 'hour');
}
if (age < 2 && ageMinutes) {
age = parseFloat(ageMinutes).toFixed(1);
unit = FormatHelpers.plural(Math.round(ageMinutes), 'minute');
}
return new Handlebars.SafeString('<dt>Age (when grabbed):</dt><dd>{0} {1}</dd>'.format(age, unit));
});

View File

@ -1,35 +0,0 @@
var $ = require('jquery');
var vent = require('vent');
var Marionette = require('marionette');
var HistoryDetailsView = require('./HistoryDetailsView');
module.exports = Marionette.Layout.extend({
template : 'Activity/History/Details/HistoryDetailsLayoutTemplate',
regions : {
bodyRegion : '.modal-body'
},
events : {
'click .x-mark-as-failed' : '_markAsFailed'
},
onShow : function() {
this.bodyRegion.show(new HistoryDetailsView({ model : this.model }));
},
_markAsFailed : function() {
var url = window.NzbDrone.ApiRoot + '/history/failed';
var data = {
id : this.model.get('id')
};
$.ajax({
url : url,
type : 'POST',
data : data
});
vent.trigger(vent.Commands.CloseModalCommand);
}
});

View File

@ -1,22 +0,0 @@
<div class="modal-content">
<div class="history-detail-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>
{{#if_eq eventType compare="grabbed"}}Grabbed{{/if_eq}}
{{#if_eq eventType compare="downloadFailed"}}Download Failed{{/if_eq}}
{{#if_eq eventType compare="downloadFolderImported"}}Movie Imported{{/if_eq}}
{{#if_eq eventType compare="movieFileDeleted"}}Movie File Deleted{{/if_eq}}
</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
{{#if_eq eventType compare="grabbed"}}<button class="btn btn-danger x-mark-as-failed">Mark As Failed</button>{{/if_eq}}
<button class="btn" data-dismiss="modal">Close</button>
</div>
</div>
</div>

View File

@ -1,6 +0,0 @@
var Marionette = require('marionette');
require('./HistoryDetailsAge');
module.exports = Marionette.ItemView.extend({
template : 'Activity/History/Details/HistoryDetailsViewTemplate'
});

View File

@ -1,103 +0,0 @@
{{#if_eq eventType compare="grabbed"}}
<dl class="dl-horizontal info">
<dt>Name:</dt>
<dd>{{sourceTitle}}</dd>
{{#with data}}
{{#if indexer}}
<dt>Indexer:</dt>
<dd>{{indexer}}</dd>
{{/if}}
{{#if releaseGroup}}
<dt>Release Group:</dt>
<dd>{{releaseGroup}}</dd>
{{/if}}
{{#if nzbInfoUrl}}
<dt>Info:</dt>
<dd><a href="{{nzbInfoUrl}}">{{nzbInfoUrl}}</a></dd>
{{/if}}
{{#if downloadClient}}
<dt>Download Client:</dt>
<dd>{{downloadClient}}</dd>
{{/if}}
{{#if downloadId}}
<dt>Grab ID:</dt>
<dd>{{downloadId}}</dd>
{{/if}}
{{#if age}}
{{historyAge}}
{{/if}}
{{#if publishedDate}}
<dt>Published Date:</dt>
<dd>{{ShortDate publishedDate}} {{LTS publishedDate}}</dd>
{{/if}}
{{/with}}
</dl>
{{/if_eq}}
{{#if_eq eventType compare="downloadFailed"}}
<dl class="dl-horizontal">
<dt>Name:</dt>
<dd>{{sourceTitle}}</dd>
{{#with data}}
<dt>Message:</dt>
<dd>{{message}}</dd>
{{/with}}
</dl>
{{/if_eq}}
{{#if_eq eventType compare="downloadFolderImported"}}
<dl class="dl-horizontal">
{{#if sourceTitle}}
<dt>Name:</dt>
<dd>{{sourceTitle}}</dd>
{{/if}}
{{#with data}}
{{#if droppedPath}}
<dt>Source:</dt>
<dd>{{droppedPath}}</dd>
{{/if}}
{{#if importedPath}}
<dt>Imported To:</dt>
<dd>{{importedPath}}</dd>
{{/if}}
{{/with}}
</dl>
{{/if_eq}}
{{#if_eq eventType compare="movieFileDeleted"}}
<dl class="dl-horizontal">
<dt>Path:</dt>
<dd>{{sourceTitle}}</dd>
{{#with data}}
<dt>Reason:</dt>
<dd>
{{#if_eq reason compare="Manual"}}
File was deleted by via UI
{{/if_eq}}
{{#if_eq reason compare="MissingFromDisk"}}
Radarr was unable to find the file on disk so it was removed
{{/if_eq}}
{{#if_eq reason compare="Upgrade"}}
File was deleted to import an upgrade
{{/if_eq}}
</dd>
{{/with}}
</dl>
{{/if_eq}}

View File

@ -1,87 +0,0 @@
var HistoryModel = require('./HistoryModel');
var PageableCollection = require('backbone.pageable');
var AsFilteredCollection = require('../../Mixins/AsFilteredCollection');
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
var AsPersistedStateCollection = require('../../Mixins/AsPersistedStateCollection');
var Collection = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/history',
model : HistoryModel,
state : {
pageSize : 15,
sortKey : 'date',
order : 1
},
queryParams : {
totalPages : null,
totalRecords : null,
pageSize : 'pageSize',
sortKey : 'sortKey',
order : 'sortDir',
directions : {
'-1' : 'asc',
'1' : 'desc'
}
},
filterModes : {
'all' : [
null,
null
],
'grabbed' : [
'eventType',
'1'
],
'imported' : [
'eventType',
'3'
],
'failed' : [
'eventType',
'4'
],
'deleted' : [
'eventType',
'6'
]
},
sortMappings : {
'movie' : { sortKey : 'movie.title' }
},
initialize : function(options) {
delete this.queryParams.episodeId;
delete this.queryParams.movieId;
if (options) {
if (options.episodeId) {
this.queryParams.episodeId = options.episodeId;
}
if (options.movieId) {
this.queryParams.movieId = options.movieId;
}
}
},
parseState : function(resp) {
return { totalRecords : resp.totalRecords };
},
parseRecords : function(resp) {
if (resp) {
return resp.records;
}
return resp;
}
});
Collection = AsFilteredCollection.call(Collection);
Collection = AsSortedCollection.call(Collection);
Collection = AsPersistedStateCollection.call(Collection);
module.exports = Collection;

View File

@ -1,21 +0,0 @@
var vent = require('vent');
var NzbDroneCell = require('../../Cells/NzbDroneCell');
module.exports = NzbDroneCell.extend({
className : 'history-details-cell',
events : {
'click' : '_showDetails'
},
render : function() {
this.$el.empty();
this.$el.html('<i class="icon-radarr-info"></i>');
return this;
},
_showDetails : function() {
vent.trigger(vent.Commands.ShowHistoryDetails, { model : this.model });
}
});

View File

@ -1,140 +0,0 @@
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var HistoryCollection = require('./HistoryCollection');
var EventTypeCell = require('../../Cells/EventTypeCell');
var MovieTitleCell = require('../../Cells/MovieTitleCell');
var HistoryQualityCell = require('./HistoryQualityCell');
var RelativeDateCell = require('../../Cells/RelativeDateCell');
var HistoryDetailsCell = require('./HistoryDetailsCell');
var GridPager = require('../../Shared/Grid/Pager');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
var LoadingView = require('../../Shared/LoadingView');
module.exports = Marionette.Layout.extend({
template : 'Activity/History/HistoryLayoutTemplate',
regions : {
history : '#x-history',
toolbar : '#x-history-toolbar',
pager : '#x-history-pager'
},
columns : [
{
name : 'eventType',
label : '',
cell : EventTypeCell,
cellValue : 'this'
},
{
name : 'movie',
label : 'Movie Title',
cell : MovieTitleCell,
},
{
name : 'this',
label : 'Quality',
cell : HistoryQualityCell,
sortable : false
},
{
name : 'date',
label : 'Date',
cell : RelativeDateCell
},
{
name : 'this',
label : '',
cell : HistoryDetailsCell,
sortable : false
}
],
initialize : function() {
this.collection = new HistoryCollection({ tableName : 'history' });
this.listenTo(this.collection, 'sync', this._showTable);
},
onShow : function() {
this.history.show(new LoadingView());
this._showToolbar();
},
_showTable : function(collection) {
this.history.show(new Backgrid.Grid({
columns : this.columns,
collection : collection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection : collection
}));
},
_showToolbar : function() {
var filterOptions = {
type : 'radio',
storeState : true,
menuKey : 'history.filterMode',
defaultAction : 'all',
items : [
{
key : 'all',
title : '',
tooltip : 'All',
icon : 'icon-radarr-all',
callback : this._setFilter
},
{
key : 'grabbed',
title : '',
tooltip : 'Grabbed',
icon : 'icon-radarr-downloading',
callback : this._setFilter
},
{
key : 'imported',
title : '',
tooltip : 'Imported',
icon : 'icon-radarr-imported',
callback : this._setFilter
},
{
key : 'failed',
title : '',
tooltip : 'Failed',
icon : 'icon-radarr-download-failed',
callback : this._setFilter
},
{
key : 'deleted',
title : '',
tooltip : 'Deleted',
icon : 'icon-radarr-deleted',
callback : this._setFilter
}
]
};
this.toolbar.show(new ToolbarLayout({
right : [
filterOptions
],
context : this
}));
},
_setFilter : function(buttonContext) {
var mode = buttonContext.model.get('key');
this.collection.state.currentPage = 1;
var promise = this.collection.setFilterMode(mode);
if (buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
}
});

View File

@ -1,11 +0,0 @@
<div id="x-history-toolbar"/>
<div class="row">
<div class="col-md-12">
<div id="x-history" class="table-responsive"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="x-history-pager"/>
</div>
</div>

View File

@ -1,12 +0,0 @@
var Backbone = require('backbone');
var MovieModel = require('../../Movies/MovieModel');
module.exports = Backbone.Model.extend({
parse : function(model) {
if (model.movie) {
model.movie = new MovieModel(model.movie);
}
return model;
}
});

View File

@ -1,42 +0,0 @@
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var _ = require('underscore');
module.exports = NzbDroneCell.extend({
className : 'history-quality-cell',
render : function() {
var title = '';
var quality = this.model.get('quality');
var revision = quality.revision;
if (revision.real && revision.real > 0) {
title += ' REAL';
}
if (revision.version && revision.version > 1) {
title += ' PROPER';
}
title = title.trim();
var html = '';
if (this.model.get('qualityCutoffNotMet')) {
html = '<span class="badge badge-inverse" title="{0}">{1}</span>'.format(title, quality.quality.name);
} else {
html = '<span class="badge" title="{0}">{1}</span>'.format(title, quality.quality.name);
}
if (quality.customFormats.length > 0){
var formatNames = _.map(quality.customFormats, function(format) {
return format.name;
});
html += ' <span class="badge badge-success" title="Custom Formats">{0}</span>'.format(formatNames.join(", "));
}
this.$el.html(html);
return this;
}
});

View File

@ -1,23 +0,0 @@
var NzbDroneCell = require('../../Cells/NzbDroneCell');
module.exports = NzbDroneCell.extend({
className : 'progress-cell',
render : function() {
this.$el.empty();
if (this.cellValue) {
var status = this.model.get('status').toLowerCase();
if (status === 'downloading') {
var progress = 100 - (this.model.get('sizeleft') / this.model.get('size') * 100);
this.$el.html('<div class="progress" title="{0}%">'.format(progress.toFixed(1)) +
'<div class="progress-bar progress-bar-purple" style="width: {0}%;"></div></div>'.format(progress));
}
}
return this;
}
});

View File

@ -1,59 +0,0 @@
'use strict';
var $ = require('jquery');
var _ = require('underscore');
var vent = require('../../vent');
var TemplatedCell = require('../../Cells/TemplatedCell');
var RemoveFromQueueView = require('./RemoveFromQueueView');
module.exports = TemplatedCell.extend({
template : 'Activity/Queue/QueueActionsCellTemplate',
className : 'queue-actions-cell',
events : {
'click .x-remove' : '_remove',
'click .x-manual-import' : '_manualImport',
'click .x-grab' : '_grab'
},
ui : {
import : '.x-import',
grab : '.x-grab'
},
_remove : function() {
var showBlacklist = this.model.get('status') !== 'Pending';
vent.trigger(vent.Commands.OpenModalCommand, new RemoveFromQueueView({
model : this.model,
showBlacklist : showBlacklist
}));
},
_manualImport : function () {
vent.trigger(vent.Commands.ShowManualImport,
{
downloadId: this.model.get('downloadId'),
title: this.model.get('title')
});
},
_grab : function() {
var self = this;
var data = _.omit(this.model.toJSON(), 'series', 'episode');
var promise = $.ajax({
url : window.NzbDrone.ApiRoot + '/queue/grab',
type : 'POST',
data : JSON.stringify(data)
});
this.$(this.ui.grab).spinForPromise(promise);
promise.success(function() {
//find models that have the same series id and episode ids and remove them
self.model.trigger('destroy', self.model);
});
}
});

View File

@ -1,12 +0,0 @@
{{#if_eq status compare="Completed"}}
{{#if_eq trackedDownloadStatus compare="Warning"}}
<i class="icon-radarr-import-manual x-manual-import" title="Manual import"></i>
{{/if_eq}}
{{/if_eq}}
{{#if_eq status compare="Pending"}}
<i class="icon-radarr-download x-grab" title="Add to download queue (Override Delay Profile)"></i>
<i class="icon-radarr-delete x-remove" title="Remove pending release"></i>
{{else}}
<i class="icon-radarr-delete x-remove" title="Remove from download client"></i>
{{/if_eq}}

View File

@ -1,71 +0,0 @@
var _ = require('underscore');
var PageableCollection = require('backbone.pageable');
//var PageableCollection = require('../../Shared/Grid/SonarrPageableCollection');
var QueueModel = require('./QueueModel');
var FormatHelpers = require('../../Shared/FormatHelpers');
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
var AsPageableCollection = require('../../Mixins/AsPageableCollection');
var moment = require('moment');
require('../../Mixins/backbone.signalr.mixin');
var QueueCollection = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/queue',
model : QueueModel,
state : {
pageSize : 15,
sortKey: 'timeleft'
},
mode : 'client',
findMovie : function(movieId) {
return _.find(this.fullCollection.models, function(queueModel) {
return queueModel.get('movie').id === movieId;
});
},
sortMappings : {
movie : {
sortValue : function(model, attr) {
var movie = model.get(attr);
return movie.get('sortTitle');
}
},
timeleft : {
sortValue : function(model, attr) {
var eta = model.get('estimatedCompletionTime');
if (eta) {
return moment(eta).unix();
}
return Number.MAX_VALUE;
}
},
sizeleft : {
sortValue : function(model, attr) {
var size = model.get('size');
var sizeleft = model.get('sizeleft');
if (size && sizeleft) {
return sizeleft / size;
}
return 0;
}
}
}
});
QueueCollection = AsSortedCollection.call(QueueCollection);
QueueCollection = AsPageableCollection.call(QueueCollection);
var collection = new QueueCollection().bindSignalR();
collection.fetch();
module.exports = collection;

View File

@ -1,84 +0,0 @@
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var QueueCollection = require('./QueueCollection');
var MovieTitleCell = require('../../Cells/MovieTitleCell');
var QualityCell = require('../../Cells/QualityCell');
var QueueStatusCell = require('./QueueStatusCell');
var QueueActionsCell = require('./QueueActionsCell');
var TimeleftCell = require('./TimeleftCell');
var ProgressCell = require('./ProgressCell');
var ProtocolCell = require('../../Release/ProtocolCell');
var GridPager = require('../../Shared/Grid/Pager');
module.exports = Marionette.Layout.extend({
template : 'Activity/Queue/QueueLayoutTemplate',
regions : {
table : '#x-queue',
pager : '#x-queue-pager'
},
columns : [
{
name : 'status',
label : '',
cell : QueueStatusCell,
cellValue : 'this'
},
{
name : 'movie',
label : 'Movie',
cell : MovieTitleCell
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
sortable : false
},
{
name : 'protocol',
label : 'Protocol',
cell : ProtocolCell
},
{
name : 'timeleft',
label : 'Time Left',
cell : TimeleftCell,
cellValue : 'this'
},
{
name : 'sizeleft',
label : 'Progress',
cell : ProgressCell,
cellValue : 'this'
},
{
name : 'status',
label : '',
cell : QueueActionsCell,
cellValue : 'this'
}
],
initialize : function() {
this.listenTo(QueueCollection, 'sync', this._showTable);
},
onShow : function() {
this._showTable();
},
_showTable : function() {
this.table.show(new Backgrid.Grid({
columns : this.columns,
collection : QueueCollection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection : QueueCollection
}));
}
});

View File

@ -1,11 +0,0 @@
<div class="row">
<div class="col-md-12">
<div id="x-queue" class="queue table-responsive"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="x-queue-pager"/>
</div>
</div>

View File

@ -1,9 +0,0 @@
var Backbone = require('backbone');
var MovieModel = require('../../Movies/MovieModel');
module.exports = Backbone.Model.extend({
parse : function(model) {
model.movie = new MovieModel(model.movie);
return model;
}
});

View File

@ -1,81 +0,0 @@
var Marionette = require('marionette');
var NzbDroneCell = require('../../Cells/NzbDroneCell');
module.exports = NzbDroneCell.extend({
className : 'queue-status-cell',
template : 'Activity/Queue/QueueStatusCellTemplate',
render : function() {
this.$el.empty();
if (this.cellValue) {
var status = this.cellValue.get('status').toLowerCase();
var trackedDownloadStatus = this.cellValue.has('trackedDownloadStatus') ? this.cellValue.get('trackedDownloadStatus').toLowerCase() : 'ok';
var icon = 'icon-radarr-downloading';
var title = 'Downloading';
var itemTitle = this.cellValue.get('title');
var content = itemTitle;
if (status === 'paused') {
icon = 'icon-radarr-paused';
title = 'Paused';
}
if (status === 'queued') {
icon = 'icon-radarr-queued';
title = 'Queued';
}
if (status === 'completed') {
icon = 'icon-radarr-downloaded';
title = 'Downloaded';
}
if (status === 'pending') {
icon = 'icon-radarr-pending';
title = 'Pending';
}
if (status === 'failed') {
icon = 'icon-radarr-download-failed';
title = 'Download failed';
}
if (status === 'warning') {
icon = 'icon-radarr-download-warning';
title = 'Download warning: check download client for more details';
}
if (trackedDownloadStatus === 'warning') {
icon += ' icon-radarr-warning';
this.templateFunction = Marionette.TemplateCache.get(this.template);
content = this.templateFunction(this.cellValue.toJSON());
}
if (trackedDownloadStatus === 'error') {
if (status === 'completed') {
icon = 'icon-radarr-import-failed';
title = 'Import failed: ' + itemTitle;
} else {
icon = 'icon-radarr-download-failed';
title = 'Download failed';
}
this.templateFunction = Marionette.TemplateCache.get(this.template);
content = this.templateFunction(this.cellValue.toJSON());
}
this.$el.html('<i class="{0}"></i>'.format(icon));
this.$el.popover({
content : content,
html : true,
trigger : 'hover',
title : title,
placement : 'right',
container : this.$el
});
}
return this;
}
});

View File

@ -1,8 +0,0 @@
{{#each statusMessages}}
{{title}}
<ul>
{{#each messages}}
<li>{{this}}</li>
{{/each}}
</ul>
{{/each}}

View File

@ -1,40 +0,0 @@
var _ = require('underscore');
var Marionette = require('marionette');
var QueueCollection = require('./QueueCollection');
module.exports = Marionette.ItemView.extend({
tagName : 'span',
initialize : function() {
this.listenTo(QueueCollection, 'sync', this.render);
QueueCollection.fetch();
},
render : function() {
this.$el.empty();
if (QueueCollection.length === 0) {
return this;
}
var count = QueueCollection.fullCollection.length;
var label = 'label-info';
var errors = QueueCollection.fullCollection.some(function(model) {
return model.has('trackedDownloadStatus') && model.get('trackedDownloadStatus').toLowerCase() === 'error';
});
var warnings = QueueCollection.fullCollection.some(function(model) {
return model.has('trackedDownloadStatus') && model.get('trackedDownloadStatus').toLowerCase() === 'warning';
});
if (errors) {
label = 'label-danger';
} else if (warnings) {
label = 'label-warning';
}
this.$el.html('<span class="label {0}">{1}</span>'.format(label, count));
return this;
}
});

View File

@ -1,34 +0,0 @@
var vent = require('../../vent');
var Marionette = require('marionette');
module.exports = Marionette.ItemView.extend({
template : 'Activity/Queue/RemoveFromQueueViewTemplate',
events : {
'click .x-confirm-remove' : 'removeItem'
},
ui : {
blacklist : '.x-blacklist',
indicator : '.x-indicator'
},
initialize : function(options) {
this.templateHelpers = {
showBlacklist : options.showBlacklist
};
},
removeItem : function() {
var blacklist = this.ui.blacklist.prop('checked') || false;
this.ui.indicator.show();
this.model.destroy({
data : { 'blacklist' : blacklist },
wait : true
}).done(function() {
vent.trigger(vent.Commands.CloseModalCommand);
});
}
});

View File

@ -1,49 +0,0 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{{title}}</h3>
</div>
<div class="modal-body remove-from-queue-modal">
<div class="row">
<div class="col-sm-12">
Are you sure you want to remove '{{title}}'?
</div>
</div>
{{#if showBlacklist}}
<div class="row">
<div class="col-sm-12">
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-4 control-label">Blacklist release</label>
<div class="col-sm-8">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" class="x-blacklist"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn slide-button btn-danger"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-radarr-form-info" title="Do you want to blacklist this release?"/>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
{{/if}}
</div>
<div class="modal-footer">
<span class="indicator x-indicator"><i class="icon-radarr-spinner fa-spin"></i></span>
<button class="btn" data-dismiss="modal">Cancel</button>
<button class="btn btn-danger x-confirm-remove">Remove</button>
</div>
</div>

View File

@ -1,33 +0,0 @@
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var moment = require('moment');
var UiSettingsModel = require('../../Shared/UiSettingsModel');
var FormatHelpers = require('../../Shared/FormatHelpers');
module.exports = NzbDroneCell.extend({
className : 'timeleft-cell',
render : function() {
this.$el.empty();
if (this.cellValue) {
if (this.cellValue.get('status').toLowerCase() === 'pending') {
var ect = this.cellValue.get('estimatedCompletionTime');
var time = '{0} at {1}'.format(FormatHelpers.relativeDate(ect), moment(ect).format(UiSettingsModel.time(true, false)));
this.$el.html('<div title="Delaying download till {0}">-</div>'.format(time));
return this;
}
var timeleft = this.cellValue.get('timeleft');
var totalSize = FormatHelpers.bytes(this.cellValue.get('size'), 2);
var remainingSize = FormatHelpers.bytes(this.cellValue.get('sizeleft'), 2);
if (timeleft === undefined) {
this.$el.html('-');
} else {
this.$el.html('<span title="{1} / {2}">{0}</span>'.format(timeleft, remainingSize, totalSize));
}
}
return this;
}
});

View File

@ -1,26 +0,0 @@
.queue-status-cell .popover {
max-width : 800px;
}
.queue {
.protocol-cell {
text-align : center;
width : 80px;
}
.episode-number-cell {
min-width : 90px;
}
}
.remove-from-queue-modal {
.form-horizontal {
margin-top : 20px;
}
}
.history-detail-modal {
.info {
word-wrap: break-word;
}
}

View File

@ -1,22 +0,0 @@
var Backbone = require('backbone');
var MovieModel = require('../Movies/MovieModel');
var _ = require('underscore');
module.exports = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/movie/lookup',
model : MovieModel,
parse : function(response) {
var self = this;
_.each(response, function(model) {
model.id = undefined;
if (self.unmappedFolderModel) {
model.path = self.unmappedFolderModel.get('folder').path;
}
});
return response;
}
});

View File

@ -1,95 +0,0 @@
var vent = require('vent');
var AppLayout = require('../AppLayout');
var Marionette = require('marionette');
var RootFolderLayout = require('./RootFolders/RootFolderLayout');
var ExistingMoviesCollectionView = require('./Existing/AddExistingMovieCollectionView');
var AddMoviesView = require('./AddMoviesView');
var ProfileCollection = require('../Profile/ProfileCollection');
var AddFromListView = require("./List/AddFromListView");
var RootFolderCollection = require('./RootFolders/RootFolderCollection');
var BulkImportView = require("./BulkImport/BulkImportView");
var DiscoverMoviesCollection = require("./DiscoverMoviesCollection");
require('../Movies/MoviesCollection');
module.exports = Marionette.Layout.extend({
template : 'AddMovies/AddMoviesLayoutTemplate',
regions : {
workspace : '#add-movies-workspace',
},
ui : {
$existing : '#show-existing-movies-toggle'
},
events : {
'click .x-discover' : '_discoverMovies',
'click .x-bulk-import' : '_bulkImport',
'click .x-add-new' : '_addMovies',
"click .x-add-lists" : "_addFromList",
'click .x-show-existing' : '_toggleExisting'
},
attributes : {
id : 'add-movies-screen'
},
initialize : function(options) {
ProfileCollection.fetch();
RootFolderCollection.fetch().done(function() {
RootFolderCollection.synced = true;
});
if (options.action === "search") {
this._addMovies(options);
}
},
_toggleExisting : function(e) {
var showExisting = e.target.checked;
vent.trigger(vent.Commands.ShowExistingCommand, {
showExisting: showExisting
});
},
onShow : function() {
this.workspace.show(new AddMoviesView(this.options));
this.ui.$existing.hide();
},
_folderSelected : function(options) {
vent.trigger(vent.Commands.CloseModalCommand);
//this.ui.$existing.show();
this.workspace.show(new ExistingMoviesCollectionView({ model : options.model }));
},
_bulkFolderSelected : function(options) {
vent.trigger(vent.Commands.CloseModalCommand);
this.workspace.show(new BulkImportView({ model : options.model}));
},
_discoverMovies : function(options) {
options = options || {};
options.action = "discover";
options.collection = new DiscoverMoviesCollection();
this.workspace.show(new AddMoviesView(options));
},
_addMovies : function(options) {
this.workspace.show(new AddMoviesView(options));
},
_addFromList : function() {
//this.ui.$existing.hide();
this.workspace.show(new AddFromListView());
},
_bulkImport : function() {
this.bulkRootFolderLayout = new RootFolderLayout();
this.listenTo(this.bulkRootFolderLayout, 'folderSelected', this._bulkFolderSelected);
AppLayout.modalRegion.show(this.bulkRootFolderLayout);
}
});

View File

@ -1,56 +0,0 @@
<div class="row">
<div class="col-md-12">
<div class="btn-group add-movies-btn-group btn-group-lg btn-block btn-group-collapse">
<button class="btn btn-default col-md-3 col-xs-12 x-bulk-import">
<i class="icon-radarr-view-list hidden-xs" aria-hidden="true"></i>
Bulk Import Movies
</button>
<button type="button" class="btn btn-default col-md-4 col-xs-12 add-movies-import-btn x-discover">
<i class="icon-radarr-star hidden-xs" aria-hidden="true"></i>
Discover New movies
</button>
<button class="btn btn-default col-md-2 col-xs-12 x-add-new">
<i class="icon-radarr-active hidden-xs" aria-hidden="true"></i>
Add New Movie
</button>
<button class="btn btn-default col-md-3 col-xs-12 x-add-lists">
<i class="icon-radarr-active hidden-xs" aria-hidden="true"></i>
Add Movies from Lists
</button>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-horizontal" style="margin-top: 15px;">
<div id="show-existing-movies-toggle">
<div class="form-group" style="margin-bottom: 0px;">
<label class="col-sm-3 control-label">Display Existing Movies</label>
<div class="col-sm-8">
<div class="input-group">
<label class="checkbox toggle well">
<input class="x-show-existing" type="checkbox" checked="checked" name="showExisting"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-radarr-form-info" title="Should Radarr display movies already in your collection?"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="add-movies-workspace"></div>
</div>
</div>

View File

@ -1,307 +0,0 @@
var _ = require('underscore');
var $ = require('jquery');
var vent = require('vent');
var Marionette = require('marionette');
var AddMoviesCollection = require('./AddMoviesCollection');
var AddFromListCollection = require('./List/AddFromListCollection');
var SearchResultCollectionView = require('./SearchResultCollectionView');
var DiscoverableListDropdownView = require("./DiscoverableListDropdownView");
var DiscoverableListCollection = require("./DiscoverableListCollection");
var DiscoverMoviesCollection = require("./DiscoverMoviesCollection");
var EmptyView = require('./EmptyView');
var NotFoundView = require('./NotFoundView');
var DiscoverEmptyView = require('./DiscoverEmptyView');
var ErrorView = require('./ErrorView');
var LoadingView = require('../Shared/LoadingView');
var FullMovieCollection = require("../Movies/FullMovieCollection");
module.exports = Marionette.Layout.extend({
template : 'AddMovies/AddMoviesViewTemplate',
regions : {
myRegion : '#my-region',
searchResult : '#search-result',
},
ui : {
moviesSearch : '.x-movies-search',
searchBar : '.x-search-bar',
loadMore : '.x-load-more',
discoverHeader : ".x-discover-header",
discoverBefore : ".x-discover-before",
discoverRecos : ".x-recommendations-tab",
discoverPopular : ".x-popular-tab" ,
discoverUpcoming : ".x-upcoming-tab",
discoverLists : ".x-lists-tab"
},
events : {
'click .x-load-more' : '_onLoadMore',
"click .x-recommendations-tab" : "_discoverRecos",
"click .x-popular-tab" : "_discoverPopular",
"click .x-upcoming-tab" : "_discoverUpcoming",
"click .x-lists-tab" : "_discoverLists",
"click .discoverable-list-item" : "_discoverList"
},
initialize : function(options) {
this.isExisting = options.isExisting;
this.collection = options.collection || new AddMoviesCollection();
if (this.isExisting) {
this.collection.unmappedFolderModel = this.model;
}
if (this.isExisting) {
this.className = 'existing-movies';
} else {
this.className = 'new-movies';
}
this.listenTo(vent, vent.Events.MoviesAdded, this._onMoviesAdded);
this.listenTo(this.collection, 'sync', this._showResults);
this.resultCollectionView = new SearchResultCollectionView({
collection : this.collection,
isExisting : this.isExisting
});
/*this.listsDropdown = new DiscoverableListCollectionView({
collection : DiscoverableListCollection
});*/
this.listenTo(DiscoverableListCollection, 'sync', this._showListDropdown);
/*this.listsDropdown = new DiscoverableListCollectionView({
collection : DiscoverableListCollection
})*/
this.throttledSearch = _.debounce(this.search, 1000, { trailing : true }).bind(this);
if (options.action === "search") {
this.search({term: options.query});
} else if (options.action === "discover") {
this.isDiscover = true;
}
},
onRender : function() {
var self = this;
this.$el.addClass(this.className);
this.ui.moviesSearch.on('input', function(e) {
if (_.contains([
9,
16,
17,
18,
19,
20,
33,
34,
35,
36,
37,
38,
39,
40,
91,
92,
93
], e.keyCode)) {
return;
}
self._abortExistingSearch();
self.throttledSearch({
term : self.ui.moviesSearch.val()
});
});
this._clearResults();
if (this.isExisting) {
this.ui.searchBar.hide();
}
if (this.isDiscover) {
this.ui.searchBar.hide();
this._discoverRecos();
/*if (this.collection.length == 0) {
this.searchResult.show(new LoadingView());
}*/
}
},
onShow : function() {
this.ui.discoverBefore.hide();
this.ui.moviesSearch.focus();
this.ui.loadMore.hide();
this._showListDropdown();
if (this.isDiscover) {
this.ui.discoverBefore.show();
}
},
search : function(options) {
var self = this;
this.collection.reset();
if (!options.term || options.term === this.collection.term) {
return Marionette.$.Deferred().resolve();
}
this.searchResult.show(new LoadingView());
this.collection.term = options.term;
this.currentSearchPromise = this.collection.fetch({
data : { term : options.term }
});
this.currentSearchPromise.fail(function() {
self._showError();
});
return this.currentSearchPromise;
},
_onMoviesAdded : function(options) {
if (this.isExisting && options.movie.get('path') === this.model.get('folder').path) {
this.close();
}
else if (!this.isExisting) {
this.resultCollectionView.setExisting(options.movie.get('tmdbId'));
/*this.collection.term = '';
this.collection.reset();
this._clearResults();
this.ui.moviesSearch.val('');
this.ui.moviesSearch.focus();*/ //TODO: Maybe add option wheter to clear search result.
}
},
_onLoadMore : function() {
var showingAll = this.resultCollectionView.showMore();
if (!this.isDiscover) {
this.ui.searchBar.show();
}
if (showingAll) {
this.ui.loadMore.hide();
}
},
_clearResults : function() {
if (!this.isExisting) {
this.searchResult.show(new EmptyView());
} else {
this.searchResult.close();
}
},
_showResults : function() {
if (!this.isClosed) {
if (this.collection.length === 0) {
this.ui.loadMore.hide();
if (this.isDiscover) {
this.searchResult.show(new DiscoverEmptyView());
} else {
this.ui.searchBar.show();
this.searchResult.show(new NotFoundView({ term : this.collection.term }));
}
} else {
this.searchResult.show(this.resultCollectionView);
if (!this.showingAll) {
this.ui.loadMore.show();
}
}
}
},
_showListDropdown : function() {
this.listsDropdown = new DiscoverableListDropdownView(DiscoverableListCollection.toJSON());
this.listsDropdown.render();
$("#list-dropdown").html(this.listsDropdown.$el.html());
//this.myRegion.show(new DiscoverableListDropdownView(DiscoverableListCollection.toJSON()));
},
_abortExistingSearch : function() {
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
console.log('aborting previous pending search request.');
this.currentSearchPromise.abort();
} else {
this._clearResults();
}
},
_showError : function() {
if (!this.isClosed) {
this.ui.searchBar.show();
this.searchResult.show(new ErrorView({ term : this.collection.term }));
this.collection.term = '';
}
},
_discover : function(action) {
if (this.collection.action === action) {
return;
}
if (this.collection.specialProperty === "special") {
this.collection.reset();
this.collection = new DiscoverMoviesCollection();
this.resultCollectionView.collection = this.collection;
}
this.listenTo(this.collection, 'sync', this._showResults);
this.searchResult.show(new LoadingView());
this.collection.action = action;
this.currentSearchPromise = this.collection.fetch();
},
_discoverRecos : function() {
this.ui.discoverRecos.tab("show");
this.ui.discoverHeader.html("Recommendations by The Movie Database for you");
this._discover("recommendations");
},
_discoverPopular : function() {
this.ui.discoverPopular.tab("show");
this.ui.discoverHeader.html("Currently Popular Movies");
this._discover("popular");
},
_discoverUpcoming : function() {
this.ui.discoverUpcoming.tab("show");
this.ui.discoverHeader.html("Movies coming to Blu-Ray in the next weeks");
this._discover("upcoming");
},
_discoverLists : function() {
/*this.ui.discoverLists.tab("show");
this.ui.discoverHeader.html("");*/
},
_discoverList : function(options) {
this.ui.discoverLists.tab("show");
this.ui.discoverHeader.html("Showing movies from list: "+options.target.textContent);
this.collection.reset();
this.collection = new AddFromListCollection();
this.listenTo(this.collection, 'sync', this._showResults);
this.searchResult.show(new LoadingView());
this.currentSearchPromise = this.collection.fetch({ data: { listId: options.target.value } });
this.resultCollectionView.collection = this.collection;
}
});

View File

@ -1,43 +0,0 @@
{{#if folder.path}}
<div class="unmapped-folder-path">
<div class="col-md-12">
{{folder.path}}
</div>
</div>{{/if}}
<div class="x-discover-before">
<ul class="nav nav-tabs nav-justified settings-tabs">
<li><a href="#media-management" class="x-recommendations-tab no-router">Recommendations</a></li>
<li><a href="#popular" class="x-popular-tab no-router">Popular</a></li>
<li><a href="#upcoming" class="x-upcoming-tab no-router">Upcoming</a></li>
<li role="presentation" class="dropdown">
<a class="dropdown-toggle x-lists-tab" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Lists <span class="caret"></span>
</a>
<ul id="list-dropdown" class="dropdown-menu">
</ul>
</li>
</ul>
<h2 class="x-discover-header">
Recommendations by The Movie Database based on your library:
</h2>
</div>
<div class="x-search-bar">
<div class="input-group input-group-lg add-movies-search">
<span class="input-group-addon"><i class="icon-radarr-search"/></span>
{{#if folder}}
<input type="text" class="form-control x-movies-search" value="{{folder.name}}">
{{else}}
<input type="text" class="form-control x-movies-search" placeholder="Start typing the name of the movie you want to add ...">
{{/if}}
</div>
</div>
<div class="row">
<div id="search-result" class="result-list col-md-12"/>
</div>
<div class="btn btn-block text-center new-movies-loadmore x-load-more" style="display: none;">
<i class="icon-radarr-load-more"/>
more
</div>

View File

@ -1,91 +0,0 @@
var _ = require('underscore');
var PageableCollection = require('backbone.pageable');
var MovieModel = require('../../Movies/MovieModel');
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
var AsPageableCollection = require('../../Mixins/AsPageableCollection');
var AsPersistedStateCollection = require('../../Mixins/AsPersistedStateCollection');
var BulkImportCollection = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/movies/bulkimport',
model : MovieModel,
mode: "infinite",
tableName : 'bulkimport',
state : {
pageSize : 15,
sortKey: 'sortTitle',
firstPage: 1
},
queryParams: {
totalPages: null,
totalRecords: null,
sortKey: "sort",
order: "direction",
directions: {
"-1": "asc",
"1": "desc"
}
},
// queryParams : {
// totalPages : null,
// totalRecords : null,
// pageSize : 'pageSize',
// sortKey : 'sortKey'
// },
/*parse : function(response) {
var self = this;
_.each(response.records, function(model) {
model.id = undefined;
});
return response;
},*/
parseState : function(resp) {
return { totalRecords : resp.totalRecords };
},
parseRecords : function(resp) {
if (resp) {
return resp.records;
}
return resp;
},
fetch : function(options) {
options = options || {};
var data = options.data || {};
if (data.id === undefined || data.folder === undefined) {
data.id = this.folderId;
data.folder = this.folder;
}
options.data = data;
return PageableCollection.prototype.fetch.call(this, options);
},
parseLinks : function(options) {
console.log(options);
return {
first : this.url,
next: this.url,
last : this.url
};
}
});
BulkImportCollection = AsSortedCollection.call(BulkImportCollection);
BulkImportCollection = AsPageableCollection.call(BulkImportCollection);
BulkImportCollection = AsPersistedStateCollection.call(BulkImportCollection);
module.exports = BulkImportCollection;

View File

@ -1,80 +0,0 @@
var Backgrid = require('backgrid');
var Config = require('../../Config');
var _ = require('underscore');
var vent = require("vent");
var TemplatedCell = require('../../Cells/TemplatedCell');
var NzbDroneCell = require("../../Cells/NzbDroneCell");
var Marionette = require('marionette');
module.exports = TemplatedCell.extend({
className : 'monitor-cell',
template : 'AddMovies/BulkImport/BulkImportMonitorCell',
_orig : TemplatedCell.prototype.initialize,
_origRender : TemplatedCell.prototype.initialize,
ui : {
monitor : ".x-monitor",
},
events: { "change .x-monitor" : "_monitorChanged" },
initialize : function () {
this._orig.apply(this, arguments);
this.listenTo(vent, Config.Events.ConfigUpdatedEvent, this._onConfigUpdated);
this.defaultMonitor = Config.getValue(Config.Keys.MonitorEpisodes, 'all');
this.model.set('monitored', this._convertMonitorToBool(this.defaultMonitor));
this.$el.find('.x-monitor').val(this.defaultMonitor);
// this.ui.monitor.val(this.defaultProfile);//this.ui.profile.val(this.defaultProfile);
// this.model.set("profileId", this.defaultProfile);
// this.cellValue = ProfileCollection;
//this.render();
//this.listenTo(ProfileCollection, 'sync', this.render);
},
_convertMonitorToBool : function(monitorString) {
return monitorString === 'all' ? true : false;
},
_monitorChanged : function() {
Config.setValue(Config.Keys.MonitorEpisodes, this.$el.find('.x-monitor').val());
this.defaultMonitor = this.$el.find('.x-monitor').val();
this.model.set("monitored", this._convertMonitorToBool(this.$el.find('.x-monitor').val()));
},
_onConfigUpdated : function(options) {
if (options.key === Config.Keys.MonitorEpisodes) {
this.$el.find('.x-monitor').val(options.value);
}
},
render : function() {
var templateName = this.column.get('template') || this.template;
// this.cellValue = ProfileCollection;
this.templateFunction = Marionette.TemplateCache.get(templateName);
this.$el.empty();
if (this.cellValue) {
var data = this.cellValue.toJSON();
var html = this.templateFunction(data);
this.$el.html(html);
}
this.delegateEvents();
this.$el.find('.x-monitor').val(this.defaultMonitor);
return this;
}
});

View File

@ -1,4 +0,0 @@
<select class="col-md-2 form-control x-monitor">
<option value="all">Yes</option>
<option value="none">No</option>
</select>

View File

@ -1,21 +0,0 @@
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var BulkImportCollection = require("./BulkImportCollection");
module.exports = NzbDroneCell.extend({
className : 'movie-title-cell',
render : function() {
var collection = this.model.collection;
//this.listenTo(collection, 'sync', this._renderCell);
this._renderCell();
return this;
},
_renderCell : function() {
this.$el.empty();
this.$el.html('<a href="https://www.themoviedb.org/movie/' + this.cellValue.get('tmdbId') +'">' + this.cellValue.get('title') + ' (' + this.cellValue.get('year') + ')' +'</a>');
}
});

View File

@ -1,46 +0,0 @@
var Backgrid = require('backgrid');
var ProfileCollection = require('../../Profile/ProfileCollection');
var Config = require('../../Config');
var _ = require('underscore');
module.exports = Backgrid.SelectCell.extend({
className : 'profile-cell',
_orig : Backgrid.SelectCell.prototype.initialize,
initialize : function () {
this._orig.apply(this, arguments);
this.defaultProfile = Config.getValue(Config.Keys.DefaultProfileId);
if(ProfileCollection.get(this.defaultProfile))
{
this.profile = this.defaultProfile;
} else {
this.profile = ProfileCollection.get(1);
}
this.render();
//this.listenTo(ProfileCollection, 'sync', this.render);
},
optionValues : function() {
return _.map(ProfileCollection.models, function(model){
return [model.get("name"), model.get("id")+""];
});
}
/*render : function() {
this.$el.empty();
var profileId = this.model.get(this.column.get('name'));
var profile = _.findWhere(ProfileCollection.models, { id : profileId });
if (profile) {
this.$el.html(profile.get('name'));
}
return this;
}*/
});

View File

@ -1,82 +0,0 @@
var Backgrid = require('backgrid');
var ProfileCollection = require('../../Profile/ProfileCollection');
var Config = require('../../Config');
var _ = require('underscore');
var vent = require("vent");
var TemplatedCell = require('../../Cells/TemplatedCell');
var NzbDroneCell = require("../../Cells/NzbDroneCell");
var Marionette = require('marionette');
module.exports = TemplatedCell.extend({
className : 'profile-cell',
template : 'AddMovies/BulkImport/BulkImportProfileCell',
_orig : TemplatedCell.prototype.initialize,
_origRender : TemplatedCell.prototype.initialize,
ui : {
profile : ".x-profile",
},
events: { "change .x-profile" : "_profileChanged" },
initialize : function () {
this._orig.apply(this, arguments);
this.listenTo(vent, Config.Events.ConfigUpdatedEvent, this._onConfigUpdated);
this.defaultProfile = Config.getValue(Config.Keys.DefaultProfileId);
if(ProfileCollection.get(this.defaultProfile))
{
this.profile = this.defaultProfile;
this.$(".x-profile").val(this.defaultProfile);
this.model.set("profileId", this.defaultProfile);
} else {
this.profile = 1;
this.$(".x-profile").val(1);
this.model.set("profileId", 1);
}
this.cellValue = ProfileCollection;
//this.render();
//this.listenTo(ProfileCollection, 'sync', this.render);
},
_profileChanged : function() {
Config.setValue(Config.Keys.DefaultProfileId, this.$(".x-profile").val());
this.model.set("profileId", this.$(".x-profile").val());
},
_onConfigUpdated : function(options) {
if (options.key === Config.Keys.DefaultProfileId) {
this.defaultProfile = options.value;
this.$(".x-profile").val(this.defaultProfile);
//
//this.render();
//this.ui.profile.val(options.value);
}
},
render : function() {
var templateName = this.column.get('template') || this.template;
this.cellValue = ProfileCollection;
this.templateFunction = Marionette.TemplateCache.get(templateName);
this.$el.empty();
if (this.cellValue) {
var data = this.cellValue.toJSON();
var html = this.templateFunction(data);
this.$el.html(html);
}
this.delegateEvents();
this.$(".x-profile").val(this.defaultProfile);
return this;
}
});

View File

@ -1,5 +0,0 @@
<select class="col-md-2 form-control x-profile">
{{#each this}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</select>

View File

@ -1,49 +0,0 @@
var $ = require('jquery');
var _ = require('underscore');
var SelectAllCell = require('../../Cells/SelectAllCell');
var Backgrid = require('backgrid');
var FullMovieCollection = require('../../Movies/FullMovieCollection');
module.exports = SelectAllCell.extend({
_originalRender : SelectAllCell.prototype.render,
_originalInit : SelectAllCell.prototype.initialize,
initialize : function() {
this._originalInit.apply(this, arguments);
this._refreshIsDuplicate();
this.listenTo(this.model, 'change', this._refresh);
},
onChange : function(e) {
if(!this.isDuplicate) {
var checked = $(e.target).prop('checked');
this.$el.parent().toggleClass('selected', checked);
this.model.trigger('backgrid:selected', this.model, checked);
} else {
$(e.target).prop('checked', false);
}
},
render : function() {
this._originalRender.apply(this, arguments);
this.$el.children(':first').prop('disabled', this.isDuplicate);
return this;
},
_refresh: function() {
this._refreshIsDuplicate();
this.render();
},
_refreshIsDuplicate: function() {
var tmdbId = this.model.get('tmdbId');
var existingMovie = FullMovieCollection.where({ tmdbId: tmdbId });
this.isDuplicate = existingMovie.length > 0 ? true : false;
}
});

View File

@ -1,232 +0,0 @@
var $ = require('jquery');
var _ = require('underscore');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var MovieTitleCell = require('./BulkImportMovieTitleCell');
var BulkImportCollection = require("./BulkImportCollection");
var QualityCell = require('./QualityCell');
var TmdbIdCell = require('./TmdbIdCell');
var GridPager = require('../../Shared/Grid/Pager');
var SelectAllCell = require('./BulkImportSelectAllCell');
var ProfileCell = require('./BulkImportProfileCellT');
var MonitorCell = require('./BulkImportMonitorCell');
var MoviePathCell = require("./MoviePathCell");
var LoadingView = require('../../Shared/LoadingView');
var EmptyView = require("./EmptyView");
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
var CommandController = require('../../Commands/CommandController');
var Messenger = require('../../Shared/Messenger');
var MoviesCollection = require('../../Movies/MoviesCollection');
var ProfileCollection = require('../../Profile/ProfileCollection');
require('backgrid.selectall');
require('../../Mixins/backbone.signalr.mixin');
module.exports = Marionette.Layout.extend({
template : 'AddMovies/BulkImport/BulkImportViewTemplate',
regions : {
toolbar : '#x-toolbar',
table : '#x-movies-bulk',
pager : '#x-movies-bulk-pager'
},
ui : {
addSelectdBtn : '.x-add-selected',
//addAllBtn : '.x-add-all',
pageSizeSelector : '.x-page-size'
},
events: { "change .x-page-size" : "_pageSizeChanged" },
initialize : function(options) {
ProfileCollection.fetch();
this.bulkImportCollection = new BulkImportCollection().bindSignalR({ updateOnly : true });
this.model = options.model;
this.folder = this.model.get("path");
this.folderId = this.model.get("id");
this.bulkImportCollection.folderId = this.folderId;
this.bulkImportCollection.folder = this.folder;
this.bulkImportCollection.fetch();
this.listenTo(this.bulkImportCollection, {"sync" : this._showContent, "error" : this._showContent, "backgrid:selected" : this._select});
},
_pageSizeChanged : function(event) {
var pageSize = parseInt($(event.target).val());
this.bulkImportCollection.fullCollection.reset();
this.bulkImportCollection.reset();
this.table.show(new LoadingView());
this.bulkImportCollection.setPageSize(pageSize);
//this.bulkImportCollection.fetch();
},
columns : [
{
name : '',
cell : SelectAllCell,
headerCell : 'select-all',
sortable : false,
cellValue : 'this'
},
{
name : 'movie',
label : 'Movie',
cell : MovieTitleCell,
cellValue : 'this',
sortable : false,
},
{
name : "path",
label : "Path",
cell : MoviePathCell,
cellValue : 'this',
sortable : false,
},
{
name : 'tmdbId',
label : 'Tmdb Id',
cell : TmdbIdCell,
cellValue : 'this',
sortable: false
},
{
name :'monitor',
label: 'Monitor',
cell : MonitorCell,
cellValue : 'this',
sortable : false,
},
{
name : 'profileId',
label : 'Profile',
cell : ProfileCell,
cellValue : "this",
sortable : false,
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
cellValue : 'this',
sortable : false
}
],
_showContent : function() {
this._showToolbar();
this._showTable();
},
onShow : function() {
this.table.show(new LoadingView());
},
_showToolbar : function() {
var leftSideButtons = {
type : 'default',
storeState: false,
collapse : true,
items : [
{
title : 'Add Selected',
icon : 'icon-radarr-add',
callback : this._addSelected,
ownerContext : this,
className : 'x-add-selected'
}//,
// {
// title : 'Add All',
// icon : 'icon-radarr-add',
// callback : this._addAll,
// ownerContext : this,
// className : 'x-add-all'
// }
]
};
this.toolbar.show(new ToolbarLayout({
left : [leftSideButtons],
right : [],
context : this
}));
$('#x-toolbar').addClass('inline');
},
_addSelected : function() {
var selected = _.filter(this.bulkImportCollection.fullCollection.models, function(elem){
return elem.selected;
});
console.log(selected);
var promise = MoviesCollection.importFromList(selected);
this.ui.addSelectdBtn.spinForPromise(promise);
this.ui.addSelectdBtn.addClass('disabled');
//this.ui.addAllBtn.addClass('disabled');
if (selected.length === 0) {
Messenger.show({
type : 'error',
message : 'No movies selected'
});
return;
}
Messenger.show({
message : "Importing {0} movies. This can take multiple minutes depending on how many movies should be imported. Don't close this browser window until it is finished!".format(selected.length),
hideOnNavigate : false,
hideAfter : 30,
type : "error"
});
var _this = this;
promise.done(function() {
Messenger.show({
message : "Imported movies from folder.",
hideAfter : 8,
hideOnNavigate : true
});
_.forEach(selected, function(movie) {
movie.destroy(); //update the collection without the added movies
});
});
},
_addAll : function() {
console.log("TODO");
},
_handleEvent : function(event_name, data) {
if (event_name === "sync" || event_name === "content") {
this._showContent();
}
},
_select : function(model, selected) {
model.selected = selected;
},
_showTable : function() {
if (this.bulkImportCollection.length === 0) {
this.table.show(new EmptyView({ folder : this.folder }));
return;
}
//TODO: override row in order to set an opacity based on duplication state of the movie
this.importGrid = new Backgrid.Grid({
columns : this.columns,
collection : this.bulkImportCollection,
className : 'table table-hover'
});
this.table.show(this.importGrid);
this.pager.show(new GridPager({
columns : this.columns,
collection : this.bulkImportCollection
}));
}
});

View File

@ -1,20 +0,0 @@
<div id="x-toolbar"/>
{{> PageSizePartial }}
<div class="row">
<div class="col-md-12">
<strong>Disabled movies are possible duplicates. If the match is incorrect, update the Tmdb Id cell to import the proper movie.</strong>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="x-movies-bulk" class="queue table-responsive"/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="x-movies-bulk-pager"/>
</div>
</div>

View File

@ -1,11 +0,0 @@
var Marionette = require('marionette');
module.exports = Marionette.CompositeView.extend({
template : 'AddMovies/BulkImport/EmptyViewTemplate',
initialize : function (options) {
this.templateHelpers = {};
this.templateHelpers.folder = options.folder;
}
});

View File

@ -1,3 +0,0 @@
<div class="text-center hint col-md-12">
<span>No movies found in folder {{folder}}. Have you already added all of them?</span>
</div>

View File

@ -1,7 +0,0 @@
var TemplatedCell = require('../../Cells/TemplatedCell');
module.exports = TemplatedCell.extend({
className : 'movie-title-cell',
template : 'AddMovies/BulkImport/MoviePathTemplate',
});

View File

@ -1,4 +0,0 @@
{{path}}<br>
<span title="{{#if movieFile.relativePath}}&nbsp;{{movieFile.relativePath}}{{/if}}" class="hint path">
{{#if movieFile.relativePath}}&#9493;&nbsp;{{movieFile.relativePath}}{{else}}&#9493;&nbsp;Movie File Not Found{{/if}}
</span>

View File

@ -1,8 +0,0 @@
<select class="col-md-2 form-control page-size x-page-size">
<option value="15">15</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>

View File

@ -1,8 +0,0 @@
var TemplatedCell = require('../../Cells/TemplatedCell');
var QualityCellEditor = require('../../Cells/Edit/QualityCellEditor');
module.exports = TemplatedCell.extend({
className : 'quality-cell',
template : 'AddMovies/BulkImport/QualityCellTemplate',
editor : QualityCellEditor
});

View File

@ -1,5 +0,0 @@
{{#if_gt proper compare="1"}}
<span class="badge badge-info" title="PROPER">{{movieFile.quality.quality.name}}</span>
{{else}}
<span class="badge" title="{{#if movieFile.quality.hardcodedSubs}}Warning: {{movieFile.quality.hardcodedSubs}}{{/if}}">{{movieFile.quality.quality.name}}</span>
{{/if_gt}}

View File

@ -1,62 +0,0 @@
var vent = require('vent');
var _ = require('underscore');
var $ = require('jquery');
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var CommandController = require('../../Commands/CommandController');
module.exports = NzbDroneCell.extend({
className : 'tmdbId-cell',
// would like to use change with a _.debounce eventually
events : {
'blur input.tmdbId-input' : '_updateId'
},
render : function() {
this.$el.empty();
this.$el.html('<i class="icon-radarr-info hidden"></i><input type="text" class="x-tmdbId tmdbId-input form-control" value="' + this.cellValue.get('tmdbId') + '" />');
return this;
},
_updateId : function() {
var field = this.$el.find('.x-tmdbId');
var data = field.val();
var promise = $.ajax({
url : window.NzbDrone.ApiRoot + '/movie/lookup/tmdb?tmdbId=' + data,
type : 'GET',
});
//field.spinForPromise(promise);
field.prop("disabled", true);
var icon = this.$(".icon-radarr-info");
icon.removeClass("hidden");
icon.spinForPromise(promise);
var _self = this;
var cacheMonitored = this.model.get('monitored');
var cacheProfile = this.model.get("profileId");
var cachePath = this.model.get("path");
var cacheFile = this.model.get("movieFile");
var cacheRoot = this.model.get("rootFolderPath");
promise.success(function(response) {
_self.model.set(response);
_self.model.set('monitored', cacheMonitored); //reset to the previous monitored value
_self.model.set('profileId', cacheProfile);
_self.model.set('path', cachePath);
_self.model.set('movieFile', cacheFile); // may be unneccessary.
field.prop("disabled", false);
});
promise.error(function(request, status, error) {
console.error("Status: " + status, "Error: " + error);
field.prop("disabled", false);
});
}
});

View File

@ -1,5 +0,0 @@
var Marionette = require('marionette');
module.exports = Marionette.CompositeView.extend({
template : 'AddMovies/DiscoverEmptyViewTemplate'
});

View File

@ -1,6 +0,0 @@
<div class="text-center col-md-12">
<h3>
No movies left to discover. Come back at another time :)
</h3>
</div>

View File

@ -1,26 +0,0 @@
var Backbone = require('backbone');
var MovieModel = require('../Movies/MovieModel');
var _ = require('underscore');
module.exports = Backbone.Collection.extend({
url : function() {
var route = this.action || "";
return window.NzbDrone.ApiRoot + "/movies/discover/" + route;
},
model : MovieModel,
parse : function(response) {
var self = this;
_.each(response, function(model) {
model.id = undefined;
if (self.unmappedFolderModel) {
model.path = self.unmappedFolderModel.get('folder').path;
}
});
return response;
}
});

View File

@ -1,11 +0,0 @@
var Backbone = require('backbone');
var NetImportModel = require('../Settings/NetImport/NetImportModel');
var _ = require('underscore');
var DiscoverableCollection = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/movies/discover/lists',
model : NetImportModel,
});
var collection = new DiscoverableCollection();
collection.fetch();
module.exports = collection;

View File

@ -1,13 +0,0 @@
var Marionette = require('marionette');
module.exports = Marionette.CompositeView.extend({
template : 'AddMovies/DiscoverableListDropdownViewTemplate',
initialize : function(lists) {
this.lists = lists;
},
templateHelpers : function() {
return this.lists;
}
});

View File

@ -1,3 +0,0 @@
{{#each this}}
<li value="{{id}}" class="clickable discoverable-list-item">{{name}}</option>
{{/each}}

View File

@ -1,5 +0,0 @@
var Marionette = require('marionette');
module.exports = Marionette.CompositeView.extend({
template : 'AddMovies/EmptyViewTemplate'
});

View File

@ -1,3 +0,0 @@
<div class="text-center hint col-md-12">
<span>You can also search by imdbid using the imdb: prefixes.</span>
</div>

View File

@ -1,13 +0,0 @@
var Marionette = require('marionette');
module.exports = Marionette.CompositeView.extend({
template : 'AddMovies/ErrorViewTemplate',
initialize : function(options) {
this.options = options;
},
templateHelpers : function() {
return this.options;
}
});

View File

@ -1,7 +0,0 @@
<div class="text-center col-md-12">
<h3>
There was an error searching for '{{term}}'.
</h3>
If the movie title contains non-alphanumeric characters try removing them, otherwise try your search again later.
</div>

View File

@ -1,52 +0,0 @@
var Marionette = require('marionette');
var AddMoviesView = require('../AddMoviesView');
var UnmappedFolderCollection = require('./UnmappedFolderCollection');
var vent = require('vent');
module.exports = Marionette.CompositeView.extend({
itemView : AddMoviesView,
itemViewContainer : '.x-loading-folders',
template : 'AddMovies/Existing/AddExistingMovieCollectionViewTemplate',
ui : {
loadingFolders : '.x-loading-folders'
},
initialize : function() {
this.collection = new UnmappedFolderCollection();
this.collection.importItems(this.model);
},
showCollection : function() {
this._showAndSearch(0);
},
appendHtml : function(collectionView, itemView, index) {
collectionView.ui.loadingFolders.before(itemView.el);
},
_showAndSearch : function(index) {
var self = this;
var model = this.collection.at(index);
if (model) {
var currentIndex = index;
var folderName = model.get('folder').name;
this.addItemView(model, this.getItemView(), index);
this.children.findByModel(model).search({ term : folderName }).always(function() {
if (!self.isClosed) {
self._showAndSearch(currentIndex + 1);
}
});
}
else {
this.ui.loadingFolders.hide();
}
},
itemViewOptions : {
isExisting : true
}
});

View File

@ -1,5 +0,0 @@
<div class="x-existing-folders">
<div class="loading-folders x-loading-folders">
Loading search results from TMDb for your movies, this may take a few minutes.
</div>
</div>

View File

@ -1,20 +0,0 @@
var Backbone = require('backbone');
var UnmappedFolderModel = require('./UnmappedFolderModel');
var _ = require('underscore');
module.exports = Backbone.Collection.extend({
model : UnmappedFolderModel,
importItems : function(rootFolderModel) {
this.reset();
var rootFolder = rootFolderModel;
_.each(rootFolderModel.get('unmappedFolders'), function(folder) {
this.push(new UnmappedFolderModel({
rootFolder : rootFolder,
folder : folder
}));
}, this);
}
});

View File

@ -1,3 +0,0 @@
var Backbone = require('backbone');
module.exports = Backbone.Model.extend({});

View File

@ -1,19 +0,0 @@
var Backbone = require('backbone');
var MovieModel = require('../../Movies/MovieModel');
var _ = require('underscore');
module.exports = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/netimport/movies',
model : MovieModel,
specialProperty: "special",
parse : function(response) {
var self = this;
_.each(response, function(model) {
model.id = undefined;
});
return response;
}
});

View File

@ -1,47 +0,0 @@
var Marionette = require('marionette');
var ListItemView = require('./ListItemView');
var vent = require('vent');
module.exports = Marionette.CollectionView.extend({
itemView : ListItemView,
ui : {
loadingList : '.x-loading-list'
},
initialize : function() {
},
showCollection : function() {
},
//
// appendHtml : function(collectionView, itemView, index) {
// collectionView.ui.loadingFolders.before(itemView.el);
// },
//
// _showAndSearch : function(index) {
// var self = this;
// var model = this.collection.at(index);
//
// if (model) {
// var currentIndex = index;
// var folderName = model.get('folder').name;
// this.addItemView(model, this.getItemView(), index);
// this.children.findByModel(model).search({ term : folderName }).always(function() {
// if (!self.isClosed) {
// self._showAndSearch(currentIndex + 1);
// }
// });
// }
//
// else {
// this.ui.loadingFolders.hide();
// }
// },
//
// itemViewOptions : {
// isExisting : true
// }
});

View File

@ -1,4 +0,0 @@
<div class="x-list">
<div class="x-loading-list">
</div>
</div>

View File

@ -1,246 +0,0 @@
var _ = require('underscore');
var vent = require('vent');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var AddFromListCollection = require('./AddFromListCollection');
var AddFromListCollectionView = require('./AddFromListCollectionView');
var AddListView = require("../../Settings/NetImport/Add/NetImportAddItemView");
var EmptyView = require('../EmptyView');
var NotFoundView = require('../NotFoundView');
var ListCollection = require("../../Settings/NetImport/NetImportCollection");
var ErrorView = require('../ErrorView');
var LoadingView = require('../../Shared/LoadingView');
var AppLayout = require('../../AppLayout');
var InCinemasCell = require('../../Cells/InCinemasCell');
var MovieTitleCell = require('../../Cells/MovieListTitleCell');
var SelectAllCell = require('../../Cells/SelectAllCell');
var TemplatedCell = require('../../Cells/TemplatedCell');
var ProfileCell = require('../../Cells/ProfileCell');
var MovieLinksCell = require('../../Cells/MovieLinksCell');
var MovieActionCell = require('../../Cells/MovieActionCell');
var MovieStatusCell = require('../../Cells/MovieStatusCell');
var MovieDownloadStatusCell = require('../../Cells/MovieDownloadStatusCell');
var DownloadedQualityCell = require('../../Cells/DownloadedQualityCell');
var MoviesCollection = require('../../Movies/MoviesCollection');
var Messenger = require('../../Shared/Messenger');
require('jquery.dotdotdot');
var SchemaModal = require('../../Settings/NetImport/Add/NetImportSchemaModal');
module.exports = Marionette.Layout.extend({
template: 'AddMovies/List/AddFromListViewTemplate',
regions: {
fetchResult: '#fetch-result'
},
ui: {
moviesSearch: '.x-movies-search',
listSelection: ".x-list-selection",
importSelected: ".x-import-selected"
},
columns: [{
name: '',
cell: SelectAllCell,
headerCell: 'select-all',
sortable: false
}, {
name: 'title',
label: 'Title',
cell: MovieTitleCell,
cellValue: 'this',
}, {
name: 'profileId',
label: 'Profile',
cell: ProfileCell,
sortable: false,
}, {
name: 'this',
label: 'Links',
cell: MovieLinksCell,
className: "movie-links-cell",
sortable: false,
}],
events: {
'click .x-load-more': '_onLoadMore',
"change .x-list-selection": "_listSelected",
"click .x-fetch-list": "_fetchList",
"click .x-import-selected": "_importSelected"
},
initialize: function(options) {
console.log(options);
this.isExisting = options.isExisting;
//this.collection = new AddFromListCollection();
this.templateHelpers = {};
this.listCollection = new ListCollection();
this.templateHelpers.lists = this.listCollection.toJSON();
this.listenTo(this.listCollection, 'all', this._listsUpdated);
this.listCollection.fetch();
this.collection = new AddFromListCollection();
this.listenTo(this.collection, 'sync', this._showResults);
/*this.listenTo(this.collection, 'sync', this._showResults);
this.resultCollectionView = new SearchResultCollectionView({
collection : this.collection,
isExisting : this.isExisting
});*/
//this.throttledSearch = _.debounce(this.search, 1000, { trailing : true }).bind(this);
},
onRender: function() {
var self = this;
this.ui.importSelected.hide();
},
onShow: function() {
this.ui.moviesSearch.focus();
},
search: function(options) {
var self = this;
this.collection.reset();
if (!options.term || options.term === this.collection.term) {
return Marionette.$.Deferred().resolve();
}
this.searchResult.show(new LoadingView());
this.collection.term = options.term;
this.currentSearchPromise = this.collection.fetch({
data: { term: options.term }
});
this.currentSearchPromise.fail(function() {
self._showError();
});
return this.currentSearchPromise;
},
_onMoviesAdded: function(options) {
if (this.isExisting && options.movie.get('path') === this.model.get('folder').path) {
this.close();
} else if (!this.isExisting) {
this.resultCollectionView.setExisting(options.movie.get('tmdbId'));
/*this.collection.term = '';
this.collection.reset();
this._clearResults();
this.ui.moviesSearch.val('');
this.ui.moviesSearch.focus();*/ //TODO: Maybe add option wheter to clear search result.
}
},
_onLoadMore: function() {
var showingAll = this.resultCollectionView.showMore();
this.ui.searchBar.show();
if (showingAll) {
this.ui.loadMore.hide();
}
},
_listSelected: function() {
var rootFolderValue = this.ui.listSelection.val();
if (rootFolderValue === 'addNew') {
//var rootFolderLayout = new SchemaModal(this.listCollection);
//AppLayout.modalRegion.show(rootFolderLayout);
SchemaModal.open(this.listCollection);
}
},
_fetchList: function() {
var self = this;
var listId = this.ui.listSelection.val();
this.fetchResult.show(new LoadingView());
this.currentFetchPromise = this.collection.fetch({ data: { listId: listId } });
this.currentFetchPromise.fail(function() {
self._showError();
});
},
_listsUpdated: function() {
this.templateHelpers.lists = this.listCollection.toJSON();
this.render();
},
_importSelected: function() {
var selected = this.importGrid.getSelectedModels();
// console.log(selected);
var promise = MoviesCollection.importFromList(selected);
this.ui.importSelected.spinForPromise(promise);
this.ui.importSelected.addClass('disabled');
Messenger.show({
message: "Importing {0} movies. Don't close this browser window until it has finished".format(selected.length),
hideOnNavigate: false,
hideAfter: 30,
type: "error"
});
promise.done(function() {
Messenger.show({
message: "Imported movies from list.",
hideAfter: 8,
hideOnNavigate: true
});
});
/*for (m in selected) {
debugger;
m.save()
MoviesCollection.add(m);
}*/
//MoviesCollection.save();
},
_clearResults: function() {
if (!this.isExisting) {
this.searchResult.show(new EmptyView());
} else {
this.searchResult.close();
}
},
_showResults: function() {
if (this.collection.length === 0) {
this.fetchResult.show(new NotFoundView({ term: "" }));
} else {
this.importGrid = new Backgrid.Grid({
collection: this.collection,
columns: this.columns,
className: 'table table-hover'
});
this.fetchResult.show(this.importGrid);
this.ui.importSelected.show();
}
},
_abortExistingSearch: function() {
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
console.log('aborting previous pending search request.');
this.currentSearchPromise.abort();
} else {
this._clearResults();
}
},
_showError: function() {
this.fetchResult.show(new ErrorView({ term: "" }));
}
});

View File

@ -1,18 +0,0 @@
<div class="x-search-bar">
<div class="form-group" style="margin-bottom: 0px;">
<label class="col-sm-1 control-label">List</label>
<div class="col-sm-8">
{{> ListSelectionPartial lists}}
</div>
<div class="col-sm-1">
<button class="btn btn-info x-fetch-list">Fetch List</button>
</div>
<div class="col-sm-2">
<button class="btn btn-success x-import-selected"><i class="icon-radarr-add"></i> Import Selected</button>
</div>
</div>
</div>
<div class="row">
<div id="fetch-result" class="result-list col-md-12"/>
</div>

View File

@ -1,22 +0,0 @@
var _ = require('underscore');
var vent = require('vent');
var AppLayout = require('../../AppLayout');
var Backbone = require('backbone');
var Marionette = require('marionette');
var Config = require('../../Config');
var Messenger = require('../../Shared/Messenger');
var AsValidatedView = require('../../Mixins/AsValidatedView');
require('jquery.dotdotdot');
var view = Marionette.ItemView.extend({
template : 'AddMovies/SearchResultViewTemplate',
});
AsValidatedView.apply(view);
module.exports = view;

View File

@ -1,3 +0,0 @@
<div class="fetch-item">
ASDF
</div>

View File

@ -1,10 +0,0 @@
<dl class="minimumavailability-tooltip-contents">
<dt>Announced</dt>
<dd>Consider the movie available after it has been announced</dd>
<dt>In Cinemas</dt>
<dd>Consider the movie available once it is In Cinemas</dd>
<dt>Physical/Web</dt>
<dd>Consider the movie available after Physical/Web release</dd>
<dt>PreDB</dt>
<dd>Consider the movie available if preDB contains at least one entry</dd>
</dl>

Some files were not shown because too many files have changed in this diff Show More