Added totalWifiDevices to stats query.
This commit is contained in:
parent
972389e14c
commit
6599707386
|
@ -35,7 +35,9 @@ const Stats = {
|
|||
}
|
||||
}),
|
||||
|
||||
totalUsers: async () => prisma.user.count()
|
||||
totalUsers: async () => prisma.user.count(),
|
||||
|
||||
totalWifiDevices: async () => prisma.wifiDevice.count()
|
||||
}
|
||||
|
||||
export { Stats }
|
||||
|
|
|
@ -148,6 +148,7 @@ const typeDefs = gql`
|
|||
onlineUsers: Int!
|
||||
offlineUsers: Int!
|
||||
totalUsers: Int!
|
||||
totalWifiDevices: Int!
|
||||
}
|
||||
|
||||
type WifiDevice {
|
||||
|
|
|
@ -15,24 +15,20 @@ Vue.use(VueApollo)
|
|||
// Name of the localStorage item
|
||||
const AUTH_TOKEN = 'apollo-token'
|
||||
|
||||
// Http endpoint
|
||||
const httpEndpoint =
|
||||
process.env.VUE_APP_GRAPHQL_HTTP || 'http://localhost:4000/graphql'
|
||||
|
||||
// Config
|
||||
const defaultOptions = {
|
||||
// You can use `https` for secure connection (recommended in production)
|
||||
httpEndpoint,
|
||||
httpEndpoint: process.env.VUE_APP_GRAPHQL_HTTP,
|
||||
// You can use `wss` for secure connection (recommended in production)
|
||||
// Use `null` to disable subscriptions
|
||||
wsEndpoint: process.env.VUE_APP_GRAPHQL_WS || 'ws://localhost:4000/graphql',
|
||||
wsEndpoint: process.env.VUE_APP_GRAPHQL_WS,
|
||||
// LocalStorage token
|
||||
tokenName: AUTH_TOKEN,
|
||||
// Enable Automatic Query persisting with Apollo Engine
|
||||
persisting: false,
|
||||
// Use websockets for everything (no HTTP)
|
||||
// You need to pass a `wsEndpoint` for this to work
|
||||
websocketsOnly: false,
|
||||
websocketsOnly: true,
|
||||
// Is being rendered on the server?
|
||||
ssr: false
|
||||
|
||||
|
|
|
@ -27,6 +27,16 @@
|
|||
</template>
|
||||
</v-tooltip>
|
||||
</v-toolbar>
|
||||
<div v-if="stats" class="text-center mb-6 mt-0">
|
||||
<v-chip color="green" class="mr-1" dark>
|
||||
{{ wifiDevices.filter(device => device.isOnline).length }}
|
||||
</v-chip>
|
||||
online de
|
||||
<v-chip class="mx-1">
|
||||
{{ stats.totalWifiDevices }}
|
||||
</v-chip>
|
||||
no total
|
||||
</div>
|
||||
<v-data-iterator
|
||||
:items="computedWifiDevices"
|
||||
:items-per-page.sync="itemsPerPage"
|
||||
|
@ -222,6 +232,15 @@ export default {
|
|||
}
|
||||
}
|
||||
`
|
||||
},
|
||||
stats: {
|
||||
query: gql`
|
||||
query {
|
||||
stats {
|
||||
totalWifiDevices
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user