open-nomad/ui/app/templates/components/job-version.hbs
Jai Bhagat cc61ad66bf refactoring for same regression in job versions
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.
2021-07-20 16:24:42 -04:00

53 lines
1.9 KiB
Handlebars
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="boxed-section-head is-light inline-definitions">
Version #{{this.version.number}}
<span class="bumper-left pair is-faded">
<span class="term">Stable</span>
<span class="badge is-light is-faded" data-test-version-stability><code>{{this.version.stable}}</code></span>
</span>
<span class="pair is-faded">
<span class="term">Submitted</span>
<span data-test-version-submit-time class="submit-date">{{format-ts this.version.submitTime}}</span>
</span>
<div class="pull-right">
{{#unless this.isCurrent}}
{{#if (can "run job" namespace=this.version.job.namespace)}}
<TwoStepButton
data-test-revert-to
@classes={{hash
idleButton="is-warning is-outlined"
confirmButton="is-warning"}}
@alignRight={{true}}
@idleText="Revert"
@cancelText="Cancel"
@confirmText="Yes, Revert"
@confirmationMessage="Are you sure you want to revert to this version?"
@inlineText={{true}}
@fadingBackground={{true}}
@awaitingConfirmation={{this.revertTo.isRunning}}
@onConfirm={{perform this.revertTo}} />
{{else}}
<button
data-test-revert-to
type="button"
class="button is-warning is-outlined is-small tooltip"
disabled
aria-label="You dont have permission to revert"
>
Revert
</button>
{{/if}}
{{/unless}}
{{#if this.version.diff}}
<button class="button is-light is-small is-fixed-width" {{action "toggleDiff"}} type="button">{{this.changeCount}} {{pluralize "Change" this.changeCount}}</button>
{{else}}
<div class="is-fixed-width is-size-7 has-text-centered">No Changes</div>
{{/if}}
</div>
</div>
{{#if this.isOpen}}
<div class="boxed-section-body is-dark">
<JobDiff @diff={{this.version.diff}} @verbose={{this.verbose}} />
</div>
{{/if}}