mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-16 21:15:33 -04:00
New: App health displayed in UI
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
define([
|
||||
'vent',
|
||||
'marionette',
|
||||
'vent',
|
||||
'marionette',
|
||||
'backgrid',
|
||||
'System/Info/DiskSpace/DiskSpaceCollection',
|
||||
'Shared/LoadingView',
|
||||
@@ -14,6 +14,7 @@ define([
|
||||
regions: {
|
||||
grid: '#x-grid'
|
||||
},
|
||||
|
||||
columns:
|
||||
[
|
||||
{
|
||||
@@ -37,6 +38,7 @@ define([
|
||||
this.collection = new DiskSpaceCollection();
|
||||
this.listenTo(this.collection, 'sync', this._showTable);
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this.grid.show(new LoadingView());
|
||||
},
|
||||
@@ -44,6 +46,7 @@ define([
|
||||
onShow: function() {
|
||||
this.collection.fetch();
|
||||
},
|
||||
|
||||
_showTable: function() {
|
||||
this.grid.show(new Backgrid.Grid({
|
||||
row: Backgrid.Row,
|
||||
|
||||
18
src/UI/System/Info/Health/HealthCell.js
Normal file
18
src/UI/System/Info/Health/HealthCell.js
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Cells/NzbDroneCell'
|
||||
], function (NzbDroneCell) {
|
||||
return NzbDroneCell.extend({
|
||||
|
||||
className: 'log-level-cell',
|
||||
|
||||
render: function () {
|
||||
|
||||
var level = this._getValue();
|
||||
this.$el.html('<i class="icon-nd-health-{0}" title="{1}"/>'.format(this._getValue().toLowerCase(), level));
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
55
src/UI/System/Info/Health/HealthLayout.js
Normal file
55
src/UI/System/Info/Health/HealthLayout.js
Normal file
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'backgrid',
|
||||
'Health/HealthCollection',
|
||||
'System/Info/Health/HealthCell',
|
||||
'System/Info/Health/HealthOkView'
|
||||
], function (Marionette, Backgrid, HealthCollection, HealthCell, HealthOkView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'System/Info/Health/HealthLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
grid: '#x-health-grid'
|
||||
},
|
||||
|
||||
columns:
|
||||
[
|
||||
{
|
||||
name: 'type',
|
||||
label: '',
|
||||
cell: HealthCell
|
||||
},
|
||||
{
|
||||
name: 'message',
|
||||
label: 'Message',
|
||||
cell: 'string'
|
||||
}
|
||||
],
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(HealthCollection, 'sync', this.render);
|
||||
HealthCollection.fetch();
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
if (HealthCollection.length === 0) {
|
||||
this.grid.show(new HealthOkView());
|
||||
}
|
||||
|
||||
else {
|
||||
this._showTable();
|
||||
}
|
||||
},
|
||||
|
||||
_showTable: function() {
|
||||
this.grid.show(new Backgrid.Grid({
|
||||
row: Backgrid.Row,
|
||||
columns: this.columns,
|
||||
collection: HealthCollection,
|
||||
className:'table table-hover'
|
||||
}));
|
||||
}
|
||||
});
|
||||
});
|
||||
6
src/UI/System/Info/Health/HealthLayoutTemplate.html
Normal file
6
src/UI/System/Info/Health/HealthLayoutTemplate.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<fieldset class="x-health">
|
||||
<legend>Health</legend>
|
||||
|
||||
<div id="x-health-grid"/>
|
||||
</fieldset>
|
||||
|
||||
9
src/UI/System/Info/Health/HealthOkView.js
Normal file
9
src/UI/System/Info/Health/HealthOkView.js
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'System/Info/Health/HealthOkViewTemplate'
|
||||
});
|
||||
});
|
||||
2
src/UI/System/Info/Health/HealthOkViewTemplate.html
Normal file
2
src/UI/System/Info/Health/HealthOkViewTemplate.html
Normal file
@@ -0,0 +1,2 @@
|
||||
No issues with your configuration
|
||||
|
||||
@@ -4,22 +4,26 @@ define(
|
||||
'backbone',
|
||||
'marionette',
|
||||
'System/Info/About/AboutView',
|
||||
'System/Info/DiskSpace/DiskSpaceLayout'
|
||||
'System/Info/DiskSpace/DiskSpaceLayout',
|
||||
'System/Info/Health/HealthLayout'
|
||||
], function (Backbone,
|
||||
Marionette,
|
||||
AboutView,
|
||||
DiskSpaceLayout) {
|
||||
DiskSpaceLayout,
|
||||
HealthLayout) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'System/Info/SystemInfoLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
about : '#about',
|
||||
diskSpace: '#diskspace'
|
||||
diskSpace: '#diskspace',
|
||||
health : '#health'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.about.show(new AboutView());
|
||||
this.diskSpace.show(new DiskSpaceLayout());
|
||||
this.health.show(new HealthLayout());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<div class="row">
|
||||
<div class="span12" id="health"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span12" id="about"></div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user