nomad
nomad copied to clipboard
Backport of [ui] Fix: upload jobspec button into release/1.8.x
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 called didUpdateArguments() and didUpdateArguments(). Previously, we'd set this up to use didUpdateArguments to let the code-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 into modify() over-compounds this pattern a bit.
This PR makes it so that we still use didUpdateArguments(), but as a conditional method call from modify().
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
- 370952e39025805ee3097a36476eccaf3bf388c1
Ember Test Audit comparison
| release/1.8.x | 4fb6cf40140f77848273df28080349d4fe10a763 | change | |
|---|---|---|---|
| passes | 1565 | 1565 | 0 |
| failures | 2 | 2 | 0 |
| flaky | 0 | 0 | 0 |
| duration | 000ms | 000ms | -000ms |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.