summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIftekharul Islam <iffy.ryan@ibm.com>2018-03-21 10:45:52 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-29 13:47:14 +0000
commita4dacb6a365609ec8e602b3b020030fe73da6087 (patch)
tree169ac9630429a50187085cff742df74e3b0eaaf0
parent23217dae2bdc8e9bd6b3f20a395d1892382b0682 (diff)
downloadphosphor-webui-a4dacb6a365609ec8e602b3b020030fe73da6087.tar.gz
phosphor-webui-a4dacb6a365609ec8e602b3b020030fe73da6087.zip
Fix refresh for event log page
Coded the refresh button in log page so that upon clicking on it will run the rest command to get the latest event log data. This sample code can be used to fetch the relevant data for other pages when refresh button is clicked. Fixes openbmc/openbmc#3009 Change-Id: Iefdc3f77895881df44238142148eb298663c3b5a Signed-off-by: Iftekharul Islam <iffy.ryan@ibm.com>
-rw-r--r--app/common/directives/app-header.js2
-rw-r--r--app/server-health/controllers/log-controller.js11
2 files changed, 11 insertions, 2 deletions
diff --git a/app/common/directives/app-header.js b/app/common/directives/app-header.js
index 69a9c7b..4c49501 100644
--- a/app/common/directives/app-header.js
+++ b/app/common/directives/app-header.js
@@ -63,7 +63,7 @@ window.angular && (function (angular) {
$scope.refresh = function(){
loadData();
-
+ $scope.$emit('refresh-data');
//Add flash class to header timestamp on click of refresh
var myEl = angular.element( document.querySelector( '.header__refresh' ) );
myEl.addClass('flash');
diff --git a/app/server-health/controllers/log-controller.js b/app/server-health/controllers/log-controller.js
index 7493ba5..d871778 100644
--- a/app/server-health/controllers/log-controller.js
+++ b/app/server-health/controllers/log-controller.js
@@ -15,6 +15,7 @@ window.angular && (function (angular) {
paginationTemplateProvider.setString(require('../../common/directives/dirPagination.tpl.html'));
})
.controller('logController', [
+ '$rootScope',
'$scope',
'$window',
'APIUtils',
@@ -22,7 +23,7 @@ window.angular && (function (angular) {
'Constants',
'$routeParams',
'$filter',
- function($scope, $window, APIUtils, dataService, Constants, $routeParams, $filter){
+ function($rootScope, $scope, $window, APIUtils, dataService, Constants, $routeParams, $filter){
$scope.dataService = dataService;
$scope.logs = [];
$scope.tmz = 'EDT';
@@ -191,6 +192,14 @@ window.angular && (function (angular) {
}, true);
$scope.loadLogs();
+
+ var refreshDataListener = $rootScope.$on('refresh-data', function(event, args){
+ $scope.loadLogs();
+ });
+
+ $scope.$on('$destroy', function() {
+ refreshDataListener();
+ });
}
]
);
OpenPOWER on IntegriCloud