Skip to content

Commit 51dac0a

Browse files
committed
Replace NetworkOverview week comparison table and most of numbers with datapoints
1 parent b7d5ffc commit 51dac0a

13 files changed

Lines changed: 320 additions & 137 deletions

File tree

Plan/common/src/main/java/com/djrapitops/plan/delivery/export/FileExporter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ protected String toJSONResourceName(String resource) {
153153
}
154154

155155
return StringUtils.replaceEach(replaced,
156-
new String[]{"?", "&", "type=", "server=", "player=", "afterMillisAgo="},
157-
new String[]{"-", "_", "", "", "", ""});
156+
new String[]{"?", "&", "type=", "server=", "player=", "afterMillisAgo=", "beforeMillisAgo="},
157+
new String[]{"-", "_", "", "", "", "", ""});
158158
}
159159

160160
protected String toNonRelativePath(String resourceName) {

Plan/common/src/main/java/com/djrapitops/plan/delivery/export/NetworkPageExporter.java

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public void exportJSON(Path toDirectory, ServerUUID serverUUID) throws IOExcepti
113113
String datapointType = "datapoint?type=";
114114
String after = "&after=" + monthAgo;
115115
String afterMillis = "&afterMillisAgo=";
116+
String beforeMillis = "&beforeMillisAgo=";
116117
exportJSON(toDirectory,
117118
"network/overview",
118119
"network/servers",
@@ -133,26 +134,48 @@ public void exportJSON(Path toDirectory, ServerUUID serverUUID) throws IOExcepti
133134
"retention",
134135
"joinAddresses",
135136
"playersTable",
136-
datapointType + DatapointType.PLAYTIME.name(),
137-
datapointType + DatapointType.PLAYTIME.name() + after,
138-
datapointType + DatapointType.AFK_TIME.name() + after,
139-
datapointType + DatapointType.AFK_TIME_PERCENTAGE.name() + after,
140-
datapointType + DatapointType.SERVER_OCCUPIED.name() + after,
141-
datapointType + DatapointType.MOST_ACTIVE_GAME_MODE.name() + after,
142-
datapointType + DatapointType.WORLD_PIE.name() + after,
143-
datapointType + DatapointType.SERVER_PIE.name(),
144-
datapointType + DatapointType.UNIQUE_PLAYERS.name() + afterMillis + TimeUnit.DAYS.toMillis(30),
145-
datapointType + DatapointType.UNIQUE_PLAYERS.name() + afterMillis + TimeUnit.DAYS.toMillis(7),
146-
datapointType + DatapointType.UNIQUE_PLAYERS.name() + afterMillis + TimeUnit.DAYS.toMillis(1),
147-
datapointType + DatapointType.NEW_PLAYERS.name(),
148-
datapointType + DatapointType.NEW_PLAYERS.name() + afterMillis + TimeUnit.DAYS.toMillis(30),
149-
datapointType + DatapointType.NEW_PLAYERS.name() + afterMillis + TimeUnit.DAYS.toMillis(7),
150-
datapointType + DatapointType.NEW_PLAYERS.name() + afterMillis + TimeUnit.DAYS.toMillis(1),
151-
datapointType + DatapointType.REGULAR_PLAYERS.name(),
137+
datapointType + DatapointType.PLAYTIME,
138+
datapointType + DatapointType.PLAYTIME + after,
139+
datapointType + DatapointType.AFK_TIME + after,
140+
datapointType + DatapointType.AFK_TIME_PERCENTAGE + after,
141+
datapointType + DatapointType.SERVER_OCCUPIED + after,
142+
datapointType + DatapointType.MOST_ACTIVE_GAME_MODE + after,
143+
datapointType + DatapointType.WORLD_PIE + after,
144+
datapointType + DatapointType.SERVER_PIE,
145+
datapointType + DatapointType.UNIQUE_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(30),
146+
datapointType + DatapointType.UNIQUE_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(7),
147+
datapointType + DatapointType.UNIQUE_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(1),
148+
datapointType + DatapointType.NEW_PLAYERS,
149+
datapointType + DatapointType.NEW_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(30),
150+
datapointType + DatapointType.NEW_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(7),
151+
datapointType + DatapointType.NEW_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(1),
152+
datapointType + DatapointType.REGULAR_PLAYERS,
152153
datapointType + DatapointType.PLAYERS_ONLINE_PEAK + afterMillis + TimeUnit.DAYS.toMillis(2),
153154
datapointType + DatapointType.PLAYERS_ONLINE_PEAK,
154155
datapointType + DatapointType.SESSION_COUNT,
155-
datapointType + DatapointType.SESSION_COUNT + after
156+
datapointType + DatapointType.SESSION_COUNT + after,
157+
datapointType + DatapointType.PLAYTIME_PER_PLAYER_AVERAGE,
158+
datapointType + DatapointType.SESSION_LENGTH_AVERAGE,
159+
datapointType + DatapointType.PLAYER_KILLS,
160+
datapointType + DatapointType.MOB_KILLS,
161+
datapointType + DatapointType.DEATHS,
162+
// Week comparison
163+
datapointType + DatapointType.UNIQUE_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
164+
datapointType + DatapointType.NEW_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
165+
datapointType + DatapointType.REGULAR_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
166+
datapointType + DatapointType.PLAYTIME_PER_PLAYER_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
167+
datapointType + DatapointType.SESSION_LENGTH_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
168+
datapointType + DatapointType.SESSION_COUNT + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
169+
datapointType + DatapointType.PLAYER_KILLS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
170+
datapointType + DatapointType.MOB_KILLS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
171+
datapointType + DatapointType.DEATHS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L),
172+
datapointType + DatapointType.REGULAR_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(7),
173+
datapointType + DatapointType.PLAYTIME_PER_PLAYER_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(7),
174+
datapointType + DatapointType.SESSION_LENGTH_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(7),
175+
datapointType + DatapointType.SESSION_COUNT + afterMillis + TimeUnit.DAYS.toMillis(7),
176+
datapointType + DatapointType.PLAYER_KILLS + afterMillis + TimeUnit.DAYS.toMillis(7),
177+
datapointType + DatapointType.MOB_KILLS + afterMillis + TimeUnit.DAYS.toMillis(7),
178+
datapointType + DatapointType.DEATHS + afterMillis + TimeUnit.DAYS.toMillis(7)
156179
);
157180
}
158181

Plan/common/src/main/java/com/djrapitops/plan/delivery/export/ServerPageExporter.java

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public void exportJSON(Path toDirectory, ServerUUID serverUUID) throws IOExcepti
122122
String after = "&after=" + monthAgo;
123123
String server = "&server=" + serverUUID;
124124
String afterMillis = "&afterMillisAgo=";
125+
String beforeMillis = "&beforeMillisAgo=";
125126
exportJSON(toDirectory,
126127
"serverOverview?server=" + serverUUID,
127128
"onlineOverview?server=" + serverUUID,
@@ -147,19 +148,43 @@ public void exportJSON(Path toDirectory, ServerUUID serverUUID) throws IOExcepti
147148
"retention?server=" + serverUUID,
148149
"joinAddresses?server=" + serverUUID,
149150
"gameAllowlistBounces?server=" + serverUUID,
150-
datapointType + DatapointType.PLAYTIME.name() + server,
151-
datapointType + DatapointType.PLAYTIME.name() + after + server,
152-
datapointType + DatapointType.AFK_TIME.name() + after + server,
153-
datapointType + DatapointType.AFK_TIME_PERCENTAGE.name() + after + server,
154-
datapointType + DatapointType.SERVER_OCCUPIED.name() + after + server,
155-
datapointType + DatapointType.MOST_ACTIVE_GAME_MODE.name() + after + server,
156-
datapointType + DatapointType.WORLD_PIE.name() + server,
157-
datapointType + DatapointType.NEW_PLAYERS.name() + server,
158-
datapointType + DatapointType.REGULAR_PLAYERS.name() + server,
151+
datapointType + DatapointType.PLAYTIME + server,
152+
datapointType + DatapointType.PLAYTIME + after + server,
153+
datapointType + DatapointType.AFK_TIME + after + server,
154+
datapointType + DatapointType.AFK_TIME_PERCENTAGE + after + server,
155+
datapointType + DatapointType.SERVER_OCCUPIED + after + server,
156+
datapointType + DatapointType.MOST_ACTIVE_GAME_MODE + after + server,
157+
datapointType + DatapointType.WORLD_PIE + server,
158+
datapointType + DatapointType.NEW_PLAYERS + server,
159+
datapointType + DatapointType.REGULAR_PLAYERS + server,
159160
datapointType + DatapointType.PLAYERS_ONLINE_PEAK + afterMillis + TimeUnit.DAYS.toMillis(2) + server,
160161
datapointType + DatapointType.PLAYERS_ONLINE_PEAK + server,
161162
datapointType + DatapointType.SESSION_COUNT + server,
162-
datapointType + DatapointType.SESSION_COUNT + after + server
163+
datapointType + DatapointType.SESSION_COUNT + after + server,
164+
datapointType + DatapointType.PLAYTIME_PER_PLAYER_AVERAGE + server,
165+
datapointType + DatapointType.SESSION_LENGTH_AVERAGE + server,
166+
datapointType + DatapointType.PLAYER_KILLS + server,
167+
datapointType + DatapointType.MOB_KILLS + server,
168+
datapointType + DatapointType.DEATHS + server,
169+
// Week comparison
170+
datapointType + DatapointType.UNIQUE_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
171+
datapointType + DatapointType.NEW_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
172+
datapointType + DatapointType.REGULAR_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
173+
datapointType + DatapointType.PLAYTIME_PER_PLAYER_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
174+
datapointType + DatapointType.SESSION_LENGTH_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
175+
datapointType + DatapointType.SESSION_COUNT + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
176+
datapointType + DatapointType.PLAYER_KILLS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
177+
datapointType + DatapointType.MOB_KILLS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
178+
datapointType + DatapointType.DEATHS + afterMillis + TimeUnit.DAYS.toMillis(14) + beforeMillis + TimeUnit.DAYS.toMillis(7L) + server,
179+
datapointType + DatapointType.UNIQUE_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
180+
datapointType + DatapointType.NEW_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
181+
datapointType + DatapointType.REGULAR_PLAYERS + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
182+
datapointType + DatapointType.PLAYTIME_PER_PLAYER_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
183+
datapointType + DatapointType.SESSION_LENGTH_AVERAGE + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
184+
datapointType + DatapointType.SESSION_COUNT + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
185+
datapointType + DatapointType.PLAYER_KILLS + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
186+
datapointType + DatapointType.MOB_KILLS + afterMillis + TimeUnit.DAYS.toMillis(7) + server,
187+
datapointType + DatapointType.DEATHS + afterMillis + TimeUnit.DAYS.toMillis(7) + server
163188
);
164189
}
165190

Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/json/datapoint/DatapointType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@ public Class<? extends Datapoint<?>> getDatapointClass() {
7272
public Set<DatapointCacheKey> getCacheKeys() {
7373
return new HashSet<>(Arrays.asList(cacheKeys));
7474
}
75+
76+
@Override
77+
public String toString() {
78+
return name();
79+
}
7580
}

Plan/react/dashboard/src/components/cards/server/tables/ServerWeekComparisonCard.jsx

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)