1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Show error if System->Logs fails to load due to ad blocker.

This commit is contained in:
Taloth Saldono 2018-01-27 23:27:30 +01:00
parent d617b6c6e3
commit d93645fb46
4 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,10 @@
var _ = require('underscore');
var Backbone = require('backbone');
module.exports = Backbone.Model.extend({
defaults : {
'type' : 'danger',
'title' : '',
'message' : ''
}
});

View 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);
}
});

View File

@ -0,0 +1,6 @@
<div class="alert alert-{{type}}" role="alert">
{{#if title}}
<strong>{{title}}</strong>
{{/if}}
{{message}}
</div>

View File

@ -8,6 +8,7 @@ var GridPager = require('../../../Shared/Grid/Pager');
var LogCollection = require('../LogsCollection');
var ToolbarLayout = require('../../../Shared/Toolbar/ToolbarLayout');
var LoadingView = require('../../../Shared/LoadingView');
var ErrorView = require('../../../Shared/ErrorView');
require('../../../jQuery/jquery.spin');
module.exports = Marionette.Layout.extend({
@ -57,6 +58,7 @@ module.exports = Marionette.Layout.extend({
this.collection = new LogCollection();
this.listenTo(this.collection, 'sync', this._showTable);
this.listenTo(this.collection, 'error', this._showTableError);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
@ -68,6 +70,13 @@ module.exports = Marionette.Layout.extend({
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() {
this.grid.show(new Backgrid.Grid({
row : LogRow,