فهرست منبع

convert event timestamp to milliseconds

jnfrati 4 سال پیش
والد
کامیت
83b5288827
1فایلهای تغییر یافته به همراه20 افزوده شده و 2 حذف شده
  1. 20 2
      dashboard/src/main/home/cluster-dashboard/dashboard/incidents/IncidentPage.tsx

+ 20 - 2
dashboard/src/main/home/cluster-dashboard/dashboard/incidents/IncidentPage.tsx

@@ -42,9 +42,17 @@ const IncidentPage = () => {
         }
         }
       )
       )
       .then((res) => {
       .then((res) => {
-        if (isSubscribed) {
-          setIncident(res.data);
+        if (!isSubscribed) {
+          return;
         }
         }
+
+        let incident = res.data;
+
+        incident.events = convertEventsTimestampsToMilliseconds(
+          incident.events
+        );
+
+        setIncident(incident);
       });
       });
 
 
     return () => {
     return () => {
@@ -140,6 +148,16 @@ const IncidentPage = () => {
 
 
 export default IncidentPage;
 export default IncidentPage;
 
 
+const convertEventsTimestampsToMilliseconds = (events: IncidentEvent[]) => {
+  return events.map((e) => {
+    let newEvent = e;
+
+    newEvent.timestamp = newEvent.timestamp * 1000;
+
+    return newEvent;
+  });
+};
+
 const groupEventsByDate = (
 const groupEventsByDate = (
   events: IncidentEvent[]
   events: IncidentEvent[]
 ): { [key: string]: IncidentEvent[] } => {
 ): { [key: string]: IncidentEvent[] } => {