Skip to content

Commit 799a412

Browse files
committed
Initial implementation for retrigger in Graphs View
Test pre-commit Remove console log
1 parent 68955f6 commit 799a412

File tree

4 files changed

+132
-0
lines changed

4 files changed

+132
-0
lines changed

ui/glean/generated/classification.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.
6+
7+
import CounterMetricType from '@mozilla/glean/private/metrics/counter';
8+
9+
/**
10+
* Counts how often a failure is annotated FBC.
11+
*
12+
* Generated from `classification.fixed_by_commit`.
13+
*/
14+
export const fixedByCommit = new CounterMetricType({
15+
category: 'classification',
16+
name: 'fixed_by_commit',
17+
sendInPings: ['classified'],
18+
lifetime: 'ping',
19+
disabled: false,
20+
});
21+
22+
/**
23+
* Counts how often a failure is annotated FBC with a NEW tag.
24+
*
25+
* Generated from `classification.fixed_by_commit_new_failure`.
26+
*/
27+
export const fixedByCommitNewFailure = new CounterMetricType({
28+
category: 'classification',
29+
name: 'fixed_by_commit_new_failure',
30+
sendInPings: ['classified'],
31+
lifetime: 'ping',
32+
disabled: false,
33+
});
34+
35+
/**
36+
* Counts how often a bug is filed without a NEW tag.
37+
*
38+
* Generated from `classification.new_bug`.
39+
*/
40+
export const newBug = new CounterMetricType({
41+
category: 'classification',
42+
name: 'new_bug',
43+
sendInPings: ['classified'],
44+
lifetime: 'ping',
45+
disabled: false,
46+
});
47+
48+
/**
49+
* Counts how often a bug is filed with a NEW tag.
50+
*
51+
* Generated from `classification.new_failure_new_bug`.
52+
*/
53+
export const newFailureNewBug = new CounterMetricType({
54+
category: 'classification',
55+
name: 'new_failure_new_bug',
56+
sendInPings: ['classified'],
57+
lifetime: 'ping',
58+
disabled: false,
59+
});
60+
61+
/**
62+
* Counts how often a NEW tag is classified as fixed_by_commit.
63+
*
64+
* Generated from `classification.new_failure_other`.
65+
*/
66+
export const newFailureOther = new CounterMetricType({
67+
category: 'classification',
68+
name: 'new_failure_other',
69+
sendInPings: ['classified'],
70+
lifetime: 'ping',
71+
disabled: false,
72+
});

ui/glean/generated/pings.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.
6+
7+
import PingType from '@mozilla/glean/private/ping';
8+
9+
/**
10+
* sends counters related to user actions done on treeherder.
11+
*
12+
* Generated from `classified`.
13+
*/
14+
export const classified = new PingType({
15+
name: 'classified',
16+
includeClientId: false,
17+
sendIfEmpty: false,
18+
preciseTimestamps: true,
19+
includeInfoSections: true,
20+
enabled: true,
21+
schedulesPings: [],
22+
reasonCodes: [],
23+
});

ui/perfherder/graphs/GraphTooltip.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import { displayNumber, getStatus } from '../perf-helpers/helpers';
2121
import Clipboard from '../../shared/Clipboard';
2222
import { toMercurialDateStr } from '../../helpers/display';
2323

24+
import RetriggerJobButton from './RetriggerJobButton';
25+
2426
const GraphTooltip = ({
2527
testData,
2628
infraAffectedData,
@@ -334,6 +336,10 @@ const GraphTooltip = ({
334336
{Boolean(retriggerNum) && (
335337
<p className="small">{`Retriggers: ${retriggerNum}`}</p>
336338
)}
339+
<RetriggerJobButton
340+
pushId={datum.pushId}
341+
repoName={repositoryName}
342+
/>
337343
</div>
338344
</div>
339345
<div
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React, { useState } from 'react';
2+
import { Button } from 'reactstrap';
3+
4+
import JobModel from '../../models/job';
5+
6+
const RetriggerJobButton = (props) => {
7+
const [notification, setNotification] = useState('');
8+
9+
const notify = (message) => {
10+
console.log(message);
11+
setNotification(message);
12+
};
13+
14+
const retrigger = () => {
15+
const { pushId, repoName } = props;
16+
JobModel.retrigger([{ push_id: pushId }], repoName, notify);
17+
};
18+
19+
return (
20+
<React.Fragment>
21+
<Button size="sm" onClick={() => retrigger()}>
22+
Retrigger
23+
</Button>
24+
<p className="small text-white pt-2">Retrigger status: {notification}</p>
25+
</React.Fragment>
26+
);
27+
};
28+
29+
RetriggerJobButton.propType = {};
30+
31+
export default RetriggerJobButton;

0 commit comments

Comments
 (0)