From 305961db414b8c86fd1dee53e76d4fbd7aa5513f Mon Sep 17 00:00:00 2001 From: Kanika Murarka Date: Thu, 25 Apr 2019 16:21:04 +0530 Subject: [PATCH] mgr/dashboard: Log's time from UTC to local Fixes: https://tracker.ceph.com/issues/39297 Signed-off-by: Kanika Murarka --- .../src/app/ceph/cluster/logs/logs.component.html | 6 +++--- .../frontend/src/app/ceph/cluster/logs/logs.component.ts | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html index a2c7d2389eb..c455894c1eb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.html @@ -6,7 +6,7 @@

- {{ line.stamp }} + {{ line.stamp | cdDate }} {{ line.priority }} {{ line.message }}

@@ -22,7 +22,7 @@

- {{ line.stamp }} + {{ line.stamp | cdDate }} {{ line.priority }} {{ line.message }}

@@ -42,7 +42,7 @@ diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts index cd20503c3a3..1ffc1610c7d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.ts @@ -1,3 +1,4 @@ +import { DatePipe } from '@angular/common'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { LogsService } from '../../../shared/api/logs.service'; @@ -28,7 +29,7 @@ export class LogsComponent implements OnInit, OnDestroy { selectedDate: Date; startTime: Date = new Date(); endTime: Date = new Date(); - constructor(private logsService: LogsService) { + constructor(private logsService: LogsService, private datePipe: DatePipe) { this.startTime.setHours(0, 0); this.endTime.setHours(23, 59); } @@ -81,8 +82,9 @@ export class LogsComponent implements OnInit, OnDestroy { filterExecutor(logs: Array, filters: any): Array { return logs.filter((line) => { - const hour = parseInt(line.stamp.slice(11, 13), 10); - const minutes = parseInt(line.stamp.slice(14, 16), 10); + const localDate = this.datePipe.transform(line.stamp, 'mediumTime'); + const hour = parseInt(localDate.split(':')[0], 10); + const minutes = parseInt(localDate.split(':')[1], 10); let prio: string, y_m_d: string, timeSpan: number; prio = filters.priority === 'All' ? line.priority : filters.priority;