open-nomad/ui/tests/pages/jobs/job/versions.js
Buck Doyle 90ecbdf522
Add job version revert buttons (#10336)
This adds a Revert two-step button to the JobVersions component for
not-current versions, which redirects to the overview on success. It
checks the job version before and after reversion to mitigate the edge
case where reverting to an otherwise-identical version has no effect, as
discussed in #10337.

It uses existing facilities for handling other errors and disabling the
button when permissions are lacking.
2021-04-20 08:33:16 -05:00

25 lines
787 B
JavaScript

import { attribute, create, collection, text, visitable } from 'ember-cli-page-object';
import { getter } from 'ember-cli-page-object/macros';
import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
import error from 'nomad-ui/tests/pages/components/error';
export default create({
visit: visitable('/jobs/:id/versions'),
versions: collection('[data-test-version]', {
text: text(),
stability: text('[data-test-version-stability]'),
submitTime: text('[data-test-version-submit-time]'),
revertToButton: twoStepButton('[data-test-revert-to]'),
revertToButtonIsDisabled: attribute('disabled', '[data-test-revert-to]'),
number: getter(function() {
return parseInt(this.text.match(/#(\d+)/)[1]);
}),
}),
error: error(),
});