Added initial support to wifi devices listing

This commit is contained in:
Douglas Barone 2020-11-20 16:17:35 -04:00
parent 2abc723d00
commit 4e0d244477
4 changed files with 80 additions and 2 deletions

View File

@ -1,6 +1,6 @@
const WifiDevice = { const WifiDevice = {
lastSeen: _ => _.lastSeen.toISOString(), lastSeen: _ => _.lastSeen?.toISOString(),
firstSeen: _ => _.firstSeen.toISOString() firstSeen: _ => _.firstSeen?.toISOString()
} }
export { WifiDevice } export { WifiDevice }

View File

@ -40,6 +40,12 @@ export default {
route: { name: 'user-presence' }, route: { name: 'user-presence' },
role: 'watcher' role: 'watcher'
}, },
{
title: 'Dispositivos WiFi',
icon: 'mdi-cellphone-wireless',
route: { name: 'wifi-devices' },
role: 'superAdmin'
},
{ {
title: 'Criar token', title: 'Criar token',
icon: 'mdi-qrcode', icon: 'mdi-qrcode',

View File

@ -154,6 +154,18 @@ const routes = [
/* webpackChunkName: "user-presence" */ '../views/UserPresence.vue' /* webpackChunkName: "user-presence" */ '../views/UserPresence.vue'
) )
}, },
{
path: '/wifi-devices',
name: 'wifi-devices',
meta: {
title: 'Dispositivos WiFi',
watcher: true
},
component: () =>
import(/* webpackChunkName: "wifi-devices" */ '../views/WifiDevices.vue')
},
{ {
path: '/system-administration', path: '/system-administration',
name: 'system-administration', name: 'system-administration',

View File

@ -0,0 +1,60 @@
<template>
<v-container fluid>
<v-data-table :headers="headers" :items="items"> </v-data-table>
</v-container>
</template>
<script>
import gql from 'graphql-tag'
export default {
name: 'WifiDevices',
data: () => ({
headers: [
{ text: 'Hostname', value: 'hostname' },
{ text: 'Usuário', value: 'user' },
{ text: 'OUI', value: 'oui' },
{ text: 'AP', value: 'apName' },
{ text: 'Controladora', value: 'controller' },
{ text: 'Endereço MAC', value: 'mac' }
]
}),
apollo: {
wifiDevices: {
fetchPolicy: 'cache-and-network',
query: gql`
query {
wifiDevices {
user {
displayName
sAMAccountName
}
oui
mac
controller
hostname
firstSeen
lastSeen
essid
ip
uptime
apName
status
}
}
`
}
},
computed: {
items() {
return this.wifiDevices?.map(device => ({
...device,
hostname: device.hostname || 'Desconhecido',
user: device.user.displayName
}))
}
}
}
</script>
<style scoped></style>