Skip to content

Commit ac3b0b5

Browse files
authored
Fixed dashboard callout (#403)
* switched dashboard callout to modal
1 parent ae6efa0 commit ac3b0b5

File tree

6 files changed

+60
-5
lines changed

6 files changed

+60
-5
lines changed

test-result-summary-client/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test-result-summary-client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"react-nl2br": "^0.6.1",
2929
"react-router": "^5.2.0",
3030
"react-router-dom": "^5.2.0",
31-
"react-table": "^6.11.5"
31+
"react-table": "^6.11.5",
32+
"sweetalert2": "^10.15.7"
3233
},
3334
"scripts": {
3435
"start": "react-app-rewired start",

test-result-summary-client/src/Dashboard/Widgets/Graph/ChartComponent/StockChart.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default class StockChart extends Component {
5656
<Chart zoomType="x" />
5757

5858
<Legend />
59-
<Tooltip formatter={this.formatter} useHTML style={{ pointerEvents: 'auto' }} />
59+
{ this.props.showTooltip && <Tooltip formatter={this.formatter} useHTML style={{ pointerEvents: 'auto' }} />}
6060

6161
<XAxis >
6262
<XAxis.Title>Time</XAxis.Title>
@@ -84,4 +84,8 @@ export default class StockChart extends Component {
8484
</Navigator>
8585
</HighchartsStockChart>
8686
}
87+
}
88+
89+
StockChart.defaultProps = {
90+
showTooltip: true,
8791
}

test-result-summary-client/src/Dashboard/Widgets/Graph/Dacapo.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import Settings from '../Settings';
33
import StockChart from './ChartComponent/StockChart';
4-
import { getStatisticValues } from './utils';
4+
import { getStatisticValues, handlePointClick } from './utils';
55

66
const builds = ["Test_openjdk8_j9_sanity.perf_x86-64_linux",
77
"Test_openjdk11_j9_sanity.perf_x86-64_linux",
@@ -111,14 +111,17 @@ export default class Dacapo extends Component {
111111
visible: key === "h2Data",
112112
name: key,
113113
data: series[key],
114-
keys: ['x', 'y', 'additionalData', 'CI']
114+
keys: ['x', 'y', 'additionalData', 'CI'],
115+
events: {
116+
click: (event) => handlePointClick(event)
117+
}
115118
});
116119
}
117120
this.setState({ displaySeries });
118121
}
119122

120123
render() {
121124
const { displaySeries } = this.state;
122-
return <StockChart displaySeries={displaySeries} />;
125+
return <StockChart showTooltip={false} displaySeries={displaySeries} />;
123126
}
124127
}

test-result-summary-client/src/Dashboard/Widgets/Graph/utils.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import math from 'mathjs';
2+
import Swal from 'sweetalert2';
23
import BenchmarkMath from '../../../PerfCompare/lib/BenchmarkMath';
34

45
export const parseSha = (str, sha) => {
@@ -57,3 +58,40 @@ export const getStatisticValues = (resultsByJDKBuild, key) => {
5758
});
5859
return [data, std, mean, median];
5960
}
61+
62+
export const handlePointClick = (event) => {
63+
const { buildName, buildNum, javaVersion, jdkDate, testId } = event.point.additionalData[0];
64+
65+
const buildLinks = ` <a href="/output/test?id=${testId}">${buildName} #${buildNum}</a>`;
66+
const CIstr = (typeof event.point.CI === 'undefined') ? `` : `CI = ${event.point.CI}`;
67+
68+
let ret = `<b>${'NAME'}:</b> ${event.y}<br/> <b>Build: </b> ${jdkDate} <pre>${javaVersion}</pre><br/><b>Link to builds:</b> ${buildLinks}<br /> ${CIstr}`;
69+
70+
let i = event.point.series.data.indexOf(event.point);
71+
let prevPoint = i === 0 ? null : event.point.series.data[i - 1];
72+
let lengthPrev = prevPoint ?
73+
prevPoint.additionalData.length : 0;
74+
let prevJavaVersion = prevPoint ? prevPoint.additionalData[lengthPrev - 1].javaVersion : null;
75+
76+
prevJavaVersion = parseSha(prevJavaVersion, 'OpenJ9');
77+
javaVersion = parseSha(javaVersion, 'OpenJ9');
78+
79+
if (prevJavaVersion && javaVersion) {
80+
let githubLink = `<a href="https://github.com/eclipse/openj9/compare/${prevJavaVersion}${javaVersion}">Github Link </a>`;
81+
ret += `<br/> <b> Compare Builds: </b>${githubLink}`;
82+
}
83+
84+
Swal.fire({
85+
html: ret,
86+
showCloseButton: true,
87+
showConfirmButton: false,
88+
width: '50%',
89+
customClass: {
90+
htmlContainer: 'text-align: left !important;',
91+
container: 'text-align: left !important;',
92+
content: 'text-align: left !important;',
93+
input: 'text-align: left !important;',
94+
95+
}
96+
});
97+
}

test-result-summary-client/src/Dashboard/dashboard.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@
5252
text-align: center;
5353
font-size: 20px;
5454
flex: 1 0 0%;
55+
}
56+
57+
.swal2-content {
58+
text-align: left !important;
5559
}

0 commit comments

Comments
 (0)