From 286647b4fd2a17c28a337829fd1e9f7b9d416153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Fri, 19 Nov 2021 15:45:26 +0100 Subject: [PATCH] remove classic features from feature_list --- src/assets/js/map-util.js | 2 -- src/store/index.js | 8 ++++++-- src/views/feature/Feature_list.vue | 6 ++---- src/views/project/Project_edit.vue | 23 +++++++++++++---------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index 9e2ce68c..3d948ff9 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -312,9 +312,7 @@ const mapUtil = { if(colorValue) { color=colorValue; } - } - console.log(featureType); let hiddenStyle=({ radius: 0, fillOpacity: 0.5, diff --git a/src/store/index.js b/src/store/index.js index 6f543f6d..eea20cf3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -274,13 +274,17 @@ export default new Vuex.Store({ }); }, - async GET_PROJECT_INFO({ state, commit, dispatch }, slug) { + async GET_PROJECT_INFO({ state, commit, dispatch }, slug, noFeatures) { commit("SET_PROJECT_SLUG", slug); let promises = [ dispatch("GET_PROJECT_LAST_MESSAGES", slug).then(response => response), dispatch("feature_type/GET_PROJECT_FEATURE_TYPES", slug).then(response => response), - dispatch("feature/GET_PROJECT_FEATURES", slug).then(response => response), ] + console.log(noFeatures) + if (!noFeatures) { + promises.push(dispatch("feature/GET_PROJECT_FEATURES", slug).then(response => response)) + } + console.log(promises) if (state.user) promises.push(dispatch("map/GET_BASEMAPS", slug).then(response => response)) const promiseResult = await Promise.all(promises) diff --git a/src/views/feature/Feature_list.vue b/src/views/feature/Feature_list.vue index ebf02bfd..6190906d 100644 --- a/src/views/feature/Feature_list.vue +++ b/src/views/feature/Feature_list.vue @@ -249,7 +249,7 @@ export default { computed: { ...mapGetters(["project", "permissions"]), ...mapState(["user"]), - ...mapState("feature", ["features", "checkedFeatures"]), + ...mapState("feature", ["checkedFeatures"]), ...mapState("feature_type", ["feature_types"]), baseMaps() { @@ -264,7 +264,6 @@ export default { ); } if (this.form.status.selected.value) { - console.log("filter by" + this.form.status.selected.value); results = results.filter( (el) => el.properties.status.value === this.form.status.selected.value ); @@ -355,7 +354,6 @@ export default { }, initMap() { - console.log(this); this.zoom = this.$route.query.zoom || ""; this.lat = this.$route.query.lat || ""; this.lng = this.$route.query.lng || ""; @@ -454,7 +452,7 @@ export default { created() { if (!this.project) { //this.$store.dispatch("GET_PROJECT_MESSAGES", this.$route.params.slug); - this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug); + this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug, "noFeatures"); } }, diff --git a/src/views/project/Project_edit.vue b/src/views/project/Project_edit.vue index 70862005..8076625e 100644 --- a/src/views/project/Project_edit.vue +++ b/src/views/project/Project_edit.vue @@ -459,14 +459,7 @@ export default { }); } }, - }, - - created() { - this.definePageType(); - console.log(this.action); - if (this.action === "create") { - this.thumbnailFileSrc = require("@/assets/img/default.png"); - } else if (this.action === "edit" || this.action === "create_from") { + fillProjectForm() { if (!this.project) { this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug); } @@ -481,18 +474,28 @@ export default { this.form.is_project_type = false; } //* transform string values to objects for dropdowns display (could be in a computed) + this.form.access_level_pub_feature = { name: this.project.access_level_pub_feature, value: this.levelPermissions.find( - (el) => (el.name === this.project.access_level_pub_feature) + (el) => el.name === this.project.access_level_pub_feature ).value, }; this.form.access_level_arch_feature = { name: this.project.access_level_arch_feature, value: this.levelPermissions.find( - (el) => (el.name === this.project.access_level_arch_feature) + (el) => el.name === this.project.access_level_arch_feature ).value, }; + }, + }, + + created() { + this.definePageType(); + if (this.action === "create") { + this.thumbnailFileSrc = require("@/assets/img/default.png"); + } else if (this.action === "edit" || this.action === "create_from") { + this.fillProjectForm(); } }, }; -- GitLab