diff --git a/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/config.jelly b/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/config.jelly index 29555a6..0b147e7 100644 --- a/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/config.jelly +++ b/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/config.jelly @@ -25,30 +25,16 @@ THE SOFTWARE. + + - +
- \ No newline at end of file diff --git a/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/load-params.js b/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/load-params.js new file mode 100644 index 0000000..d733ab2 --- /dev/null +++ b/src/main/resources/hudson/plugins/release/pipeline/ReleaseStep/load-params.js @@ -0,0 +1,25 @@ +Behaviour.specify('.release-load-params', 'release-load-params', 0, function(e) { + e.addEventListener('blur', function() { + const dataSpan = document.querySelector('.release-params-data'); + const div = document.getElementById('params'); + + const url = dataSpan.dataset.descriptorUrl + '/parameters?job=' + + encodeURIComponent(this.value) + + '&context=' + encodeURIComponent(dataSpan.dataset.context); + + fetch(url) + .then(rsp => { + if (rsp.ok) { + return rsp.text(); + } + throw new Error(rsp.statusText); + }) + .then(responseText => { + div.innerHTML = responseText; + Behaviour.applySubtree(div); + }) + .catch(error => { + div.innerHTML = 'ERROR: Failed to load parameter definitions: ' + error.message; + }); + }); +});