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

add loader inside App for project members and adapt to feature list

parent 579e06e6
No related branches found
No related tags found
No related merge requests found
...@@ -151,6 +151,11 @@ ...@@ -151,6 +151,11 @@
</div> </div>
</div> </div>
</div> </div>
<div :class="{ active: loader.isLoading }" class="ui inverted dimmer">
<div class="ui text loader">
{{ loader.message }}
</div>
</div>
<router-view /> <router-view />
<!-- //* Les views sont injectées ici --> <!-- //* Les views sont injectées ici -->
</div> </div>
...@@ -194,6 +199,7 @@ export default { ...@@ -194,6 +199,7 @@ export default {
"USER_LEVEL_PROJECTS", "USER_LEVEL_PROJECTS",
"configuration", "configuration",
"messages", "messages",
"loader",
]), ]),
...mapGetters(["project"]), ...mapGetters(["project"]),
APPLICATION_NAME: function () { APPLICATION_NAME: function () {
...@@ -256,6 +262,11 @@ body { ...@@ -256,6 +262,11 @@ body {
flex-direction: column; flex-direction: column;
} }
/* to display loader between header and footer */
main {
position: relative;
}
footer { footer {
margin-top: auto; margin-top: auto;
} }
...@@ -269,28 +280,32 @@ footer { ...@@ -269,28 +280,32 @@ footer {
background: white !important; background: white !important;
} }
.flex {
display: flex;
}
/* keep above loader */
#menu-dropdown {
z-index: 1001;
}
@media screen and (min-width: 560px) { @media screen and (min-width: 560px) {
.mobile { .mobile {
display: none !important; display: none !important;
} }
.header-menu { .header-menu {
min-width: 560px; min-width: 560px;
} }
.menu.container { .menu.container {
width: auto !important; width: auto !important;
margin-left: 1em !important; margin-left: 1em !important;
margin-right: 1em !important; margin-right: 1em !important;
} }
.push-right-desktop { .push-right-desktop {
margin-left: auto; margin-left: auto;
} }
} }
.flex {
display: flex;
}
@media screen and (max-width: 560px) { @media screen and (max-width: 560px) {
.desktop { .desktop {
display: none !important; display: none !important;
......
...@@ -48,12 +48,11 @@ export default new Vuex.Store({ ...@@ -48,12 +48,11 @@ export default new Vuex.Store({
USER_LEVEL_PROJECTS: null, USER_LEVEL_PROJECTS: null,
user_permissions: null, user_permissions: null,
messages: [], messages: [],
events: null events: null,
// events: { loader: {
// 'events': null, isLoading: false,
// 'features': null, message: "En cours de chargement"
// 'comments': null },
// }
}, },
mutations: { mutations: {
...@@ -108,7 +107,16 @@ export default new Vuex.Store({ ...@@ -108,7 +107,16 @@ export default new Vuex.Store({
}, },
CLEAR_MESSAGES(state) { CLEAR_MESSAGES(state) {
state.messages = []; state.messages = [];
} },
DISPLAY_LOADER(state, message) {
state.loader = { isLoading: true, message }
},
DISCARD_LOADER(state) {
state.loader = {
isLoading: false,
message: "En cours de chargement"
};
},
}, },
getters: { getters: {
......
<template> <template>
<div class="fourteen wide column"> <div class="fourteen wide column">
<div class="ui dimmer" :class="[{ active: featureLoading }]"></div>
<script <script
type="application/javascript" type="application/javascript"
:src=" :src="
...@@ -233,7 +232,6 @@ export default { ...@@ -233,7 +232,6 @@ export default {
}, },
geojsonFeatures: [], geojsonFeatures: [],
featureLoading: false,
filterStatus: null, filterStatus: null,
filterType: null, filterType: null,
baseUrl: this.$store.state.configuration.BASE_URL, baseUrl: this.$store.state.configuration.BASE_URL,
...@@ -369,15 +367,18 @@ export default { ...@@ -369,15 +367,18 @@ export default {
this.loadFeatures(this.$store.state.map.geojsonFeatures); this.loadFeatures(this.$store.state.map.geojsonFeatures);
} else { } else {
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`; const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`;
this.featureLoading = true; this.$store.commit(
"DISPLAY_LOADER",
"Récupération des signalements en cours..."
);
axios axios
.get(url) .get(url)
.then((response) => { .then((response) => {
this.loadFeatures(response.data.features); this.loadFeatures(response.data.features);
this.featureLoading = false; this.$store.commit("DISCARD_LOADER");
}) })
.catch((error) => { .catch((error) => {
this.featureLoading = false; this.$store.commit("DISCARD_LOADER");
throw error; throw error;
}); });
} }
...@@ -429,6 +430,11 @@ export default { ...@@ -429,6 +430,11 @@ export default {
mounted() { mounted() {
this.initMap(); this.initMap();
}, },
destroyed() {
//* allow user to change page if ever stuck on loader
this.$store.commit("DISCARD_LOADER");
},
}; };
</script> </script>
......
...@@ -132,7 +132,12 @@ export default { ...@@ -132,7 +132,12 @@ export default {
}, },
async populateMembers() { async populateMembers() {
this.$store.commit(
"DISPLAY_LOADER",
"Récupération des membres en cours..."
);
await this.fetchMembers().then((members) => { await this.fetchMembers().then((members) => {
this.$store.commit("DISCARD_LOADER");
this.projectMembers = members.map((el) => { this.projectMembers = members.map((el) => {
return { return {
userLevel: { name: el.level.display, value: el.level.codename }, userLevel: { name: el.level.display, value: el.level.codename },
...@@ -149,5 +154,10 @@ export default { ...@@ -149,5 +154,10 @@ export default {
} }
this.populateMembers(); this.populateMembers();
}, },
destroyed() {
//* allow user to change page if ever stuck on loader
this.$store.commit("DISCARD_LOADER");
},
}; };
</script> </script>
\ 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