mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-09 04:11:50 +01:00
Inspect Page Plugins Tab Structure parsing
This commit is contained in:
parent
b012b09469
commit
ae6f3f8de7
@ -12,6 +12,7 @@ import main.java.com.djrapitops.plan.api.exceptions.*;
|
|||||||
import main.java.com.djrapitops.plan.command.commands.AnalyzeCommand;
|
import main.java.com.djrapitops.plan.command.commands.AnalyzeCommand;
|
||||||
import main.java.com.djrapitops.plan.data.AnalysisData;
|
import main.java.com.djrapitops.plan.data.AnalysisData;
|
||||||
import main.java.com.djrapitops.plan.data.additional.HookHandler;
|
import main.java.com.djrapitops.plan.data.additional.HookHandler;
|
||||||
|
import main.java.com.djrapitops.plan.data.additional.InspectContainer;
|
||||||
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
||||||
import main.java.com.djrapitops.plan.systems.cache.DataCache;
|
import main.java.com.djrapitops.plan.systems.cache.DataCache;
|
||||||
import main.java.com.djrapitops.plan.systems.info.parsing.AnalysisPageParser;
|
import main.java.com.djrapitops.plan.systems.info.parsing.AnalysisPageParser;
|
||||||
@ -30,6 +31,7 @@ import main.java.com.djrapitops.plan.systems.webserver.webapi.universal.PingWebA
|
|||||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||||
import main.java.com.djrapitops.plan.utilities.analysis.Analysis;
|
import main.java.com.djrapitops.plan.utilities.analysis.Analysis;
|
||||||
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
|
import main.java.com.djrapitops.plan.utilities.html.HtmlStructure;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.html.structure.InspectPluginsTabContentCreator;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -52,7 +54,7 @@ public class BukkitInformationManager extends InformationManager {
|
|||||||
private String analysisPluginsTab;
|
private String analysisPluginsTab;
|
||||||
private Long refreshDate;
|
private Long refreshDate;
|
||||||
|
|
||||||
private final Map<UUID, String> pluginsTabContents;
|
private final Map<UUID, String[]> pluginsTabContents;
|
||||||
|
|
||||||
public BukkitInformationManager(Plan plugin) {
|
public BukkitInformationManager(Plan plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -93,6 +95,10 @@ public class BukkitInformationManager extends InformationManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cachePlayer(UUID uuid) {
|
public void cachePlayer(UUID uuid) {
|
||||||
|
if (uuid == null) {
|
||||||
|
Log.debug("BukkitInformationManager.cachePlayer: UUID was null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (usingAnotherWebServer) {
|
if (usingAnotherWebServer) {
|
||||||
try {
|
try {
|
||||||
getWebAPI().getAPI(PostHtmlWebAPI.class).sendInspectHtml(webServerAddress, uuid, getPlayerHtml(uuid));
|
getWebAPI().getAPI(PostHtmlWebAPI.class).sendInspectHtml(webServerAddress, uuid, getPlayerHtml(uuid));
|
||||||
@ -131,14 +137,26 @@ public class BukkitInformationManager extends InformationManager {
|
|||||||
String serverName = plugin.getServerInfoManager().getServerName();
|
String serverName = plugin.getServerInfoManager().getServerName();
|
||||||
HookHandler hookHandler = plugin.getHookHandler();
|
HookHandler hookHandler = plugin.getHookHandler();
|
||||||
List<PluginData> plugins = hookHandler.getAdditionalDataSources();
|
List<PluginData> plugins = hookHandler.getAdditionalDataSources();
|
||||||
// TODO Inspect Plugins Tab
|
Map<PluginData, InspectContainer> containers = new HashMap<>();
|
||||||
// Map<String, Serializable> replaceMap = hookHandler.getAdditionalInspectReplaceRules(uuid);
|
for (PluginData pluginData : plugins) {
|
||||||
// String contents = HtmlStructure.createInspectPluginsTabContent(serverName, plugins, replaceMap);
|
InspectContainer inspectContainer = new InspectContainer();
|
||||||
cacheInspectPluginsTab(uuid, "");
|
try {
|
||||||
|
InspectContainer container = pluginData.getPlayerData(uuid, inspectContainer);
|
||||||
|
if (container != null && !container.isEmpty()) {
|
||||||
|
containers.put(pluginData, container);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
String sourcePlugin = pluginData.getSourcePlugin();
|
||||||
|
Log.error("PluginData caused exception: " + sourcePlugin);
|
||||||
|
Log.toLog(this.getClass().getName() + " " + sourcePlugin, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cacheInspectPluginsTab(UUID uuid, String contents) {
|
cacheInspectPluginsTab(uuid, InspectPluginsTabContentCreator.createContent(containers));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cacheInspectPluginsTab(UUID uuid, String[] contents) {
|
||||||
if (usingAnotherWebServer) {
|
if (usingAnotherWebServer) {
|
||||||
try {
|
try {
|
||||||
getWebAPI().getAPI(PostInspectPluginsTabWebAPI.class).sendPluginsTab(webServerAddress, uuid, contents);
|
getWebAPI().getAPI(PostInspectPluginsTabWebAPI.class).sendPluginsTab(webServerAddress, uuid, contents);
|
||||||
@ -158,8 +176,8 @@ public class BukkitInformationManager extends InformationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPluginsTabContent(UUID uuid) {
|
public String[] getPluginsTabContent(UUID uuid) {
|
||||||
String calculating = HtmlStructure.createInspectPageTabContentCalculating();
|
String[] calculating = HtmlStructure.createInspectPageTabContentCalculating();
|
||||||
return pluginsTabContents.getOrDefault(uuid, calculating);
|
return pluginsTabContents.getOrDefault(uuid, calculating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class BungeeInformationManager extends InformationManager {
|
|||||||
private Map<UUID, ServerInfo> bukkitServers;
|
private Map<UUID, ServerInfo> bukkitServers;
|
||||||
|
|
||||||
private final Map<UUID, String> networkPageContent;
|
private final Map<UUID, String> networkPageContent;
|
||||||
private final Map<UUID, Map<UUID, String>> pluginsTabContent;
|
private final Map<UUID, Map<UUID, String[]>> pluginsTabContent;
|
||||||
private final BungeeServerInfoManager serverInfoManager;
|
private final BungeeServerInfoManager serverInfoManager;
|
||||||
|
|
||||||
public BungeeInformationManager(PlanBungee plugin) throws SQLException {
|
public BungeeInformationManager(PlanBungee plugin) throws SQLException {
|
||||||
@ -246,10 +246,10 @@ public class BungeeInformationManager extends InformationManager {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getPlayerHtml(UUID uuid) {
|
public String getPlayerHtml(UUID uuid) {
|
||||||
Response response = PageCache.loadPage("inspectPage:" + uuid,
|
Response response = PageCache.copyPage("inspectPage:" + uuid,
|
||||||
() -> new NotFoundResponse("No Bukkit Servers were online to process this request"));
|
() -> new NotFoundResponse("No Bukkit Servers were online to process this request"));
|
||||||
if (response instanceof InspectPageResponse) {
|
if (response instanceof InspectPageResponse) {
|
||||||
((InspectPageResponse) response).setInspectPagePluginsTab(pluginsTabContent.get(uuid));
|
((InspectPageResponse) response).setInspectPagePluginsTab(getPluginsTabContent(uuid));
|
||||||
}
|
}
|
||||||
return response.getContent();
|
return response.getContent();
|
||||||
}
|
}
|
||||||
@ -275,17 +275,28 @@ public class BungeeInformationManager extends InformationManager {
|
|||||||
* @return Html string.
|
* @return Html string.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getPluginsTabContent(UUID uuid) {
|
public String[] getPluginsTabContent(UUID uuid) {
|
||||||
Map<UUID, String> pluginsTab = pluginsTabContent.get(uuid);
|
Map<UUID, String[]> pluginsTab = pluginsTabContent.get(uuid);
|
||||||
if (pluginsTab == null) {
|
if (pluginsTab == null) {
|
||||||
return HtmlStructure.createInspectPageTabContentCalculating();
|
return HtmlStructure.createInspectPageTabContentCalculating();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
List<String[]> order = new ArrayList<>(pluginsTab.values());
|
||||||
for (String tab : pluginsTab.values()) {
|
// Sort serverNames alphabetically
|
||||||
builder.append(tab);
|
order.sort(new Comparator<String[]>() {
|
||||||
|
@Override
|
||||||
|
public int compare(String[] o1, String[] o2) {
|
||||||
|
return o1[0].compareTo(o2[1]);
|
||||||
}
|
}
|
||||||
return builder.toString();
|
});
|
||||||
|
|
||||||
|
StringBuilder nav = new StringBuilder();
|
||||||
|
StringBuilder tabs = new StringBuilder();
|
||||||
|
for (String[] tab : order) {
|
||||||
|
nav.append(tab[0]);
|
||||||
|
tabs.append(tab[1]);
|
||||||
|
}
|
||||||
|
return new String[]{nav.toString(), tabs.toString()};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,8 +306,8 @@ public class BungeeInformationManager extends InformationManager {
|
|||||||
* @param uuid UUID of the player
|
* @param uuid UUID of the player
|
||||||
* @param html Plugins tab html for the player on the server
|
* @param html Plugins tab html for the player on the server
|
||||||
*/
|
*/
|
||||||
public void cachePluginsTabContent(UUID serverUUID, UUID uuid, String html) {
|
public void cachePluginsTabContent(UUID serverUUID, UUID uuid, String[] html) {
|
||||||
Map<UUID, String> perServerPluginsTab = pluginsTabContent.getOrDefault(uuid, new HashMap<>());
|
Map<UUID, String[]> perServerPluginsTab = pluginsTabContent.getOrDefault(uuid, new HashMap<>());
|
||||||
perServerPluginsTab.put(serverUUID, html);
|
perServerPluginsTab.put(serverUUID, html);
|
||||||
pluginsTabContent.put(uuid, perServerPluginsTab);
|
pluginsTabContent.put(uuid, perServerPluginsTab);
|
||||||
Response inspectResponse = PageCache.loadPage("inspectPage: " + uuid);
|
Response inspectResponse = PageCache.loadPage("inspectPage: " + uuid);
|
||||||
|
@ -70,7 +70,7 @@ public abstract class InformationManager {
|
|||||||
analysisNotification.put(serverUUID, notify);
|
analysisNotification.put(serverUUID, notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getPluginsTabContent(UUID uuid);
|
public abstract String[] getPluginsTabContent(UUID uuid);
|
||||||
|
|
||||||
public boolean isUsingAnotherWebServer() {
|
public boolean isUsingAnotherWebServer() {
|
||||||
return usingAnotherWebServer;
|
return usingAnotherWebServer;
|
||||||
|
@ -52,6 +52,9 @@ public class InspectPageParser extends PageParser {
|
|||||||
|
|
||||||
public String parse() throws ParseException {
|
public String parse() throws ParseException {
|
||||||
try {
|
try {
|
||||||
|
if (uuid == null) {
|
||||||
|
throw new IllegalStateException("UUID was null!");
|
||||||
|
}
|
||||||
Log.logDebug("Database", "Inspect Parse Fetch");
|
Log.logDebug("Database", "Inspect Parse Fetch");
|
||||||
Benchmark.start("Inspect Parse, Fetch");
|
Benchmark.start("Inspect Parse, Fetch");
|
||||||
Database db = plugin.getDB();
|
Database db = plugin.getDB();
|
||||||
@ -65,6 +68,9 @@ public class InspectPageParser extends PageParser {
|
|||||||
addValue("timeZone", MiscUtils.getTimeZoneOffsetHours());
|
addValue("timeZone", MiscUtils.getTimeZoneOffsetHours());
|
||||||
|
|
||||||
PlayerProfile profile = db.getPlayerProfile(uuid);
|
PlayerProfile profile = db.getPlayerProfile(uuid);
|
||||||
|
if (profile == null) {
|
||||||
|
throw new IllegalStateException("Player profile was null!");
|
||||||
|
}
|
||||||
|
|
||||||
String online = "Offline";
|
String online = "Offline";
|
||||||
Optional<Session> activeSession = plugin.getInfoManager().getDataCache().getCachedSession(uuid);
|
Optional<Session> activeSession = plugin.getInfoManager().getDataCache().getCachedSession(uuid);
|
||||||
|
@ -2,6 +2,7 @@ package main.java.com.djrapitops.plan.systems.webserver;
|
|||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import main.java.com.djrapitops.plan.systems.webserver.response.InspectPageResponse;
|
||||||
import main.java.com.djrapitops.plan.systems.webserver.response.Response;
|
import main.java.com.djrapitops.plan.systems.webserver.response.Response;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -67,6 +68,22 @@ public class PageCache {
|
|||||||
return pageCache.getIfPresent(identifier);
|
return pageCache.getIfPresent(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a copy some responses
|
||||||
|
*
|
||||||
|
* Currently supported copyable responses: InspectPageResponse
|
||||||
|
*
|
||||||
|
* @param identifier The identifier of the page
|
||||||
|
* @return Copied Response of loadPage, so that cache contents are not changed.
|
||||||
|
*/
|
||||||
|
public static Response copyPage(String identifier, PageLoader loader) {
|
||||||
|
Response response = loadPage(identifier, loader);
|
||||||
|
if (response instanceof InspectPageResponse) {
|
||||||
|
return InspectPageResponse.copyOf((InspectPageResponse) response);
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts the page into the page cache.
|
* Puts the page into the page cache.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -2,7 +2,9 @@ package main.java.com.djrapitops.plan.systems.webserver.response;
|
|||||||
|
|
||||||
import main.java.com.djrapitops.plan.systems.info.InformationManager;
|
import main.java.com.djrapitops.plan.systems.info.InformationManager;
|
||||||
import main.java.com.djrapitops.plan.systems.webserver.theme.Theme;
|
import main.java.com.djrapitops.plan.systems.webserver.theme.Theme;
|
||||||
|
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -12,30 +14,37 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class InspectPageResponse extends Response {
|
public class InspectPageResponse extends Response {
|
||||||
|
|
||||||
private String inspectPagePluginsTab;
|
private final UUID uuid;
|
||||||
|
|
||||||
public InspectPageResponse(InformationManager infoManager, UUID uuid) {
|
public InspectPageResponse(InformationManager infoManager, UUID uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
super.setHeader("HTTP/1.1 200 OK");
|
super.setHeader("HTTP/1.1 200 OK");
|
||||||
super.setContent(infoManager.getPlayerHtml(uuid));
|
super.setContent(infoManager.getPlayerHtml(uuid));
|
||||||
setInspectPagePluginsTab(infoManager.getPluginsTabContent(uuid));
|
setInspectPagePluginsTab(infoManager.getPluginsTabContent(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public InspectPageResponse(InformationManager infoManager, UUID uuid, String html) {
|
public InspectPageResponse(InformationManager infoManager, UUID uuid, String html) {
|
||||||
|
this.uuid = uuid;
|
||||||
super.setHeader("HTTP/1.1 200 OK");
|
super.setHeader("HTTP/1.1 200 OK");
|
||||||
super.setContent(Theme.replaceColors(html));
|
super.setContent(Theme.replaceColors(html));
|
||||||
setInspectPagePluginsTab(infoManager.getPluginsTabContent(uuid));
|
setInspectPagePluginsTab(infoManager.getPluginsTabContent(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInspectPagePluginsTab(String inspectPagePluginsTab) {
|
private InspectPageResponse(InspectPageResponse response) {
|
||||||
if (this.inspectPagePluginsTab != null) {
|
this.uuid = response.uuid;
|
||||||
setContent(getContent().replace(this.inspectPagePluginsTab, inspectPagePluginsTab));
|
super.setHeader(response.getHeader());
|
||||||
} else {
|
super.setContent(response.getContent());
|
||||||
setContent(getContent().replace("${tabContentPlugins}", inspectPagePluginsTab));
|
|
||||||
}
|
|
||||||
this.inspectPagePluginsTab = inspectPagePluginsTab;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInspectPagePluginsTab(Map<UUID, String> uuidStringMap) {
|
public void setInspectPagePluginsTab(String[] inspectPagePluginsTab) {
|
||||||
// TODO
|
Map<String, String> replaceMap = new HashMap<>();
|
||||||
|
replaceMap.put("navPluginsTabs", inspectPagePluginsTab[0]);
|
||||||
|
replaceMap.put("pluginsTabs", inspectPagePluginsTab[1]);
|
||||||
|
|
||||||
|
setContent(StrSubstitutor.replace(getContent(), replaceMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InspectPageResponse copyOf(InspectPageResponse response) {
|
||||||
|
return new InspectPageResponse(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ public abstract class Response {
|
|||||||
this.type = ResponseType.HTML.get();
|
this.type = ResponseType.HTML.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getHeader() {
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
public String getResponse() {
|
public String getResponse() {
|
||||||
return header + "\r\n"
|
return header + "\r\n"
|
||||||
+ "Content-Type: " + type + ";\r\n"
|
+ "Content-Type: " + type + ";\r\n"
|
||||||
|
@ -33,9 +33,17 @@ public class PostInspectPluginsTabWebAPI extends WebAPI {
|
|||||||
|
|
||||||
UUID uuid = UUID.fromString(uuidS);
|
UUID uuid = UUID.fromString(uuidS);
|
||||||
UUID serverUUID = UUID.fromString(variables.get("sender"));
|
UUID serverUUID = UUID.fromString(variables.get("sender"));
|
||||||
|
String nav = variables.get("nav");
|
||||||
|
if (nav == null) {
|
||||||
|
return badRequest("nav not included");
|
||||||
|
}
|
||||||
String html = variables.get("html");
|
String html = variables.get("html");
|
||||||
|
if (html == null) {
|
||||||
|
return badRequest("html not included");
|
||||||
|
}
|
||||||
|
String[] content = new String[]{nav, html};
|
||||||
|
|
||||||
((BungeeInformationManager) plugin.getInfoManager()).cachePluginsTabContent(serverUUID, uuid, html);
|
((BungeeInformationManager) plugin.getInfoManager()).cachePluginsTabContent(serverUUID, uuid, content);
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
@ -45,9 +53,10 @@ public class PostInspectPluginsTabWebAPI extends WebAPI {
|
|||||||
throw new IllegalStateException("Wrong method call for this WebAPI, call sendRequest(String, UUID, UUID) instead.");
|
throw new IllegalStateException("Wrong method call for this WebAPI, call sendRequest(String, UUID, UUID) instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPluginsTab(String address, UUID uuid, String html) throws WebAPIException {
|
public void sendPluginsTab(String address, UUID uuid, String[] html) throws WebAPIException {
|
||||||
addVariable("uuid", uuid.toString());
|
addVariable("uuid", uuid.toString());
|
||||||
addVariable("html", html);
|
addVariable("nav", html[0]);
|
||||||
|
addVariable("html", html[1]);
|
||||||
super.sendRequest(address);
|
super.sendRequest(address);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,6 @@ import main.java.com.djrapitops.plan.data.Session;
|
|||||||
import main.java.com.djrapitops.plan.database.Database;
|
import main.java.com.djrapitops.plan.database.Database;
|
||||||
import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager;
|
import main.java.com.djrapitops.plan.systems.info.BukkitInformationManager;
|
||||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
|
||||||
import main.java.com.djrapitops.plan.utilities.html.graphs.PlayerActivityGraphCreator;
|
import main.java.com.djrapitops.plan.utilities.html.graphs.PlayerActivityGraphCreator;
|
||||||
import main.java.com.djrapitops.plan.utilities.html.structure.SessionTabStructureCreator;
|
import main.java.com.djrapitops.plan.utilities.html.structure.SessionTabStructureCreator;
|
||||||
import main.java.com.djrapitops.plan.utilities.html.tables.SessionsTableCreator;
|
import main.java.com.djrapitops.plan.utilities.html.tables.SessionsTableCreator;
|
||||||
@ -72,26 +71,17 @@ public class HtmlStructure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] getSessionsAsTable(Map<String, List<Session>> sessions, List<Session> allSessions, UUID uuid) {
|
public static String[] createInspectPageTabContentCalculating() {
|
||||||
Map<Integer, UUID> uuidByID = new HashMap<>();
|
String tab = "<div class=\"tab\">" +
|
||||||
for (List<Session> sessionList : sessions.values()) {
|
"<div class=\"row clearfix\">" +
|
||||||
for (Session session : sessionList) {
|
"<div class=\"col-lg-12 col-md-12 col-sm-12 col-xs-12\">" +
|
||||||
uuidByID.put(session.getSessionID(), uuid);
|
"<div class=\"card\">" +
|
||||||
}
|
"<div class=\"header\"><h2><i class=\"fa fa-users\"></i> Plugin Data</h2></div>" +
|
||||||
}
|
"<div class=\"body\">" +
|
||||||
|
"<p><i class=\"fa fa-spin fa-refresh\"></i> Calculating Plugins tab, refresh (F5) shortly..</p>" +
|
||||||
return new String[]{/*Html.TABLE_SESSIONS.parse(SessionsTableCreator.createTable(uuidByID, allSessions)[0]),*/"", ""};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createInspectPageTabContentCalculating() {
|
|
||||||
return "<div class=\"row\">" +
|
|
||||||
"<div class=\"column\">" +
|
|
||||||
"<div class=\"box-header\">" +
|
|
||||||
"<h2><i class=\"fa fa-cube\" aria-hidden=\"true\"></i> No Plugins</h2></div>" +
|
|
||||||
"<div class=\"box plugin\">" +
|
|
||||||
"<p><i class=\"fa fa-refresh fa-spin\" aria-hidden=\"true\"></i> Plugins tab is still being calculated, please refresh the page after a while (F5)</p>" +
|
|
||||||
"</div></div>" +
|
"</div></div>" +
|
||||||
"</div>";
|
"</div></div></div>";
|
||||||
|
return new String[]{"<li><a>Calculating... Refresh shortly</a></li>", tab};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createNetworkPageContent(Map<UUID, String> networkPageContents) {
|
public static String createNetworkPageContent(Map<UUID, String> networkPageContents) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
package main.java.com.djrapitops.plan.utilities.html.structure;
|
package main.java.com.djrapitops.plan.utilities.html.structure;
|
||||||
|
|
||||||
import main.java.com.djrapitops.plan.data.additional.AnalysisContainer;
|
import main.java.com.djrapitops.plan.data.additional.AnalysisContainer;
|
||||||
|
import main.java.com.djrapitops.plan.data.additional.InspectContainer;
|
||||||
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
||||||
import main.java.com.djrapitops.plan.utilities.analysis.Analysis;
|
import main.java.com.djrapitops.plan.utilities.analysis.Analysis;
|
||||||
import main.java.com.djrapitops.plan.utilities.comparators.PluginDataNameComparator;
|
import main.java.com.djrapitops.plan.utilities.comparators.PluginDataNameComparator;
|
||||||
@ -85,7 +86,7 @@ public class AnalysisPluginsTabContentCreator {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void appendThird(PluginData pluginData, AnalysisContainer container, StringBuilder generalTab) {
|
public static void appendThird(PluginData pluginData, InspectContainer container, StringBuilder generalTab) {
|
||||||
generalTab.append("<div class=\"col-xs-12 col-sm-12 col-md-4 col-lg-4\">" +
|
generalTab.append("<div class=\"col-xs-12 col-sm-12 col-md-4 col-lg-4\">" +
|
||||||
"<div class=\"card\">" +
|
"<div class=\"card\">" +
|
||||||
"<div class=\"header\">" +
|
"<div class=\"header\">" +
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Licence is provided in the jar as license.yml also here:
|
||||||
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||||
|
*/
|
||||||
|
package main.java.com.djrapitops.plan.utilities.html.structure;
|
||||||
|
|
||||||
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
|
import main.java.com.djrapitops.plan.data.additional.InspectContainer;
|
||||||
|
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
||||||
|
import main.java.com.djrapitops.plan.systems.info.server.BukkitServerInfoManager;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.comparators.PluginDataNameComparator;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* //TODO Class Javadoc Comment
|
||||||
|
*
|
||||||
|
* @author Rsl1122
|
||||||
|
*/
|
||||||
|
public class InspectPluginsTabContentCreator {
|
||||||
|
|
||||||
|
public static String[] createContent(Map<PluginData, InspectContainer> containers) {
|
||||||
|
BukkitServerInfoManager serverInfoManager = Plan.getInstance().getServerInfoManager();
|
||||||
|
String serverName = serverInfoManager.getServerName();
|
||||||
|
String actualServerName = serverName.equals("Plan") ? "Server " + serverInfoManager.getServerID() : serverName;
|
||||||
|
String nav = "<li><a class=\"nav-button\" href=\"javascript:void(0)\">" + actualServerName + "</a></li>";
|
||||||
|
|
||||||
|
StringBuilder tab = new StringBuilder();
|
||||||
|
tab.append("<div class=\"tab\"><div class=\"row clearfix\">");
|
||||||
|
|
||||||
|
List<PluginData> order = new ArrayList<>(containers.keySet());
|
||||||
|
order.sort(new PluginDataNameComparator());
|
||||||
|
|
||||||
|
for (PluginData pluginData : order) {
|
||||||
|
InspectContainer container = containers.get(pluginData);
|
||||||
|
AnalysisPluginsTabContentCreator.appendThird(pluginData, container, tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
tab.append("</div></div>");
|
||||||
|
|
||||||
|
return new String[]{nav, tab.toString()};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user