Different kinds of "Default Properties for Issue Form" dropdowns (the regular ones and the ones with a search box) on BTS settings page demonstrate inconsistent behavior: the regular ones submit valueName
as a default value for a field even if valueId
is defined, and the ones with a search box submits valueId
no matter if it is defined or not.
This inconsistency is the cause of the issues reported as reportportal/service-rally#4 reportportal/service-rally#6.
I would propose to implement the following approach: use valueId
as a field value if available, otherwise fallback to using valueName
. Are there any drawbacks of such approach you could think of?
Example of Problematic Behavior
Consider one requests Rally integration in project settings. After specifying all the configuration details, the following request will be made to determine the fields set:
GET http://localhost:8080/api/v1/superadmin_personal/external-system/%external_system_id%/fields-set?issuetype=BUG
[
// Renders as a regular dropdown.
{
"definedValues": [
{
"valueId": "/flowstate/10000000000",
"valueName": "Pre-Defined"
},
{
"valueId": "/flowstate/10000000001",
"valueName": "Defined"
}
],
"fieldName": "Flow State",
"fieldType": "FlowState",
"id": "FlowState",
"required": true
},
// Renders as a regular dropdown.
{
"definedValues": [
{
"valueName": "Pre-Defined"
},
{
"valueName": "Defined"
}
],
"fieldName": "Schedule State",
"fieldType": "string",
"id": "ScheduleState",
"required": true
},
// Renders as a dropdown with a search box, as more than 10 definedValues are returned.
{
"definedValues": [
{
"valueId": "/iteration/10000000002",
"valueName": "2017.Q2.7"
},
{
"valueId": "/iteration/10000000003",
"valueName": "2017.Q4.4"
}
// 9 more objects.
],
"fieldName": "Iteration",
"fieldType": "Iteration",
"id": "Iteration",
"required": false
},
// Renders as a dropdown with a search box, as more than 10 definedValues are returned.
{
"definedValues": [
{
"valueName": "Code Change"
},
{
"valueName": "Content Change"
}
// 9 more objects.
],
"fieldName": "Resolution",
"fieldType": "string",
"id": "Resolution",
"required": false
}
];
The form will look as below, "Iteration" and "Resolution" are dropdowns with a search box, and the rest are regular ones:
![Default Properties for Issue Form](https://user-images.githubusercontent.com/739500/27444206-4c9a0a64-577e-11e7-88a0-5e68c01492d4.png)
Ones trying to submit some new default values:
![Default Properties for Issue Form](https://user-images.githubusercontent.com/739500/27444415-f710a89a-577e-11e7-967a-5dd4bf427b25.png)
This ends up with the following request:
PUT http://localhost:8080/api/v1/superadmin_personal/external-system/%external_system_id%
{
"accessKey": "%access_key%",
"fields": [
{
"definedValues": [
{
"valueId": "/flowstate/10000000000",
"valueName": "Pre-Defined"
},
{
"valueId": "/flowstate/10000000001",
"valueName": "Defined"
}
],
"fieldName": "Flow State",
"fieldType": "FlowState",
"id": "FlowState",
"required": true,
"value": [
"Defined" // Note valueName is passed, though valueId's are defined for this field.
]
},
{
"definedValues": [
{
"valueName": "Pre-Defined"
},
{
"valueName": "Defined"
}
],
"fieldName": "Schedule State",
"fieldType": "string",
"id": "ScheduleState",
"required": true,
"value": [
"Defined"
]
},
{
"definedValues": [
{
"valueId": "/iteration/10000000002",
"valueName": "2017.Q2.7"
},
{
"valueId": "/iteration/10000000003",
"valueName": "2017.Q4.4"
}
// 9 more objects.
],
"fieldName": "Iteration",
"fieldType": "Iteration",
"id": "Iteration",
"required": false,
"value": [
"/iteration/10000000003" // In contrast to FlowState field, valueId is passed instead of valueName.
]
},
{
"definedValues": [
{
"valueName": "Code Change"
},
{
"valueName": "Content Change"
}
// 9 more objects.
],
"fieldName": "Resolution",
"fieldType": "string",
"id": "Resolution",
"required": false,
"value": [
"" // Empty string is passed as no valueId's are defined for this field.
]
}
],
"project": "%bts_project_id%",
"systemAuth": "APIKEY",
"systemType": "RALLY",
"url": "%rally_url%"
}
{
"msg": "ExternalSystem with ID = '%external_system_id%' is successfully updated."
}
And after that, the form gets redrawn, note that "Resolution" default value is missing:
![Default Properties for Issue Form](https://user-images.githubusercontent.com/739500/27444526-4f7aaeb8-577f-11e7-926e-15e8ea3201ba.png)