1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Deleting logs will refresh on completion

This commit is contained in:
Mark McDowall 2013-10-07 20:35:27 -07:00
parent 4dfe201019
commit 0d7097a682

View File

@ -1,6 +1,7 @@
'use strict';
define(
[
'app',
'marionette',
'backgrid',
'System/Logs/Table/LogTimeCell',
@ -9,7 +10,7 @@ define(
'System/Logs/LogsCollection',
'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView'
], function (Marionette, Backgrid, LogTimeCell, LogLevelCell, GridPager, LogCollection, ToolbarLayout, LoadingView) {
], function (App, Marionette, Backgrid, LogTimeCell, LogLevelCell, GridPager, LogCollection, ToolbarLayout, LoadingView) {
return Marionette.Layout.extend({
template: 'System/Logs/Table/LogsTableLayoutTemplate',
@ -57,6 +58,8 @@ define(
initialize: function () {
this.collection = new LogCollection();
this.collectionPromise = this.collection.fetch();
App.vent.on(App.Events.CommandComplete, this._commandComplete, this);
},
onRender: function () {
@ -72,8 +75,6 @@ define(
});
},
_showTable: function () {
this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
@ -104,11 +105,7 @@ define(
{
title : 'Clear Logs',
icon : 'icon-trash',
command : 'clearLog',
successMessage : 'Logs have been cleared',
errorMessage : 'Failed to clear logs',
ownerContext : this,
onSuccess : this._refreshLogs
command : 'clearLog'
}
]
};
@ -126,6 +123,12 @@ define(
this.collection.state.currentPage = 1;
this.collection.fetch({ reset: true });
this._showTable();
},
_commandComplete: function (options) {
if (options.command.get('name') === 'clearlog') {
this._refreshLogs();
}
}
});
});