Skip to content

Commit e2054c5

Browse files
authored
Show a button in the Action Bar to allow opening the resource use profiles in the Firefox Profiler with a single click. (#8872)
1 parent f15d9d4 commit e2054c5

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

ui/job-view/details/DetailsPanel.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ class DetailsPanel extends React.Component {
389389
classificationMap={classificationMap}
390390
jobLogUrls={jobLogUrls}
391391
logParseStatus={logParseStatus}
392+
jobDetails={jobDetails}
392393
jobDetailLoading={jobDetailLoading}
393394
latestClassification={
394395
classifications.length

ui/job-view/details/summary/ActionBar.jsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
faThumbtack,
1717
faTimesCircle,
1818
faCrosshairs,
19+
faGaugeHigh,
1920
} from '@fortawesome/free-solid-svg-icons';
2021

2122
import {
@@ -32,7 +33,11 @@ import {
3233
confirmFailure,
3334
findJobInstance,
3435
} from '../../../helpers/job';
35-
import { getInspectTaskUrl, getReftestUrl } from '../../../helpers/url';
36+
import {
37+
getInspectTaskUrl,
38+
getReftestUrl,
39+
getPerfAnalysisUrl,
40+
} from '../../../helpers/url';
3641
import JobModel from '../../../models/job';
3742
import TaskclusterModel from '../../../models/taskcluster';
3843
import CustomJobActions from '../../CustomJobActions';
@@ -307,11 +312,17 @@ class ActionBar extends React.PureComponent {
307312
selectedJobFull,
308313
logViewerUrl,
309314
logViewerFullUrl,
315+
jobDetails,
310316
jobLogUrls,
311317
pinJob,
312318
currentRepo,
313319
} = this.props;
314320
const { customJobActionsShowing } = this.state;
321+
const resourceUsageProfile = jobDetails.find((artifact) =>
322+
['profile_build_resources.json', 'profile_resource-usage.json'].includes(
323+
artifact.value,
324+
),
325+
);
315326

316327
return (
317328
<div id="actionbar">
@@ -342,6 +353,21 @@ class ActionBar extends React.PureComponent {
342353
<FontAwesomeIcon icon={faRedo} title="Retrigger job" />
343354
</Button>
344355
</li>
356+
{resourceUsageProfile &&
357+
// not shown at the same time as the reftest analyzer to avoid running out of space.
358+
!isReftest(selectedJobFull) && (
359+
<li>
360+
<a
361+
title="Show the resource usage profile in the Firefox Profiler"
362+
className="actionbar-nav-btn btn"
363+
target="_blank"
364+
rel="noopener noreferrer"
365+
href={getPerfAnalysisUrl(resourceUsageProfile.url)}
366+
>
367+
<FontAwesomeIcon icon={faGaugeHigh} />
368+
</a>
369+
</li>
370+
)}
345371
{isReftest(selectedJobFull) &&
346372
jobLogUrls.map((jobLogUrl) => (
347373
<li key={`reftest-${jobLogUrl.id}`}>

ui/job-view/details/summary/SummaryPanel.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class SummaryPanel extends React.PureComponent {
1616
latestClassification,
1717
bugs,
1818
jobLogUrls,
19+
jobDetails,
1920
jobDetailLoading,
2021
logViewerUrl,
2122
logViewerFullUrl,
@@ -46,6 +47,7 @@ class SummaryPanel extends React.PureComponent {
4647
logParseStatus={logParseStatus}
4748
currentRepo={currentRepo}
4849
isTryRepo={currentRepo.is_try_repo}
50+
jobDetails={jobDetails}
4951
logViewerUrl={logViewerUrl}
5052
logViewerFullUrl={logViewerFullUrl}
5153
jobLogUrls={jobLogUrls}
@@ -96,6 +98,11 @@ SummaryPanel.propTypes = {
9698
selectedJobFull: PropTypes.shape({}).isRequired,
9799
latestClassification: PropTypes.shape({}),
98100
jobLogUrls: PropTypes.arrayOf(PropTypes.shape({})),
101+
jobDetails: PropTypes.arrayOf({
102+
url: PropTypes.string.isRequired,
103+
value: PropTypes.string.isRequired,
104+
title: PropTypes.string.isRequired,
105+
}),
99106
jobDetailLoading: PropTypes.bool,
100107
logParseStatus: PropTypes.string,
101108
logViewerUrl: PropTypes.string,
@@ -105,6 +112,7 @@ SummaryPanel.propTypes = {
105112
SummaryPanel.defaultProps = {
106113
latestClassification: null,
107114
jobLogUrls: [],
115+
jobDetails: [],
108116
jobDetailLoading: false,
109117
logParseStatus: 'pending',
110118
logViewerUrl: null,

0 commit comments

Comments
 (0)