Skip to content

Commit 953da46

Browse files
authored
Jira: fix custom field option display and value formatting (#966)
1 parent 3ae7e4e commit 953da46

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/appmixer/jira/bundle.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "appmixer.jira",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"changelog": {
55
"1.0.0": [
66
"Initial version"
@@ -49,7 +49,7 @@
4949
"2.0.0": [
5050
"(breaking change) Updated FindIssues, NewIssue, and UpdatedIssue components to use the new JQL enhanced search API endpoint instead of the deprecated /rest/api/3/search endpoint."
5151
],
52-
"2.0.1": [
52+
"2.0.2": [
5353
"Create Issue, Update Issue: fix support for custom fields."
5454
]
5555
}

src/appmixer/jira/jira-commons.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ module.exports = {
140140

141141
if (Array.isArray(allowedValues)) {
142142
inspector.inputs[key].type = 'select';
143-
inspector.inputs[key].options = allowedValues.map(value => ({ content: value.name, value: value.id }));
143+
inspector.inputs[key].options = allowedValues.map(v => ({
144+
content: v.name || v.value || v.id,
145+
value: v.id
146+
}));
144147
}
145148

146149
if (schema.type === 'array') {
@@ -187,15 +190,15 @@ module.exports = {
187190
if (!meta || !meta.schema) return;
188191

189192
const { schema } = meta;
190-
if (schema.type === 'option') {
191-
issueInfo[key] = { id: value };
192-
} else if (schema.type === 'array') {
193+
const hasAllowedValues = Array.isArray(meta.allowedValues) && meta.allowedValues.length > 0;
194+
195+
if (schema.type === 'array') {
193196
if (Array.isArray(value)) {
194-
if (schema.items === 'option') {
197+
if (schema.items === 'option' || (hasAllowedValues && schema.items !== 'string')) {
195198
issueInfo[key] = value.map(v => ({ id: v }));
196199
}
197200
}
198-
} else if (schema.type === 'user') {
201+
} else if (schema.type === 'option' || schema.type === 'user' || hasAllowedValues) {
199202
issueInfo[key] = { id: value };
200203
} else if (schema.type === 'number') {
201204
issueInfo[key] = Number(value);

0 commit comments

Comments
 (0)