1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

UI Cleanup - Updated Health subtree.

This commit is contained in:
Taloth Saldono 2015-02-13 22:05:54 +01:00
parent a5fd28326e
commit 44928c8f64
3 changed files with 21 additions and 17 deletions

View File

@ -2,12 +2,12 @@ var Backbone = require('backbone');
var HealthModel = require('./HealthModel');
require('../Mixins/backbone.signalr.mixin');
module.exports = (function(){
var Collection = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/health',
model : HealthModel
});
var collection = new Collection().bindSignalR();
collection.fetch();
return collection;
}).call(this);
module.exports = collection;

View File

@ -12,17 +12,21 @@ module.exports = Marionette.ItemView.extend({
render : function() {
this.$el.empty();
if (HealthCollection.length === 0) {
return this;
}
var count = HealthCollection.length;
var label = 'label-warning';
var errors = HealthCollection.some(function(model) {
return model.get('type') === 'error';
});
if (errors) {
label = 'label-danger';
}
this.$el.html('<span class="label {0}">{1}</span>'.format(label, count));
return this;
},

View File

@ -1,4 +1,4 @@
var vent = require('vent');
var vent = require('vent');
var Marionette = require('marionette');
module.exports = Marionette.ItemView.extend({template : 'Hotkeys/HotkeysViewTemplate'});