From 7f3db4090f8f3772bc4a9cbb420770e845a9a7c4 Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Wed, 14 Nov 2018 08:26:57 -0800 Subject: [PATCH] Bug 1506633 - Fix Logviewer links to original job in Treeherder (#4270) --- ui/logviewer/App.jsx | 12 +++++++++--- ui/logviewer/Navigation.jsx | 18 +++++++++++++++++- ui/shared/JobInfo.jsx | 27 ++++++++++++++++++--------- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/ui/logviewer/App.jsx b/ui/logviewer/App.jsx index e268ad991..5bacdb983 100644 --- a/ui/logviewer/App.jsx +++ b/ui/logviewer/App.jsx @@ -52,6 +52,7 @@ class App extends React.PureComponent { highlight: getUrlLineNumber(), repoName: queryString.get('repo'), jobId: queryString.get('job_id'), + jobUrl: null, }; this.setSelectedLine = this.setSelectedLine.bind(this); @@ -85,7 +86,10 @@ class App extends React.PureComponent { const push = await resp.json(); const { revision } = push; - this.setState({ revision }); + this.setState({ + revision, + jobUrl: getJobsUrl({ repo: repoName, revision, selectedJob: jobId }), + }); }); }); }).catch((error) => { @@ -169,11 +173,11 @@ class App extends React.PureComponent { render() { const { job, rawLogUrl, reftestUrl, jobDetails, jobError, jobExists, - revision, errors, highlight, jobId, repoName, + revision, errors, highlight, jobUrl, } = this.state; const extraFields = [{ title: 'Revision', - url: getJobsUrl({ repo: repoName, revision, selectedJob: jobId }), + url: jobUrl, value: revision, }]; @@ -185,6 +189,7 @@ class App extends React.PureComponent { jobError={jobError} rawLogUrl={rawLogUrl} reftestUrl={reftestUrl} + jobUrl={jobUrl} /> {job && (
@@ -195,6 +200,7 @@ class App extends React.PureComponent { extraFields={extraFields} revision={revision} className="list-unstyled" + showJobFilters={false} />
diff --git a/ui/logviewer/Navigation.jsx b/ui/logviewer/Navigation.jsx index c34f1720a..35736ae5e 100644 --- a/ui/logviewer/Navigation.jsx +++ b/ui/logviewer/Navigation.jsx @@ -9,7 +9,7 @@ const getShadingClass = result => `result-status-shading-${result}`; export default class Navigation extends React.PureComponent { render() { const { - jobExists, result, jobError, rawLogUrl, reftestUrl, + jobExists, result, jobError, jobUrl, rawLogUrl, reftestUrl, } = this.props; const resultStatusShading = getShadingClass(result); @@ -34,6 +34,20 @@ export default class Navigation extends React.PureComponent { )} + {!!jobUrl && ( + + + + open Job + + + )}
  • - (sig):  - {jobSearchStr} + {showJobFilters ? ( + + (sig):  + {jobSearchStr} + + ) : ( + {job.getTitle()} + ) + }
  • {job.taskcluster_metadata &&
  • @@ -98,8 +105,10 @@ JobInfo.propTypes = { value: PropTypes.string, }), ), + showJobFilters: PropTypes.bool, }; JobInfo.defaultProps = { extraFields: [], + showJobFilters: true, };