diff --git a/.gitignore b/.gitignore index bd5b618c3..4dc71476c 100644 --- a/.gitignore +++ b/.gitignore @@ -120,7 +120,7 @@ _tests/ setup/Output/ *.~is -UI.Phantom/ +UI/ #VS outout folders bin diff --git a/build.sh b/build.sh index cede3c535..956cabdda 100755 --- a/build.sh +++ b/build.sh @@ -95,12 +95,8 @@ RunGulp() ProgressEnd 'yarn install' echo "##teamcity[progressStart 'Running gulp']" - CheckExitCode npm run build + CheckExitCode yarn run build --production echo "##teamcity[progressFinish 'Running gulp']" - - echo "##teamcity[progressStart 'Running gulp (phantom)']" - CheckExitCode yarn run build -- --production - echo "##teamcity[progressFinish 'Running gulp (phantom)']" } CreateMdbs() diff --git a/gulp/build.js b/gulp/build.js deleted file mode 100644 index 23f457baf..000000000 --- a/gulp/build.js +++ /dev/null @@ -1,18 +0,0 @@ -var gulp = require('gulp'); -var runSequence = require('run-sequence'); - -require('./clean'); -require('./less'); -require('./handlebars'); -require('./copy'); - -gulp.task('build', function() { - return runSequence('clean', [ - 'webpack', - 'less', - 'handlebars', - 'copyHtml', - 'copyContent', - 'copyJs' - ]); -}); diff --git a/gulp/clean.js b/gulp/clean.js deleted file mode 100644 index 73b5868a2..000000000 --- a/gulp/clean.js +++ /dev/null @@ -1,8 +0,0 @@ -var gulp = require('gulp'); -var del = require('del'); - -var paths = require('./paths'); - -gulp.task('clean', function() { - return del([paths.dest.root]); -}); diff --git a/gulp/copy.js b/gulp/copy.js deleted file mode 100644 index 9962defef..000000000 --- a/gulp/copy.js +++ /dev/null @@ -1,31 +0,0 @@ -var gulp = require('gulp'); -var print = require('gulp-print'); -var cache = require('gulp-cached'); -var livereload = require('gulp-livereload'); - -var paths = require('./paths.js'); - -gulp.task('copyJs', function () { - return gulp.src( - [ - paths.src.root + 'polyfills.js', - paths.src.root + 'JsLibraries/handlebars.runtime.js' - ]) - .pipe(cache('copyJs')) - .pipe(print()) - .pipe(gulp.dest(paths.dest.root)) - .pipe(livereload()); -}); - -gulp.task('copyHtml', function () { - return gulp.src(paths.src.html) - .pipe(cache('copyHtml')) - .pipe(gulp.dest(paths.dest.root)) - .pipe(livereload()); -}); - -gulp.task('copyContent', function () { - return gulp.src([paths.src.content + '**/*.*', '!**/*.less', '!**/*.css']) - .pipe(gulp.dest(paths.dest.content)) - .pipe(livereload()); -}); diff --git a/gulp/errorHandler.js b/gulp/errorHandler.js deleted file mode 100644 index db24e1a66..000000000 --- a/gulp/errorHandler.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - onError : function(error) { - //If you want details of the error in the console - console.log(error.toString()); - this.emit('end'); - } -}; \ No newline at end of file diff --git a/gulp/gulpFile.js b/gulp/gulpFile.js deleted file mode 100644 index fd48cf1b0..000000000 --- a/gulp/gulpFile.js +++ /dev/null @@ -1,10 +0,0 @@ -require('./watch.js'); -require('./build.js'); -require('./clean.js'); -require('./handlebars.js'); -require('./copy.js'); -require('./less.js'); -require('./stripBom.js'); -require('./imageMin.js'); -require('./webpack.js'); -require('./start.js'); diff --git a/gulp/handlebars.js b/gulp/handlebars.js deleted file mode 100644 index aab62f438..000000000 --- a/gulp/handlebars.js +++ /dev/null @@ -1,55 +0,0 @@ -var gulp = require('gulp'); -var handlebars = require('gulp-handlebars'); -var declare = require('gulp-declare'); -var concat = require('gulp-concat'); -var wrap = require("gulp-wrap"); -var livereload = require('gulp-livereload'); -var path = require('path'); -var streamqueue = require('streamqueue'); -var stripbom = require('gulp-stripbom'); - -var paths = require('./paths.js'); - -gulp.task('handlebars', function() { - - var coreStream = gulp.src([ - paths.src.templates, - '!*/**/*Partial.*' - ]) - .pipe(stripbom({ showLog : false })) - .pipe(handlebars()) - .pipe(declare({ - namespace : 'T', - noRedeclare : true, - processName : function(filePath) { - - filePath = path.relative(paths.src.root, filePath); - - return filePath.replace(/\\/g, '/') - .toLocaleLowerCase() - .replace('template', '') - .replace('.js', ''); - } - })); - - var partialStream = gulp.src([paths.src.partials]) - .pipe(stripbom({ showLog : false })) - .pipe(handlebars()) - .pipe(wrap('Handlebars.template(<%= contents %>)')) - .pipe(wrap('Handlebars.registerPartial(<%= processPartialName(file.relative) %>, <%= contents %>)', {}, { - imports : { - processPartialName : function(fileName) { - return JSON.stringify( - path.basename(fileName, '.js') - ); - } - } - })); - - return streamqueue({ objectMode : true }, - partialStream, - coreStream - ).pipe(concat('templates.js')) - .pipe(gulp.dest(paths.dest.root)) - .pipe(livereload()); -}); diff --git a/gulp/imageMin.js b/gulp/imageMin.js deleted file mode 100644 index 6c8236e03..000000000 --- a/gulp/imageMin.js +++ /dev/null @@ -1,15 +0,0 @@ -var gulp = require('gulp'); -var print = require('gulp-print'); -var paths = require('./paths.js'); - -gulp.task('imageMin', function() { - var imagemin = require('gulp-imagemin'); - return gulp.src(paths.src.images) - .pipe(imagemin({ - progressive : false, - optimizationLevel : 4, - svgoPlugins : [{ removeViewBox : false }] - })) - .pipe(print()) - .pipe(gulp.dest(paths.src.content + 'Images/')); -}); \ No newline at end of file diff --git a/gulp/less.js b/gulp/less.js deleted file mode 100644 index 380f81363..000000000 --- a/gulp/less.js +++ /dev/null @@ -1,51 +0,0 @@ -var gulp = require('gulp'); - -var less = require('gulp-less'); -var postcss = require('gulp-postcss'); -var sourcemaps = require('gulp-sourcemaps'); -var autoprefixer = require('autoprefixer'); -var livereload = require('gulp-livereload'); -var cleancss = require('gulp-clean-css'); -var print = require('gulp-print'); -var paths = require('./paths'); -var errorHandler = require('./errorHandler'); - -gulp.task('less', function() { - - var src = [ - paths.src.content + 'bootstrap.less', - paths.src.content + 'theme.less', - paths.src.content + 'overrides.less', - paths.src.content + 'bootstrap.toggle-switch.css', - paths.src.content + 'fullcalendar.css', - paths.src.content + 'Messenger/messenger.css', - paths.src.content + 'Messenger/messenger.flat.css', - paths.src.root + 'Series/series.less', - paths.src.root + 'Activity/activity.less', - paths.src.root + 'AddSeries/addSeries.less', - paths.src.root + 'Calendar/calendar.less', - paths.src.root + 'Cells/cells.less', - paths.src.root + 'ManualImport/manualimport.less', - paths.src.root + 'Settings/settings.less', - paths.src.root + 'System/Logs/logs.less', - paths.src.root + 'System/Update/update.less', - paths.src.root + 'System/Info/info.less' - ]; - - return gulp.src(src) - .pipe(print()) - .pipe(sourcemaps.init()) - .pipe(less({ - dumpLineNumbers : 'false', - compress : false, - yuicompress : false, - ieCompat : true, - strictImports : true - })) - .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ])) - .pipe(cleancss()) - .on('error', errorHandler.onError) - .pipe(sourcemaps.write(paths.dest.content)) - .pipe(gulp.dest(paths.dest.content)) - .pipe(livereload()); -}); diff --git a/gulp/paths.js b/gulp/paths.js deleted file mode 100644 index e05aa1d2b..000000000 --- a/gulp/paths.js +++ /dev/null @@ -1,21 +0,0 @@ -var paths = { - src : { - root : './src/UI/', - templates : './src/UI/**/*.hbs', - html : './src/UI/*.html', - partials : './src/UI/**/*Partial.hbs', - scripts : './src/UI/**/*.js', - less : ['./src/UI/**/*.less'], - content : './src/UI/Content/', - images : './src/UI/Content/Images/**/*', - exclude : { - libs : '!./src/UI/JsLibraries/**' - } - }, - dest : { - root : './_output/UI/', - content : './_output/UI/Content/' - } -}; - -module.exports = paths; diff --git a/gulp/start.js b/gulp/start.js deleted file mode 100644 index 5b5f88044..000000000 --- a/gulp/start.js +++ /dev/null @@ -1,112 +0,0 @@ -// will download and run sonarr (server) in a non-windows enviroment -// you can use this if you don't care about the server code and just want to work -// with the web code. - -var http = require('http'); -var gulp = require('gulp'); -var fs = require('fs'); -var targz = require('tar.gz'); -var del = require('del'); -var print = require('gulp-print'); -var spawn = require('child_process').spawn; - -function download(url, dest, cb) { - console.log('Downloading ' + url + ' to ' + dest); - var file = fs.createWriteStream(dest); - var request = http.get(url, function (response) { - response.pipe(file); - file.on('finish', function () { - console.log('Download completed'); - file.close(cb); - }); - }); -} - -function getLatest(cb) { - var branch = 'develop'; - process.argv.forEach(function (val) { - var branchMatch = /branch=([\S]*)/.exec(val); - if (branchMatch && branchMatch.length > 1) { - branch = branchMatch[1]; - } - }); - - var url = 'http://services.sonarr.tv/v1/update/' + branch + '?os=osx'; - - console.log('Checking for latest version:', url); - - http.get(url, function (res) { - var data = ''; - - res.on('data', function (chunk) { - data += chunk; - }); - - res.on('end', function () { - var updatePackage = JSON.parse(data).updatePackage; - console.log('Latest version available: ' + updatePackage.version + ' Release Date: ' + updatePackage.releaseDate); - cb(updatePackage); - }); - }).on('error', function (e) { - console.log('problem with request: ' + e.message); - }); -} - -function extract(source, dest, cb) { - console.log('extracting download page to ' + dest); - new targz().extract(source, dest, function (err) { - if (err) { - console.log(err); - } - console.log('Update package extracted.'); - cb(); - }); -} - -gulp.task('getSonarr', function () { - - //gulp.src('/Users/kayone/git/Sonarr/_start/2.0.0.3288/NzbDrone/*.*') - // .pipe(print()) - // .pipe(gulp.dest('./_output - - //return; - try { - fs.mkdirSync('./_start/'); - } catch (e) { - if (e.code != 'EEXIST') { - throw e; - } - } - - getLatest(function (package) { - var packagePath = "./_start/" + package.filename; - var dirName = "./_start/" + package.version; - download(package.url, packagePath, function () { - extract(packagePath, dirName, function () { - // clean old binaries - console.log('Cleaning old binaries'); - del.sync(['./_output/*', '!./_output/UI/']); - console.log('copying binaries to target'); - gulp.src(dirName + '/NzbDrone/*.*') - .pipe(gulp.dest('./_output/')); - }); - }); - }); -}); - -gulp.task('startSonarr', function () { - - var ls = spawn('mono', ['--debug', './_output/NzbDrone.exe']); - - ls.stdout.on('data', function (data) { - process.stdout.write('' + data); - }); - - ls.stderr.on('data', function (data) { - process.stdout.write('' + data); - }); - - ls.on('close', function (code) { - console.log('child process exited with code ' + code); - }); -}); diff --git a/gulp/stripBom.js b/gulp/stripBom.js deleted file mode 100644 index d10238c3e..000000000 --- a/gulp/stripBom.js +++ /dev/null @@ -1,27 +0,0 @@ -var gulp = require('gulp'); -var paths = require('./paths.js'); -var stripbom = require('gulp-stripbom'); - -var stripBom = function(dest) { - gulp.src([paths.src.scripts, paths.src.exclude.libs]) - .pipe(stripbom({ - showLog: false - })) - .pipe(gulp.dest(dest)); - - gulp.src(paths.src.less) - .pipe(stripbom({ - showLog: false - })) - .pipe(gulp.dest(dest)); - - gulp.src(paths.src.templates) - .pipe(stripbom({ - showLog: false - })) - .pipe(gulp.dest(dest)); -}; - -gulp.task('stripBom', function() { - stripBom(paths.src.root); -}); diff --git a/gulp/watch.js b/gulp/watch.js deleted file mode 100644 index 49a85f2b9..000000000 --- a/gulp/watch.js +++ /dev/null @@ -1,19 +0,0 @@ -var gulp = require('gulp'); -var livereload = require('gulp-livereload'); - -var paths = require('./paths.js'); - -require('./handlebars.js'); -require('./less.js'); -require('./copy.js'); -require('./webpack.js'); - -gulp.task('watch', ['handlebars', 'less', 'copyHtml', 'copyContent', 'copyJs'], function () { - livereload.listen(); - gulp.start('webpackWatch'); - gulp.watch([paths.src.scripts, paths.src.exclude.libs], ['copyJs']); - gulp.watch(paths.src.templates, ['handlebars']); - gulp.watch([paths.src.less, paths.src.exclude.libs], ['less']); - gulp.watch([paths.src.html], ['copyHtml']); - gulp.watch([paths.src.content + '**/*.*', '!**/*.less'], ['copyContent']); -}); diff --git a/gulp/webpack.js b/gulp/webpack.js deleted file mode 100644 index 64570593c..000000000 --- a/gulp/webpack.js +++ /dev/null @@ -1,13 +0,0 @@ -var gulp = require('gulp'); -var webpackStream = require('webpack-stream'); -var livereload = require('gulp-livereload'); -var webpackConfig = require('../webpack.config'); - -gulp.task('webpack', function() { - return gulp.src('main.js').pipe(webpackStream(webpackConfig)).pipe(gulp.dest('')); -}); - -gulp.task('webpackWatch', function() { - webpackConfig.watch = true; - return gulp.src('main.js').pipe(webpackStream(webpackConfig)).pipe(gulp.dest('')).pipe(livereload()); -}); diff --git a/gulpFile.js b/gulpFile.js index fea49f151..73636a918 100644 --- a/gulpFile.js +++ b/gulpFile.js @@ -1,7 +1 @@ -var phantom = require('./frontend/gulp/helpers/phantom'); - -if (phantom) { - require('./frontend/gulp/gulpFile.js'); -} else { - require('./gulp/gulpFile.js'); -} +require('./frontend/gulp/gulpFile.js'); diff --git a/src/UI/.idea/.name b/src/UI/.idea/.name deleted file mode 100644 index 78ec2c0fe..000000000 --- a/src/UI/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -NzbDrone.UI \ No newline at end of file diff --git a/src/UI/.idea/NzbDrone.UI.iml b/src/UI/.idea/NzbDrone.UI.iml deleted file mode 100644 index 2184ad470..000000000 --- a/src/UI/.idea/NzbDrone.UI.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/UI/.idea/codeStyleSettings.xml b/src/UI/.idea/codeStyleSettings.xml deleted file mode 100644 index 7598f4c8e..000000000 --- a/src/UI/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/UI/.idea/dictionaries/Keivan.xml b/src/UI/.idea/dictionaries/Keivan.xml deleted file mode 100644 index e85a39c0f..000000000 --- a/src/UI/.idea/dictionaries/Keivan.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - deps - mixins - nzbdrone - rootdir - rootfolder - rootfolders - signalr - sonarr - templated - thetvdb - trakt - tvdb - xlarge - yyyy - - - \ No newline at end of file diff --git a/src/UI/.idea/dictionaries/Keivan_Beigi.xml b/src/UI/.idea/dictionaries/Keivan_Beigi.xml deleted file mode 100644 index 00d8e4cec..000000000 --- a/src/UI/.idea/dictionaries/Keivan_Beigi.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - backgrid - bnzbd - clickable - couldn - mouseenter - mouseleave - navbar - - - \ No newline at end of file diff --git a/src/UI/.idea/dictionaries/Mark.xml b/src/UI/.idea/dictionaries/Mark.xml deleted file mode 100644 index ecbbe884c..000000000 --- a/src/UI/.idea/dictionaries/Mark.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/UI/.idea/encodings.xml b/src/UI/.idea/encodings.xml deleted file mode 100644 index e55d06786..000000000 --- a/src/UI/.idea/encodings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/UI/.idea/inspectionProfiles/Project_Default.xml b/src/UI/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 7aba4e3c2..000000000 --- a/src/UI/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/UI/.idea/inspectionProfiles/profiles_settings.xml b/src/UI/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b312839b..000000000 --- a/src/UI/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/UI/.idea/jsLibraryMappings.xml b/src/UI/.idea/jsLibraryMappings.xml deleted file mode 100644 index 62c621f94..000000000 --- a/src/UI/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/UI/.idea/jsLinters/jshint.xml b/src/UI/.idea/jsLinters/jshint.xml deleted file mode 100644 index 0b5c0e41e..000000000 --- a/src/UI/.idea/jsLinters/jshint.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/UI/.idea/jsLinters/jslint.xml b/src/UI/.idea/jsLinters/jslint.xml deleted file mode 100644 index 822a7aa5e..000000000 --- a/src/UI/.idea/jsLinters/jslint.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/src/UI/.idea/misc.xml b/src/UI/.idea/misc.xml deleted file mode 100644 index e9e9ba1c3..000000000 --- a/src/UI/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/UI/.idea/modules.xml b/src/UI/.idea/modules.xml deleted file mode 100644 index ab774833e..000000000 --- a/src/UI/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/UI/.idea/runConfigurations/Debug___Chrome.xml b/src/UI/.idea/runConfigurations/Debug___Chrome.xml deleted file mode 100644 index 47bd06dc9..000000000 --- a/src/UI/.idea/runConfigurations/Debug___Chrome.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/UI/.idea/runConfigurations/Debug___Firefox.xml b/src/UI/.idea/runConfigurations/Debug___Firefox.xml deleted file mode 100644 index d9e99acc3..000000000 --- a/src/UI/.idea/runConfigurations/Debug___Firefox.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/UI/.idea/scopes/NzbDrone.xml b/src/UI/.idea/scopes/NzbDrone.xml deleted file mode 100644 index 17c1c9c5e..000000000 --- a/src/UI/.idea/scopes/NzbDrone.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/UI/.idea/scopes/scope_settings.xml b/src/UI/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b84..000000000 --- a/src/UI/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/UI/.idea/vcs.xml b/src/UI/.idea/vcs.xml deleted file mode 100644 index 9ab281ac8..000000000 --- a/src/UI/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/UI/.jshintrc b/src/UI/.jshintrc deleted file mode 100644 index 888afe448..000000000 --- a/src/UI/.jshintrc +++ /dev/null @@ -1,19 +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 - } -} diff --git a/src/UI/Activity/ActivityLayout.js b/src/UI/Activity/ActivityLayout.js deleted file mode 100644 index a8826a714..000000000 --- a/src/UI/Activity/ActivityLayout.js +++ /dev/null @@ -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'); - } -}); \ No newline at end of file diff --git a/src/UI/Activity/ActivityLayoutTemplate.hbs b/src/UI/Activity/ActivityLayoutTemplate.hbs deleted file mode 100644 index c9c08ecf7..000000000 --- a/src/UI/Activity/ActivityLayoutTemplate.hbs +++ /dev/null @@ -1,11 +0,0 @@ - - -
-
-
-
-
\ No newline at end of file diff --git a/src/UI/Activity/Blacklist/BlacklistActionsCell.js b/src/UI/Activity/Blacklist/BlacklistActionsCell.js deleted file mode 100644 index 61ce7d102..000000000 --- a/src/UI/Activity/Blacklist/BlacklistActionsCell.js +++ /dev/null @@ -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('' + - ''); - - return this; - }, - - _details : function() { - vent.trigger(vent.Commands.OpenModalCommand, new BlacklistDetailsLayout({ model : this.model })); - }, - - _delete : function() { - this.model.destroy(); - } -}); diff --git a/src/UI/Activity/Blacklist/BlacklistCollection.js b/src/UI/Activity/Blacklist/BlacklistCollection.js deleted file mode 100644 index d7e2f1a16..000000000 --- a/src/UI/Activity/Blacklist/BlacklistCollection.js +++ /dev/null @@ -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 : { - 'series' : { sortKey : 'series.sortTitle' } - }, - - 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; \ No newline at end of file diff --git a/src/UI/Activity/Blacklist/BlacklistLayout.js b/src/UI/Activity/Blacklist/BlacklistLayout.js deleted file mode 100644 index 22d7da60e..000000000 --- a/src/UI/Activity/Blacklist/BlacklistLayout.js +++ /dev/null @@ -1,114 +0,0 @@ -var vent = require('vent'); -var Marionette = require('marionette'); -var Backgrid = require('backgrid'); -var BlacklistCollection = require('./BlacklistCollection'); -var SeriesTitleCell = require('../../Cells/SeriesTitleCell'); -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 : 'series', - label : 'Series', - cell : SeriesTitleCell - }, - { - 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, - items : [ - { - title : 'Clear Blacklist', - icon : 'icon-sonarr-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(); - } - } -}); diff --git a/src/UI/Activity/Blacklist/BlacklistLayoutTemplate.hbs b/src/UI/Activity/Blacklist/BlacklistLayoutTemplate.hbs deleted file mode 100644 index 8f78eb0db..000000000 --- a/src/UI/Activity/Blacklist/BlacklistLayoutTemplate.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
-
-
-
-
-
-
-
diff --git a/src/UI/Activity/Blacklist/BlacklistModel.js b/src/UI/Activity/Blacklist/BlacklistModel.js deleted file mode 100644 index e103f718f..000000000 --- a/src/UI/Activity/Blacklist/BlacklistModel.js +++ /dev/null @@ -1,17 +0,0 @@ -var Backbone = require('backbone'); -var SeriesCollection = require('../../Series/SeriesCollection'); - -module.exports = Backbone.Model.extend({ - - //Hack to deal with Backbone 1.0's bug - initialize : function() { - this.url = function() { - return this.collection.url + '/' + this.get('id'); - }; - }, - - parse : function(model) { - model.series = SeriesCollection.get(model.seriesId); - return model; - } -}); \ No newline at end of file diff --git a/src/UI/Activity/Blacklist/Details/BlacklistDetailsLayout.js b/src/UI/Activity/Blacklist/Details/BlacklistDetailsLayout.js deleted file mode 100644 index cdcbf25f0..000000000 --- a/src/UI/Activity/Blacklist/Details/BlacklistDetailsLayout.js +++ /dev/null @@ -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 })); - } -}); \ No newline at end of file diff --git a/src/UI/Activity/Blacklist/Details/BlacklistDetailsLayoutTemplate.hbs b/src/UI/Activity/Blacklist/Details/BlacklistDetailsLayoutTemplate.hbs deleted file mode 100644 index 3cdfa99c7..000000000 --- a/src/UI/Activity/Blacklist/Details/BlacklistDetailsLayoutTemplate.hbs +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/src/UI/Activity/Blacklist/Details/BlacklistDetailsView.js b/src/UI/Activity/Blacklist/Details/BlacklistDetailsView.js deleted file mode 100644 index 1b7bc883d..000000000 --- a/src/UI/Activity/Blacklist/Details/BlacklistDetailsView.js +++ /dev/null @@ -1,5 +0,0 @@ -var Marionette = require('marionette'); - -module.exports = Marionette.ItemView.extend({ - template : 'Activity/Blacklist/Details/BlacklistDetailsViewTemplate' -}); \ No newline at end of file diff --git a/src/UI/Activity/Blacklist/Details/BlacklistDetailsViewTemplate.hbs b/src/UI/Activity/Blacklist/Details/BlacklistDetailsViewTemplate.hbs deleted file mode 100644 index d29a878fc..000000000 --- a/src/UI/Activity/Blacklist/Details/BlacklistDetailsViewTemplate.hbs +++ /dev/null @@ -1,23 +0,0 @@ -
- -
Name:
-
{{sourceTitle}}
- - {{#if protocol}} - {{#unless_eq protocol compare="unknown"}} -
Protocol:
-
{{protocol}}
- {{/unless_eq}} - {{/if}} - - {{#if indexer}} -
Indexer:
-
{{indexer}}
- {{/if}} - - - {{#if message}} -
Message:
-
{{message}}
- {{/if}} -
diff --git a/src/UI/Activity/History/Details/HistoryDetailsAge.js b/src/UI/Activity/History/Details/HistoryDetailsAge.js deleted file mode 100644 index a7c40f69a..000000000 --- a/src/UI/Activity/History/Details/HistoryDetailsAge.js +++ /dev/null @@ -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('
Age (when grabbed):
{0} {1}
'.format(age, unit)); -}); diff --git a/src/UI/Activity/History/Details/HistoryDetailsLayout.js b/src/UI/Activity/History/Details/HistoryDetailsLayout.js deleted file mode 100644 index 5654a3e72..000000000 --- a/src/UI/Activity/History/Details/HistoryDetailsLayout.js +++ /dev/null @@ -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); - } -}); \ No newline at end of file diff --git a/src/UI/Activity/History/Details/HistoryDetailsLayoutTemplate.hbs b/src/UI/Activity/History/Details/HistoryDetailsLayoutTemplate.hbs deleted file mode 100644 index ec1181c90..000000000 --- a/src/UI/Activity/History/Details/HistoryDetailsLayoutTemplate.hbs +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/src/UI/Activity/History/Details/HistoryDetailsView.js b/src/UI/Activity/History/Details/HistoryDetailsView.js deleted file mode 100644 index a883b0cb4..000000000 --- a/src/UI/Activity/History/Details/HistoryDetailsView.js +++ /dev/null @@ -1,6 +0,0 @@ -var Marionette = require('marionette'); -require('./HistoryDetailsAge'); - -module.exports = Marionette.ItemView.extend({ - template : 'Activity/History/Details/HistoryDetailsViewTemplate' -}); \ No newline at end of file diff --git a/src/UI/Activity/History/Details/HistoryDetailsViewTemplate.hbs b/src/UI/Activity/History/Details/HistoryDetailsViewTemplate.hbs deleted file mode 100644 index b70b8e4cb..000000000 --- a/src/UI/Activity/History/Details/HistoryDetailsViewTemplate.hbs +++ /dev/null @@ -1,122 +0,0 @@ -{{#if_eq eventType compare="grabbed"}} -
- -
Name:
-
{{sourceTitle}}
- - {{#with data}} - {{#if indexer}} -
Indexer:
-
{{indexer}}
- {{/if}} - - {{#if releaseGroup}} -
Release Group:
-
{{releaseGroup}}
- {{/if}} - - {{#if nzbInfoUrl}} -
Info:
-
{{nzbInfoUrl}}
- {{/if}} - - {{#if downloadClient}} -
Download Client:
-
{{downloadClient}}
- {{/if}} - - {{#if downloadId}} -
Grab ID:
-
{{downloadId}}
- {{/if}} - - {{#if age}} - {{historyAge}} - {{/if}} - - {{#if publishedDate}} -
Published Date:
-
{{ShortDate publishedDate}} {{LTS publishedDate}}
- {{/if}} - {{/with}} -
-{{/if_eq}} - -{{#if_eq eventType compare="downloadFailed"}} -
- -
Name:
-
{{sourceTitle}}
- - {{#with data}} -
Message:
-
{{message}}
- {{/with}} -
-{{/if_eq}} - -{{#if_eq eventType compare="downloadFolderImported"}} -
- - {{#if sourceTitle}} -
Name:
-
{{sourceTitle}}
- {{/if}} - - {{#with data}} - {{#if droppedPath}} -
Source:
-
{{droppedPath}}
- {{/if}} - - {{#if importedPath}} -
Imported To:
-
{{importedPath}}
- {{/if}} - {{/with}} -
-{{/if_eq}} - -{{#if_eq eventType compare="episodeFileDeleted"}} -
- -
Path:
-
{{sourceTitle}}
- - {{#with data}} -
Reason:
-
- {{#if_eq reason compare="Manual"}} - File was deleted by via UI - {{/if_eq}} - - {{#if_eq reason compare="MissingFromDisk"}} - Sonarr 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}} -
- {{/with}} -
-{{/if_eq}} - -{{#if_eq eventType compare="episodeFileRenamed"}} -
- -
Source Path:
-
{{sourceTitle}}
- - {{#with data}} -
Source Relative Path:
-
{{sourceRelativePath}}
- -
Path:
-
{{path}}
- -
Relative Path:
-
{{relativePath}}
- {{/with}} -
-{{/if_eq}} diff --git a/src/UI/Activity/History/HistoryCollection.js b/src/UI/Activity/History/HistoryCollection.js deleted file mode 100644 index 661e2221a..000000000 --- a/src/UI/Activity/History/HistoryCollection.js +++ /dev/null @@ -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', - '5' - ], - 'renamed' : [ - 'eventType', - '6' - ] - }, - - sortMappings : { - 'series' : { sortKey : 'series.sortTitle' } - }, - - initialize : function(options) { - delete this.queryParams.episodeId; - - if (options) { - if (options.episodeId) { - this.queryParams.episodeId = options.episodeId; - } - } - }, - - 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; diff --git a/src/UI/Activity/History/HistoryDetailsCell.js b/src/UI/Activity/History/HistoryDetailsCell.js deleted file mode 100644 index 4a1a8a53f..000000000 --- a/src/UI/Activity/History/HistoryDetailsCell.js +++ /dev/null @@ -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(''); - - return this; - }, - - _showDetails : function() { - vent.trigger(vent.Commands.ShowHistoryDetails, { model : this.model }); - } -}); \ No newline at end of file diff --git a/src/UI/Activity/History/HistoryLayout.js b/src/UI/Activity/History/HistoryLayout.js deleted file mode 100644 index 29d6f44af..000000000 --- a/src/UI/Activity/History/HistoryLayout.js +++ /dev/null @@ -1,161 +0,0 @@ -var Marionette = require('marionette'); -var Backgrid = require('backgrid'); -var HistoryCollection = require('./HistoryCollection'); -var EventTypeCell = require('../../Cells/EventTypeCell'); -var SeriesTitleCell = require('../../Cells/SeriesTitleCell'); -var EpisodeNumberCell = require('../../Cells/EpisodeNumberCell'); -var EpisodeTitleCell = require('../../Cells/EpisodeTitleCell'); -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 : 'series', - label : 'Series', - cell : SeriesTitleCell - }, - { - name : 'episode', - label : 'Episode', - cell : EpisodeNumberCell, - sortable : false - }, - { - name : 'episode', - label : 'Episode Title', - cell : EpisodeTitleCell, - sortable : false - }, - { - 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-sonarr-all', - callback : this._setFilter - }, - { - key : 'grabbed', - title : '', - tooltip : 'Grabbed', - icon : 'icon-sonarr-downloading', - callback : this._setFilter - }, - { - key : 'imported', - title : '', - tooltip : 'Imported', - icon : 'icon-sonarr-imported', - callback : this._setFilter - }, - { - key : 'failed', - title : '', - tooltip : 'Failed', - icon : 'icon-sonarr-download-failed', - callback : this._setFilter - }, - { - key : 'deleted', - title : '', - tooltip : 'Deleted', - icon : 'icon-sonarr-deleted', - callback : this._setFilter - }, - { - key : 'renamed', - title : '', - tooltip : 'Renamed', - icon : 'icon-sonarr-rename', - 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); - } - } -}); diff --git a/src/UI/Activity/History/HistoryLayoutTemplate.hbs b/src/UI/Activity/History/HistoryLayoutTemplate.hbs deleted file mode 100644 index bffb274fe..000000000 --- a/src/UI/Activity/History/HistoryLayoutTemplate.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
-
-
-
-
-
-
-
diff --git a/src/UI/Activity/History/HistoryModel.js b/src/UI/Activity/History/HistoryModel.js deleted file mode 100644 index f8ec8c538..000000000 --- a/src/UI/Activity/History/HistoryModel.js +++ /dev/null @@ -1,12 +0,0 @@ -var Backbone = require('backbone'); -var SeriesModel = require('../../Series/SeriesModel'); -var EpisodeModel = require('../../Series/EpisodeModel'); - -module.exports = Backbone.Model.extend({ - parse : function(model) { - model.series = new SeriesModel(model.series); - model.episode = new EpisodeModel(model.episode); - model.episode.set('series', model.series); - return model; - } -}); \ No newline at end of file diff --git a/src/UI/Activity/History/HistoryQualityCell.js b/src/UI/Activity/History/HistoryQualityCell.js deleted file mode 100644 index c65aa042b..000000000 --- a/src/UI/Activity/History/HistoryQualityCell.js +++ /dev/null @@ -1,30 +0,0 @@ -var NzbDroneCell = require('../../Cells/NzbDroneCell'); - -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(); - - if (this.model.get('qualityCutoffNotMet')) { - this.$el.html('{1}'.format(title, quality.quality.name)); - } else { - this.$el.html('{1}'.format(title, quality.quality.name)); - } - - return this; - } -}); \ No newline at end of file diff --git a/src/UI/Activity/Queue/ProgressCell.js b/src/UI/Activity/Queue/ProgressCell.js deleted file mode 100644 index 1f69bf017..000000000 --- a/src/UI/Activity/Queue/ProgressCell.js +++ /dev/null @@ -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('
'.format(progress.toFixed(1)) + - '
'.format(progress)); - } - } - - return this; - } -}); diff --git a/src/UI/Activity/Queue/QueueActionsCell.js b/src/UI/Activity/Queue/QueueActionsCell.js deleted file mode 100644 index ad3f75144..000000000 --- a/src/UI/Activity/Queue/QueueActionsCell.js +++ /dev/null @@ -1,60 +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 status = this.model.get('status'); - var showBlacklist = status !== 'Delay' && status !== 'DownloadClientUnavailable'; - - 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); - }); - } -}); diff --git a/src/UI/Activity/Queue/QueueActionsCellTemplate.hbs b/src/UI/Activity/Queue/QueueActionsCellTemplate.hbs deleted file mode 100644 index 01e5b34ab..000000000 --- a/src/UI/Activity/Queue/QueueActionsCellTemplate.hbs +++ /dev/null @@ -1,19 +0,0 @@ -{{#if_eq status compare="Completed"}} - {{#if_eq trackedDownloadStatus compare="Warning"}} - - {{/if_eq}} -{{/if_eq}} - -{{#if_eq status compare="Delay"}} - - -{{else}} - {{#unless_eq status compare="DownloadClientUnavailable"}} - - {{/unless_eq}} -{{/if_eq}} - -{{#if_eq status compare="DownloadClientUnavailable"}} - - -{{/if_eq}} diff --git a/src/UI/Activity/Queue/QueueCollection.js b/src/UI/Activity/Queue/QueueCollection.js deleted file mode 100644 index 474cafe6b..000000000 --- a/src/UI/Activity/Queue/QueueCollection.js +++ /dev/null @@ -1,87 +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', - - findEpisode : function(episodeId) { - return _.find(this.fullCollection.models, function(queueModel) { - return queueModel.get('episode').id === episodeId; - }); - }, - - sortMappings : { - series : { - sortValue : function(model, attr) { - var series = model.get(attr); - - return series.get('sortTitle'); - } - }, - - episode : { - sortValue : function(model, attr) { - var episode = model.get('episode'); - - return FormatHelpers.pad(episode.get('seasonNumber'), 4) + FormatHelpers.pad(episode.get('episodeNumber'), 4); - } - }, - - episodeTitle : { - sortValue : function(model, attr) { - var episode = model.get('episode'); - - return episode.get('title'); - } - }, - - 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; \ No newline at end of file diff --git a/src/UI/Activity/Queue/QueueLayout.js b/src/UI/Activity/Queue/QueueLayout.js deleted file mode 100644 index 462c6a568..000000000 --- a/src/UI/Activity/Queue/QueueLayout.js +++ /dev/null @@ -1,97 +0,0 @@ -var Marionette = require('marionette'); -var Backgrid = require('backgrid'); -var QueueCollection = require('./QueueCollection'); -var SeriesTitleCell = require('../../Cells/SeriesTitleCell'); -var EpisodeNumberCell = require('../../Cells/EpisodeNumberCell'); -var EpisodeTitleCell = require('../../Cells/EpisodeTitleCell'); -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 : 'series', - label : 'Series', - cell : SeriesTitleCell - }, - { - name : 'episode', - label : 'Episode', - cell : EpisodeNumberCell - }, - { - name : 'episodeTitle', - label : 'Episode Title', - cell : EpisodeTitleCell, - cellValue : 'episode' - }, - { - 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 - })); - } -}); diff --git a/src/UI/Activity/Queue/QueueLayoutTemplate.hbs b/src/UI/Activity/Queue/QueueLayoutTemplate.hbs deleted file mode 100644 index e8e6a3c12..000000000 --- a/src/UI/Activity/Queue/QueueLayoutTemplate.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
-
- -
-
-
-
-
\ No newline at end of file diff --git a/src/UI/Activity/Queue/QueueModel.js b/src/UI/Activity/Queue/QueueModel.js deleted file mode 100644 index f8ec8c538..000000000 --- a/src/UI/Activity/Queue/QueueModel.js +++ /dev/null @@ -1,12 +0,0 @@ -var Backbone = require('backbone'); -var SeriesModel = require('../../Series/SeriesModel'); -var EpisodeModel = require('../../Series/EpisodeModel'); - -module.exports = Backbone.Model.extend({ - parse : function(model) { - model.series = new SeriesModel(model.series); - model.episode = new EpisodeModel(model.episode); - model.episode.set('series', model.series); - return model; - } -}); \ No newline at end of file diff --git a/src/UI/Activity/Queue/QueueStatusCell.js b/src/UI/Activity/Queue/QueueStatusCell.js deleted file mode 100644 index 42cad2467..000000000 --- a/src/UI/Activity/Queue/QueueStatusCell.js +++ /dev/null @@ -1,91 +0,0 @@ -var Marionette = require('marionette'); -var NzbDroneCell = require('../../Cells/NzbDroneCell'); -var moment = require('moment'); -var UiSettingsModel = require('../../Shared/UiSettingsModel'); -var FormatHelpers = require('../../Shared/FormatHelpers'); - -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-sonarr-downloading'; - var title = 'Downloading'; - var itemTitle = this.cellValue.get('title'); - var content = itemTitle; - - if (status === 'paused') { - icon = 'icon-sonarr-paused'; - title = 'Paused'; - } - - if (status === 'queued') { - icon = 'icon-sonarr-queued'; - title = 'Queued'; - } - - if (status === 'completed') { - icon = 'icon-sonarr-downloaded'; - title = 'Downloaded'; - } - - if (status === 'delay') { - icon = 'icon-sonarr-pending'; - var ect = this.cellValue.get('estimatedCompletionTime'); - var time = '{0} at {1}'.format(FormatHelpers.relativeDate(ect), moment(ect).format(UiSettingsModel.time(true, false))); - title = 'Download delayed till {0}'.format(time); - } - - if (status === 'downloadclientunavailable') { - icon = 'icon-sonarr-client-unavailable'; - title = 'Download pending, download client is unavailable'; - } - - if (status === 'failed') { - icon = 'icon-sonarr-download-failed'; - title = 'Download failed'; - } - - if (status === 'warning') { - icon = 'icon-sonarr-download-warning'; - title = 'Download warning: check download client for more details'; - } - - if (trackedDownloadStatus === 'warning') { - icon += ' icon-sonarr-warning'; - - this.templateFunction = Marionette.TemplateCache.get(this.template); - content = this.templateFunction(this.cellValue.toJSON()); - } - - if (trackedDownloadStatus === 'error') { - if (status === 'completed') { - icon = 'icon-sonarr-import-failed'; - title = 'Import failed: ' + itemTitle; - } else { - icon = 'icon-sonarr-download-failed'; - title = 'Download failed'; - } - - this.templateFunction = Marionette.TemplateCache.get(this.template); - content = this.templateFunction(this.cellValue.toJSON()); - } - - this.$el.html(''.format(icon)); - this.$el.popover({ - content : content, - html : true, - trigger : 'hover', - title : title, - placement : 'right', - container : this.$el - }); - } - return this; - } -}); \ No newline at end of file diff --git a/src/UI/Activity/Queue/QueueStatusCellTemplate.hbs b/src/UI/Activity/Queue/QueueStatusCellTemplate.hbs deleted file mode 100644 index 477fdd028..000000000 --- a/src/UI/Activity/Queue/QueueStatusCellTemplate.hbs +++ /dev/null @@ -1,8 +0,0 @@ -{{#each statusMessages}} - {{title}} -
    - {{#each messages}} -
  • {{this}}
  • - {{/each}} -
-{{/each}} \ No newline at end of file diff --git a/src/UI/Activity/Queue/QueueView.js b/src/UI/Activity/Queue/QueueView.js deleted file mode 100644 index ccddebbc9..000000000 --- a/src/UI/Activity/Queue/QueueView.js +++ /dev/null @@ -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('{1}'.format(label, count)); - return this; - } -}); \ No newline at end of file diff --git a/src/UI/Activity/Queue/RemoveFromQueueView.js b/src/UI/Activity/Queue/RemoveFromQueueView.js deleted file mode 100644 index 571738d7a..000000000 --- a/src/UI/Activity/Queue/RemoveFromQueueView.js +++ /dev/null @@ -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); - }); - } -}); diff --git a/src/UI/Activity/Queue/RemoveFromQueueViewTemplate.hbs b/src/UI/Activity/Queue/RemoveFromQueueViewTemplate.hbs deleted file mode 100644 index c0834ea69..000000000 --- a/src/UI/Activity/Queue/RemoveFromQueueViewTemplate.hbs +++ /dev/null @@ -1,49 +0,0 @@ -