Re: repeatableProperty in Jenkins Global Configuration

2019-11-12 Thread Jesse Glick
On Tue, Nov 12, 2019 at 5:53 PM Ullrich Hafner 
wrote:
> if I remove the last element in the UI then the empty list ist not saved.
More precisely, the data bound setter […]
> Is not called if I remove all elements in the UI (it is called for 1,…,n
elements).

This is a well-known limitation in databinding. The workaround is to
override a `configSubmit` or whatever method to first null out / clear the
list, then call super. Example:

https://github.com/jenkinsci/ui-samples-plugin/blob/7d0fe2b32204a7fe0ec6adb6815e65d48b0dd54e/src/main/java/jenkins/plugins/ui_samples/HeteroList.java#L81

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr26sng%2BPMm7xULu%2B0SH97CgJhTRf3TdiC4NuPew6NFwSQ%40mail.gmail.com.


repeatableProperty in Jenkins Global Configuration

2019-11-12 Thread Ullrich Hafner
I have a repeatableProperty in Jenkins Global Configuration page (see 
https://github.com/jenkinsci/warnings-ng-plugin/pull/266 
<https://github.com/jenkinsci/warnings-ng-plugin/pull/266>).

Expanded snippet:

  

  

  

  

  



(And a describable config.jelly)

  

I can successfully add entries and delete entries in the UI. However, if I 
remove the last element in the UI then the empty list ist not saved. More 
precisely, the data bound setter 
/**
 * Sets the list of source directories to the specified elements. Previously 
set directories will be removed.
 *
 * @param sourceDirectories
 * the source directories that contain the affected files
 */
@DataBoundSetter
public void setSourceDirectories(final List sourceDirectories) 
{
...


Is not called if I remove all elements in the UI (it is called for 1,…,n 
elements). Has anyone an idea what I am making wrong? 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/987D0FAA-15D1-4AD7-9EF8-9918EB79FF62%40gmail.com.


Re: Jenkins global configuration

2019-10-02 Thread Raihaan Shouhell
That helped a ton, figured out that it was me not marking the setters and 
getters public.
Thanks Jesse

On Tuesday, 1 October 2019 20:44:49 UTC+8, Jesse Glick wrote:
>
> On Tue, Oct 1, 2019 at 5:06 AM Raihaan Shouhell 
> > wrote: 
> > I've been trying to implement a global configuration 
>
> Try using the sample in https://github.com/jenkinsci/archetypes which 
> includes a functional test that should be helpful. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/969fa337-bca1-4883-b24c-17cd78bf9f94%40googlegroups.com.


Re: Jenkins global configuration

2019-10-01 Thread Jesse Glick
On Tue, Oct 1, 2019 at 5:06 AM Raihaan Shouhell
 wrote:
> I've been trying to implement a global configuration

Try using the sample in https://github.com/jenkinsci/archetypes which
includes a functional test that should be helpful.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3ioYibmV3t8AcEYnH7rbA5ZWZqPXPyPnq14P2e_CHaDQ%40mail.gmail.com.


Jenkins global configuration

2019-10-01 Thread Raihaan Shouhell
Hi all,

I've been trying to implement a global configuration but have an issue 
where only the username field is properly reflected and saved when I use 
the configuration UI.
Other plugins seem to do similar things.

Here is a repo with an MRE of what I get 
https://github.com/res0nance/global-test

Any help would be appreciated.

Cheers,
Raihaan

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/fd8ac17d-8317-4ddc-aa4c-7e8ce647ce41%40googlegroups.com.