mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: App health displayed in UI
This commit is contained in:
parent
90a6bcaa47
commit
c8ae9f40fb
54 changed files with 873 additions and 44 deletions
39
src/UI/Health/HealthView.js
Normal file
39
src/UI/Health/HealthView.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'underscore',
|
||||
'marionette',
|
||||
'Health/HealthCollection'
|
||||
], function (_, Marionette, HealthCollection) {
|
||||
return Marionette.ItemView.extend({
|
||||
initialize: function () {
|
||||
this.listenTo(HealthCollection, 'sync', this._healthSync);
|
||||
HealthCollection.fetch();
|
||||
},
|
||||
|
||||
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-important';
|
||||
}
|
||||
|
||||
this.$el.html('<span class="label pull-right {0}">{1}</span>'.format(label, count));
|
||||
return this;
|
||||
},
|
||||
|
||||
_healthSync: function () {
|
||||
this.render();
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue