Default headers btn
This commit is contained in:
parent
a532d4e148
commit
bce128dfa9
|
@ -25,7 +25,6 @@
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn
|
<v-btn
|
||||||
text
|
text
|
||||||
block
|
|
||||||
@click="
|
@click="
|
||||||
allHeaders = allHeaders.map(header => ({
|
allHeaders = allHeaders.map(header => ({
|
||||||
...header,
|
...header,
|
||||||
|
@ -36,6 +35,10 @@
|
||||||
<v-icon left>mdi-check-all</v-icon>
|
<v-icon left>mdi-check-all</v-icon>
|
||||||
Todos
|
Todos
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
<v-btn text @click="resetDefaultHeaders">
|
||||||
|
<v-icon left>mdi-check-all</v-icon>
|
||||||
|
Padrões
|
||||||
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
|
@ -90,6 +93,19 @@
|
||||||
{{ item.updatedAt | conciseDate }}
|
{{ item.updatedAt | conciseDate }}
|
||||||
</small>
|
</small>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #[`item.controller`]="{ item }">
|
||||||
|
<ApIcon :controller="item.controller" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #[`item.actions`]>
|
||||||
|
<v-btn icon small>
|
||||||
|
<v-icon small>mdi-pencil</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-btn icon small>
|
||||||
|
<v-icon small>mdi-eye</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
<v-alert class="mt-2" dismissible outlined type="success">
|
<v-alert class="mt-2" dismissible outlined type="success">
|
||||||
As informações são atualizadas automaticamente</v-alert
|
As informações são atualizadas automaticamente</v-alert
|
||||||
|
@ -99,33 +115,56 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
import ApIcon from '../components/ApIcon.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AccessPoints',
|
name: 'AccessPoints',
|
||||||
|
components: { ApIcon },
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
linesPerPage: 150,
|
linesPerPage: 150,
|
||||||
search: '',
|
search: '',
|
||||||
|
defaultHeaders: [
|
||||||
|
'name',
|
||||||
|
'ip',
|
||||||
|
'local',
|
||||||
|
'clients',
|
||||||
|
'uptime',
|
||||||
|
'updatedAt',
|
||||||
|
'actions'
|
||||||
|
],
|
||||||
allHeaders: [
|
allHeaders: [
|
||||||
{ text: 'Nome', value: 'name', active: true },
|
{ text: 'Nome', value: 'name' },
|
||||||
{ text: 'Hostname', value: 'hostname', active: false },
|
{ text: 'Hostname', value: 'hostname' },
|
||||||
{ text: 'IP', value: 'ip', active: true, width: 80 },
|
{ text: 'IP', value: 'ip', width: 80 },
|
||||||
{ text: 'MAC', value: 'mac', active: false },
|
{ text: 'MAC', value: 'mac' },
|
||||||
{ text: 'Localização', value: 'local', active: true },
|
{ text: 'Localização', value: 'local' },
|
||||||
{
|
{
|
||||||
text: 'Clientes',
|
text: 'Clientes',
|
||||||
value: 'clients',
|
value: 'clients',
|
||||||
active: true,
|
|
||||||
width: 140,
|
width: 140,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{ text: 'Uptime', value: 'uptime', active: true },
|
{ text: 'Uptime', value: 'uptime' },
|
||||||
{ text: 'Modelo', value: 'model', active: false },
|
{ text: 'Modelo', value: 'model' },
|
||||||
{ text: 'Controladora', value: 'controller', active: false },
|
{
|
||||||
{ text: 'Observações', value: 'notes', active: true },
|
text: 'Controladora',
|
||||||
{ text: 'Última atualização', value: 'updatedAt', active: true }
|
value: 'controller'
|
||||||
|
},
|
||||||
|
{ text: 'Observações', value: 'notes' },
|
||||||
|
{ text: 'Última atualização', value: 'updatedAt' },
|
||||||
|
{
|
||||||
|
text: 'Ações',
|
||||||
|
value: 'actions',
|
||||||
|
width: 120,
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
|
mounted() {
|
||||||
|
this.resetDefaultHeaders()
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
headers() {
|
headers() {
|
||||||
return this.allHeaders.filter(header => header.active)
|
return this.allHeaders.filter(header => header.active)
|
||||||
|
@ -138,12 +177,10 @@ export default {
|
||||||
load(connectedClients) {
|
load(connectedClients) {
|
||||||
const MAX_LOAD = 70
|
const MAX_LOAD = 70
|
||||||
const load = Math.floor((connectedClients / MAX_LOAD) * 100)
|
const load = Math.floor((connectedClients / MAX_LOAD) * 100)
|
||||||
|
|
||||||
return load < 100 ? load : 100
|
return load < 100 ? load : 100
|
||||||
},
|
},
|
||||||
loadColor(clients) {
|
loadColor(clients) {
|
||||||
const load = this.load(clients)
|
const load = this.load(clients)
|
||||||
|
|
||||||
if (load < 20) return 'teal lighten-2'
|
if (load < 20) return 'teal lighten-2'
|
||||||
else if (load < 30) return 'green'
|
else if (load < 30) return 'green'
|
||||||
else if (load < 40) return 'light-green'
|
else if (load < 40) return 'light-green'
|
||||||
|
@ -156,17 +193,21 @@ export default {
|
||||||
},
|
},
|
||||||
loadIcon(clients) {
|
loadIcon(clients) {
|
||||||
const load = this.load(clients)
|
const load = this.load(clients)
|
||||||
|
|
||||||
if (load < 25) return 'mdi-gauge-empty'
|
if (load < 25) return 'mdi-gauge-empty'
|
||||||
else if (load < 50) return 'mdi-gauge-low'
|
else if (load < 50) return 'mdi-gauge-low'
|
||||||
else if (load < 75) return 'mdi-gauge'
|
else if (load < 75) return 'mdi-gauge'
|
||||||
else return 'mdi-gauge-full'
|
else return 'mdi-gauge-full'
|
||||||
|
},
|
||||||
|
resetDefaultHeaders() {
|
||||||
|
this.allHeaders = this.allHeaders.map(header => ({
|
||||||
|
...header,
|
||||||
|
active: this.defaultHeaders.includes(header.value)
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
accessPoints: {
|
accessPoints: {
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
|
|
||||||
query: gql`
|
query: gql`
|
||||||
query accessPoints {
|
query accessPoints {
|
||||||
accessPoints {
|
accessPoints {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user