Skip to content

Commit

Permalink
refactoring for same regression in job versions
Browse files Browse the repository at this point in the history
In job versions, if you have an ACL token with a write policy
you should be able to revert a job, however, that was not the
case here. This is because we're using ember-can to check if
the user can run a job. That permission relies on policiesSupportRunning
which uses a function called namespaceIncludesCapability. We're going to
need to refactor any cases that use this function.
  • Loading branch information
ChaiWithJai committed Jul 15, 2021
1 parent d92261e commit f99a0a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions ui/app/routes/jobs/job/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Route from '@ember/routing/route';
import { collect } from '@ember/object/computed';
import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch';
import WithWatchers from 'nomad-ui/mixins/with-watchers';

export default class VersionsRoute extends Route.extend(WithWatchers) {
model() {
const job = this.modelFor('jobs.job');
Expand All @@ -18,6 +17,5 @@ export default class VersionsRoute extends Route.extend(WithWatchers) {

@watchRecord('job') watch;
@watchRelationship('versions') watchVersions;

@collect('watch', 'watchVersions') watchers;
}
2 changes: 1 addition & 1 deletion ui/app/templates/components/job-version.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</span>
<div class="pull-right">
{{#unless this.isCurrent}}
{{#if (can "run job")}}
{{#if (can "run job" namespace=this.version.job.namespace)}}
<TwoStepButton
data-test-revert-to
@classes={{hash
Expand Down

0 comments on commit f99a0a8

Please sign in to comment.