From 37419563139717bd090f14eae10ac69efb969204 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Fri, 15 Oct 2021 10:22:58 +0200
Subject: [PATCH] adapt computed selected_colors_style to display label instead
 of name

---
 src/views/feature_type/Feature_type_edit.vue | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/views/feature_type/Feature_type_edit.vue b/src/views/feature_type/Feature_type_edit.vue
index 8786d6d2..889b249c 100644
--- a/src/views/feature_type/Feature_type_edit.vue
+++ b/src/views/feature_type/Feature_type_edit.vue
@@ -98,8 +98,8 @@
           </div>
           <div class="colors_selection" id="id_colors_selection" hidden>
             <div
-              v-for="(value, key) in form.colors_style.value.colors"
-              :key="'colors_style-' + key"
+              v-for="(value, key, index) in form.colors_style.value.colors"
+              :key="'colors_style-' + index"
               class="color-input"
             >
               <label>{{ key }}</label
@@ -268,9 +268,14 @@ export default {
     },
     selected_colors_style: {
       get() {
-        return this.form.colors_style.value.custom_field_name;
+        const value = this.form.colors_style.value.custom_field_name;
+        const customField = this.customForms.find((el) => el.name === value);
+        return customField && customField.length !== 0
+          ? customField.label
+          : value;
       },
       set(newValue) {
+        console.log(newValue);
         const newColorsStyle = {
           colors: {
             [newValue.options[0]]: "#000000",
-- 
GitLab