Remove join address pie
This commit is contained in:
parent
c4ddd53b8f
commit
bca4880e2a
|
@ -121,7 +121,6 @@ public class NetworkPageExporter extends FileExporter {
|
|||
"graph?type=uniqueAndNew",
|
||||
"graph?type=hourlyUniqueAndNew",
|
||||
"graph?type=serverPie",
|
||||
"graph?type=joinAddressPie",
|
||||
"graph?type=joinAddressByDay",
|
||||
"graph?type=activity",
|
||||
"graph?type=geolocation",
|
||||
|
|
|
@ -137,7 +137,6 @@ public class ServerPageExporter extends FileExporter {
|
|||
"graph?type=geolocation&server=" + serverUUID,
|
||||
"graph?type=uniqueAndNew&server=" + serverUUID,
|
||||
"graph?type=hourlyUniqueAndNew&server=" + serverUUID,
|
||||
"graph?type=joinAddressPie&server=" + serverUUID,
|
||||
"graph?type=joinAddressByDay&server=" + serverUUID,
|
||||
"graph?type=serverCalendar&server=" + serverUUID,
|
||||
"graph?type=punchCard&server=" + serverUUID,
|
||||
|
|
|
@ -32,7 +32,6 @@ import com.djrapitops.plan.delivery.rendering.json.graphs.line.LineGraphFactory;
|
|||
import com.djrapitops.plan.delivery.rendering.json.graphs.line.PingGraph;
|
||||
import com.djrapitops.plan.delivery.rendering.json.graphs.line.Point;
|
||||
import com.djrapitops.plan.delivery.rendering.json.graphs.pie.Pie;
|
||||
import com.djrapitops.plan.delivery.rendering.json.graphs.pie.PieSlice;
|
||||
import com.djrapitops.plan.delivery.rendering.json.graphs.pie.WorldPie;
|
||||
import com.djrapitops.plan.delivery.rendering.json.graphs.special.WorldMap;
|
||||
import com.djrapitops.plan.delivery.rendering.json.graphs.stack.StackGraph;
|
||||
|
@ -57,7 +56,6 @@ import com.djrapitops.plan.storage.database.queries.analysis.PlayerCountQueries;
|
|||
import com.djrapitops.plan.storage.database.queries.objects.*;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.JoinAddressTable;
|
||||
import com.djrapitops.plan.utilities.comparators.DateHolderOldestComparator;
|
||||
import com.djrapitops.plan.utilities.comparators.PieSliceComparator;
|
||||
import com.djrapitops.plan.utilities.dev.Untrusted;
|
||||
import com.djrapitops.plan.utilities.java.Lists;
|
||||
import com.djrapitops.plan.utilities.java.Maps;
|
||||
|
@ -458,34 +456,6 @@ public class GraphJSONCreator {
|
|||
.build();
|
||||
}
|
||||
|
||||
public Map<String, Object> playerHostnamePieJSONAsMap() {
|
||||
String[] pieColors = theme.getPieColors(ThemeVal.GRAPH_WORLD_PIE);
|
||||
Map<String, Integer> joinAddresses = dbSystem.getDatabase().query(JoinAddressQueries.latestJoinAddresses());
|
||||
|
||||
translateUnknown(joinAddresses);
|
||||
|
||||
List<PieSlice> slices = graphs.pie().joinAddressPie(joinAddresses).getSlices();
|
||||
slices.sort(new PieSliceComparator());
|
||||
return Maps.builder(String.class, Object.class)
|
||||
.put("colors", pieColors)
|
||||
.put("slices", slices)
|
||||
.build();
|
||||
}
|
||||
|
||||
public Map<String, Object> playerHostnamePieJSONAsMap(ServerUUID serverUUID) {
|
||||
String[] pieColors = theme.getPieColors(ThemeVal.GRAPH_WORLD_PIE);
|
||||
Map<String, Integer> joinAddresses = dbSystem.getDatabase().query(JoinAddressQueries.latestJoinAddresses(serverUUID));
|
||||
|
||||
translateUnknown(joinAddresses);
|
||||
|
||||
List<PieSlice> slices = graphs.pie().joinAddressPie(joinAddresses).getSlices();
|
||||
slices.sort(new PieSliceComparator());
|
||||
return Maps.builder(String.class, Object.class)
|
||||
.put("colors", pieColors)
|
||||
.put("slices", slices)
|
||||
.build();
|
||||
}
|
||||
|
||||
public void translateUnknown(Map<String, Integer> joinAddresses) {
|
||||
Integer unknown = joinAddresses.get(JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
|
||||
if (unknown != null) {
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.plan.delivery.rendering.json.graphs.pie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JoinAddressPie extends Pie {
|
||||
|
||||
JoinAddressPie(Map<String, Integer> joinAddresses) {
|
||||
super(turnToSlices(joinAddresses));
|
||||
}
|
||||
|
||||
private static List<PieSlice> turnToSlices(Map<String, Integer> joinAddresses) {
|
||||
List<PieSlice> slices = new ArrayList<>();
|
||||
for (Map.Entry<String, Integer> address : joinAddresses.entrySet()) {
|
||||
String joinAddress = address.getKey();
|
||||
Integer total = address.getValue();
|
||||
slices.add(new PieSlice(joinAddress, total));
|
||||
}
|
||||
return slices;
|
||||
}
|
||||
}
|
|
@ -68,10 +68,6 @@ public class PieGraphFactory {
|
|||
return new ServerPreferencePie(playtimeByServerName);
|
||||
}
|
||||
|
||||
public Pie joinAddressPie(Map<String, Integer> joinAddresses) {
|
||||
return new JoinAddressPie(joinAddresses);
|
||||
}
|
||||
|
||||
public WorldPie worldPie(WorldTimes worldTimes) {
|
||||
WorldAliasSettings worldAliasSettings = config.getWorldAliasSettings();
|
||||
Map<String, Long> playtimePerAlias = worldAliasSettings.getPlaytimePerAlias(worldTimes);
|
||||
|
|
|
@ -42,7 +42,6 @@ public enum DataID {
|
|||
GRAPH_ACTIVITY,
|
||||
GRAPH_PING,
|
||||
GRAPH_SERVER_PIE,
|
||||
GRAPH_HOSTNAME_PIE,
|
||||
GRAPH_PUNCHCARD,
|
||||
SERVER_OVERVIEW,
|
||||
ONLINE_OVERVIEW,
|
||||
|
|
|
@ -122,7 +122,6 @@ public class GraphsJSONResolver extends JSONResolver {
|
|||
@ExampleObject("aggregatedPing"),
|
||||
@ExampleObject("punchCard"),
|
||||
@ExampleObject("serverPie"),
|
||||
@ExampleObject("joinAddressPie"),
|
||||
@ExampleObject("joinAddressByDay"),
|
||||
}),
|
||||
@Parameter(in = ParameterIn.QUERY, name = "server", description = "Server identifier to get data for", examples = {
|
||||
|
@ -209,8 +208,6 @@ public class GraphsJSONResolver extends JSONResolver {
|
|||
return DataID.GRAPH_PUNCHCARD;
|
||||
case "serverPie":
|
||||
return DataID.GRAPH_SERVER_PIE;
|
||||
case "joinAddressPie":
|
||||
return DataID.GRAPH_HOSTNAME_PIE;
|
||||
case "joinAddressByDay":
|
||||
return DataID.JOIN_ADDRESSES_BY_DAY;
|
||||
default:
|
||||
|
@ -241,8 +238,6 @@ public class GraphsJSONResolver extends JSONResolver {
|
|||
return List.of(WebPermission.PAGE_SERVER_PLAYERBASE_GRAPHS);
|
||||
case GRAPH_WORLD_MAP:
|
||||
return List.of(WebPermission.PAGE_SERVER_GEOLOCATIONS_MAP);
|
||||
case GRAPH_HOSTNAME_PIE:
|
||||
return List.of(WebPermission.PAGE_SERVER_JOIN_ADDRESSES_GRAPHS_PIE);
|
||||
case JOIN_ADDRESSES_BY_DAY:
|
||||
return List.of(WebPermission.PAGE_SERVER_JOIN_ADDRESSES_GRAPHS_TIME);
|
||||
default:
|
||||
|
@ -270,8 +265,6 @@ public class GraphsJSONResolver extends JSONResolver {
|
|||
return List.of(WebPermission.PAGE_NETWORK_GEOLOCATIONS_MAP);
|
||||
case GRAPH_ONLINE_PROXIES:
|
||||
return List.of(WebPermission.PAGE_NETWORK_OVERVIEW_GRAPHS_ONLINE);
|
||||
case GRAPH_HOSTNAME_PIE:
|
||||
return List.of(WebPermission.PAGE_NETWORK_JOIN_ADDRESSES_GRAPHS_PIE);
|
||||
case JOIN_ADDRESSES_BY_DAY:
|
||||
return List.of(WebPermission.PAGE_NETWORK_JOIN_ADDRESSES_GRAPHS_TIME);
|
||||
default:
|
||||
|
@ -295,8 +288,6 @@ public class GraphsJSONResolver extends JSONResolver {
|
|||
return graphJSON.serverCalendarJSON(serverUUID);
|
||||
case GRAPH_WORLD_PIE:
|
||||
return graphJSON.serverWorldPieJSONAsMap(serverUUID);
|
||||
case GRAPH_HOSTNAME_PIE:
|
||||
return graphJSON.playerHostnamePieJSONAsMap(serverUUID);
|
||||
case GRAPH_ACTIVITY:
|
||||
return graphJSON.activityGraphsJSONAsMap(serverUUID);
|
||||
case GRAPH_WORLD_MAP:
|
||||
|
@ -336,8 +327,6 @@ public class GraphsJSONResolver extends JSONResolver {
|
|||
return graphJSON.networkCalendarJSON();
|
||||
case GRAPH_SERVER_PIE:
|
||||
return graphJSON.serverPreferencePieJSONAsMap();
|
||||
case GRAPH_HOSTNAME_PIE:
|
||||
return graphJSON.playerHostnamePieJSONAsMap();
|
||||
case GRAPH_WORLD_MAP:
|
||||
return graphJSON.geolocationGraphsJSONAsMap();
|
||||
case GRAPH_ONLINE_PROXIES:
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.djrapitops.plan.storage.database.sql.tables.SessionsTable;
|
|||
import com.djrapitops.plan.storage.database.sql.tables.UsersTable;
|
||||
import com.djrapitops.plan.utilities.dev.Untrusted;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
import org.jetbrains.annotations.VisibleForTesting;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -44,6 +45,7 @@ public class JoinAddressQueries {
|
|||
/* Static method class */
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static Query<Map<String, Integer>> latestJoinAddresses() {
|
||||
String selectLatestJoinAddresses = SELECT +
|
||||
"COUNT(1) as total," +
|
||||
|
@ -67,6 +69,7 @@ public class JoinAddressQueries {
|
|||
joinAddresses.put(UUID.fromString(set.getString(UsersTable.USER_UUID)), set.getString(JoinAddressTable.JOIN_ADDRESS));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static Query<Map<String, Integer>> latestJoinAddresses(ServerUUID serverUUID) {
|
||||
String selectLatestSessionStarts = SELECT + SessionsTable.USER_ID + ",MAX(" + SessionsTable.SESSION_START + ") as max_start" +
|
||||
FROM + SessionsTable.TABLE_NAME + " max_s" +
|
||||
|
|
|
@ -95,7 +95,6 @@ class AccessControlTest {
|
|||
Arguments.of("/v1/graph?type=aggregatedPing&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_PERFORMANCE_GRAPHS, 200, 403),
|
||||
Arguments.of("/v1/graph?type=worldPie&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_SESSIONS_WORLD_PIE, 200, 403),
|
||||
Arguments.of("/v1/graph?type=activity&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_PLAYERBASE_GRAPHS, 200, 403),
|
||||
Arguments.of("/v1/graph?type=joinAddressPie&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_JOIN_ADDRESSES_GRAPHS_PIE, 200, 403),
|
||||
Arguments.of("/v1/graph?type=geolocation&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_GEOLOCATIONS_MAP, 200, 403),
|
||||
Arguments.of("/v1/graph?type=uniqueAndNew&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_ONLINE_ACTIVITY_GRAPHS_DAY_BY_DAY, 200, 403),
|
||||
Arguments.of("/v1/graph?type=hourlyUniqueAndNew&server=" + TestConstants.SERVER_UUID_STRING + "", WebPermission.PAGE_SERVER_ONLINE_ACTIVITY_GRAPHS_HOUR_BY_HOUR, 200, 403),
|
||||
|
@ -122,7 +121,6 @@ class AccessControlTest {
|
|||
Arguments.of("/v1/graph?type=hourlyUniqueAndNew", WebPermission.PAGE_NETWORK_OVERVIEW_GRAPHS_HOUR_BY_HOUR, 200, 403),
|
||||
Arguments.of("/v1/graph?type=serverCalendar", WebPermission.PAGE_NETWORK_OVERVIEW_GRAPHS_CALENDAR, 200, 403),
|
||||
Arguments.of("/v1/graph?type=serverPie", WebPermission.PAGE_NETWORK_SESSIONS_SERVER_PIE, 200, 403),
|
||||
Arguments.of("/v1/graph?type=joinAddressPie", WebPermission.PAGE_NETWORK_JOIN_ADDRESSES_GRAPHS_PIE, 200, 403),
|
||||
Arguments.of("/v1/graph?type=activity", WebPermission.PAGE_NETWORK_PLAYERBASE_GRAPHS, 200, 403),
|
||||
Arguments.of("/v1/graph?type=geolocation", WebPermission.PAGE_NETWORK_GEOLOCATIONS_MAP, 200, 403),
|
||||
Arguments.of("/v1/network/pingTable", WebPermission.PAGE_NETWORK_GEOLOCATIONS_PING_PER_COUNTRY, 200, 403),
|
||||
|
|
|
@ -141,8 +141,7 @@ class AccessControlVisibilityTest {
|
|||
Arguments.arguments(WebPermission.PAGE_SERVER_PLAYERBASE_OVERVIEW, "playerbase-insights", "playerbase"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_PLAYERBASE_GRAPHS, "playerbase-graph", "playerbase"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_PLAYERBASE_GRAPHS, "playerbase-current", "playerbase"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_JOIN_ADDRESSES_GRAPHS_TIME, "join-address-graph", "join-addresses"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_JOIN_ADDRESSES_GRAPHS_PIE, "join-address-groups", "join-addresses"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_JOIN_ADDRESSES_GRAPHS_TIME, "join-address-graph", "server-join-addresses"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_RETENTION, "retention-graph", "retention"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_PLAYERS, "players-table", "players"),
|
||||
Arguments.arguments(WebPermission.PAGE_SERVER_GEOLOCATIONS_MAP, "geolocations", "geolocations"),
|
||||
|
@ -172,8 +171,7 @@ class AccessControlVisibilityTest {
|
|||
Arguments.arguments(WebPermission.PAGE_NETWORK_PLAYERBASE_OVERVIEW, "playerbase-insights", "playerbase"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_PLAYERBASE_GRAPHS, "playerbase-graph", "playerbase"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_PLAYERBASE_GRAPHS, "playerbase-current", "playerbase"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_JOIN_ADDRESSES_GRAPHS_TIME, "join-address-graph", "join-addresses"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_JOIN_ADDRESSES_GRAPHS_PIE, "join-address-groups", "join-addresses"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_JOIN_ADDRESSES_GRAPHS_TIME, "join-address-graph", "network-join-addresses"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_RETENTION, "retention-graph", "retention"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_PLAYERS, "players-table", "players"),
|
||||
Arguments.arguments(WebPermission.PAGE_NETWORK_GEOLOCATIONS_MAP, "geolocations", "geolocations"),
|
||||
|
|
|
@ -264,13 +264,5 @@ class PlayerLeaveEventConsumerTest {
|
|||
List<String> expected = List.of("PLAY.UPPERCASE.COM", "play.uppercase.com", JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
|
||||
List<String> result = database.query(JoinAddressQueries.allJoinAddresses());
|
||||
assertEquals(expected, result);
|
||||
|
||||
Map<String, Integer> expectedMap = Map.of("PLAY.UPPERCASE.COM", 1);
|
||||
Map<String, Integer> resultMap = database.query(JoinAddressQueries.latestJoinAddresses(serverUUID));
|
||||
assertEquals(expectedMap, resultMap);
|
||||
|
||||
expectedMap = Map.of("PLAY.UPPERCASE.COM", 1);
|
||||
resultMap = database.query(JoinAddressQueries.latestJoinAddresses());
|
||||
assertEquals(expectedMap, resultMap);
|
||||
}
|
||||
}
|
|
@ -254,15 +254,6 @@ public interface JoinAddressQueriesTest extends DatabaseTestPreparer {
|
|||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
default void serverJoinAddressQueryHasNoNullValues() {
|
||||
joinAddressCanBeUnknown();
|
||||
|
||||
Map<String, Integer> expected = Collections.singletonMap(JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP, 1);
|
||||
Map<String, Integer> result = db().query(JoinAddressQueries.latestJoinAddresses(serverUUID()));
|
||||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
default void joinAddressQueryHasDistinctPlayers() {
|
||||
joinAddressCanBeUnknown();
|
||||
|
|
|
@ -11,7 +11,7 @@ const AddressGroupSelectorRow = () => {
|
|||
const {list, add, remove, replace, allAddresses} = useJoinAddressListContext();
|
||||
|
||||
return (
|
||||
<Row>
|
||||
<Row id={"address-selector"}>
|
||||
{list.map((group, i) =>
|
||||
<Col lg={2} key={group.uuid}>
|
||||
<AddressGroupCard n={i + 1}
|
||||
|
|
|
@ -12,14 +12,14 @@ const JoinAddresses = ({id, permission, identifier}) => {
|
|||
|
||||
return (
|
||||
<LoadIn>
|
||||
<section className={id}>
|
||||
{seeTime && <section className={id}>
|
||||
<ExtendableRow id={`row-${id}-0`}>
|
||||
<Col lg={12}>
|
||||
{seeTime && <JoinAddressGraphCard identifier={identifier}/>}
|
||||
<JoinAddressGraphCard identifier={identifier}/>
|
||||
</Col>
|
||||
</ExtendableRow>
|
||||
<AddressGroupSelectorRow/>
|
||||
</section>
|
||||
</section>}
|
||||
</LoadIn>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue