Improved location listing

This commit is contained in:
Douglas Barone 2022-04-11 14:01:12 -04:00
parent 1c83ed527c
commit 1c6028d0cf
6 changed files with 60 additions and 7 deletions

View File

@ -21,7 +21,7 @@ export async function wifiDevices(parent, { take = 100, skip = 0, search }) {
] ]
}, },
orderBy: [{ lastSeen: 'desc' }, { hostname: 'asc' }], orderBy: [{ lastSeen: 'desc' }, { hostname: 'asc' }],
include: { user: true }, include: { user: true, accessPoint: true },
take, take,
skip skip
}) })

View File

@ -11,7 +11,9 @@ const WifiDevice = {
where: { id: parent.id }, where: { id: parent.id },
include: { user: true } include: { user: true }
}) })
).user ).user,
accessPoint: async parent => prisma.accessPoint.findUnique({ where: { id: parent.accessPointId } })
} }
export { WifiDevice } export { WifiDevice }

View File

@ -234,6 +234,7 @@ const typeDefs = gql`
uptime: String uptime: String
apName: String apName: String
status: Status status: Status
accessPoint: AccessPoint!
} }
"A user that is on the Wi-Fi network reach" "A user that is on the Wi-Fi network reach"

View File

@ -21,9 +21,14 @@
</v-list-item-action> </v-list-item-action>
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title>
{{ wifiDevice.essid }} (próximo ao AP {{ wifiDevice.apName }}) {{ wifiDevice.essid }}
</v-list-item-title> </v-list-item-title>
<v-list-item-subtitle> SSID </v-list-item-subtitle> <v-list-item-subtitle>
SSID (conectado pelo AP
{{
wifiDevice.accessPoint.name || wifiDevice.accessPoint.hostname
}})</v-list-item-subtitle
>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
@ -33,9 +38,14 @@
</v-list-item-action> </v-list-item-action>
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title>
{{ wifiDevice.essid }} (próximo ao AP {{ wifiDevice.apName }}) {{ wifiDevice.essid }}
</v-list-item-title> </v-list-item-title>
<v-list-item-subtitle> Dispositivo off-line </v-list-item-subtitle> <v-list-item-subtitle>
Dispositivo off-line (visto próximo ao AP
{{
wifiDevice.accessPoint.name || wifiDevice.accessPoint.hostname
}})</v-list-item-subtitle
>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
@ -63,6 +73,21 @@
<v-list-item-subtitle> {{ wifiDevice.oui }} </v-list-item-subtitle> <v-list-item-subtitle> {{ wifiDevice.oui }} </v-list-item-subtitle>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
<v-list-item v-if="wifiDevice.accessPoint.local">
<v-list-item-action>
<v-icon>mdi-map-marker-radius</v-icon>
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>
{{ wifiDevice.accessPoint.local }}
</v-list-item-title>
<v-list-item-subtitle>
Localização aproximada
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item> <v-list-item>
<v-list-item-action> <v-list-item-action>
<v-icon>mdi-eye</v-icon> <v-icon>mdi-eye</v-icon>

View File

@ -49,6 +49,11 @@ export default {
oui oui
uptime uptime
status status
accessPoint {
name
hostname
local
}
} }
} }
} }

View File

@ -108,13 +108,28 @@
</v-list-item-action> </v-list-item-action>
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title>
{{ device.apName }} {{
device.accessPoint.name || device.accessPoint.hostname
}}
</v-list-item-title> </v-list-item-title>
<v-list-item-subtitle> <v-list-item-subtitle>
Access Point ({{ device.controller }}) Access Point ({{ device.controller }})
</v-list-item-subtitle> </v-list-item-subtitle>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
<v-list-item v-if="device.accessPoint.local">
<v-list-item-action>
<v-icon>mdi-map-marker-radius</v-icon>
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>
{{ device.accessPoint.local }}
</v-list-item-title>
<v-list-item-subtitle>
Localização do AP
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item> <v-list-item>
<v-list-item-action> <v-list-item-action>
@ -242,6 +257,11 @@ export default {
sAMAccountName sAMAccountName
thumbnailPhoto thumbnailPhoto
} }
accessPoint {
name
hostname
local
}
oui oui
mac mac
controller controller