diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index 56d127c116f392e1afdb8254a704bff09895c397..da388ae4d557cea90b06bd042558b32c38661b03 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -293,7 +293,7 @@ const mapUtil = { }, retrieveFeatureColor: function (featureType, properties) { - const colorsStyle = featureType.colors_style && featureType.colors_style.value ? featureType.colors_style.value : featureType.colors_style; + const colorsStyle = featureType.colors_style; if (featureType && colorsStyle && colorsStyle.custom_field_name) { const currentValue = properties[colorsStyle.custom_field_name]; const colorStyle = colorsStyle.colors[currentValue]; @@ -400,7 +400,13 @@ const mapUtil = { } const colorValue = color.value ? color.value : color; if (geomJSON.type === 'Point') { - if (customFieldOption && featureType.colors_style && featureType.colors_style.value && featureType.colors_style.value.icons) { + if ( + customFieldOption && + featureType.colors_style && + featureType.colors_style.value && + featureType.colors_style.value.icons && + !!Object.keys(featureType.colors_style.value.icons).length + ) { if (featureType.colors_style.value.icons[customFieldOption]) { const iconHTML = ` <i diff --git a/src/store/modules/feature.js b/src/store/modules/feature.js index 1d359d832bd3ebc439eef95ff8b0007d32d9e984..fd331b50afb9e4fcb3aa32a7db9b895167c7cf90 100644 --- a/src/store/modules/feature.js +++ b/src/store/modules/feature.js @@ -139,10 +139,10 @@ const feature = { const features_count = response.data.count; commit("SET_FEATURES_COUNT", features_count); } - return response + return response; } catch (error) { console.error(error); - return error + return error; } }, GET_PROJECT_FEATURE({ commit, rootState }, { project_slug, feature_id }) { diff --git a/src/views/feature_type/Feature_type_detail.vue b/src/views/feature_type/Feature_type_detail.vue index 506fcc84b4007beeea7eaed8e8a40658a076f167..7dd2f69fe5ea53a56b2863429ebb1f7fda6fb768 100644 --- a/src/views/feature_type/Feature_type_detail.vue +++ b/src/views/feature_type/Feature_type_detail.vue @@ -337,7 +337,8 @@ export default { if (!this.project) { this.GET_PROJECT_INFO(this.$route.params.slug); } - this.setCurrentFeatureTypeSlug(); + this.$store.commit("feature/SET_FEATURES", []); //* empty features remaining in case they were in geojson format and will be fetch anyway + this.getFeatures(); // .then(res => resolve(res)) // .catch(err => reject(err)); this.SET_CURRENT_FEATURE_TYPE_SLUG( @@ -481,7 +482,7 @@ export default { } }); }, - async setCurrentFeatureTypeSlug(){ + async getFeatures(){ const response = await this.GET_PROJECT_FEATURES({ project_slug: this.$route.params.slug, diff --git a/src/views/feature_type/Feature_type_edit.vue b/src/views/feature_type/Feature_type_edit.vue index 22b98958768e19438113996394545e0a1706b804..c2ecc61a67122aece2d988221035c93d4e3a5e48 100644 --- a/src/views/feature_type/Feature_type_edit.vue +++ b/src/views/feature_type/Feature_type_edit.vue @@ -90,7 +90,7 @@ <!-- //* s'affiche après sélection d'option de type liste dans type de champ --> <div - v-if="colorsStyleList.length > 0" + v-if="colorsStyleList.length > 0 && selectedGeomType !== 'Point'" class="custom_style" id="id_style_container" > diff --git a/src/views/project/Project_detail.vue b/src/views/project/Project_detail.vue index 604663b20087bb7eb7c7a3457cad1a7f0341820c..419469b6377ef871a30953952136633fed8c6d69 100644 --- a/src/views/project/Project_detail.vue +++ b/src/views/project/Project_detail.vue @@ -749,11 +749,13 @@ export default { }, created() { + if (this.user) { projectAPI .getProjectSubscription({ projectSlug: this.$route.params.slug }) .then((data) => (this.is_suscriber = data.is_suscriber)); } + this.$store.commit("feature/SET_FEATURES", []); //* empty features remaining in case they were in geojson format and will be fetch after map initialization anyway this.$store.commit("feature_type/SET_FEATURE_TYPES", []); //* empty feature_types remaining from previous project },