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

add sorting function

parent c8537f08
1 merge request!122REDMINE_ISSUE-10911
......@@ -123,6 +123,8 @@ export default {
value: "contributor",
},
},
isSortedByName: false,
isSortedByStatus: false,
};
},
......@@ -147,9 +149,21 @@ export default {
},
projectMembers() {
return this.projectUsers.filter(
(el) => el.userLevel.value !== "logged_user"
);
return this.projectUsers
.filter((el) => el.userLevel.value !== "logged_user")
.sort((a, b) => {
if (this.isSortedByName) {
const textA = a.user.username.toUpperCase();
const textB = b.user.username.toUpperCase();
return textA < textB ? -1 : textA > textB ? 1 : 0;
} else if (this.isSortedByStatus) {
const textA = a.userLevel.name.toUpperCase();
const textB = b.userLevel.name.toUpperCase();
return textA < textB ? -1 : textA > textB ? 1 : 0;
} else {
return 0;
}
});
},
},
......@@ -195,7 +209,8 @@ export default {
});
},
fetchMembers() { // todo: move function to a service
fetchMembers() {
// todo: move function to a service
return axios
.get(
`${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/utilisateurs`
......
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