Skip to content
Snippets Groups Projects
Commit 37041c06 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

wip:changing routes params

parent 6b1cb363
No related branches found
No related tags found
4 merge requests!295Version 3.0.0,!247REDMINE_ISSUE-12787,!245REDMINE_ISSUE-12786,!233REDMINE_ISSUE-12378
......@@ -334,6 +334,7 @@ export default {
computed: {
...mapGetters(["project", "permissions"]),
...mapGetters("feature_type", ["feature_type"]),
paginatedRessources() {
return this.ressources.slice(this.pagination.start, this.pagination.end);
......@@ -383,16 +384,16 @@ export default {
}
},
toNewFeatureType() {
//this.featureTypeImporting = true;
redirect() {
const routerHistory = this.$router.history.router.options.routerHistory
const name = routerHistory[routerHistory.length - 1].name === "details-type-signalement" ? "details-type-signalement" : "ajouter-type-signalement"
this.$router.push({
name: "ajouter-type-signalement",
name,
params: {
geojson: this.geojson,
type: "external-geojson",
},
});
//this.featureTypeImporting = false;
},
launchImport() {
......@@ -400,13 +401,14 @@ export default {
const paramsTest = `user=${user}&TYPENAME=${this.selectedResource.layerName}`;
miscAPI.getExternalGeojson(paramsTest).then((data) => {
this.geojson = data;
console.log(this.geojson);
this.toNewFeatureType();
this.redirect();
});
},
},
created() {
console.log(this.$router)
console.log(this.$router.history.router.options.routerHistory[this.$router.history.router.options.routerHistory.length -1].name)
this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
},
};
......@@ -428,6 +430,7 @@ h1 {
}
.table > .row {
display: flex;
transition: background-color ease-out 0.2s;
}
.table > .row:not(:first-of-type).selected {
background-color: #8bddd9;
......
......@@ -85,13 +85,29 @@
id="json_file"
/>
</div>
<router-link
v-if="
permissions &&
permissions.can_create_feature
"
:to="{
name: 'catalog-import',
params: { slug: project.slug },
}"
class="ui icon button import-catalog"
>Créer un nouveau type de signalement à partir du catalogue Datasud
</router-link>
<div v-if="$route.params.geojson" class="ui button import-catalog">
Ressource {{$route.params.geojson.name}}
</div>
<ul v-if="importError" class="errorlist">
<li>
{{ importError }}
</li>
</ul>
<button
:disabled="fileToImport.size === 0"
:disabled="fileToImport.size === 0 && !$route.params.geojson"
@click="importGeoJson"
class="ui fluid teal icon button"
>
......@@ -234,6 +250,8 @@ export default {
ImportTask: ImportTask,
},
props: ["geojson", "typename", ],
data() {
return {
importError: "",
......@@ -322,6 +340,11 @@ export default {
this.SET_CURRENT_FEATURE_TYPE_SLUG(
this.$route.params.feature_type_slug
);
console.log(this.$route.params)
console.log(this.$route.params.type)
if (this.$route.params.type === "external-geojson") {
this.showImport = true;
}
},
methods: {
......@@ -431,11 +454,16 @@ export default {
},
importGeoJson() {
this.$store.dispatch('feature_type/SEND_FEATURES_FROM_GEOJSON', {
slug: this.$route.params.slug,
feature_type_slug: this.$route.params.feature_type_slug,
fileToImport: this.fileToImport,
});
let payload = {
slug: this.$route.params.slug,
feature_type_slug: this.$route.params.feature_type_slug,
}
if (this.$route.params.geojson) {
payload["geojson"] = this.$route.params.geojson
} else {
payload["fileToImport"] = this.fileToImport;
}
this.$store.dispatch('feature_type/SEND_FEATURES_FROM_GEOJSON', payload);
},
exportFeatures() {
......@@ -459,8 +487,6 @@ export default {
limit: '5'
});
console.log("response", response)
if (response){
this.featuresLoading = false;
}
......@@ -473,4 +499,8 @@ export default {
.margin-25 {
margin: 0 0.25em 0.25em 0 !important;
}
.import-catalog {
margin-bottom: 1em;
}
</style>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment