Skip to content

Commit 9386daf

Browse files
authored
fix(core): display user primary body on list view (#2318)
* fix(core): display user primary body on list view Fixes #2679 * fix(core): correctly reference primary body column for backend sorting Also fixes ongoing issue with sorting and pagination * chore(core): remove sorting on primary body column
1 parent 4f2519a commit 9386daf

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/views/core/members/List.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
{{ props.row.date_of_birth }}
4040
</b-table-column>
4141

42-
<b-table-column field="address" label="Address" v-slot="props">
43-
{{ props.row.address }}
42+
<b-table-column field="primary_body_id" label="Primary body" v-slot="props">
43+
<span v-if="props.row.primary_body_id">{{ bodyMapping[props.row.primary_body_id] }}</span>
44+
<span v-else><i>Not set.</i></span>
4445
</b-table-column>
4546

4647
<b-table-column field="about_me" label="About me" v-slot="props">
@@ -68,6 +69,7 @@ export default {
6869
data () {
6970
return {
7071
users: [],
72+
bodyMapping: {},
7173
isLoading: false,
7274
query: '',
7375
limit: 30,
@@ -108,6 +110,7 @@ export default {
108110
onSort (field, order) {
109111
this.sortField = field
110112
this.sortOrder = order
113+
this.page = 0
111114
this.fetchData()
112115
},
113116
fetchData () {
@@ -132,7 +135,15 @@ export default {
132135
}
133136
},
134137
mounted () {
135-
this.fetchData()
138+
this.axios.get(this.services['core'] + '/bodies').then((response) => {
139+
const bodies = response.data.data
140+
this.bodyMapping = Object.fromEntries(
141+
bodies.map(({ id, name }) => [id, name])
142+
)
143+
this.fetchData()
144+
}).catch((err) => {
145+
this.$root.showError('Could not fetch bodies list', err)
146+
})
136147
}
137148
}
138149
</script>

0 commit comments

Comments
 (0)