Backport of [ui] Fix: upload jobspec button into release/1.8.x #23562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport
This PR is auto-generated from #23548 to be assessed for backporting due to the inclusion of the label backport/1.8.x.
The below text is copied from the body of the original PR.
At some point recently, the upload jobspec button (on the Job Run page) stopped working and I've yet to find a good reason why.
The job editor component uses what's called a render modifier in Ember. It uses a library to help add syntactical sugar to do this.
(Modifier TLDR: it "modifies" an existing HTML element, like a
<div>
in this case, instead of creating a new one in an Ember context. This is useful for codemirror, our text editor, because it needs to exist outside of an Ember context for lifecycle reasons)There's a lifecycle hook in modifiers written this way called
modify()
, and there were previously ones calleddidUpdateArguments()
anddidUpdateArguments()
. Previously, we'd set this up to usedidUpdateArguments
to let thecode-mirror
modifier, but per the library's migrations guide, this is/was being deprecated.Problem is,
modify()
is a lifecycle hook that happens both on initial load and on content update and on external-attribute (like the "should word-wrap" property, etc.) and bundling everything intomodify()
over-compounds this pattern a bit.This PR makes it so that we still use
didUpdateArguments()
, but as a conditional method call frommodify()
.To test:
Head to the jobs index page, click "Run Job", click "Upload", and you should now see the text of your .hcl upload appear in the text editor. In previous (1.8.x anyway) versions this should not work.
Overview of commits