Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-73894] Un-inline JavaScript in IssuesChartPortlet/portlet.jelly #1859

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:dp="/hudson/plugins/view/dashboard" xmlns:st="jelly:stapler">
<j:jelly xmlns:j="jelly:core" xmlns:dp="/hudson/plugins/view/dashboard" xmlns:st="jelly:stapler" xmlns:f="/lib/form">

<j:set var="model" value="${it.register(jobs)}"/>

Expand All @@ -15,12 +15,10 @@

<st:adjunct includes="io.jenkins.plugins.echarts"/>

<script>
{
const trendProxy = <st:bind value="${it}"/>;

echartsJenkinsApi.renderTrendChart('${it.id}-issues-chart', `false`, trendProxy);
}
</script>
<st:bind value="${it}" var="trendProxy"/>
<f:invisibleEntry>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be changed to have inline style on the span hiding the element if someone is opposed to the current approach.

<span class="issues-chart-portlet-data-holder" data-id="${it.id}" />
</f:invisibleEntry>
<st:adjunct includes="io.jenkins.plugins.analysis.core.portlets.IssuesChartPortlet.render-trend-chart" />

</j:jelly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const issuesChartPortletId = document.querySelector(".issues-chart-portlet-data-holder").getAttribute("data-id");
echartsJenkinsApi.renderTrendChart(`${issuesChartPortletId}-issues-chart`, `false`, trendProxy);
Loading