mirror of
https://github.com/Readarr/Readarr.git
synced 2026-02-05 11:41:41 -05:00
UI Cleanup - Updated Activity subtree.
This commit is contained in:
@@ -3,30 +3,37 @@ var Marionette = require('marionette');
|
||||
var QueueCollection = require('./QueueCollection');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
tagName : 'span',
|
||||
initialize : function(){
|
||||
tagName : 'span',
|
||||
|
||||
initialize : function() {
|
||||
this.listenTo(QueueCollection, 'sync', this.render);
|
||||
QueueCollection.fetch();
|
||||
},
|
||||
render : function(){
|
||||
|
||||
render : function() {
|
||||
this.$el.empty();
|
||||
if(QueueCollection.length === 0) {
|
||||
|
||||
if (QueueCollection.length === 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
var count = QueueCollection.fullCollection.length;
|
||||
var label = 'label-info';
|
||||
var errors = QueueCollection.fullCollection.some(function(model){
|
||||
|
||||
var errors = QueueCollection.fullCollection.some(function(model) {
|
||||
return model.has('trackedDownloadStatus') && model.get('trackedDownloadStatus').toLowerCase() === 'error';
|
||||
});
|
||||
var warnings = QueueCollection.fullCollection.some(function(model){
|
||||
|
||||
var warnings = QueueCollection.fullCollection.some(function(model) {
|
||||
return model.has('trackedDownloadStatus') && model.get('trackedDownloadStatus').toLowerCase() === 'warning';
|
||||
});
|
||||
if(errors) {
|
||||
|
||||
if (errors) {
|
||||
label = 'label-danger';
|
||||
}
|
||||
else if(warnings) {
|
||||
} else if (warnings) {
|
||||
label = 'label-warning';
|
||||
}
|
||||
|
||||
this.$el.html('<span class="label {0}">{1}</span>'.format(label, count));
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user