Added search query
This commit is contained in:
parent
314c50078d
commit
2ba9c46bef
4
server/package-lock.json
generated
4
server/package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "ifms-pti-svr",
|
"name": "ifms-pti-svr",
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ifms-pti-svr",
|
"name": "ifms-pti-svr",
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^3.15.2",
|
"@prisma/client": "^3.15.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ifms-pti-svr",
|
"name": "ifms-pti-svr",
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"description": "Servidor do Portal de TI do IFMS",
|
"description": "Servidor do Portal de TI do IFMS",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"prisma": {
|
"prisma": {
|
||||||
|
|
4
web/package-lock.json
generated
4
web/package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "ifms-pti",
|
"name": "ifms-pti",
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ifms-pti",
|
"name": "ifms-pti",
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mdi/font": "^6.6.96",
|
"@mdi/font": "^6.6.96",
|
||||||
"apollo-link-ws": "^1.0.20",
|
"apollo-link-ws": "^1.0.20",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ifms-pti",
|
"name": "ifms-pti",
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
:search="search"
|
:search="search"
|
||||||
calculate-widths
|
calculate-widths
|
||||||
class="elevation-2 mb-2"
|
class="elevation-2 mb-2"
|
||||||
sort-by="name"
|
:sort-by.sync="sortBy"
|
||||||
hide-default-footer
|
hide-default-footer
|
||||||
disable-pagination
|
disable-pagination
|
||||||
:group-by="groupBy ? 'campus' : null"
|
:group-by="groupBy ? 'campus' : null"
|
||||||
|
@ -201,6 +201,7 @@ export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
search: '',
|
search: '',
|
||||||
groupBy: true,
|
groupBy: true,
|
||||||
|
sortBy: 'name',
|
||||||
defaultHeaders: [
|
defaultHeaders: [
|
||||||
'name',
|
'name',
|
||||||
'ip',
|
'ip',
|
||||||
|
@ -249,9 +250,30 @@ export default {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
search(newValue) {
|
||||||
|
if (!newValue)
|
||||||
|
this.$router.push({
|
||||||
|
query: { ...this.$route.query, search: undefined }
|
||||||
|
})
|
||||||
|
else if (this.$route.query.search != newValue)
|
||||||
|
this.$router.push({ query: { ...this.$route.query, search: newValue } })
|
||||||
|
},
|
||||||
|
sortBy(newValue) {
|
||||||
|
if (!newValue)
|
||||||
|
this.$router.push({
|
||||||
|
query: { ...this.$route.query, sortBy: undefined }
|
||||||
|
})
|
||||||
|
else if (this.$route.query.sortBy != newValue)
|
||||||
|
this.$router.push({ query: { ...this.$route.query, sortBy: newValue } })
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.resetDefaultHeaders()
|
this.resetDefaultHeaders()
|
||||||
|
this.search = this.$route.query.search || ''
|
||||||
|
this.sortBy = this.$route.query.sortBy || 'name'
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
navigateToAccessPoint(accessPoint) {
|
navigateToAccessPoint(accessPoint) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
|
@ -259,14 +281,17 @@ export default {
|
||||||
params: { id: accessPoint.id }
|
params: { id: accessPoint.id }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
readableUptime(uptime) {
|
readableUptime(uptime) {
|
||||||
return Math.floor(uptime / 3600)
|
return Math.floor(uptime / 3600)
|
||||||
},
|
},
|
||||||
|
|
||||||
load(connectedClients) {
|
load(connectedClients) {
|
||||||
const MAX_LOAD = 80
|
const MAX_LOAD = 80
|
||||||
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 < 10) return 'teal'
|
if (load < 10) return 'teal'
|
||||||
|
@ -278,6 +303,7 @@ export default {
|
||||||
else if (load < 90) return 'deep-orange'
|
else if (load < 90) return 'deep-orange'
|
||||||
else return 'red'
|
else return 'red'
|
||||||
},
|
},
|
||||||
|
|
||||||
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'
|
||||||
|
@ -285,6 +311,7 @@ export default {
|
||||||
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() {
|
resetDefaultHeaders() {
|
||||||
this.groupBy = true
|
this.groupBy = true
|
||||||
this.allHeaders = this.allHeaders.map(header => ({
|
this.allHeaders = this.allHeaders.map(header => ({
|
||||||
|
@ -293,9 +320,11 @@ export default {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
accessPoints: {
|
accessPoints: {
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
|
debounce: 200,
|
||||||
query: gql`
|
query: gql`
|
||||||
query accessPoints {
|
query accessPoints {
|
||||||
accessPoints {
|
accessPoints {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user