UI improvements
This commit is contained in:
parent
38c42079ff
commit
e07153b7cd
|
@ -57,7 +57,7 @@
|
|||
:search="search"
|
||||
calculate-widths
|
||||
class="elevation-1"
|
||||
@click:row="viewInfo"
|
||||
:footer-props="{ itemsPerPageOptions: [10, 25, 50, 100, 150] }"
|
||||
>
|
||||
<template #[`item.name`]="{ item }">
|
||||
{{ item.name || item.hostname }}
|
||||
|
@ -69,10 +69,12 @@
|
|||
|
||||
<template #[`item.clients`]="{ item }">
|
||||
<div class="align-content-end">
|
||||
{{ item.clients }}
|
||||
<v-icon :color="loadColor(item.clients)">
|
||||
<v-chip outlined>
|
||||
<v-icon left :color="loadColor(item.clients)">
|
||||
{{ loadIcon(item.clients) }}
|
||||
</v-icon>
|
||||
{{ item.clients }}
|
||||
</v-chip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -101,19 +103,25 @@ import gql from 'graphql-tag'
|
|||
export default {
|
||||
name: 'AccessPoints',
|
||||
data: () => ({
|
||||
linesPerPage: 15,
|
||||
linesPerPage: 150,
|
||||
search: '',
|
||||
allHeaders: [
|
||||
{ text: 'Nome', value: 'name', active: true },
|
||||
{ text: 'IP', value: 'ip', active: true },
|
||||
{ text: 'Hostname', value: 'hostname', active: false },
|
||||
{ text: 'IP', value: 'ip', active: true, width: 80 },
|
||||
{ text: 'MAC', value: 'mac', active: false },
|
||||
{ text: 'Localização', value: 'local', active: true },
|
||||
{
|
||||
text: 'Clientes',
|
||||
value: 'clients',
|
||||
active: true,
|
||||
width: 140,
|
||||
align: 'center'
|
||||
},
|
||||
{ text: 'Uptime', value: 'uptime', active: true },
|
||||
{ text: 'Modelo', value: 'model', active: false },
|
||||
{ text: 'Clientes', value: 'clients', active: true },
|
||||
{ text: 'Observações', value: 'notes', active: true },
|
||||
{ text: 'Hostname', value: 'hostname', active: false },
|
||||
{ text: 'MAC', value: 'mac', active: false },
|
||||
{ text: 'Controladora', value: 'controller', active: false },
|
||||
{ text: 'Observações', value: 'notes', active: true },
|
||||
{ text: 'Última atualização', value: 'updatedAt', active: true }
|
||||
]
|
||||
}),
|
||||
|
@ -127,11 +135,8 @@ export default {
|
|||
readableUptime(uptime) {
|
||||
return Math.floor(uptime / 3600)
|
||||
},
|
||||
viewInfo(data) {
|
||||
console.log(data)
|
||||
},
|
||||
load(connectedClients) {
|
||||
const MAX_LOAD = 50
|
||||
const MAX_LOAD = 70
|
||||
const load = Math.floor((connectedClients / MAX_LOAD) * 100)
|
||||
|
||||
return load < 100 ? load : 100
|
||||
|
@ -139,26 +144,22 @@ export default {
|
|||
loadColor(clients) {
|
||||
const load = this.load(clients)
|
||||
|
||||
let r = 0
|
||||
let g = 0
|
||||
let b = 10
|
||||
|
||||
if (load < 50) {
|
||||
g = 255
|
||||
r = Math.round(5.1 * load)
|
||||
} else {
|
||||
r = 255
|
||||
g = Math.round(510 - 5.1 * load)
|
||||
}
|
||||
let h = r * 0x10000 + g * 0x100 + b * 0x1
|
||||
return '#' + ('000000' + h.toString(16)).slice(-6)
|
||||
if (load < 20) return 'teal lighten-2'
|
||||
else if (load < 30) return 'green'
|
||||
else if (load < 40) return 'light-green'
|
||||
else if (load < 50) return 'lime'
|
||||
else if (load < 60) return 'yellow darken-2'
|
||||
else if (load < 70) return 'amber'
|
||||
else if (load < 80) return 'orange'
|
||||
else if (load < 90) return 'deep-orange'
|
||||
else return 'red'
|
||||
},
|
||||
loadIcon(clients) {
|
||||
const load = this.load(clients)
|
||||
|
||||
if (load < 20) return 'mdi-gauge-empty'
|
||||
if (load < 25) return 'mdi-gauge-empty'
|
||||
else if (load < 50) return 'mdi-gauge-low'
|
||||
else if (load < 80) return 'mdi-gauge'
|
||||
else if (load < 75) return 'mdi-gauge'
|
||||
else return 'mdi-gauge-full'
|
||||
}
|
||||
},
|
||||
|
@ -207,16 +208,11 @@ export default {
|
|||
}
|
||||
}
|
||||
`,
|
||||
updateQuery: (
|
||||
previousResult,
|
||||
{
|
||||
subscriptionData: {
|
||||
data: { accessPointsUpdated }
|
||||
updateQuery: (previousResult, { subscriptionData }) => {
|
||||
return {
|
||||
accessPoints: subscriptionData.data.accessPointsUpdated
|
||||
}
|
||||
}
|
||||
) => {
|
||||
return accessPointsUpdated
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user