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 }
|
export { Stats }
|
||||||
|
|
|
@ -148,6 +148,7 @@ const typeDefs = gql`
|
||||||
onlineUsers: Int!
|
onlineUsers: Int!
|
||||||
offlineUsers: Int!
|
offlineUsers: Int!
|
||||||
totalUsers: Int!
|
totalUsers: Int!
|
||||||
|
totalWifiDevices: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
type WifiDevice {
|
type WifiDevice {
|
||||||
|
|
|
@ -15,24 +15,20 @@ Vue.use(VueApollo)
|
||||||
// Name of the localStorage item
|
// Name of the localStorage item
|
||||||
const AUTH_TOKEN = 'apollo-token'
|
const AUTH_TOKEN = 'apollo-token'
|
||||||
|
|
||||||
// Http endpoint
|
|
||||||
const httpEndpoint =
|
|
||||||
process.env.VUE_APP_GRAPHQL_HTTP || 'http://localhost:4000/graphql'
|
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
// You can use `https` for secure connection (recommended in production)
|
// 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)
|
// You can use `wss` for secure connection (recommended in production)
|
||||||
// Use `null` to disable subscriptions
|
// 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
|
// LocalStorage token
|
||||||
tokenName: AUTH_TOKEN,
|
tokenName: AUTH_TOKEN,
|
||||||
// Enable Automatic Query persisting with Apollo Engine
|
// Enable Automatic Query persisting with Apollo Engine
|
||||||
persisting: false,
|
persisting: false,
|
||||||
// Use websockets for everything (no HTTP)
|
// Use websockets for everything (no HTTP)
|
||||||
// You need to pass a `wsEndpoint` for this to work
|
// You need to pass a `wsEndpoint` for this to work
|
||||||
websocketsOnly: false,
|
websocketsOnly: true,
|
||||||
// Is being rendered on the server?
|
// Is being rendered on the server?
|
||||||
ssr: false
|
ssr: false
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,16 @@
|
||||||
</template>
|
</template>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</v-toolbar>
|
</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
|
<v-data-iterator
|
||||||
:items="computedWifiDevices"
|
:items="computedWifiDevices"
|
||||||
:items-per-page.sync="itemsPerPage"
|
:items-per-page.sync="itemsPerPage"
|
||||||
|
@ -222,6 +232,15 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
query: gql`
|
||||||
|
query {
|
||||||
|
stats {
|
||||||
|
totalWifiDevices
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user