From 0747e53d4fcfa299774fc1d06280cbf8844c5499 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 11 Nov 2013 14:31:33 -0800 Subject: [PATCH] Fixed logs table, added spinner to logs refresh --- src/UI/Shared/Toolbar/Button/ButtonView.js | 6 +++++- src/UI/System/Logs/Files/LogFileLayout.js | 6 ++++-- src/UI/System/Logs/Table/LogsTableLayout.js | 10 ++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/UI/Shared/Toolbar/Button/ButtonView.js b/src/UI/Shared/Toolbar/Button/ButtonView.js index a35d1a048..45300e988 100644 --- a/src/UI/Shared/Toolbar/Button/ButtonView.js +++ b/src/UI/Shared/Toolbar/Button/ButtonView.js @@ -11,6 +11,10 @@ define( template : 'Shared/Toolbar/ButtonTemplate', className: 'btn', + ui: { + icon: 'i' + }, + events: { 'click': 'onClick' }, @@ -73,7 +77,7 @@ define( var callback = this.model.get('callback'); if (callback) { - callback.call(this.model.ownerContext); + callback.call(this.model.ownerContext, this); } } }); diff --git a/src/UI/System/Logs/Files/LogFileLayout.js b/src/UI/System/Logs/Files/LogFileLayout.js index f8de17828..ad96e297b 100644 --- a/src/UI/System/Logs/Files/LogFileLayout.js +++ b/src/UI/System/Logs/Files/LogFileLayout.js @@ -12,7 +12,8 @@ define( 'System/Logs/Files/ContentsView', 'System/Logs/Files/ContentsModel', 'Shared/Toolbar/ToolbarLayout', - 'Shared/LoadingView' + 'Shared/LoadingView', + 'jQuery/jquery.spin' ], function (vent, Marionette, Backgrid, @@ -141,7 +142,8 @@ define( _refreshLogs: function () { this.contents.close(); - this.collection.fetch(); + var promise = this.collection.fetch(); + buttonContext.ui.icon.spinForPromise(promise); }, _commandComplete: function (options) { diff --git a/src/UI/System/Logs/Table/LogsTableLayout.js b/src/UI/System/Logs/Table/LogsTableLayout.js index e364baa3c..82960ba79 100644 --- a/src/UI/System/Logs/Table/LogsTableLayout.js +++ b/src/UI/System/Logs/Table/LogsTableLayout.js @@ -10,7 +10,8 @@ define( 'Shared/Grid/Pager', 'System/Logs/LogsCollection', 'Shared/Toolbar/ToolbarLayout', - 'Shared/LoadingView' + 'Shared/LoadingView', + 'jQuery/jquery.spin' ], function (vent, Marionette, Backgrid, LogTimeCell, LogLevelCell, LogRow, GridPager, LogCollection, ToolbarLayout, LoadingView) { return Marionette.Layout.extend({ template: 'System/Logs/Table/LogsTableLayoutTemplate', @@ -65,6 +66,7 @@ define( onRender: function () { this.grid.show(new LoadingView()); + this.collection.fetch(); }, onShow: function () { @@ -115,10 +117,10 @@ define( })); }, - _refreshLogs: function () { + _refreshLogs: function (buttonContext) { this.collection.state.currentPage = 1; - this.collection.fetch({ reset: true }); - this._showTable(); + var promise = this.collection.fetch({ reset: true }); + buttonContext.ui.icon.spinForPromise(promise); }, _commandComplete: function (options) {