Skip to content

Initial implementation for retrigger in Graphs View #8717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions ui/glean/generated/classification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.

import CounterMetricType from '@mozilla/glean/private/metrics/counter';

/**
* Counts how often a failure is annotated FBC.
*
* Generated from `classification.fixed_by_commit`.
*/
export const fixedByCommit = new CounterMetricType({
category: 'classification',
name: 'fixed_by_commit',
sendInPings: ['classified'],
lifetime: 'ping',
disabled: false,
});

/**
* Counts how often a failure is annotated FBC with a NEW tag.
*
* Generated from `classification.fixed_by_commit_new_failure`.
*/
export const fixedByCommitNewFailure = new CounterMetricType({
category: 'classification',
name: 'fixed_by_commit_new_failure',
sendInPings: ['classified'],
lifetime: 'ping',
disabled: false,
});

/**
* Counts how often a bug is filed without a NEW tag.
*
* Generated from `classification.new_bug`.
*/
export const newBug = new CounterMetricType({
category: 'classification',
name: 'new_bug',
sendInPings: ['classified'],
lifetime: 'ping',
disabled: false,
});

/**
* Counts how often a bug is filed with a NEW tag.
*
* Generated from `classification.new_failure_new_bug`.
*/
export const newFailureNewBug = new CounterMetricType({
category: 'classification',
name: 'new_failure_new_bug',
sendInPings: ['classified'],
lifetime: 'ping',
disabled: false,
});

/**
* Counts how often a NEW tag is classified as fixed_by_commit.
*
* Generated from `classification.new_failure_other`.
*/
export const newFailureOther = new CounterMetricType({
category: 'classification',
name: 'new_failure_other',
sendInPings: ['classified'],
lifetime: 'ping',
disabled: false,
});
23 changes: 23 additions & 0 deletions ui/glean/generated/pings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v14.5.2. DO NOT EDIT. DO NOT COMMIT.

import PingType from '@mozilla/glean/private/ping';

/**
* sends counters related to user actions done on treeherder.
*
* Generated from `classified`.
*/
export const classified = new PingType({
name: 'classified',
includeClientId: false,
sendIfEmpty: false,
preciseTimestamps: true,
includeInfoSections: true,
enabled: true,
schedulesPings: [],
reasonCodes: [],
});
6 changes: 6 additions & 0 deletions ui/perfherder/graphs/GraphTooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { displayNumber, getStatus } from '../perf-helpers/helpers';
import Clipboard from '../../shared/Clipboard';
import { toMercurialDateStr } from '../../helpers/display';

import RetriggerJobButton from './RetriggerJobButton';

const GraphTooltip = ({
testData,
infraAffectedData,
Expand Down Expand Up @@ -334,6 +336,10 @@ const GraphTooltip = ({
{Boolean(retriggerNum) && (
<p className="small">{`Retriggers: ${retriggerNum}`}</p>
)}
<RetriggerJobButton
pushId={datum.pushId}
repoName={repositoryName}
/>
</div>
</div>
<div
Expand Down
31 changes: 31 additions & 0 deletions ui/perfherder/graphs/RetriggerJobButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { useState } from 'react';
import { Button } from 'reactstrap';

import JobModel from '../../models/job';

const RetriggerJobButton = (props) => {
const [notification, setNotification] = useState('');

const notify = (message) => {
console.log(message);
setNotification(message);
};

const retrigger = () => {
const { pushId, repoName } = props;
JobModel.retrigger([{ push_id: pushId }], repoName, notify);
};

return (
<React.Fragment>
<Button size="sm" onClick={() => retrigger()}>
Retrigger
</Button>
<p className="small text-white pt-2">Retrigger status: {notification}</p>
</React.Fragment>
);
};

RetriggerJobButton.propType = {};

export default RetriggerJobButton;