Skip to content

Commit

Permalink
Bug 1504713 - Fix restricted global usage in JobGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Dawson committed Feb 8, 2019
1 parent b224460 commit ff98eaa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
14 changes: 5 additions & 9 deletions ui/job-view/pushes/JobButton.jsx
Expand Up @@ -33,12 +33,12 @@ export default class JobButtonComponent extends React.Component {
* shallow compare would allow.
*/
shouldComponentUpdate(nextProps, nextState) {
const { visible, status, failureClassificationId } = this.props;
const { visible, resultStatus, failureClassificationId } = this.props;
const { isSelected, isRunnableSelected } = this.state;

return (
visible !== nextProps.visible ||
status !== nextProps.status ||
resultStatus !== nextProps.resultStatus ||
failureClassificationId !== nextProps.failureClassificationId ||
isSelected !== nextState.isSelected ||
isRunnableSelected !== nextState.isRunnableSelected
Expand Down Expand Up @@ -69,7 +69,7 @@ export default class JobButtonComponent extends React.Component {
}

render() {
const { job } = this.props;
const { job, resultStatus } = this.props;
const { isSelected, isRunnableSelected } = this.state;
const {
state,
Expand All @@ -81,16 +81,12 @@ export default class JobButtonComponent extends React.Component {
visible,
id,
job_type_symbol,
result,
} = job;

if (!visible) return null;
const resultStatus = state === 'completed' ? result : state;
const runnable = state === 'runnable';
const btnClass = getBtnClass(resultStatus, failure_classification_id);
// TODO: This is broken (bug 1504713)
// eslint-disable-next-line no-restricted-globals
let title = `${resultStatus} | ${job_type_name} - ${status}`;
let title = `${resultStatus} | ${job_type_name}`;

if (state === 'completed') {
const duration = Math.round((end_timestamp - start_timestamp) / 60);
Expand Down Expand Up @@ -133,7 +129,7 @@ JobButtonComponent.propTypes = {
filterModel: PropTypes.object.isRequired,
repoName: PropTypes.string.isRequired,
visible: PropTypes.bool.isRequired,
status: PropTypes.string.isRequired,
resultStatus: PropTypes.string.isRequired,
platform: PropTypes.object.isRequired,
filterPlatformCb: PropTypes.func.isRequired,
failureClassificationId: PropTypes.number, // runnable jobs won't have this
Expand Down
2 changes: 1 addition & 1 deletion ui/job-view/pushes/JobGroup.jsx
Expand Up @@ -150,7 +150,7 @@ export class JobGroupComponent extends React.Component {
job={job}
filterModel={filterModel}
visible={job.visible}
status={getStatus(job)}
resultStatus={getStatus(job)}
failureClassificationId={job.failure_classification_id}
repoName={repoName}
filterPlatformCb={filterPlatformCb}
Expand Down
2 changes: 1 addition & 1 deletion ui/job-view/pushes/JobsAndGroups.jsx
Expand Up @@ -45,7 +45,7 @@ export default class JobsAndGroups extends React.Component {
filterModel={filterModel}
repoName={repoName}
visible={job.visible}
status={getStatus(job)}
resultStatus={getStatus(job)}
failureClassificationId={job.failure_classification_id}
filterPlatformCb={filterPlatformCb}
platform={platform}
Expand Down

0 comments on commit ff98eaa

Please sign in to comment.