Skip to content

Commit

Permalink
[JENKINS-21190] - lib/layout/layout.jelly: Interpret norefresh=="fals…
Browse files Browse the repository at this point in the history
…e" as "autorefresh is enabled"

The fix allows to explicitly disable automatic page refreshes in the @view extensions.
Resolves https://issues.jenkins-ci.org/browse/JENKINS-21190

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed Mar 17, 2014
1 parent 7b83852 commit 5de6a8d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
9 changes: 9 additions & 0 deletions core/src/main/java/hudson/model/View.java
Expand Up @@ -373,6 +373,15 @@ public boolean isEditable() {
return true;
}

/**
* Enables or disables automatic refreshes of the view.
* By default, automatic refreshes are enabled.
* @since TODO: define a version
*/
public boolean isAutomaticRefreshEnabled() {
return true;
}

/**
* If true, only show relevant executors
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/model/View/index.jelly
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<st:compress xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="${it.class.name=='hudson.model.AllView' ? '%Dashboard' : it.viewName}${not empty it.ownerItemGroup.fullDisplayName?' ['+it.ownerItemGroup.fullDisplayName+']':''}">
<l:layout title="${it.class.name=='hudson.model.AllView' ? '%Dashboard' : it.viewName}${not empty it.ownerItemGroup.fullDisplayName?' ['+it.ownerItemGroup.fullDisplayName+']':''}" norefresh="${!it.automaticRefreshEnabled}">
<j:set var="view" value="${it}"/> <!-- expose view to the scripts we include from owner -->
<st:include page="sidepanel.jelly" />
<l:main-panel>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/layout/breadcrumbBar.jelly
Expand Up @@ -40,7 +40,7 @@ THE SOFTWARE.
<div class="top-sticker noedge">
<div class="top-sticker-inner">
<div id="right-top-nav">
<j:if test="${norefresh==null}">
<j:if test="${norefresh==null or norefresh==false}">
<div id="right-top-nav">
<div class="smallfont">
<j:choose>
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/resources/lib/layout/layout.jelly
Expand Up @@ -34,7 +34,7 @@ THE SOFTWARE.
Title of the HTML page. Rendered into &lt;title> tag.
</st:attribute>
<st:attribute name="norefresh">
If non-null, auto refresh is disabled on this page.
If non-null and not "false", auto refresh is disabled on this page.
This is necessary for pages that include forms.
</st:attribute>
<st:attribute name="css" deprecated="true">
Expand Down Expand Up @@ -67,8 +67,7 @@ ${h.initPageVariables(context)}
which I suspect can end up creating sessions for wrong resource types (such as static resources.)
-->
<j:set var="_" value="${request.getSession()}"/>
<j:set var="_" value="${h.configureAutoRefresh(request, response, attrs.norefresh!=null)}"/>

<j:set var="_" value="${h.configureAutoRefresh(request, response, attrs.norefresh!=null and !attrs.norefresh.equals(false))}"/>
<j:if test="${request.servletPath=='/' || request.servletPath==''}">
${h.advertiseHeaders(response)}
<j:forEach var="pd" items="${h.pageDecorators}">
Expand Down

0 comments on commit 5de6a8d

Please sign in to comment.