add serverGraphDuration config option

This commit is contained in:
Nick Krecklow
2020-05-08 01:54:04 -05:00
parent aee7b565b2
commit f467fa1938
10 changed files with 52 additions and 55 deletions

View File

@ -15,7 +15,7 @@ class App {
this.mojangUpdater = new MojangUpdater(this)
this.pingController = new PingController(this)
this.server = new Server(this.handleClientConnection)
this.timeTracker = new TimeTracker()
this.timeTracker = new TimeTracker(this)
}
loadDatabase (callback) {
@ -24,7 +24,7 @@ class App {
// Setup database instance
this.database.ensureIndexes()
this.database.loadGraphPoints(config.graphDuration, () => {
this.database.loadGraphPoints(this.pingController.getMaxGraphDataLength(), () => {
this.database.loadRecords(callback)
})
}
@ -68,7 +68,9 @@ class App {
// Send configuration data for rendering the page
return {
graphDuration: config.graphDuration,
graphDurationLabel: config.graphDurationLabel || (Math.floor(config.graphDuration / (60 * 60 * 1000)) + 'h'),
graphMaxLength: this.pingController.getMaxGraphDataLength(),
serverGraphMaxLength: this.pingController.getMaxServerGraphDataLength(),
servers: this.serverRegistrations.map(serverRegistration => serverRegistration.data),
minecraftVersions: minecraftVersionNames,
isGraphVisible: config.logToDatabase