From 909b0e73f43fdcf9f74f7a6e9ec2d0e4168f6ccb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Tue, 7 Sep 2021 10:55:02 +0200
Subject: [PATCH] removes console

---
 src/assets/js/map-util.js                     |  6 ++--
 .../feature/FeatureAttachmentForm.vue         |  8 +----
 src/store/index.js                            |  3 +-
 src/store/modules/feature.js                  | 31 +++++++++----------
 src/store/modules/feature_type.js             | 13 ++++----
 src/store/modules/map.js                      | 11 ++++---
 src/views/Index.vue                           |  5 +++
 src/views/feature/Feature_detail.vue          |  9 +++---
 src/views/feature/Feature_edit.vue            | 15 +++------
 src/views/feature/Feature_list.vue            |  2 +-
 .../feature_type/Feature_type_detail.vue      |  5 ++-
 src/views/feature_type/Feature_type_edit.vue  |  1 -
 src/views/project/Project_detail.vue          |  2 +-
 src/views/project/Project_edit.vue            | 13 ++------
 src/views/project/Project_members.vue         | 10 +++---
 15 files changed, 57 insertions(+), 77 deletions(-)

diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js
index 23023676..4d375499 100644
--- a/src/assets/js/map-util.js
+++ b/src/assets/js/map-util.js
@@ -88,7 +88,7 @@ L.TileLayer.BetterWMS = L.TileLayer.WMS.extend({
     let content;
 
     if (err) {
-      console.log(err);
+      //console.log(err);
       content = `
 				<h4>${this.options.title}</h4>
 				<p>Données de la couche inaccessibles</p>
@@ -117,9 +117,9 @@ L.TileLayer.BetterWMS = L.TileLayer.WMS.extend({
           .setLatLng(latlng)
           .setContent(content)
           .openOn(this._map);
-      } else {
+      } /* else {
         console.log('Pas de features trouvées pour cette couche');
-      }
+      } */
     }
   }
 
diff --git a/src/components/feature/FeatureAttachmentForm.vue b/src/components/feature/FeatureAttachmentForm.vue
index 69c2d3aa..397b0a47 100644
--- a/src/components/feature/FeatureAttachmentForm.vue
+++ b/src/components/feature/FeatureAttachmentForm.vue
@@ -109,18 +109,12 @@ export default {
   },
   methods: {
     remove_attachment_formset() {
-      console.log("send to store");
       this.$store.commit(
         "feature/REMOVE_ATTACHMENT_FORM",
         this.attachmentForm.dataKey
       );
-      /*  this.attachment_formset = this.attachment_formset.filter(
-        (form) => form.dataKey !== dataKey
-      ); */
-    },
-    selectFile() {
-      console.log("selectFile");
     },
+    selectFile() {},
     updateStore() {
       this.$store.commit("feature/UPDATE_ATTACHMENT_FORM", {
         dataKey: this.attachmentForm.dataKey,
diff --git a/src/store/index.js b/src/store/index.js
index 19b8c104..c7d3fbca 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -141,8 +141,7 @@ export default new Vuex.Store({
     LOGOUT({ commit }) { // ? logout bien dans django ?
       axios
         .get(`${DJANGO_API_BASE}logout/`)
-        .then((response) => {
-          console.log(response);
+        .then((/* response */) => { // todo: check status
           commit("SET_USER", false); // ? better false or null
           commit("SET_USER_LEVEL_PROJECTS", null);
         })
diff --git a/src/store/modules/feature.js b/src/store/modules/feature.js
index 3b4f8ebb..646832c5 100644
--- a/src/store/modules/feature.js
+++ b/src/store/modules/feature.js
@@ -85,13 +85,13 @@ const feature = {
 
   },
   actions: {
-    GET_PROJECT_FEATURES({ commit, dispatch }, project_slug) {
+    GET_PROJECT_FEATURES({ commit }, project_slug) {
       axios
         .get(`${DJANGO_API_BASE}projet/${project_slug}/feature`)
         .then((response) => {
           const features = response.data.features;
           commit("SET_FEATURES", features);
-          dispatch("map/ADD_FEATURES", features, { root: true });
+          //dispatch("map/ADD_FEATURES", features, { root: true });
         })
         .catch((error) => {
           throw error;
@@ -102,14 +102,13 @@ const feature = {
       dispatch ("map/ADD_FEATURES");
     }, */
 
-    POST_FEATURE({ state }) {
-      const data = {
+   // POST_FEATURE({ state }) {
+      /* const data = {
         form: state.form,
         attachmentFormset: state.attachmentFormset,
         linkedFormset: state.linkedFormset,
         extra_form: state.extra_form,
-      }
-      console.log("data", data)
+      } */
 
       /* axios
         .post(`${DJANGO_API_BASE}feature_type/`, data)
@@ -122,9 +121,9 @@ const feature = {
         .catch(() => {
           commit("SET_USER", false)
         }); */
-    },
-    DELETE_FEATURE({ state }, feature_slug) {
-      console.log("Deleting feature:", feature_slug, state)
+   // },
+    //DELETE_FEATURE({ state }, feature_slug) {
+      //console.log("Deleting feature:", feature_slug, state)
 
       /* axios
         .post(`${DJANGO_API_BASE}feature_type/`, data)
@@ -137,9 +136,9 @@ const feature = {
         .catch(() => {
           commit("SET_USER", false)
         }); */
-    },
-    POST_COMMENT({ state }, data) {
-      console.log("post comment", data, state)
+   // },
+   // POST_COMMENT({ state }, data) {
+      //console.log("post comment", data, state)
 
       /* axios
         .post(`${DJANGO_API_BASE}feature_type/`, data)
@@ -152,10 +151,10 @@ const feature = {
         .catch(() => {
           commit("SET_USER", false)
         }); */
-    },
-    EXPORT_FEATURES({ state }) {
-      console.log("Export features", state.features)
-    }
+   // },
+   // EXPORT_FEATURES({ /* state */ }) {
+      //console.log("Export features", state.features)
+   // }
   },
 
 }
diff --git a/src/store/modules/feature_type.js b/src/store/modules/feature_type.js
index fc4bcc2e..1dbc6ee5 100644
--- a/src/store/modules/feature_type.js
+++ b/src/store/modules/feature_type.js
@@ -87,8 +87,8 @@ const feature_type = {
           const status = response.status;
           return { feature_type_slug, status };
         })
-        .catch((error) => {
-          console.error(error);
+        .catch((/* error */) => {
+          //console.error(error);
         });
     },
 
@@ -109,16 +109,15 @@ const feature_type = {
             },
           })
           .then((response) => {
-            console.log(response)
             if (response.status === 200) {
               dispatch("GET_IMPORTS", feature_type_slug);
               // TODO : RELOAD DERNIER SIGNALEMENTS
             }
             return response
           })
-          .catch((err) => {
+          .catch((/* err */) => {
             // TODO : HANDLER ERROR
-            console.log(err);
+            //console.log(err);
           });
       }
     },
@@ -133,8 +132,8 @@ const feature_type = {
         .then((response) => {
           commit("SET_IMPORT_FEATURE_TYPES_DATA", response.data);
         })
-        .catch((err) => {
-          console.log(err);
+        .catch((/* err */) => {
+          //console.log(err);
         });
     }
   }
diff --git a/src/store/modules/map.js b/src/store/modules/map.js
index 624633bc..470e3b63 100644
--- a/src/store/modules/map.js
+++ b/src/store/modules/map.js
@@ -1,3 +1,4 @@
+import flip from "@turf/flip";
 import { mapUtil } from "@/assets/js/map-util.js";
 
 
@@ -167,7 +168,7 @@ const map = {
     ADD_FEATURES({ rootState }, features) {
       const featuresToAdd = features || rootState.feature.features
       const featureGroup = mapUtil.addFeatures(featuresToAdd.map(el => {
-        const geometry = el.geom; // * map features as geojson
+        const geometry = flip(el.geom); // * map features as geoJSON format and flip coordinates for leaflet
         const properties = { ...el }
         return { geometry, properties }
       }));
@@ -176,11 +177,11 @@ const map = {
       }
     },
 
-    SAVE_BASEMAPS({ state }) {
-      const data = JSON.stringify(state.basemaps);
-      console.log("SAVE_BASEMAPS", data);
+    //SAVE_BASEMAPS({ state }) {
+      // const data = JSON.stringify(state.basemaps);
+      // console.log("SAVE_BASEMAPS", data);
       // todo : call axios POST
-    }
+    //}
   }
 }
 export default map
\ No newline at end of file
diff --git a/src/views/Index.vue b/src/views/Index.vue
index f7cd1ed8..cc0407f2 100644
--- a/src/views/Index.vue
+++ b/src/views/Index.vue
@@ -117,5 +117,10 @@ export default {
     APPLICATION_NAME: () => process.env.VUE_APP_APPLICATION_NAME,
     APPLICATION_ABSTRACT: () => process.env.VUE_APP_APPLICATION_ABSTRACT,
   },
+  created() {
+    if (this.$store.getters.project) {
+      this.$store.commit("SET_PROJECT_SLUG", null);
+    }
+  },
 };
 </script>
\ No newline at end of file
diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue
index 0310176f..737e474c 100644
--- a/src/views/feature/Feature_detail.vue
+++ b/src/views/feature/Feature_detail.vue
@@ -4,7 +4,7 @@
       <div class="fourteen wide column">
         <h1 class="ui header">
           <div class="content">
-            {{ feature.title }}
+            {{ feature.title || feature.feature_id }}
             <div class="ui icon right floated compact buttons">
               <!-- {% if permissions|lookup:'can_create_feature' %} -->
               <router-link
@@ -489,13 +489,13 @@ export default {
 
   methods: {
     postComment() {
-      const data = {
+      /* const data = {
         comment: this.comment_form.comment.value,
         title: this.comment_form.title.value,
         attachment_file: this.comment_form.attachment_file.value,
-      };
+      }; */
       this.$store.dispatch("feature/POST_COMMENT");
-      console.log("POST comment", data);
+      //console.log("POST comment", data);
     },
     getAttachmentFileData(evt) {
       const input = evt.target.value;
@@ -515,7 +515,6 @@ export default {
   },
 
   created() {
-    console.log;
     if (!this.project) {
       this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
     }
diff --git a/src/views/feature/Feature_edit.vue b/src/views/feature/Feature_edit.vue
index a3e304e6..1e08e841 100644
--- a/src/views/feature/Feature_edit.vue
+++ b/src/views/feature/Feature_edit.vue
@@ -4,7 +4,7 @@
       <h1
         v-if="feature && $router.history.current.name === 'editer-signalement'"
       >
-        Mise à jour du signalement "{{ feature.title }}"
+        Mise à jour du signalement "{{ feature.title || feature.feature_id }}"
       </h1>
       <h1
         v-else-if="
@@ -309,15 +309,10 @@ export default {
         this.updateStore();
       },
     },
-    extra_form_with_values: {
-      get() {
-        return this.extra_form.map((el) => {
-          return { ...el, value: el.value ? el.value : null };
-        });
-      },
-      set(newValue) {
-        console.log(newValue);
-      },
+    extra_form_with_values: function () {
+      return this.extra_form.map((el) => {
+        return { ...el, value: el.value ? el.value : null };
+      });
     },
     selected_extra_form_list: {
       get() {
diff --git a/src/views/feature/Feature_list.vue b/src/views/feature/Feature_list.vue
index fcd009ba..fcaadc5f 100644
--- a/src/views/feature/Feature_list.vue
+++ b/src/views/feature/Feature_list.vue
@@ -139,7 +139,7 @@
         <tbody>
           <tr
             v-for="(feature, index) in filteredFeatures"
-            :key="feature.title + index"
+            :key="feature.feature_id + index"
           >
             <td class="dt-center" :data-order="feature.get_status_display">
               <div v-if="feature.status == 'archived'" data-tooltip="Archivé">
diff --git a/src/views/feature_type/Feature_type_detail.vue b/src/views/feature_type/Feature_type_detail.vue
index a24fff4d..ce8b1a2c 100644
--- a/src/views/feature_type/Feature_type_detail.vue
+++ b/src/views/feature_type/Feature_type_detail.vue
@@ -120,7 +120,7 @@
       <h3 class="ui header">Derniers signalements</h3>
       <div
         v-for="(feature, index) in features"
-        :key="feature.title + index"
+        :key="feature.feature_id + index"
         class="ui small header"
       >
         <span v-if="feature.status == 'archived'" data-tooltip="Archivé">
@@ -148,7 +148,7 @@
             },
           }"
         >
-          {{ feature.title }}
+          {{ feature.title || feature.feature_id }}
         </router-link>
         <div class="sub header">
           <div>
@@ -248,7 +248,6 @@ export default {
       });
     },
     exportFeatures() {
-      console.log("TEST", this.$store);
       this.$store.dispatch(
         "feature/EXPORT_FEATURES",
         this.$route.params.slug_type_signal
diff --git a/src/views/feature_type/Feature_type_edit.vue b/src/views/feature_type/Feature_type_edit.vue
index 0f0050f4..bacb8919 100644
--- a/src/views/feature_type/Feature_type_edit.vue
+++ b/src/views/feature_type/Feature_type_edit.vue
@@ -346,7 +346,6 @@ export default {
         this.$store
           .dispatch("feature_type/POST_FEATURE_TYPE")
           .then(({ status }) => {
-            console.log(status);
             if (status === 201) {
               this.goBackToProject();
             } else {
diff --git a/src/views/project/Project_detail.vue b/src/views/project/Project_detail.vue
index e50497d7..5401956e 100644
--- a/src/views/project/Project_detail.vue
+++ b/src/views/project/Project_detail.vue
@@ -535,7 +535,7 @@ export default {
       }
     },
     subsribeProject() {
-      console.log("Subsribe to project");
+      //console.log("Subsribe to project");
     },
   },
 
diff --git a/src/views/project/Project_edit.vue b/src/views/project/Project_edit.vue
index 0d512063..9e281886 100644
--- a/src/views/project/Project_edit.vue
+++ b/src/views/project/Project_edit.vue
@@ -209,15 +209,6 @@ export default {
   computed: {
     ...mapGetters(["project"]),
   },
-  /* 
-  watch: {
-    project(newValue, oldValue) {
-      console.log("watch", newValue);
-      if (oldValue !== newValue) {
-        this.form = newValue;
-      }
-    },
-  }, */
 
   methods: {
     definePageType() {
@@ -265,8 +256,8 @@ export default {
     },
 
     postForm() {
-      const data = JSON.stringify(this.project);
-      console.log("POST this data : ", data);
+      /* const data = JSON.stringify(this.project);
+      console.log("POST this data : ", data); */
     },
   },
   created() {
diff --git a/src/views/project/Project_members.vue b/src/views/project/Project_members.vue
index bd7e6f7b..0ed6f03c 100644
--- a/src/views/project/Project_members.vue
+++ b/src/views/project/Project_members.vue
@@ -86,11 +86,11 @@ export default {
   },
   methods: {
     validateMembers() {
-      const data = {
-        slug: this.project.slug,
-        data: this.projectMembers,
-      };
-      console.log("validateMembers", data);
+      // const data = {
+      //   slug: this.project.slug,
+      //   data: this.projectMembers,
+      // };
+      // console.log("validateMembers", data);
       /* axios
         .post(`${DJANGO_API_BASE}projet/${payload.slug}/utilisateurs/`, payload.data)
         .then((response) => {
-- 
GitLab