--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/b1d50920-9334-4b77-b738-ab7c924d30cc%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/b1d50920-9334-4b77-b738-ab7c924d30cc%40googlegroups.com.
Hi Albert, sure.
I think that I changed the plugin to focus on another example. but I finally tried the plugin after many years (it was difficult to recall how the code works, but it was a good challenge). Let’s start.
On Rundeck, I have this job definition with two options:
- defaultTab: nodes description: '' executionEnabled: true id: 3134efd6-050a-47fb-b64e-2a66862e0b75 loglevel: INFO name: JobCASCADE nodeFilterEditable: false options: - enforced: true name: option1 required: true valuesUrl: file:/my/path/toos.json - enforced: true name: option2 valuesUrl: file:/my/path/to/${option.option1.value} plugins: ExecutionLifecycle: null scheduleEnabled: true sequence: commands: - exec: 'echo "The selected server is: ${option.option2}"' keepgoing: false strategy: node-first uuid: 3134efd6-050a-47fb-b64e-2a66862e0b75This plugin needs three JSON files as remote options:
os.json
[ {"name":"windows", "value":"windows.json"}, {"name":"linux", "value":"linux.json"} ]windows.json
[ {"name":"AD_Server", "value":"ad_server"}, {"name":"SQLServer", "value":"sql_server"} ]linux.json
[ {"name":"k8s", "value":"K8S"}, {"name":"ssh", "value":"SSH"} ]Now, let’s see the plugin code (option-filter.zip) I changed only the ‘ main.js’ file:
function initJobFilter() { //console.log(rundeckPage.path()); if(rundeckPage.path() === "scheduledExecution/show"){ var checkExist = setInterval(function() { if (jQuery('[name="extra.option.'+rootOption+'"]').length) { clearInterval(checkExist); filterSSHUSR(); jQuery('[name="extra.option.'+rootOption+'"]')[0].setAttribute("onchange", "filterSSHUSR()"); } }, 100); } } var rootOption = 'option1'; var childOption = 'option2'; var hideValue = 'linux.json'; function filterSSHUSR(){ if(jQuery('[name="extra.option.'+childOption+'"]').size()==1){ var input1 = jQuery('[name="extra.option.'+childOption+'"]')[0]; if(jQuery('[name="extra.option.'+rootOption+'"]')[0].value==hideValue){ jQuery(input1).closest('.form-group')[0].hidden=true; }else{ jQuery(input1).closest('.form-group')[0].hidden=false; } } }Now, how it works?
The idea is that if you select “Linux” in the first option, the second option should be removed. However, if you select “Windows,” you will be presented with the second choice, which includes two Windows Servers. Great but…
The problem here is that this type of plugin does not work on the most recent Rundeck version (I tested on 3.0.22 vs 4.17). It is still operational on 3.0.22). This is due to the significant difference in graphic internal library modifications between Rundeck 3.0.X (2017) and the most recent Rundeck version.
So, please, open a new ticket here to request this compatibility back again.
Thanks!