Skip to content

Commit

Permalink
extract JS in sidepanel.jelly - use updated <l:task>
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomomdahan committed Oct 21, 2024
1 parent 10c26a8 commit 34437e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function refresh(link) {

fetch(link.href, {
method: "POST",
headers: crumb.wrap({})
}).catch(() => {});

hoverNotification('${%Refresh scheduled}', link);
return true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,16 @@
Side panel for the build view.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler">
<l:header />
<l:side-panel>
<l:tasks>
<l:task href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<l:task href="${rootURL}/manage" icon="icon-setting icon-md" title="${%Manage Jenkins}"/>
<l:task href="." icon="/plugin/cloudbees-disk-usage-simple/images/disk.png" title="${%Disk usage}"/>
<j:if test="${not it.running}">
<l:task href="." onclick="return refresh(this)" icon="icon-refresh icon-md" title="${%Refresh disk usage}" post="true"/>
<script>
function refresh(a) {
fetch("refresh", {
method: "post",
headers: crumb.wrap({}),
});
hoverNotification('${%Refresh scheduled}',a.parentNode);
return true;
}
</script>
<st:adjunct includes="com.cloudbees.simplediskusage.QuickDiskUsagePlugin.refresh"/>
<j:if test="${not it.running}">
<l:task href="." data-callback="refresh" icon="icon-refresh icon-md" title="${%Refresh disk usage}" post="true"/>
</j:if>
</l:tasks>
</l:side-panel>
Expand Down

0 comments on commit 34437e5

Please sign in to comment.