mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Fixed: Show error if System->Logs fails to load due to ad blocker.
This commit is contained in:
parent
d617b6c6e3
commit
d93645fb46
10
src/UI/Shared/ErrorModel.js
Normal file
10
src/UI/Shared/ErrorModel.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
var _ = require('underscore');
|
||||||
|
var Backbone = require('backbone');
|
||||||
|
|
||||||
|
module.exports = Backbone.Model.extend({
|
||||||
|
defaults : {
|
||||||
|
'type' : 'danger',
|
||||||
|
'title' : '',
|
||||||
|
'message' : ''
|
||||||
|
}
|
||||||
|
});
|
10
src/UI/Shared/ErrorView.js
Normal file
10
src/UI/Shared/ErrorView.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
var Marionette = require('marionette');
|
||||||
|
var ErrorModel = require('./ErrorModel');
|
||||||
|
|
||||||
|
module.exports = Marionette.ItemView.extend({
|
||||||
|
template : 'Shared/ErrorViewTemplate',
|
||||||
|
|
||||||
|
initialize: function(data) {
|
||||||
|
this.model = new ErrorModel(data);
|
||||||
|
}
|
||||||
|
});
|
6
src/UI/Shared/ErrorViewTemplate.hbs
Normal file
6
src/UI/Shared/ErrorViewTemplate.hbs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div class="alert alert-{{type}}" role="alert">
|
||||||
|
{{#if title}}
|
||||||
|
<strong>{{title}}</strong>
|
||||||
|
{{/if}}
|
||||||
|
{{message}}
|
||||||
|
</div>
|
@ -8,6 +8,7 @@ var GridPager = require('../../../Shared/Grid/Pager');
|
|||||||
var LogCollection = require('../LogsCollection');
|
var LogCollection = require('../LogsCollection');
|
||||||
var ToolbarLayout = require('../../../Shared/Toolbar/ToolbarLayout');
|
var ToolbarLayout = require('../../../Shared/Toolbar/ToolbarLayout');
|
||||||
var LoadingView = require('../../../Shared/LoadingView');
|
var LoadingView = require('../../../Shared/LoadingView');
|
||||||
|
var ErrorView = require('../../../Shared/ErrorView');
|
||||||
require('../../../jQuery/jquery.spin');
|
require('../../../jQuery/jquery.spin');
|
||||||
|
|
||||||
module.exports = Marionette.Layout.extend({
|
module.exports = Marionette.Layout.extend({
|
||||||
@ -57,6 +58,7 @@ module.exports = Marionette.Layout.extend({
|
|||||||
this.collection = new LogCollection();
|
this.collection = new LogCollection();
|
||||||
|
|
||||||
this.listenTo(this.collection, 'sync', this._showTable);
|
this.listenTo(this.collection, 'sync', this._showTable);
|
||||||
|
this.listenTo(this.collection, 'error', this._showTableError);
|
||||||
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
|
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -68,6 +70,13 @@ module.exports = Marionette.Layout.extend({
|
|||||||
this._showToolbar();
|
this._showToolbar();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_showTableError : function() {
|
||||||
|
this.grid.show(new ErrorView({
|
||||||
|
title: "Oh snap!",
|
||||||
|
message: "Failed to load logs, your ad blocker might be blocking the api calls."
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
_showTable : function() {
|
_showTable : function() {
|
||||||
this.grid.show(new Backgrid.Grid({
|
this.grid.show(new Backgrid.Grid({
|
||||||
row : LogRow,
|
row : LogRow,
|
||||||
|
Loading…
Reference in New Issue
Block a user