Skip to content
Permalink
Browse files

[JENKINS-8276] Moved method that tests for job filter extenstions fro…

…m SectionedViewSection to SectionedViewSectionDescriptor.

The config.jelly file was previously attempting to invoke this method in SectionedViewSection via the 'instance'
reference.  However the 'instance' does not exist until the new section is saved.  Because of this the
'Add Job Filter' button could never appear until after the view was saved and re-opened for editing.

By moving the method to the SectionedViewSectionDescriptor class it is available before the section is created by the first save.
  • Loading branch information...
Richard Thomas authored and tbingaman committed Sep 28, 2015
1 parent 3769737 commit 7a9f98fd328d2bb60ed3b088eafdd38138d99a4c
@@ -104,8 +104,12 @@ public String getIncludeRegex() {
return jobFilters;
}

/**
* @deprecated use {@link SectionedViewSectionDescriptor#hasJobFilterExtensions()} instead
*/
@Deprecated
public boolean hasJobFilterExtensions() {
return !ViewJobFilter.all().isEmpty();
return getDescriptor().hasJobFilterExtensions();
}

public Width getWidth() {
@@ -55,6 +55,10 @@ protected SectionedViewSectionDescriptor(Class<? extends SectionedViewSection> c
protected SectionedViewSectionDescriptor() {
}

public boolean hasJobFilterExtensions() {
return !ViewJobFilter.all().isEmpty();
}

@Override
public SectionedViewSection newInstance(StaplerRequest req, JSONObject formData) throws FormException {
SectionedViewSection section = (SectionedViewSection)req.bindJSON(getClass().getDeclaringClass(), formData);
@@ -49,7 +49,7 @@ THE SOFTWARE.
</f:entry>
</f:optionalBlock>

<j:if test="${instance.hasJobFilterExtensions()}">
<j:if test="${descriptor.hasJobFilterExtensions()}">
<j:invokeStatic var="allJobFilters" className="hudson.views.ViewJobFilter" method="all"/>
<f:block>
<f:hetero-list name="jobFilters" hasHeader="true"
@@ -43,7 +43,7 @@ THE SOFTWARE.
</j:forEach>
</f:entry>

<j:if test="${instance.hasJobFilterExtensions()}">
<j:if test="${descriptor.hasJobFilterExtensions()}">
<j:invokeStatic var="allJobFilters" className="hudson.views.ViewJobFilter" method="all"/>
<f:block>
<f:hetero-list name="jobFilters" hasHeader="true"

0 comments on commit 7a9f98f

Please sign in to comment.
You can’t perform that action at this time.