Skip to content
Snippets Groups Projects
Commit 08b9e66f authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix errors if no custom field was selected

parent 54a010dc
No related branches found
No related tags found
No related merge requests found
...@@ -335,13 +335,19 @@ const mapService = { ...@@ -335,13 +335,19 @@ const mapService = {
if (colors_style && colors_style.custom_field_name && customfield_set) { if (colors_style && colors_style.custom_field_name && customfield_set) {
const fieldType = customfield_set.find((el) => el.name === colors_style.custom_field_name).field_type; const fieldType = customfield_set.find((el) => el.name === colors_style.custom_field_name).field_type;
const currentValue = properties[colors_style.custom_field_name]; const currentValue = properties[colors_style.custom_field_name];
if (fieldType === 'list') {
color = colors_style.colors[currentValue]; if (currentValue) {
opacity = colors_style.opacities[currentValue]; switch (fieldType) {
} else if (fieldType === 'char') { //* if the custom field is supposed to be a string case 'list' :
//* check if its current value is empty or not, to select a color | https://redmine.neogeo.fr/issues/14048 color = colors_style.colors[currentValue];
color = colors_style.value.colors[currentValue ? 'Non vide' : 'Vide']; opacity = colors_style.opacities[currentValue];
opacity = colors_style.value.opacities[currentValue ? 'Non vide' : 'Vide']; break;
case 'char': //* if the custom field is supposed to be a string
//* check if its current value is empty or not, to select a color | https://redmine.neogeo.fr/issues/14048
color = colors_style.value.colors[currentValue ? 'Non vide' : 'Vide'];
opacity = colors_style.value.opacities[currentValue ? 'Non vide' : 'Vide'];
break;
}
} }
} }
return { color, opacity }; return { color, opacity };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment