diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index d8b6c6008882f6878d8be14e8e2dfd60cfc4845e..59eeaf4fa07d9e580d1e511f237ac29a56ee43b0 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -143,9 +143,7 @@ L.TileLayer.BetterWMS = L.TileLayer.WMS.extend({ .setLatLng(latlng) .setContent(content) .openOn(this._map); - } /* else { - console.log('Pas de features trouvées pour cette couche'); - } */ + } } } @@ -359,7 +357,6 @@ const mapUtil = { } }); layerMVT.on('click', (e) => { // The .on method attaches an event handler - console.log("e", e); const popupContent = this._createContentPopup(e.layer, featureTypes, project_slug); L.popup() .setContent(popupContent) diff --git a/src/components/project/project_mapping_basemap.vue b/src/components/project/project_mapping_basemap.vue index 99fb2a408625294a27b56e5e1c3a3524b0ae66e4..34399ea8a969706a4f84714d76b0ceb67bc6e3ef 100644 --- a/src/components/project/project_mapping_basemap.vue +++ b/src/components/project/project_mapping_basemap.vue @@ -135,8 +135,7 @@ export default { //* drag & drop *// - onlayerMove(event) { - console.log(event); + onlayerMove() { //* Get the names of the current layers in order. const currentLayersNamesInOrder = Array.from( document.getElementsByClassName("layer-item") diff --git a/src/main.js b/src/main.js index 87be60e859f1e0bd80fc3ea91ea87260740da337..3ff59325ded1f4dff75020ca8abb256e0edcdd0b 100644 --- a/src/main.js +++ b/src/main.js @@ -67,7 +67,7 @@ let onConfigLoaded = function(config){ axios.get("./config/config.json") .catch((error)=>{ - console.log(error); + console.error(error); console.log("try to get From Localstorage"); let conf=localStorage.getItem("geontrib_conf"); if(conf){ diff --git a/src/store/modules/feature.js b/src/store/modules/feature.js index 7d42ef515fa16c814ea1aede68311d54b46ff486..2d8925884ff4f4c0f77f62151833126f6487b10e 100644 --- a/src/store/modules/feature.js +++ b/src/store/modules/feature.js @@ -105,7 +105,7 @@ const feature = { getters: { }, actions: { - GET_PROJECT_FEATURES({ commit, rootState }, { project_slug, feature_type__slug, ordering, search, limit }) { + GET_PROJECT_FEATURES({ commit, rootState }, { project_slug, feature_type__slug, ordering, search, limit, geojson = false }) { if (rootState.cancellableSearchRequest.length > 0) { const currentRequestCancelToken = rootState.cancellableSearchRequest[rootState.cancellableSearchRequest.length - 1]; @@ -129,7 +129,7 @@ const feature = { if (limit) { url = url.concat('', `${url.includes('?') ? '&' : '?'}limit=${limit}`); } - url = url.concat('', '&output=geojson'); + if (geojson) url = url.concat('', '&output=geojson'); return axios .get(url, { cancelToken: cancelToken.token }) .then((response) => { diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue index f14f24213bdcbb6724d3199aa492664df66e6f0c..1203b2652d9c91605698d6ffcfba74894a23a46a 100644 --- a/src/views/feature/Feature_detail.vue +++ b/src/views/feature/Feature_detail.vue @@ -347,7 +347,7 @@ <script> import frag from "vue-frag"; -import { mapGetters, mapState } from "vuex"; +import { mapGetters, mapState, mapActions } from "vuex"; import { mapUtil } from "@/assets/js/map-util.js"; import featureAPI from "@/services/feature-api"; import axios from '@/axios-client.js'; @@ -381,9 +381,18 @@ export default { }, computed: { - ...mapState(["user", "USER_LEVEL_PROJECTS"]), - ...mapGetters(["permissions", "project"]), - ...mapState("feature", ["linked_features", "statusChoices"]), + ...mapState([ + 'user', + 'USER_LEVEL_PROJECTS' + ]), + ...mapGetters([ + 'permissions', + 'project' + ]), + ...mapState('feature', [ + 'linked_features', + 'statusChoices' + ]), DJANGO_BASE_URL() { return this.$store.state.configuration.VUE_APP_DJANGO_BASE; }, @@ -438,6 +447,9 @@ export default { }, methods: { + ...mapActions('feature', [ + 'GET_PROJECT_FEATURES' + ]), isOffline() { return navigator.onLine == false; }, @@ -562,12 +574,9 @@ export default { .dispatch("feature/DELETE_FEATURE", this.feature.feature_id) .then((response) => { if (response.status === 204) { - this.$store.dispatch( - "feature/GET_PROJECT_FEATURES", - { - project_slug: this.$route.params.slug - } - ); + this.GET_PROJECT_FEATURES({ + project_slug: this.$route.params.slug + }); this.goBackToProject(); } }); diff --git a/src/views/feature/Feature_edit.vue b/src/views/feature/Feature_edit.vue index 62230a8ad09640c59bce137bb9c811e6f2ce1469..1b8a9f1ffddf514d68f28c54af9f70fcaf25b664 100644 --- a/src/views/feature/Feature_edit.vue +++ b/src/views/feature/Feature_edit.vue @@ -501,11 +501,9 @@ export default { }, georeferencement() { - console.log("georeferencement"); const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}exif-geom-reader/`; let formData = new FormData(); formData.append("image_file", this.file); - console.log(">> formData >> ", formData); axios .post(url, formData, { headers: { @@ -513,7 +511,6 @@ export default { }, }) .then((response) => { - console.log("SUCCESS!!", response.data); if (response.data.geom.indexOf("POINT") >= 0) { let regexp = /POINT\s\((.*)\s(.*)\)/; let arr = regexp.exec(response.data.geom); @@ -886,7 +883,6 @@ export default { updateMap(geomFeatureJSON) { if (this.drawnItems) this.drawnItems.clearLayers(); - console.log("update map"); var geomType = this.feature_type.geom_type; if (geomFeatureJSON) { var geomJSON = flip(geomFeatureJSON.geometry); //turf.flip(geomFeatureJSON) @@ -937,7 +933,6 @@ export default { axios .get(url) .then((response) => { - console.log(response.data.features); const features = response.data.features; if (features) { const allFeaturesExceptCurrent = features.filter( diff --git a/src/views/feature/Feature_list.vue b/src/views/feature/Feature_list.vue index cdceee6da1d67c9929bd61db6ac3e6d0ce34bfb3..e72194a62133f38071157354004fc5d170ad3aa3 100644 --- a/src/views/feature/Feature_list.vue +++ b/src/views/feature/Feature_list.vue @@ -181,7 +181,7 @@ </template> <script> -import { mapGetters, mapState } from "vuex"; +import { mapGetters, mapState, mapActions } from "vuex"; import { mapUtil } from "@/assets/js/map-util.js"; import featureAPI from "@/services/feature-api"; import SidebarLayers from "@/components/map-layers/SidebarLayers"; @@ -328,6 +328,9 @@ export default { }, methods: { + ...mapActions('feature', [ + 'GET_PROJECT_FEATURES' + ]), modalAllDelete() { this.modalAllDeleteOpen = !this.modalAllDeleteOpen; }, @@ -338,10 +341,9 @@ export default { .delete(url, {}) .then(() => { if (!this.modalAllDeleteOpen) { - this.$store - .dispatch("feature/GET_PROJECT_FEATURES", { - project_slug: this.project.slug, - }) + this.GET_PROJECT_FEATURES({ + project_slug: this.project.slug, + }) .then(() => { this.fetchPagedFeatures(); this.getNloadGeojsonFeatures(); @@ -465,7 +467,6 @@ export default { url = newUrl; } const queryString = this.buildQueryString(); - console.log(queryString); url += queryString; this.$store.commit( diff --git a/src/views/feature_type/Feature_type_detail.vue b/src/views/feature_type/Feature_type_detail.vue index 07dbfc9c86a745b70a2737aefed54f505a5c0641..cf4ddc8f768ef7d5d7fa868f163da6c911eec6b5 100644 --- a/src/views/feature_type/Feature_type_detail.vue +++ b/src/views/feature_type/Feature_type_detail.vue @@ -222,7 +222,7 @@ </template> <script> -import { mapGetters, mapState } from "vuex"; +import { mapActions, mapMutations, mapGetters, mapState } from "vuex"; import ImportTask from "@/components/ImportTask"; import featureAPI from "@/services/feature-api"; @@ -256,9 +256,18 @@ export default { }, computed: { - ...mapGetters(["project", "permissions"]), - ...mapState("feature", ["features", "features_count"]), - ...mapState("feature_type", ["feature_types", "importFeatureTypeData"]), + ...mapGetters([ + 'project', + 'permissions' + ]), + ...mapState('feature', [ + 'features', + 'features_count' + ]), + ...mapState('feature_type', [ + 'feature_types', + 'importFeatureTypeData' + ]), structure: function () { if (Object.keys(this.feature_types).length) { let st = this.feature_types.find( @@ -293,7 +302,41 @@ export default { }, }, + watch:{ + structure(newValue){ + if (newValue.slug){ + this.GET_IMPORTS({ + feature_type: this.$route.params.feature_type_slug + }); + } + } + }, + + created() { + if (!this.project) { + this.GET_PROJECT_INFO(this.$route.params.slug); + } + this.setCurrentFeatureTypeSlug(); + // .then(res => resolve(res)) + // .catch(err => reject(err)); + this.SET_CURRENT_FEATURE_TYPE_SLUG( + this.$route.params.feature_type_slug + ); + }, + methods: { + ...mapMutations('feature_type', [ + 'SET_CURRENT_FEATURE_TYPE_SLUG' + ]), + ...mapActions([ + 'GET_PROJECT_INFO' + ]), + ...mapActions('feature_type', [ + 'GET_IMPORTS' + ]), + ...mapActions('feature', [ + 'GET_PROJECT_FEATURES' + ]), toggleShowImport() { this.showImport = !this.showImport; if (this.showImport) { @@ -409,39 +452,18 @@ export default { }, async setCurrentFeatureTypeSlug(){ const response = await - this.$store.dispatch('feature/GET_PROJECT_FEATURES', { + this.GET_PROJECT_FEATURES({ project_slug: this.$route.params.slug, feature_type__slug : this.$route.params.feature_type_slug, ordering: '-created_on', limit: '5' - }) + }); if (response){ this.featuresLoading = false; } } - }, - watch:{ - 'structure'(newValue){ - if (newValue.slug){ - this.$store.dispatch("feature_type/GET_IMPORTS", { - feature_type: this.$route.params.feature_type_slug - }); - } - } - }, - created() { - if (!this.project) { - this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug); - } - this.setCurrentFeatureTypeSlug(); - // .then(res => resolve(res)) - // .catch(err => reject(err)); - this.$store.commit( - "feature_type/SET_CURRENT_FEATURE_TYPE_SLUG", - this.$route.params.feature_type_slug - ); - }, + } }; </script> diff --git a/src/views/project/Project_detail.vue b/src/views/project/Project_detail.vue index f284036ef0bd1236bb247ab9a9d5429170fd316b..37f31fe7a38f5c67e0264c5d26229447e079c89f 100644 --- a/src/views/project/Project_detail.vue +++ b/src/views/project/Project_detail.vue @@ -958,7 +958,8 @@ export default { this.GET_PROJECT_FEATURES({ project_slug: this.slug, ordering: '-created_on', - limit: 5 + limit: 5, + geojson: true }) .then(() => { this.featuresLoading = false;