Show uplink
This commit is contained in:
parent
1181eee75a
commit
c8ffd3bc5c
|
@ -0,0 +1,2 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "AccessPoint" ADD COLUMN "uplinkSpeed" INTEGER;
|
|
@ -148,6 +148,7 @@ model AccessPoint {
|
||||||
inventoryTag String?
|
inventoryTag String?
|
||||||
usage BigInt?
|
usage BigInt?
|
||||||
uptime Int?
|
uptime Int?
|
||||||
|
uplinkSpeed Int?
|
||||||
stats AccessPointStats[] @relation("accesspointstats_to_ap")
|
stats AccessPointStats[] @relation("accesspointstats_to_ap")
|
||||||
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
|
wifiDevices WifiDevice[] @relation("wifidevice_to_ap")
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,8 @@ export function getAccessPoints() {
|
||||||
model: Md,
|
model: Md,
|
||||||
ip: A4,
|
ip: A4,
|
||||||
clients: +Cl,
|
clients: +Cl,
|
||||||
usage: +Vm
|
usage: +Vm,
|
||||||
|
uplinkSpeed: null
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -205,12 +205,14 @@ export async function getOnlineWifiDevices() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
export async function getAccessPoints() {
|
export async function getAccessPoints() {
|
||||||
try {
|
try {
|
||||||
const [accessPoints] = await unifiController.getAccessDevices('default')
|
const [accessPoints] = await unifiController.getAccessDevices('default')
|
||||||
|
|
||||||
const restructuredAccessPoints = accessPoints.map(
|
const restructuredAccessPoints = accessPoints.map(
|
||||||
({ mac, model, ip, uptime, name, num_sta, bytes }) => ({
|
({ mac, model, ip, uptime, name, num_sta, bytes, uplink }) => ({
|
||||||
mac,
|
mac,
|
||||||
hostname: name || mac.replaceAll(':', ''),
|
hostname: name || mac.replaceAll(':', ''),
|
||||||
uptime: uptime ? +uptime : -1,
|
uptime: uptime ? +uptime : -1,
|
||||||
|
@ -218,7 +220,8 @@ export async function getAccessPoints() {
|
||||||
model,
|
model,
|
||||||
ip,
|
ip,
|
||||||
clients: num_sta,
|
clients: num_sta,
|
||||||
usage: +bytes || 0
|
usage: +bytes || 0,
|
||||||
|
uplinkSpeed: uplink?.speed || null
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -327,6 +327,7 @@ const typeDefs = gql`
|
||||||
clients: Int
|
clients: Int
|
||||||
subnetInfo: SubnetInfo
|
subnetInfo: SubnetInfo
|
||||||
usage: String
|
usage: String
|
||||||
|
uplinkSpeed: Int
|
||||||
|
|
||||||
createdAt: String
|
createdAt: String
|
||||||
updatedAt: String
|
updatedAt: String
|
||||||
|
|
|
@ -201,6 +201,20 @@
|
||||||
<template #[`item.usage`]="{ item }">
|
<template #[`item.usage`]="{ item }">
|
||||||
<small>{{ item.usage | bytes }}</small>
|
<small>{{ item.usage | bytes }}</small>
|
||||||
</template>
|
</template>
|
||||||
|
<template #[`item.uplinkSpeed`]="{ item }">
|
||||||
|
<v-chip v-if="item.uplinkSpeed == 1000" color="info" x-small outlined>
|
||||||
|
GbE
|
||||||
|
</v-chip>
|
||||||
|
<v-chip
|
||||||
|
v-else-if="item.uplinkSpeed == 100"
|
||||||
|
color="warning"
|
||||||
|
x-small
|
||||||
|
outlined
|
||||||
|
>
|
||||||
|
FE
|
||||||
|
</v-chip>
|
||||||
|
<small v-else> - </small>
|
||||||
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
@ -250,6 +264,7 @@ export default {
|
||||||
value: 'controller'
|
value: 'controller'
|
||||||
},
|
},
|
||||||
{ text: 'Uso', value: 'usage' },
|
{ text: 'Uso', value: 'usage' },
|
||||||
|
{ text: 'Uplink', value: 'uplinkSpeed' },
|
||||||
{ text: 'Observações', value: 'notes' },
|
{ text: 'Observações', value: 'notes' },
|
||||||
{ text: 'Última atualização', value: 'updatedAt', width: 160 }
|
{ text: 'Última atualização', value: 'updatedAt', width: 160 }
|
||||||
]
|
]
|
||||||
|
@ -381,6 +396,7 @@ export default {
|
||||||
ip
|
ip
|
||||||
clients
|
clients
|
||||||
usage
|
usage
|
||||||
|
uplinkSpeed
|
||||||
|
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user