Skip to content

Commit 6eaefed

Browse files
committed
Formatting frame window
1 parent c56f967 commit 6eaefed

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/App.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
box-shadow: 15px 30px 40px 5px rgba(0, 0, 0, 0.5);
4848
}
4949

50+
.tooltip-entry {
51+
text-align: left;
52+
}
53+
5054
.App-link {
5155
color: #61dafb;
5256
}

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function App() {
99
<div className="App">
1010
<header className="App-header">
1111
<h1 style={{marginBottom: "5px"}}> Dashboard </h1>
12-
<a class="Header-link" href="https://openmonitor.zeekay.dev" >&gt;&gt;&gt; Visit us on GitHub! &lt;&lt;&lt;</a>
12+
<a className="Header-link" href="https://openmonitor.zeekay.dev" >&gt;&gt;&gt; Visit us on GitHub! &lt;&lt;&lt;</a>
1313

1414
</header>
1515
<div >

src/components/Components.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import React, { Component } from 'react';
22
import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer, Legend, Tooltip, ReferenceLine, ScatterChart, Scatter, Cell } from 'recharts';
33
import '../App.css';
44

5+
const renderColorfulLegendText = (value) => {
6+
const { color } = "white";
7+
console.log('formatter')
8+
9+
return <span style={{ color }}>{value}</span>;
10+
};
11+
512
export default class Instances extends Component{
613

714
getColor(frame){
@@ -93,7 +100,7 @@ export default class Instances extends Component{
93100
<Tooltip content={<CustomTooltip />} />
94101
<ReferenceLine y={this.props.components.timeout} label={{value:"Timeout", position:"bottom", fill: 'red'}} stroke="red" strokeDasharray="3 3" />
95102
<ReferenceLine y={this.props.components.expectedTime} stroke="lightblue" label={{value:"Expected Time (" + this.props.components.expectedTime + "ms)", position:"bottom", fill: 'lightblue'}} strokeDasharray="3 3" />
96-
<Legend />
103+
<Legend formatter={renderColorfulLegendText}/>
97104
<Scatter name="ResponseTime" data={frames} fill="url(#gradient)">
98105
{frames.map((entry, index) => (
99106
<Cell key={`cell-${frames[index].id}`} fill={this.getColor(frames[index])} />
@@ -112,14 +119,19 @@ export default class Instances extends Component{
112119

113120
function CustomTooltip({active, payload}) {
114121
if(active){
122+
const timestamp = new Date(payload[0].payload.timestamp).toLocaleString()
115123
return(
116124
<div className="tooltip">
117-
<p>{payload[0].payload.timestamp}</p>
118-
<p>ResponseTime: {payload[0].payload.responseTime}ms</p>
119-
<p>CPU usage: {payload[0].payload.cpu}%</p>
120-
<p>Comment: {payload[0].payload.comment}</p>
121-
<p>Comment ID: {payload[0].payload.commentId}</p>
122-
<p>Frame ID: {payload[0].payload.id}</p>
125+
<p>{timestamp}</p>
126+
<p className={"tooltip-entry"}>ResponseTime: {payload[0].payload.responseTime}ms</p>
127+
<p className={"tooltip-entry"}>CPU usage: {payload[0].payload.cpu}%</p>
128+
{payload[0].payload.comment !== undefined &&
129+
<p className={"tooltip-entry"}>Comment: {payload[0].payload.comment}</p>
130+
}
131+
{payload[0].payload.comment !== undefined &&
132+
<p className={"tooltip-entry"}>Comment ID: {payload[0].payload.commentId}</p>
133+
}
134+
<p className={"tooltip-entry"}>Frame ID: {payload[0].payload.id}</p>
123135
</div>
124136
)
125137
}

0 commit comments

Comments
 (0)