@@ -67,36 +67,13 @@ THE SOFTWARE.
6767 <f : dropdownListBlock title =" ${%— Advanced/Deprecated —}" />
6868 <local : listSteps quasiDescriptors =" ${it.getQuasiDescriptors(true)}" />
6969 </f : dropdownList >
70- <j : set var =" id" value =" ${h.generateId()}" />
7170 <f : block >
72- <input type =" button" value =" ${%Generate Pipeline Script}" onclick =" handlePrototype_${id}(); return false" class =" submit-button primary" />
73- <f : textarea id =" prototypeText_${id}" readonly =" true" style =" margin-top: 10px" />
74- <script >
75- function handlePrototype_${id}() {
76- buildFormTree(document.forms.config);
77- // TODO JSON.stringify fails in some circumstances: https://gist.github.com/jglick/70ec4b15c1f628fdf2e9 due to Array.prototype.toJSON
78- // TODO simplify when Prototype.js is removed
79- var json = Object.toJSON ? Object.toJSON(JSON.parse(document.forms.config.elements.json.value).prototype) : JSON.stringify(JSON.parse(document.forms.config.elements.json.value).prototype);
80- if (!json) {
81- return; // just a separator
82- }
83- fetch('${rootURL}/${it.GENERATE_URL}', {
84- method: 'post',
85- headers: crumb.wrap({
86- "Content-Type": "application/x-www-form-urlencoded",
87- }),
88- body: new URLSearchParams({
89- json: json,
90- }),
91- }).then((rsp) => {
92- if (rsp.ok) {
93- rsp.text().then((responseText) => {
94- document.getElementById('prototypeText_${id}').value = responseText;
95- });
96- }
97- });
98- }
99- </script >
71+ <input type =" button" id =" generatePipelineScript" value =" ${%Generate Pipeline Script}"
72+ class =" submit-button primary"
73+ data-url =" ${rootURL}/${it.GENERATE_URL}"
74+ data-crumb =" ${h.getCrumb(request)}" />
75+ <f : textarea id =" prototypeText" readonly =" true" style =" margin-top: 10px" />
76+ <st : adjunct includes =" org.jenkinsci.plugins.workflow.cps.Snippetizer.handle-prototype" />
10077 </f : block >
10178 <f : section title =" ${%Global Variables}" />
10279 <f : block >
0 commit comments