diff --git a/server/src/resolvers/Query/wifiUsers.js b/server/src/resolvers/Query/wifiUsers.js
index 56db13a..5d95cae 100644
--- a/server/src/resolvers/Query/wifiUsers.js
+++ b/server/src/resolvers/Query/wifiUsers.js
@@ -1,46 +1,53 @@
import prisma from '../../prisma'
// TODO: Add filtering
-export async function wifiUsers(parent, { take = 100, skip = 0, search }) {
+export async function wifiUsers(parent, { take = 10, skip = 0, search }) {
const mode = 'insensitive'
if (search === null)
search = undefined
- return prisma.user.findMany({
- where: {
- AND: [
- { wifiDevices: { some: { id: { not: undefined } } } },
- {
- OR: [
- { wifiDevices: { some: { hostname: { contains: search, mode } } } },
- {
- wifiDevices: {
- some: {
- accessPoint: {
- OR: [
- { name: { contains: search, mode } },
- { local: { contains: search, mode } },
- ]
- }
+ const where = {
+ AND: [
+ { wifiDevices: { some: { id: { not: undefined } } } },
+ {
+ OR: [
+ { wifiDevices: { some: { hostname: { contains: search, mode } } } },
+ {
+ wifiDevices: {
+ some: {
+ accessPoint: {
+ OR: [
+ { name: { contains: search, mode } },
+ { local: { contains: search, mode } },
+ ]
}
}
- },
- { wifiDevices: { some: { mac: { contains: search, mode } } } },
- { wifiDevices: { some: { ip: { contains: search, mode } } } },
- { displayName: { contains: search, mode } }, ,
- { sAMAccountName: { contains: search, mode } },
- ]
- }
- ]
- },
- include: {
- wifiDevices: true
- },
- orderBy: [
- { wifiDevices: { _count: 'desc' } },
- { displayName: 'asc' }],
- take,
- skip
- })
+ }
+ },
+ { wifiDevices: { some: { mac: { contains: search, mode } } } },
+ { wifiDevices: { some: { ip: { contains: search, mode } } } },
+ { displayName: { contains: search, mode } }, ,
+ { sAMAccountName: { contains: search, mode } },
+ ]
+ }
+ ]
+ }
+
+ return {
+ data:
+ prisma.user.findMany({
+ where,
+ include: {
+ wifiDevices: true
+ },
+ orderBy: [
+ { wifiDevices: { _count: 'desc' } },
+ { displayName: 'asc' }],
+ take,
+ skip
+ }),
+
+ total: prisma.user.count({ where })
+ }
}
diff --git a/server/src/typeDefs.js b/server/src/typeDefs.js
index 6b10773..468de52 100644
--- a/server/src/typeDefs.js
+++ b/server/src/typeDefs.js
@@ -42,7 +42,7 @@ const typeDefs = gql`
wifiUsers(
search: String = ""
take: Int
- skip: Int): [User]! @auth(roles: ["superAdmin"])
+ skip: Int): WifiUsersResult! @auth(roles: ["superAdmin"])
"Application Logs"
logs(
@@ -243,12 +243,6 @@ const typeDefs = gql`
usage: Int
}
- "A WiFi Device Search result"
- type WifiDevicesResult {
- data: [WifiDevice!]!
- total: Int!
- }
-
"A user that is on the Wi-Fi network reach"
type UserPresence {
id: ID!
@@ -327,6 +321,18 @@ const typeDefs = gql`
wifiDevices: [WifiDevice]
}
+ "A WiFi Device Search result"
+ type WifiDevicesResult {
+ data: [WifiDevice!]!
+ total: Int!
+ }
+
+ "A WiFi User Search result"
+ type WifiUsersResult {
+ data: [User!]!
+ total: Int!
+ }
+
"Subnet information"
type SubnetInfo {
shortName: String!
diff --git a/web/src/components/DataTables/UserWifiDevicesDataTable.vue b/web/src/components/DataTables/UserWifiDevicesDataTable.vue
index a5af963..56abcbc 100644
--- a/web/src/components/DataTables/UserWifiDevicesDataTable.vue
+++ b/web/src/components/DataTables/UserWifiDevicesDataTable.vue
@@ -108,4 +108,8 @@ export default {
}
-
+
diff --git a/web/src/components/DataTables/WifiDevicesDataTable.vue b/web/src/components/DataTables/WifiDevicesDataTable.vue
index 3fcf561..3e79420 100644
--- a/web/src/components/DataTables/WifiDevicesDataTable.vue
+++ b/web/src/components/DataTables/WifiDevicesDataTable.vue
@@ -130,4 +130,8 @@ export default {
}
-
+
diff --git a/web/src/views/WifiUsers.vue b/web/src/views/WifiUsers.vue
index 6a1f3c4..b50e911 100644
--- a/web/src/views/WifiUsers.vue
+++ b/web/src/views/WifiUsers.vue
@@ -1,14 +1,25 @@
-
+
+
+
+
Atualizar
@@ -48,6 +59,8 @@
@@ -58,6 +71,7 @@
+
@@ -98,9 +112,12 @@
-
- São exibidos apenas os 100 primeiros resultados da pesquisa
-
+