Allow filtering by all member statuses in member list view
This commit is contained in:
@@ -11,12 +11,14 @@ const search = (query, members) => {
|
||||
}
|
||||
}
|
||||
|
||||
const filterByStatus = (status, members) => {
|
||||
const filterByStatus = (status, statusesByDisplayName, members) => {
|
||||
const getStatusFromDisplayName = (_status) => statusesByDisplayName[_status].name
|
||||
|
||||
if (status === '' || status === 'all') {
|
||||
return members
|
||||
} else {
|
||||
return members.filter(
|
||||
(member) => member.status.toLowerCase() === status
|
||||
(member) => getStatusFromDisplayName(member.status) === status
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -52,6 +54,7 @@ export default {
|
||||
props: {
|
||||
members: Array,
|
||||
role_choices: Array,
|
||||
status_choices: Array,
|
||||
},
|
||||
|
||||
data: function () {
|
||||
@@ -90,6 +93,7 @@ export default {
|
||||
return {
|
||||
searchValue: '',
|
||||
status: '',
|
||||
statusesByDisplayName: indexBy(prop('display_name'), this.status_choices),
|
||||
role: '',
|
||||
rolesByDisplayName: indexBy(prop('display_name'), this.role_choices),
|
||||
sortInfo: {
|
||||
@@ -104,7 +108,7 @@ export default {
|
||||
searchedList: function () {
|
||||
return pipe(
|
||||
partial(search, [this.searchValue]),
|
||||
partial(filterByStatus, [this.status]),
|
||||
partial(filterByStatus, [this.status, this.statusesByDisplayName]),
|
||||
partial(filterByRole, [this.role, this.rolesByDisplayName]),
|
||||
partial(sort, [this.sortInfo])
|
||||
)(this.members)
|
||||
|
Reference in New Issue
Block a user