Skip to content

Commit

Permalink
Extract JS in columnHeaders.jelly
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomomdahan committed Oct 31, 2024
1 parent 0ff593b commit cbe19f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
<td id="project-${project.getId()}"></td>
</j:otherwise>
</j:choose>
<script>
//save project proxies for future reference (being able to refresh project cards)
buildPipeline.projectProxies[${project.getId()}] = <st:bind value="${project}" />;
jQuery("#project-${project.getId()}").append(buildPipeline.projectCardTemplate(${project.asJSON()}));
</script>
<st:adjunct includes="au.com.centrumsystems.hudson.plugin.buildpipeline.extension.PipelineHeaderExtension.pipeline-column-headers"/>
<st:bind value="${project}" var="projectProxy${project.getId()}"/>
<span class="ch-project-data-holder" data-project-id="${project.getId()}" data-proxy-name="projectProxy${project.getId()}" data-project-json="${project.asJSON()}" style="display:none"/>
<!-- <script>-->
<!-- //save project proxies for future reference (being able to refresh project cards)-->
<!-- buildPipeline.projectProxies[${project.getId()}] = <st:bind value="${project}" />;-->
<!-- jQuery("#project-${project.getId()}").append(buildPipeline.projectCardTemplate(${project.asJSON()}));-->
<!-- </script>-->
<j:if test="${(y + 1 != buildPipelineForm.getGridWidth())}">
<td class="next">
<!-- Changing length to size() to get rid of arrows when there are no more child jobs.-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
window.addEventListener("DOMContentLoaded", () => {
const projectDataHolders = document.querySelectorAll(".ch-project-data-holder");

projectDataHolders.forEach(dataHolder => {
const { projectId, proxyName, projectJson } = dataHolder.dataset;

buildPipeline.projectProxies[projectId] = window[proxyName];

const projectElement = document.getElementById("project-" + projectId);
const projectData = JSON.parse(projectJson);
projectElement.innerHTML = buildPipeline.projectCardTemplate(projectData);
});
});

0 comments on commit cbe19f0

Please sign in to comment.