Fix suggested max
This commit is contained in:
parent
107d04c2c7
commit
0f5e810e51
|
@ -59,10 +59,8 @@
|
|||
<ClientsChart
|
||||
:stats="subnet.stats"
|
||||
:subnet="subnet"
|
||||
:suggested-max0="maxClients > 300 ? maxClients : 300"
|
||||
:suggested-max1="
|
||||
maxUsage > 100000000000 ? maxUsage : 100000000000
|
||||
"
|
||||
:suggested-max0="suggestedClientsMax"
|
||||
:suggested-max1="suggestedUsageMax"
|
||||
:height="130"
|
||||
hide-labels
|
||||
/>
|
||||
|
@ -107,7 +105,7 @@ export default {
|
|||
computed: {
|
||||
maxClients() {
|
||||
const maxClients = this.subnets?.reduce((max, subnet) => {
|
||||
return Math.max(max, subnet.stats[0].clients)
|
||||
return Math.max(max, this.subnetPeakClients(subnet))
|
||||
}, 0)
|
||||
|
||||
return maxClients || 0
|
||||
|
@ -115,17 +113,42 @@ export default {
|
|||
|
||||
maxUsage() {
|
||||
const maxUsage = this.subnets?.reduce((max, subnet) => {
|
||||
return Math.max(max, subnet.stats[0].sumUsage)
|
||||
return Math.max(max, this.subnetPeakUsage(subnet))
|
||||
}, 0)
|
||||
|
||||
return maxUsage || 0
|
||||
},
|
||||
|
||||
suggestedClientsMax() {
|
||||
const upper100 = this.roundToUpper100(this.maxClients)
|
||||
|
||||
const MIN = 300
|
||||
|
||||
return upper100 > MIN ? upper100 : MIN
|
||||
},
|
||||
|
||||
suggestedUsageMax() {
|
||||
const upper100 = this.roundToUpper100(this.maxUsage)
|
||||
|
||||
const MIN = 1000000000
|
||||
|
||||
return upper100 > MIN ? upper100 : MIN
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
roundToUpper100(value) {
|
||||
console.log(value)
|
||||
return Math.ceil(value / 100) * 100
|
||||
},
|
||||
subnetPeakClients(subnet) {
|
||||
return subnet.stats.reduce((max, stat) => {
|
||||
return Math.max(max, stat.clients)
|
||||
}, 0)
|
||||
},
|
||||
subnetPeakUsage(subnet) {
|
||||
return subnet.stats.reduce((max, stat) => {
|
||||
return Math.max(max, stat.sumUsage)
|
||||
}, 0)
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user