From 38467a74decc5ee46cba58d0f8a09e5177d695cc Mon Sep 17 00:00:00 2001 From: Daniel Campbell Date: Fri, 13 Jul 2018 16:43:56 -0700 Subject: [PATCH] Add timestamp marker to histogram --- ui/src/logs/containers/LogsPage.tsx | 82 ++++++++++++++++++++++++++++- ui/src/reusable_ui/types/index.ts | 24 +++++++++ 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/ui/src/logs/containers/LogsPage.tsx b/ui/src/logs/containers/LogsPage.tsx index 749e834e30..636c67a9f6 100644 --- a/ui/src/logs/containers/LogsPage.tsx +++ b/ui/src/logs/containers/LogsPage.tsx @@ -4,6 +4,7 @@ import _ from 'lodash' import moment from 'moment' import {connect} from 'react-redux' import {AutoSizer} from 'react-virtualized' +import {Greys} from 'src/reusable_ui/types' import { setTableCustomTimeAsync, @@ -333,7 +334,10 @@ class LogsPage extends Component { } private get chart(): JSX.Element { - const {histogramData} = this.props + const { + histogramData, + timeRange: {timeOption}, + } = this.props const {histogramColors} = this.state return ( @@ -347,7 +351,81 @@ class LogsPage extends Component { colors={histogramColors} onBarClick={this.handleBarClick} sortBarGroups={this.handleSortHistogramBarGroups} - /> + > + {({adjustedWidth, adjustedHeight, margins}) => { + const x = margins.left + adjustedWidth / 2 + const y1 = margins.top + const y2 = margins.top + adjustedHeight + const textSize = 11 + const markerSize = 5 + const labelSize = 100 + + if (timeOption === 'now') { + return null + } else { + const lineContainerWidth = 3 + const lineWidth = 1 + + return ( + <> + + + + + + Current Timestamp + + + + {moment(timeOption).format('YYYY-MM-DD | HH:mm:ss.SSS')} + + + + ) + } + }} + )} ) diff --git a/ui/src/reusable_ui/types/index.ts b/ui/src/reusable_ui/types/index.ts index b212a4e864..b09a8dc1b8 100644 --- a/ui/src/reusable_ui/types/index.ts +++ b/ui/src/reusable_ui/types/index.ts @@ -19,3 +19,27 @@ export enum ButtonShape { Square = 'square', StretchToFit = 'stretch', } + +export enum Greys { + Obsidian = '#0f0e15', + Raven = '#1c1c21', + Kevlar = '#202028', + Castle = '#292933', + Onyx = '#31313d', + Pepper = '#383846', + Smoke = '#434453', + Graphite = '#545667', + Storm = '#676978', + Mountain = '#757888', + Wolf = '#8e91a1', + Sidewalk = '#999dab', + Forge = '#a4a8b6', + Mist = '#bec2cc', + Chromium = '#c6cad3', + Platinum = '#d4d7dd', + Pearl = '#e7e8eb', + Whisper = '#eeeff2', + Cloud = '#f6f6f8', + Ghost = '#fafafc', + White = '#ffffff', +}