2018-11-09 12:15:00 +03:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-02-05 11:44:49 +03:00
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
|
import { faChartBar, faFileAlt } from '@fortawesome/free-regular-svg-icons';
|
|
|
|
import { faTree } from '@fortawesome/free-solid-svg-icons';
|
2020-06-30 04:16:35 +03:00
|
|
|
import { Button } from 'reactstrap';
|
2018-11-09 12:15:00 +03:00
|
|
|
|
|
|
|
import LogoMenu from '../shared/LogoMenu';
|
|
|
|
|
|
|
|
// Get the css class for the result, step buttons and other general use
|
2020-04-30 22:40:38 +03:00
|
|
|
const getShadingClass = (result) => `result-status-shading-${result}`;
|
2018-11-09 12:15:00 +03:00
|
|
|
|
|
|
|
export default class Navigation extends React.PureComponent {
|
|
|
|
render() {
|
|
|
|
const {
|
2018-11-16 11:28:34 +03:00
|
|
|
jobExists,
|
|
|
|
result,
|
|
|
|
jobError,
|
|
|
|
jobUrl,
|
|
|
|
rawLogUrl,
|
|
|
|
reftestUrl,
|
2020-06-30 04:16:35 +03:00
|
|
|
collapseDetails,
|
|
|
|
collapseJobDetails,
|
2022-01-31 19:07:21 +03:00
|
|
|
copySelectedLogToBugFiler,
|
2018-11-09 12:15:00 +03:00
|
|
|
} = this.props;
|
|
|
|
const resultStatusShading = getShadingClass(result);
|
|
|
|
|
|
|
|
return (
|
2020-06-30 04:16:35 +03:00
|
|
|
<nav className="navbar navbar-dark bg-dark p-0" role="navigation">
|
|
|
|
<div id="th-global-navbar-top">
|
|
|
|
<div className="nav mr-auto flex-row">
|
|
|
|
<span id="lv-logo">
|
|
|
|
<LogoMenu menuText="Logviewer" />
|
2018-11-16 11:28:34 +03:00
|
|
|
</span>
|
2020-06-30 04:16:35 +03:00
|
|
|
{jobExists ? (
|
|
|
|
<span
|
|
|
|
className={`lightgray ${resultStatusShading} pt-2 pl-2 pr-2`}
|
|
|
|
>
|
|
|
|
<strong>Result: </strong>
|
|
|
|
{result}
|
2020-06-24 21:07:25 +03:00
|
|
|
</span>
|
2020-06-30 04:16:35 +03:00
|
|
|
) : (
|
|
|
|
<span className="alert-danger">
|
|
|
|
<span title="The job does not exist or has expired">
|
|
|
|
{`Unavailable: ${jobError}`}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
{!!jobUrl && (
|
|
|
|
<span>
|
|
|
|
<a
|
|
|
|
title="Open the Job in Treeherder"
|
|
|
|
className="nav-link btn-view-nav"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
href={jobUrl}
|
|
|
|
>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faTree}
|
|
|
|
className="actionbtn-icon mr-1"
|
|
|
|
/>
|
|
|
|
<span>open Job</span>
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
)}
|
2018-11-14 19:26:57 +03:00
|
|
|
<span>
|
|
|
|
<a
|
2020-06-30 04:16:35 +03:00
|
|
|
title="Open the raw log in a new window"
|
2018-11-14 19:26:57 +03:00
|
|
|
className="nav-link btn-view-nav"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2020-06-30 04:16:35 +03:00
|
|
|
href={rawLogUrl}
|
2018-11-14 19:26:57 +03:00
|
|
|
>
|
2019-02-05 11:44:49 +03:00
|
|
|
<FontAwesomeIcon
|
2020-06-30 04:16:35 +03:00
|
|
|
icon={faFileAlt}
|
2019-02-05 11:44:49 +03:00
|
|
|
className="actionbtn-icon mr-1"
|
|
|
|
/>
|
2020-06-30 04:16:35 +03:00
|
|
|
<span>open raw log</span>
|
2018-11-14 19:26:57 +03:00
|
|
|
</a>
|
|
|
|
</span>
|
2020-06-30 04:16:35 +03:00
|
|
|
{!!reftestUrl && (
|
|
|
|
<span>
|
|
|
|
<a
|
|
|
|
title="Open the Reftest Analyser in a new window"
|
|
|
|
className="nav-link btn-view-nav"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
href={reftestUrl}
|
|
|
|
>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faChartBar}
|
|
|
|
className="actionbtn-icon mr-1"
|
|
|
|
/>
|
|
|
|
<span>open analyser</span>
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
)}
|
2022-01-31 19:07:21 +03:00
|
|
|
<span>
|
|
|
|
<Button
|
|
|
|
className="nav-link btn-view-nav"
|
|
|
|
data-testid="log-lines-to-bug-filer"
|
|
|
|
onClick={copySelectedLogToBugFiler}
|
|
|
|
>
|
|
|
|
Selected lines to bug filer
|
|
|
|
</Button>
|
|
|
|
</span>
|
2018-11-09 12:15:00 +03:00
|
|
|
<span>
|
2020-06-30 04:16:35 +03:00
|
|
|
<Button
|
2018-11-09 12:15:00 +03:00
|
|
|
className="nav-link btn-view-nav"
|
2020-12-21 23:54:07 +03:00
|
|
|
data-testid="show-job-info"
|
2020-06-30 04:16:35 +03:00
|
|
|
onClick={collapseJobDetails}
|
2018-11-09 12:15:00 +03:00
|
|
|
>
|
2020-06-30 04:16:35 +03:00
|
|
|
{collapseDetails ? `Show Job Info` : `Hide Job Info`}
|
|
|
|
</Button>
|
2018-11-09 12:15:00 +03:00
|
|
|
</span>
|
2020-06-30 04:16:35 +03:00
|
|
|
</div>
|
2018-11-09 12:15:00 +03:00
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Navigation.propTypes = {
|
|
|
|
jobExists: PropTypes.bool.isRequired,
|
|
|
|
result: PropTypes.string.isRequired,
|
|
|
|
jobError: PropTypes.string.isRequired,
|
|
|
|
rawLogUrl: PropTypes.string.isRequired,
|
2018-11-14 19:26:57 +03:00
|
|
|
jobUrl: PropTypes.string,
|
2018-11-09 12:15:00 +03:00
|
|
|
reftestUrl: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
Navigation.defaultProps = {
|
2018-11-14 19:26:57 +03:00
|
|
|
jobUrl: null,
|
2018-11-09 12:15:00 +03:00
|
|
|
reftestUrl: null,
|
|
|
|
};
|