Skip to content

Commit cf5113f

Browse files
committed
[JENKINS-70695] add copy to clipboard button
this change adds a copy to clipboard button below the field with the generated code.
1 parent dd8d2ce commit cf5113f

File tree

1 file changed

+5
-1
lines changed
  • plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer

1 file changed

+5
-1
lines changed

plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ THE SOFTWARE.
7070
<j:set var="id" value="${h.generateId()}"/>
7171
<f:block>
7272
<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" />
73+
<f:textarea id="prototypeText_${id}" readonly="true" style="margin-top: 10px; margin-bottom: 5px" />
74+
<l:copyButton text="" clazz="jenkins-hidden"/>
7475
<script>
7576
function handlePrototype_${id}() {
7677
buildFormTree(document.forms.config);
@@ -84,6 +85,9 @@ THE SOFTWARE.
8485
parameters: {json: json},
8586
onSuccess: function(r) {
8687
document.getElementById('prototypeText_${id}').value = r.responseText;
88+
copybutton = document.querySelector('.jenkins-copy-button');
89+
copybutton.setAttribute("text", r.responseText);
90+
copybutton.classList.remove('jenkins-hidden');
8791
}
8892
});
8993
}

0 commit comments

Comments
 (0)