Display log events in user time
Allows user to display events in their timezone or in UTC.
Previously allowed either ETC or UTC, but listed ETC as
'user timezone'. Updates date time page from GMT offset to
UTC offset for overall consistency. Also updates overview
page to list critical events in user timezone
Resolves openbmc/phosphor-webui#36
Tested: changed timezone settings locally and validated
that correct timezone and UTC offset was presented in
the UI.
Change-Id: I89ca5045eeb789527aa07f5b1baebaa3fbd6b1fa
Signed-off-by: beccabroek <beccabroek@gmail.com>
diff --git a/app/server-health/controllers/log-controller.js b/app/server-health/controllers/log-controller.js
index 5e6db6d..0303854 100644
--- a/app/server-health/controllers/log-controller.js
+++ b/app/server-health/controllers/log-controller.js
@@ -25,7 +25,7 @@
$scope.dataService = dataService;
$scope.logs = [];
$scope.filteredLogs = [];
- $scope.tmz = 'EDT';
+ $scope.tmz = '';
$scope.itemsPerPage = Constants.PAGINATION.LOG_ITEMS_PER_PAGE;
$scope.loading = false;
var expandedSelectedIdOnce = false;
@@ -69,6 +69,7 @@
dataService.updateServerHealth(result.data);
$scope.logs = result.data;
$scope.originalData = result.original;
+ $scope.selectUserTimezone();
$scope.loading = false;
});
};
@@ -159,6 +160,10 @@
$scope.export_data = JSON.stringify(data);
}
+ $scope.selectUserTimezone = function() {
+ $scope.tmz = new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1];
+ };
+
$scope.accept = function() {
APIUtils.deleteLogs($scope.selectedEvents).then(function() {
$scope.confirm = false;