Made session overview update again on load

This commit is contained in:
Risto Lahtela 2021-02-08 18:52:20 +02:00 committed by Risto Lahtela
parent b8ec15e381
commit c6817e0e28
3 changed files with 20 additions and 3 deletions

View File

@ -79,6 +79,18 @@ public class JSONFileStorage implements JSONStorage {
jsonDirectory = files.getJSONStorageDirectory(); jsonDirectory = files.getJSONStorageDirectory();
} }
// for testing
JSONFileStorage(
PlanFiles files, Formatter<Long> dateFormatter, PluginLogger logger
) {
this.logger = logger;
debugLogger = logger.getDebugLogger();
this.dateFormatter = dateFormatter;
jsonDirectory = files.getJSONStorageDirectory();
}
@Override @Override
public StoredJSON storeJson(String identifier, String json, long timestamp) { public StoredJSON storeJson(String identifier, String json, long timestamp) {
Path writingTo = jsonDirectory.resolve(identifier + '-' + timestamp + JSON_FILE_EXTENSION); Path writingTo = jsonDirectory.resolve(identifier + '-' + timestamp + JSON_FILE_EXTENSION);

View File

@ -532,7 +532,12 @@
<!-- Page Heading --> <!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4"> <div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800"><i class="sidebar-toggler fa fa-fw fa-bars"></i>${serverDisplayName} <h1 class="h3 mb-0 text-gray-800"><i class="sidebar-toggler fa fa-fw fa-bars"></i>${serverDisplayName}
&middot; Sessions</h1> &middot; Sessions
<span class="refresh-element">
<i class="fa fa-fw fa-sync"></i> <span class="refresh-time"></span>
<span class="refresh-notice"><i class="fa fa-fw fa-cog fa-spin"></i> Updating..</span>
</span>
</h1>
${backButton} ${backButton}
</div> </div>
@ -1303,7 +1308,7 @@
setLoadingText('Calculating values..'); setLoadingText('Calculating values..');
refreshingJsonRequest("../v1/serverOverview?server=${serverUUID}", loadserverOverviewValues, 'server-overview'); refreshingJsonRequest("../v1/serverOverview?server=${serverUUID}", loadserverOverviewValues, 'server-overview');
refreshingJsonRequest("../v1/onlineOverview?server=${serverUUID}", loadOnlineActivityOverviewValues, 'online-activity-overview'); refreshingJsonRequest("../v1/onlineOverview?server=${serverUUID}", loadOnlineActivityOverviewValues, 'online-activity-overview');
jsonRequest("../v1/sessionsOverview?server=${serverUUID}", loadSessionValues); refreshingJsonRequest("../v1/sessionsOverview?server=${serverUUID}", loadSessionValues, 'sessions-overview');
jsonRequest("../v1/playerVersus?server=${serverUUID}", loadPvPPvEValues); jsonRequest("../v1/playerVersus?server=${serverUUID}", loadPvPPvEValues);
jsonRequest("../v1/playerbaseOverview?server=${serverUUID}", loadPlayerbaseOverviewValues); jsonRequest("../v1/playerbaseOverview?server=${serverUUID}", loadPlayerbaseOverviewValues);
jsonRequest("../v1/performanceOverview?server=${serverUUID}", loadPerformanceValues); jsonRequest("../v1/performanceOverview?server=${serverUUID}", loadPerformanceValues);

View File

@ -49,7 +49,7 @@ class JSONStorageTest {
this.tempDir = tempDir; this.tempDir = tempDir;
when(files.getJSONStorageDirectory()).thenReturn(this.tempDir); when(files.getJSONStorageDirectory()).thenReturn(this.tempDir);
UNDER_TEST = new JSONFileStorage(files, new TestPluginLogger()); UNDER_TEST = new JSONFileStorage(files, value -> Long.toString(value), new TestPluginLogger());
} }
private Optional<File> findTheFile() { private Optional<File> findTheFile() {