[QUESTION] How to use multi-cascaded Active Reactive ?

22 views
Skip to first unread message

Olivier Renault

unread,
Apr 9, 2018, 5:09:53 AM4/9/18
to BioUno Developers
Hi !

I'm using this greeeeat plugin to parametrize the build of a complex pipeline.

So I need to define/select some properties before running the build.


Bruno helps me to set the first level of Active Choices Reactive Parameter, as-is.


Environnement
 (do a SQL query to populate a Single Select)
         |
         |___  Version
                   (do a SQL query to populate a Single Select)
                       |
                       | ____ Site
                                  (do a SQL query to populate a Multi Select)
                                      |
                                      |____  User
                                                  (do a SQL query to populate a Multi Select)


So, it's working nice. The different components are updated accordingly to the selection.

What I need now, is to add a way to "overwrite" the selection for the "User" list.
I want to be able to define if I want to use the selection from "User", or to use all the values defined in "User", or to take the information from another way.

For this, I think I can have a 5th "active choices parameter" named 'selection" with a list of radio buttons and 3 choices; All users, Selected Users, External, and add another component which will list the users accordingly to the Radio button selected:

1- if " All users" => list all the values displayed in "User"
2- if " Selectedl users" => list all the values selected in "User"
3- if "External" => list the values from a sql query in a db

What I don't know is if I have to use the    Active Choice Reactive Reference   to do that,by creating a bulleted list maybe, and how to proceed ?                        
                                                                  
Specially, I don't know how to dynamically get the list of "user", complete or selected items only, from another active reactive component.

At the end, I should have:


Environnement
 (do a SQL query to populate a Single Select)
         |
         |___  Version
                   (do a SQL query to populate a Single Select)
                       |
                       | ____ Site
                                  (do a SQL query to populate a Multi Select)
                                      |
                                      |____  User
                                                  (do a SQL query to populate a Multi Select)


Selection
     |
     |___  Radio Buttons


User List
     |
     |____   Bulleted List
                  (according to 'Selection', get full User list, or selected List, or data from DB, will be refreshed if 'Site' or 'Selection' is changed)

Can you help ?

Thanks
Olivier


Ioannis Moutsatsos

unread,
Apr 9, 2018, 7:16:31 AM4/9/18
to BioUno Developers
Hi Olivier;

I think an AC Reactive Choice is the right parameter type as it can render directly a bulleted list. However, you would need to recalculate the <User> list in 'Bulleted List' when 'all' is selected as the <User> parameter can only cascade the selected value.

I would suggest to consider an alternate (simpler) scenario:

Have the <Selection> parameter upstream of the <Users>.

Then, referencing the <Selection> option in addition to the other parameters in <Users> (one of: all, selected, external)  you can render the <User> list accordingly
  1. when --all--: return a list of users as follows {'user01:selected', 'user02:selected',....'user0N:selected'} the 'selected' keyword is an AC documented feature to select one or more options in the default rendering of an AC without user action
  2. when --selected--: return a list of users as you are currently are doing so the user can make selections
  3. when --external--: return a list f external users selected with the approach in 1 above

In this scenario the cascade is as follows:

Environment
 (do a SQL query to populate a Single Select)
         |
         |___  Version
                   (do a SQL query to populate a Single Select)
                       |
                       | ____ Site
                                  (do a SQL query to populate a Multi Select)
                                      |
                                      |____  Selection
                                      |          (an Active Choice with 3 options)
                                      |
                                      |____ User (AC Reactive Parameter, References: Site, Selection)


I hope his helps.

Best regards
Ioannis

Olivier Renault

unread,
Apr 9, 2018, 10:25:38 AM4/9/18
to biouno-d...@googlegroups.com
Thanks a lot.. I'm following your advice and change the order of the Choices.

Another question.

Is there a way to use an "input text box" and have another choice to react when I change the text in the input text box ?
I've tried with a classical "string parameter" but the active choices parameter is not updated.
And if I use a "active choices parameter references", I can display a "text box" but the user is not allowed to update the value, the box is not editable.
Thanks.

Olivier

--
You received this message because you are subscribed to the Google Groups "BioUno Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biouno-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ioannis Moutsatsos

unread,
Apr 9, 2018, 10:43:47 AM4/9/18
to BioUno Developers
A String parameter should cascade just fine to an an Active Choice Reactive or Reactive Reference. I don't see a reason why is not working in your configuration.
Perhaps providing some more details would be helpful to troubleshoot.

You are correct on the second point. The default 'text box input' in AC Reactive Reference is very limited. I rarely use it.
Try rendering an input text box from as: 'Formatted HTML' this is much more useful, as you can both display a default value AND allow the user to edit it.
See the Active Choices wiki pageScenario 1: Pass a dynamically created value that can be edited by the user

Olivier Renault

unread,
Apr 9, 2018, 11:35:40 AM4/9/18
to biouno-d...@googlegroups.com
ok, nice advice again

I try to use the "Formatted html", but how to retrieve the value entered in the input text box ?

Imagine i have put 2 "active reactive reference parameter", with womething like:

if   (Selection == 'All the PACs')  {
 return "<input name=\"value1\" value=\"\" class=\"setting-input\" type=\"text\"><input name=\"value2\" value=\"\" class=\"setting-input\" type=\"text\">"
}


When I select the "All the PACs", the edit box are correctly shown.
But when I put a text into them, and run the build, i am not able to get the values.

Do you have a tip for that ?

Thanks

Olivier

Ioannis Moutsatsos

unread,
Apr 9, 2018, 1:43:37 PM4/9/18
to BioUno Developers
Most likely you need to go to 'Advanced options and check the 'Omit Value' check box
Otherwise the AC reference parameter value will not be passed to the build.

The AC reference is considered just a 'visual reference' for guiding the selection of other parameters, and therefore normally passes a null value to the build, unless you check off the 'Omit Value' check Box
That is also documented in the wiki, but it's not obvious...

Olivier Renault

unread,
Apr 9, 2018, 3:38:37 PM4/9/18
to biouno-d...@googlegroups.com
ok, thanks.. I will try tomorrow morning at the office.
In fact, I've found this in the wiki and I"ve checked the "omit value" for my first tests.
But as this doesn't work, I've tried without.. Maybe i have an issue somewhere.

Will try to find. I've got a demo at the end of the morning, hope to fix it before....

Olivier Renault

unread,
Apr 10, 2018, 3:09:03 AM4/10/18
to biouno-d...@googlegroups.com
Hi, 

Sorry to disturb you again.

But still not working, even with "Omit value field" tiped.



Maybe I don't try to get the right variable ?

In the "Active Choices Reactive Reference Parameter", I've defined the name as "value2".

Then in the groovy script:

return "<input name=\"value2\" value=\"test\" class=\"setting-input\" type=\"text\">"



In the build step, I have a bash step where I put something like:


echo "value2: $value2"


So, when I run the build, I should get the value put in the input text box....  but nothing.

I've added a 'Persistent String Parameter' named Script. So when I run the build, in the bash, I have:

echo "Script: $Script"   => it works, I get the value of the input box of this parameter.

But, when I try to get the value of script within a groovy script of an active choices, I get nothing (I got a groovy.lang.Script instead of a value).


So, I should be wrong in the way to manipulate these variables ?

Olivier Renault

unread,
Apr 10, 2018, 3:55:21 AM4/10/18
to biouno-d...@googlegroups.com
Ok.. I have this working.


The variable is the name of the parameter, not the name of the input box.
AND, the name of the input box can't be changed, it have to be "value".

So, as a limitation, you can't display more than one input box.  It's not really "clear" in the documentation.

But now it appears obvious... 

Thanks a lot for your help !

Last: why I retrieve an extra comma at the end of the value get from the variable ?  It is a list ?

Ioannis Moutsatsos

unread,
Apr 10, 2018, 6:39:37 AM4/10/18
to BioUno Developers
Olivier, glad you got it working!
You are right, We should probably write some more examples to clarify these issues. 

Checking the 'Omit Value' Check Box should eliminate the 'extra comma'. What follows that comma is the null value ;-)

Olivier Renault

unread,
Apr 11, 2018, 2:31:02 AM4/11/18
to biouno-d...@googlegroups.com
Hi Ioannis !

Thanks a lot for your help and your support.

Thanks to you, I was successfull for my demo.

At the office, we use Jenkins for automating complex application deployments, not only build of code.
We automatize all thz process, from the packaging to the production deployment, with jira tickets, documentation in confluence & flowdocks, automated testing with selenium & robot framework, etc...

And the active choices plugin is really usefull !

Thanks again

Have a good day !

Olivier

Ioannis Moutsatsos

unread,
Apr 11, 2018, 9:58:43 AM4/11/18
to BioUno Developers
You are welcome!
I'm glad you are finding the Active Choices plugin useful.

In our scientific data processing workflows we are also using Jenkins rather unconventionally. We are finding it to be an excellent tool for supporting complex workflows where parameters and inputs need to be defined by users before a build.
We published a paper on this in a scientific journal, and maintain an open source project on GitHub: https://github.com/Novartis/Jenkins-LSCI 

Best regards
Ioannis

Olivier Renault

unread,
Apr 12, 2018, 2:54:04 AM4/12/18
to biouno-d...@googlegroups.com
Hello Ioannis,

It's really interesting. I will check this project.

I've worked 7 years ago with bruno on another jenkins plugin, the one for testlink. I'm a professionnal in QA testing, and I try to developp a complete platform to deploy & test softwares, only using open source like jenkins.

The active choices plugin is really amazing.

Bruno really did a great job, the only bad thing is that he can't work 23h a day !!

Have a good day.

Regards

Olivier

Olivier Renault

unread,
May 2, 2018, 11:15:16 AM5/2/18
to biouno-d...@googlegroups.com
Hi Ioannis !

How are you ?

I hope you're fine.

I've got another nedd with the active reactive choice.
Maybe you can help me to find the way ?


I see in a jira ticket of the plugin that you're a GURU using javascript with the plugin.  :p

I've made some tests but don't really know how to implement what I need.


I need to have a "selection box".

I've got a first dropdown list, "active choices reactive parameter", multi select, populated from a database, named Clients.
Just after, i've got a "Activ choices Reactive reference Parameter", Formatted HTML, which display a button:
Groovy:
return "<button type='button'>=></button>"

Just after I've got another dropdown list,   "active choices reactive parameter", named "Selected Clients".


What I want is:

When I select some lines on the 1st dropdown, then click on the button "=>" (select) populate the 2nd dropdown "Selected Clients", with the selected lines.
And if I select other lines on the 1st dropdown list (after its update by exemple), and click on the button "=>", then add those new selected lines with the existing, on the 2nd dropdown.

My first question is, is it possible ?

My intuition is I need to put some javascript with the button, in order to trigger the 2nd dropdown, but I don't know how to do this.

Do you already have this kind of need ?

Regards
Olivier

Reply all
Reply to author
Forward
0 new messages