Queue should update now

This commit is contained in:
Mark McDowall 2013-10-03 14:06:52 -07:00
parent 938b5f1ae3
commit 6f27d8c33f
11 changed files with 65 additions and 7 deletions

View File

@ -14,5 +14,6 @@ namespace NzbDrone.Api.Queue
public String Title { get; set; } public String Title { get; set; }
public Decimal Sizeleft { get; set; } public Decimal Sizeleft { get; set; }
public TimeSpan Timeleft { get; set; } public TimeSpan Timeleft { get; set; }
public String Status { get; set; }
} }
} }

View File

@ -73,7 +73,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
queueItem.Id = nzbGetQueueItem.NzbId.ToString(); queueItem.Id = nzbGetQueueItem.NzbId.ToString();
queueItem.Title = nzbGetQueueItem.NzbName; queueItem.Title = nzbGetQueueItem.NzbName;
queueItem.Size = nzbGetQueueItem.FileSizeMb; queueItem.Size = nzbGetQueueItem.FileSizeMb;
queueItem.SizeLeft = nzbGetQueueItem.RemainingSizeMb; queueItem.Sizeleft = nzbGetQueueItem.RemainingSizeMb;
yield return queueItem; yield return queueItem;
} }

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
public string Category { get; set; } public string Category { get; set; }
[JsonProperty(PropertyName = "mbleft")] [JsonProperty(PropertyName = "mbleft")]
public decimal SizeLeft { get; set; } public decimal Sizeleft { get; set; }
public int Percentage { get; set; } public int Percentage { get; set; }

View File

@ -117,9 +117,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
queueItem.Id = sabQueueItem.Id; queueItem.Id = sabQueueItem.Id;
queueItem.Title = sabQueueItem.Title; queueItem.Title = sabQueueItem.Title;
queueItem.Size = sabQueueItem.Size; queueItem.Size = sabQueueItem.Size;
queueItem.SizeLeft = sabQueueItem.Size; queueItem.Sizeleft = sabQueueItem.Sizeleft;
queueItem.Timeleft = sabQueueItem.Timeleft;
queueItem.Status = sabQueueItem.Status;
queueItems.Add( queueItem); queueItems.Add(queueItem);
} }
return queueItems; return queueItems;

View File

@ -7,7 +7,8 @@ namespace NzbDrone.Core.Download
public string Id { get; set; } public string Id { get; set; }
public decimal Size { get; set; } public decimal Size { get; set; }
public string Title { get; set; } public string Title { get; set; }
public decimal SizeLeft { get; set; } public decimal Sizeleft { get; set; }
public TimeSpan Timeleft { get; set; } public TimeSpan Timeleft { get; set; }
public String Status { get; set; }
} }
} }

View File

@ -13,5 +13,6 @@ namespace NzbDrone.Core.Queue
public String Title { get; set; } public String Title { get; set; }
public Decimal Sizeleft { get; set; } public Decimal Sizeleft { get; set; }
public TimeSpan Timeleft { get; set; } public TimeSpan Timeleft { get; set; }
public String Status { get; set; }
} }
} }

View File

@ -59,8 +59,9 @@ namespace NzbDrone.Core.Queue
queue.Quality = remoteEpisode.ParsedEpisodeInfo.Quality; queue.Quality = remoteEpisode.ParsedEpisodeInfo.Quality;
queue.Title = queueItem.Title; queue.Title = queueItem.Title;
queue.Size = queueItem.Size; queue.Size = queueItem.Size;
queue.Sizeleft = queueItem.SizeLeft; queue.Sizeleft = queueItem.Sizeleft;
queue.Timeleft = queueItem.Timeleft; queue.Timeleft = queueItem.Timeleft;
queue.Status = queueItem.Status;
queued.Add(queue); queued.Add(queue);
} }
} }

View File

@ -96,4 +96,9 @@ td.episode-status-cell, td.quality-cell {
.timeleft-cell { .timeleft-cell {
cursor: default; cursor: default;
width: 80px; width: 80px;
}
.queue-status-cell {
width: 20px;
text-align: center !important;
} }

View File

@ -8,6 +8,7 @@ define(
'Cells/EpisodeNumberCell', 'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell', 'Cells/EpisodeTitleCell',
'Cells/QualityCell', 'Cells/QualityCell',
'History/Queue/QueueStatusCell',
'History/Queue/TimeleftCell' 'History/Queue/TimeleftCell'
], function (Marionette, ], function (Marionette,
Backgrid, Backgrid,
@ -16,6 +17,7 @@ define(
EpisodeNumberCell, EpisodeNumberCell,
EpisodeTitleCell, EpisodeTitleCell,
QualityCell, QualityCell,
QueueStatusCell,
TimeleftCell) { TimeleftCell) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'History/Queue/QueueLayoutTemplate', template: 'History/Queue/QueueLayoutTemplate',
@ -26,6 +28,12 @@ define(
columns: columns:
[ [
{
name : 'status',
label: '',
cell : QueueStatusCell,
cellValue: 'this'
},
{ {
name : 'series', name : 'series',
label: 'Series', label: 'Series',

View File

@ -0,0 +1,39 @@
'use strict';
define(
[
'Cells/NzbDroneCell'
], function (NzbDroneCell) {
return NzbDroneCell.extend({
className: 'queue-status-cell',
render: function () {
this.$el.empty();
if (this.cellValue) {
var status = this.cellValue.get('status').toLowerCase();
var icon = 'icon-nd-downloading';
var title = 'Downloading';
if (status === 'paused') {
icon = 'icon-pause';
title = 'Paused';
}
if (status === 'queued') {
icon = 'icon-cloud';
title = 'Queued';
}
var timeleft = this.cellValue.get('timeleft');
var size = this.cellValue.get('size');
var sizeleft = this.cellValue.get('sizeleft');
this.$el.html('<i class="{0}" title="{1}"></i>'.format(icon, title));
}
return this;
}
});
});

View File

@ -22,7 +22,7 @@ define(function () {
} }
if (xhr) { if (xhr) {
xhr.headers = xhr.headers || {}; xhr.headers = xhr.headers || {};
xhr.headers['Authorization'] = window.NzbDrone.ApiKey; // xhr.headers.Authorization = window.NzbDrone.ApiKey;
} }
return original.apply(this, arguments); return original.apply(this, arguments);