mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
rjs -> webpack
This commit is contained in:
@@ -1,29 +1,16 @@
|
||||
'use strict';
|
||||
var NzbDroneCell = require('../../Cells/NzbDroneCell');
|
||||
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell'
|
||||
], function (NzbDroneCell) {
|
||||
return 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;
|
||||
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;
|
||||
}
|
||||
});
|
@@ -1,31 +1,22 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'underscore',
|
||||
'backbone',
|
||||
'backbone.pageable',
|
||||
'Activity/Queue/QueueModel',
|
||||
'Mixins/backbone.signalr.mixin'
|
||||
], function (_, Backbone, PageableCollection, QueueModel) {
|
||||
var QueueCollection = PageableCollection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/queue',
|
||||
model: QueueModel,
|
||||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
var PageableCollection = require('backbone.pageable');
|
||||
var QueueModel = require('./QueueModel');
|
||||
require('../../Mixins/backbone.signalr.mixin');
|
||||
|
||||
state: {
|
||||
pageSize: 15
|
||||
},
|
||||
|
||||
mode: 'client',
|
||||
|
||||
findEpisode: function (episodeId) {
|
||||
return _.find(this.fullCollection.models, function (queueModel) {
|
||||
return queueModel.get('episode').id === episodeId;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var collection = new QueueCollection().bindSignalR();
|
||||
collection.fetch();
|
||||
|
||||
return collection;
|
||||
module.exports = (function(){
|
||||
var QueueCollection = PageableCollection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/queue',
|
||||
model : QueueModel,
|
||||
state : {pageSize : 15},
|
||||
mode : 'client',
|
||||
findEpisode : function(episodeId){
|
||||
return _.find(this.fullCollection.models, function(queueModel){
|
||||
return queueModel.get('episode').id === episodeId;
|
||||
});
|
||||
}
|
||||
});
|
||||
var collection = new QueueCollection().bindSignalR();
|
||||
collection.fetch();
|
||||
return collection;
|
||||
}).call(this);
|
@@ -1,16 +1,12 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Series/SeriesModel',
|
||||
'Series/EpisodeModel'
|
||||
], function (Backbone, SeriesModel, EpisodeModel) {
|
||||
return 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;
|
||||
}
|
||||
});
|
||||
});
|
||||
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;
|
||||
}
|
||||
});
|
@@ -1,89 +1,69 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var NzbDroneCell = require('../../Cells/NzbDroneCell');
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Cells/NzbDroneCell'
|
||||
], function (Marionette, NzbDroneCell) {
|
||||
return 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-nd-downloading';
|
||||
var title = 'Downloading';
|
||||
var itemTitle = this.cellValue.get('title');
|
||||
var content = itemTitle;
|
||||
|
||||
if (status === 'paused') {
|
||||
icon = 'icon-pause';
|
||||
title = 'Paused';
|
||||
}
|
||||
|
||||
if (status === 'queued') {
|
||||
icon = 'icon-cloud';
|
||||
title = 'Queued';
|
||||
}
|
||||
|
||||
if (status === 'completed') {
|
||||
icon = 'icon-inbox';
|
||||
title = 'Downloaded';
|
||||
}
|
||||
|
||||
if (status === 'pending') {
|
||||
icon = 'icon-time';
|
||||
title = 'Pending';
|
||||
}
|
||||
|
||||
if (status === 'failed') {
|
||||
icon = 'icon-nd-download-failed';
|
||||
title = 'Download failed';
|
||||
}
|
||||
|
||||
if (status === 'warning') {
|
||||
icon = 'icon-nd-download-warning';
|
||||
title = 'Download warning: check download client for more details';
|
||||
}
|
||||
|
||||
if (trackedDownloadStatus === 'warning') {
|
||||
icon += ' icon-nd-warning';
|
||||
|
||||
this.templateFunction = Marionette.TemplateCache.get(this.template);
|
||||
content = this.templateFunction(this.cellValue.toJSON());
|
||||
}
|
||||
|
||||
if (trackedDownloadStatus === 'error') {
|
||||
if (status === 'completed') {
|
||||
icon = 'icon-nd-import-failed';
|
||||
title = 'Import failed: ' + itemTitle;
|
||||
}
|
||||
else {
|
||||
icon = 'icon-nd-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;
|
||||
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-nd-downloading';
|
||||
var title = 'Downloading';
|
||||
var itemTitle = this.cellValue.get('title');
|
||||
var content = itemTitle;
|
||||
if(status === 'paused') {
|
||||
icon = 'icon-pause';
|
||||
title = 'Paused';
|
||||
}
|
||||
});
|
||||
});
|
||||
if(status === 'queued') {
|
||||
icon = 'icon-cloud';
|
||||
title = 'Queued';
|
||||
}
|
||||
if(status === 'completed') {
|
||||
icon = 'icon-inbox';
|
||||
title = 'Downloaded';
|
||||
}
|
||||
if(status === 'pending') {
|
||||
icon = 'icon-time';
|
||||
title = 'Pending';
|
||||
}
|
||||
if(status === 'failed') {
|
||||
icon = 'icon-nd-download-failed';
|
||||
title = 'Download failed';
|
||||
}
|
||||
if(status === 'warning') {
|
||||
icon = 'icon-nd-download-warning';
|
||||
title = 'Download warning: check download client for more details';
|
||||
}
|
||||
if(trackedDownloadStatus === 'warning') {
|
||||
icon += ' icon-nd-warning';
|
||||
this.templateFunction = Marionette.TemplateCache.get(this.template);
|
||||
content = this.templateFunction(this.cellValue.toJSON());
|
||||
}
|
||||
if(trackedDownloadStatus === 'error') {
|
||||
if(status === 'completed') {
|
||||
icon = 'icon-nd-import-failed';
|
||||
title = 'Import failed: ' + itemTitle;
|
||||
}
|
||||
else {
|
||||
icon = 'icon-nd-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;
|
||||
}
|
||||
});
|
@@ -1,46 +1,33 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'underscore',
|
||||
'marionette',
|
||||
'Activity/Queue/QueueCollection'
|
||||
], function (_, Marionette, QueueCollection) {
|
||||
return Marionette.ItemView.extend({
|
||||
tagName: 'span',
|
||||
var _ = require('underscore');
|
||||
var Marionette = require('marionette');
|
||||
var QueueCollection = require('./QueueCollection');
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
});
|
@@ -1,47 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell',
|
||||
'filesize',
|
||||
'moment',
|
||||
'Shared/UiSettingsModel',
|
||||
'Shared/FormatHelpers'
|
||||
], function (NzbDroneCell, fileSize, moment, UiSettingsModel, FormatHelpers) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'timeleft-cell',
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
|
||||
if (this.cellValue) {
|
||||
|
||||
//If the release is pending we want to use the timeleft as the time it will be processed at
|
||||
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('-');
|
||||
this.$el.attr('title', 'Will be processed during the first RSS Sync after {0}'.format(time));
|
||||
this.$el.attr('data-container', 'body');
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
var timeleft = this.cellValue.get('timeleft');
|
||||
var totalSize = fileSize(this.cellValue.get('size'), 1, false);
|
||||
var remainingSize = fileSize(this.cellValue.get('sizeleft'), 1, false);
|
||||
|
||||
if (timeleft === undefined) {
|
||||
this.$el.html('-');
|
||||
}
|
||||
else {
|
||||
this.$el.html('<span title="{1} / {2}">{0}</span>'.format(timeleft, remainingSize, totalSize));
|
||||
}
|
||||
}
|
||||
var NzbDroneCell = require('../../Cells/NzbDroneCell');
|
||||
var fileSize = require('filesize');
|
||||
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('-');
|
||||
this.$el.attr('title', 'Will be processed during the first RSS Sync after {0}'.format(time));
|
||||
this.$el.attr('data-container', 'body');
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
var timeleft = this.cellValue.get('timeleft');
|
||||
var totalSize = fileSize(this.cellValue.get('size'), 1, false);
|
||||
var remainingSize = fileSize(this.cellValue.get('sizeleft'), 1, false);
|
||||
if(timeleft === undefined) {
|
||||
this.$el.html('-');
|
||||
}
|
||||
else {
|
||||
this.$el.html('<span title="{1} / {2}">{0}</span>'.format(timeleft, remainingSize, totalSize));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user