refactor(frontend, server): backport stream admin route handling solution to user admin

This commit is contained in:
Gergő Jedlicska
2021-11-23 14:55:21 +01:00
parent a1e2af7bc8
commit aedf54deb4
2 changed files with 19 additions and 12 deletions
@@ -141,8 +141,8 @@ export default {
items: [],
totalCount: 0
},
currentPage: 1,
searchQuery: null,
// currentPage: 1,
// searchQuery: null,
showConfirmDialog: false,
showDeleteDialog: false,
manipulatedUser: null,
@@ -153,6 +153,22 @@ export default {
queryLimit() {
return parseInt(this.limit)
},
currentPage: {
get() {
return parseInt(this.page)
},
set(newPage) {
this.paginateNext(newPage)
}
},
searchQuery: {
get() {
return this.q
},
set: debounce(function (q) {
this.applySearch(q)
}, 500)
},
queryOffset() {
return (this.page - 1) * this.queryLimit
},
@@ -167,21 +183,12 @@ export default {
return roleItems
}
},
watch: {
currentPage: function (newPage) {
this.paginateNext(newPage)
},
searchQuery: debounce(function (newQuery) {
this.applySearch(newQuery)
}, 1000)
},
methods: {
initiateDeleteUser(user) {
this.showDeleteDialog = true
this.manipulatedUser = user
},
async deleteUser(user) {
console.log('deleting', user.email)
await this.$apollo.mutate({
mutation: gql`
mutation($userEmail: String!) {
@@ -7,7 +7,7 @@ extend type Query {
"""
Get users from the server in a paginated view. The query search for matches in name, company and email.
"""
users(limit: Int!=25, offset: Int!=0, query: String=null) : UserCollection
users(limit: Int! = 25, offset: Int! = 0, query: String=null) : UserCollection
userSearch(
query: String!
limit: Int! = 25