Skip to content

Commit e46e923

Browse files
Add test history calendar view (#3139)
When viewing a particular test, it's currently possible to view prior test statuses on a scatter plot. A scatter plot with binary is not ideal for a multitude of reasons, so this PR re-implements it to instead show the data on a calendar plot. Days with only passing tests are shown in free, days with only failing tests are shown in red, and days with both passing and failing tests are shown in green/red. Clicking on a day takes users to the test query page with appropriate filters set for further exploration. Further refactoring of this plot and similar plots is yet to come, but these changes are sufficient in the short term. I also intend to add a visual difference test for this component once I implement visual difference testing. Before: <img width="500" alt="image" src="https://github.com/user-attachments/assets/64b2e045-85b3-4494-9978-80db0761683b" /> After: <img width="500" alt="image" src="https://github.com/user-attachments/assets/68113d2a-48ee-4e33-a3ed-83a944182c2b" />
1 parent df2f5c9 commit e46e923

7 files changed

Lines changed: 598 additions & 11 deletions

File tree

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ module.exports = {
99
'^.+\\.js$': 'babel-jest',
1010
'^.+\\.vue$': '@vue/vue3-jest',
1111
},
12+
transformIgnorePatterns: [
13+
'/node_modules/(?!echarts|zrender)/',
14+
],
1215
};

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"bootstrap": "^4.6.2",
4040
"d3": "^3.5.17",
4141
"daisyui": "^4.12.23",
42+
"echarts": "^6.0.0",
4243
"eslint": "^8.57.0",
4344
"eslint-plugin-vue": "^10.5.0",
4445
"flot": "^4.2.6",

resources/js/vue/components/TestDetails.vue

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,19 @@
216216

217217
<!-- Graph -->
218218
<div
219-
v-show="showgraph"
219+
v-show="showgraph && graphSelection !== 'status'"
220220
id="graph_holder"
221221
/>
222222
<div id="tooltip" />
223223

224+
<test-history-plot
225+
v-if="graphSelection === 'status'"
226+
:base-url="$baseURL"
227+
:project-id="cdash.projectid"
228+
:project-name="cdash.projectname"
229+
:test-name="cdash.test.test"
230+
/>
231+
224232
<br>
225233
<b>Test output</b>
226234
<pre
@@ -241,9 +249,16 @@
241249
import ApiLoader from './shared/ApiLoader';
242250
import QueryParams from './shared/QueryParams';
243251
import TextMutator from './shared/TextMutator';
252+
import {DateTime} from 'luxon';
253+
import TestHistoryPlot from './shared/TestHistoryPlot.vue';
254+
244255
export default {
245256
name: 'TestDetails',
246257
258+
components: {
259+
TestHistoryPlot,
260+
},
261+
247262
data () {
248263
return {
249264
// API results.
@@ -342,6 +357,11 @@ export default {
342357
}
343358
}
344359
360+
if (this.graphSelection === 'status') {
361+
// The passing/failing graph is special because it loads its own data and handles rendering itself.
362+
return;
363+
}
364+
345365
const testname = this.cdash.test.test;
346366
const buildid = this.cdash.test.buildid;
347367
const measurementname = this.graphSelection;
@@ -456,13 +476,12 @@ export default {
456476
457477
const plot = $.plot(
458478
$('#graph_holder'), chart_data, options);
459-
const date_formatter = d3.time.format('%b %d, %I:%M:%S %p');
460479
461480
// Show tooltip on hover.
462481
$('#graph_holder').bind('plothover', (event, pos, item) => {
463482
if (item) {
464-
const x = date_formatter(new Date(item.datapoint[0])),
465-
y = item.datapoint[1].toFixed(2);
483+
const x = DateTime.fromMillis(item.datapoint[0]).toFormat('LLL dd, hh:mm:ss a');
484+
const y = item.datapoint[1].toFixed(2);
466485
467486
$('#tooltip').html(
468487
`<b>${x}</b><br/>${

0 commit comments

Comments
 (0)