Skip to content

Commit

Permalink
[JENKINS-74044] Extract inline JavaScript from repos.jelly
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavafenkin committed Nov 27, 2024
1 parent 61062e3 commit 728d8e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main/resources/lib/jfrog/repos.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@

<f:entry>
<div style="float:right">
<input type="button" value="${%Refresh Repositories}" class="yui-button validate-button"
onclick="repos(this,
'${jsFunction}',
'${uniqueId}',
'${repoUrl}',
'${credentialsDescriber}',
${bind})"/>
<button type="button" class="jenkins-button validate-button artifactory-refresh-repos-button"
data-js-function="${jsFunction}" data-unique-id="${uniqueId}" data-repo-url="${repoUrl}"
data-credentials-describer="${credentialsDescriber}" data-stapler-proxy-name="${bind}">${%Refresh Repositories}</button>

</div>
<div style="display:none;">
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/lib/jfrog/repos/repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,15 @@ document.addEventListener("DOMContentLoaded", () => {
setStagingParamsSelectedValue(event.target);
});
});

document.querySelectorAll(".artifactory-refresh-repos-button").forEach((button) => {
button.addEventListener("click", (event) => {
const target = event.target;
const { jsFunction, uniqueId, repoUrl, credentialsDescriber, staplerProxyName } = target.dataset;

repos(target, jsFunction, uniqueId, repoUrl, credentialsDescriber, window[staplerProxyName]);
});
});
});

Behaviour.specify("BUTTON.artifactory-toggle-txt-and-select", "dynamicRepos_artifactory-toggle-txt-and-select", 0, (element) => {
Expand Down

0 comments on commit 728d8e9

Please sign in to comment.