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

pull/2283/head^2
Taloth Saldono 7 years ago
parent d617b6c6e3
commit d93645fb46

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

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

@ -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…
Cancel
Save