Skip to content

Commit

Permalink
Bug 1443087 - Remove requirement of try or sheriff to cancel all jobs (
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Dawson committed Mar 7, 2018
1 parent cffdb1b commit d902682
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 1 addition & 3 deletions ui/job-view/Push.jsx
Expand Up @@ -37,7 +37,7 @@ export default class Push extends React.Component {
}

render() {
const { push, loggedIn, isStaff, isTryRepo, $injector, repoName } = this.props;
const { push, loggedIn, isStaff, $injector, repoName } = this.props;
const { currentRepo, urlBasePath } = this.$rootScope;
const { id, push_timestamp, revision, job_counts, author } = push;

Expand All @@ -52,7 +52,6 @@ export default class Push extends React.Component {
loggedIn={loggedIn}
isStaff={isStaff}
repoName={repoName}
isTryRepo={isTryRepo}
urlBasePath={urlBasePath}
$injector={$injector}
runnableVisible={this.state.runnableVisible}
Expand Down Expand Up @@ -83,7 +82,6 @@ export default class Push extends React.Component {

Push.propTypes = {
push: PropTypes.object.isRequired,
isTryRepo: PropTypes.bool,
loggedIn: PropTypes.bool,
isStaff: PropTypes.bool,
repoName: PropTypes.string,
Expand Down
10 changes: 4 additions & 6 deletions ui/job-view/PushHeader.jsx
Expand Up @@ -127,10 +127,10 @@ export default class PushHeader extends React.PureComponent {
}

cancelAllJobs() {
const { repoName, revision, isTryRepo, isStaff, pushId } = this.props;
const { repoName, revision, loggedIn, pushId } = this.props;

this.setState({ showConfirmCancelAll: false });
if (!(isTryRepo || isStaff)) return;
if (!loggedIn) return;

this.ThResultSetModel.cancelAll(pushId).then(() => (
this.thBuildApi.cancelAll(repoName, revision)
Expand Down Expand Up @@ -161,14 +161,13 @@ export default class PushHeader extends React.PureComponent {
}

render() {
const { repoName, loggedIn, pushId, isTryRepo, isStaff, jobCounts, author,
const { repoName, loggedIn, pushId, isStaff, jobCounts, author,
revision, runnableVisible, $injector,
showRunnableJobsCb, hideRunnableJobsCb } = this.props;
const { filterParams } = this.state;
const cancelJobsTitle = loggedIn ?
"Cancel all jobs" :
"Must be logged in to cancel jobs";
const canCancelJobs = isTryRepo || isStaff;
const counts = jobCounts || { pending: 0, running: 0, completed: 0 };

return (
Expand Down Expand Up @@ -200,7 +199,7 @@ export default class PushHeader extends React.PureComponent {
rel="noopener"
title="View details on failed test results for this push"
>View Tests</a>
{canCancelJobs &&
{loggedIn &&
<button
className="btn btn-sm btn-push cancel-all-jobs-btn"
title={cancelJobsTitle}
Expand Down Expand Up @@ -276,7 +275,6 @@ PushHeader.propTypes = {
loggedIn: PropTypes.bool,
isStaff: PropTypes.bool,
repoName: PropTypes.string.isRequired,
isTryRepo: PropTypes.bool,
urlBasePath: PropTypes.string,
$injector: PropTypes.object.isRequired,
runnableVisible: PropTypes.bool.isRequired,
Expand Down
1 change: 0 additions & 1 deletion ui/job-view/PushList.jsx
Expand Up @@ -263,7 +263,6 @@ export default class PushList extends React.Component {
{repoName && pushList.map(push => (
<Push
push={push}
isTryRepo={currentRepo.is_try_repo}
loggedIn={loggedin || false}
isStaff={is_staff}
repoName={repoName}
Expand Down

0 comments on commit d902682

Please sign in to comment.