Icinga / icingaweb2-module-jira

GNU General Public License v2.0
42 stars 16 forks source link

Make templates and their corresponding fields configurable in UI #95

Closed raviks789 closed 1 year ago

raviks789 commented 1 year ago

The templates and their corresponding has been configurable in UI. This PR also include changes to allow passing arrays to Jira Tickets.

ref #88

raviks789 commented 1 year ago

Hi @verboEse, Do you mean, you want to get the value for one custom field for example customfield_10184 from another custom field customfield_ 22806?

verboEse commented 1 year ago

I'm not sure how this is accomplished, but in WebUI I get a drop-down when trying to change the field and only the offered values are allowed for the custom field.

raviks789 commented 1 year ago

This looks promising. If I understand this correctly, this not only allows you to include "arrays" like requested in #88, but furthermore allows you to select (?) custom JIRA fields to fill with values from Icinga and make those even configurable from the configuration page in Icinga. I found that it's not possible to define custom fields that require other key-value pairs from the templates config file. Example: customfield_10184 = '{ "id": "22806" }' isn't working. Will this be possible with your approach? I will create a new issue otherwise.

Update: I just found that this occurs when the custom field type is "option" - which you excluded here, probably because the assignment of "free" values from data fields in Icinga possibly won't match these possible values. Some installations do have such fields configured as required though, so it would be great to include them, too. Maybe it's possible to just add a warning about this problem when configuring the field?

@verboEse, currently only string, number or array (only labels) type custom fields are supported for configuration in the Web GUI. In your case, which might be single-select custom field. You could directly configure it in templates.ini file like below.

[template_name]
customfield_10184.id =  "22806"
customfield_10185.value =  "option_value"

Or in case of multi-select custom field:

[template_name]
customfield_10184.0.id =  "22806"
customfield_10184.1.id =  "22807"
customfield_10185.0.value =  "option1_value"
customfield_10185.1.value =  "option2_value"

Update: You could either use customfield_10184.id or customfield_10184.value. Same in the case of multi-select.