Change analysis.html to server.html

Remove the percentage signs at addValue
This commit is contained in:
Fuzzlemann 2017-08-20 17:34:54 +02:00
parent d03626b34c
commit 5d7b54cdd4
10 changed files with 31 additions and 32 deletions

View File

@ -211,15 +211,15 @@ public class API {
* <p>
* Check if the data is cached to AnalysisCache before calling this.
*
* @return analysis.html with all placeholders replaced.
* @return server.html with all placeholders replaced.
*/
public String getAnalysisHtmlAsString() {
WebServer server = plugin.getUiServer();
if (Verify.notNull(server)) {
return server.getDataReqHandler().getAnalysisHtml();
return server.getDataReqHandler().getServerHtml();
}
DataRequestHandler reqH = new DataRequestHandler(plugin);
return reqH.getAnalysisHtml();
return reqH.getServerHtml();
}
/**

View File

@ -21,7 +21,7 @@ import java.util.Map;
* analysed using the analysis method.
* <p>
* After being analysed the ReplaceMap can be retrieved for replacing
* placeholders on the analysis.html file.
* placeholders on the server.html file.
*
* @author Rsl1122
* @since 3.5.2

View File

@ -73,7 +73,7 @@ public class HookHandler {
/**
* Used to get the Layout with PluginData placeholders to replace %plugins%
* placeholder on analysis.html.
* placeholder on server.html.
*
* @return html, getPluginsTabLayout-method
* @see HtmlUtils
@ -85,7 +85,7 @@ public class HookHandler {
}
/**
* Used to get the Layout with PluginData placeholders to replace %plugins%
* Used to get the Layout with PluginData placeholders to replace ${plugins}
* placeholder on player.html.
*
* @return html, getPluginsTabLayout-method

View File

@ -83,7 +83,7 @@ public class ActivityPart extends RawData {
private void playerActivityGraphs() {
List<TPS> tpsData = tpsPart.getTpsData();
addValue("playersonlineseries", PlayerActivityGraphCreator.buildSeriesDataString(tpsData));
addValue("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL.toString());
addValue("playersgraphcolor", Settings.HCOLOR_ACT_ONL.toString());
}
private void activityPiechart() {
@ -93,24 +93,24 @@ public class ActivityPart extends RawData {
final String colJoi = Settings.HCOLOR_ACTP_JON.toString();
final String colBan = Settings.HCOLOR_ACTP_BAN.toString();
addValue("%activecol%", colAct);
addValue("%inactivecol%", colIna);
addValue("%joinleavecol%", colJoi);
addValue("%bancol%", colBan);
addValue("activecol", colAct);
addValue("inactivecol", colIna);
addValue("joinleavecol", colJoi);
addValue("bancol", colBan);
String activityColors = HtmlUtils.separateWithQuotes(
"#" + colAct, "#" + colIna, "#" + colJoi, "#" + colBan
);
addValue("%activitycolors%", activityColors);
addValue("activitycolors", activityColors);
String activityLabels = "[" + HtmlUtils.separateWithQuotes(
"Active", "Inactive", "Unknown", "Banned") + "]";
addValue("%labelsactivity%", activityLabels);
addValue("labelsactivity", activityLabels);
addValue("activitydata", Arrays.toString(counts));
addValue("%active%", counts[0]);
addValue("%inactive%", counts[1]);
addValue("%joinleaver%", counts[2]);
addValue("%banned%", counts[3]);
addValue("active", counts[0]);
addValue("inactive", counts[1]);
addValue("joinleaver", counts[2]);
addValue("banned", counts[3]);
}
public void addBan(UUID uuid) {

View File

@ -58,17 +58,17 @@ public class GamemodePart extends RawData {
String col2 = Settings.HCOLOR_GMP_2.toString();
String col3 = Settings.HCOLOR_GMP_3.toString();
addValue("%gm0col%", col0);
addValue("%gm1col%", col1);
addValue("%gm2col%", col2);
addValue("%gm3col%", col3);
addValue("gm0col", col0);
addValue("gm1col", col1);
addValue("gm2col", col2);
addValue("gm3col", col3);
String gmColors = HtmlUtils.separateWithQuotes(
"#" + col0, "#" + col1, "#" + col2, "#" + col3
);
String gmLabels = "[" + HtmlUtils.separateWithQuotes(
"Survival", "Creative", "Adventure", "Spectator") + "]";
addValue("%gmcolors%", gmColors);
addValue("%gmlabels%", gmLabels);
addValue("gmcolors", gmColors);
addValue("gmlabel", gmLabels);
// Adds Percentage indicators
for (int i = 0; i < percentages.length; i++) {

View File

@ -68,7 +68,7 @@ public abstract class RawData {
/**
* Adds a placeholder to the replaceMap.
*
* @param placeholder placeholder, with or without % signs.
* @param placeholder placeholder, without prefix and suffix
* @param value Any value the placeholder should be replaced with.
*/
public void addValue(String placeholder, Serializable value) {

View File

@ -63,21 +63,20 @@ public class DataRequestHandler {
}
/**
* Returns the analysis.html as string with replaced placeholders.
* Returns the server.html as string with replaced placeholders.
*
* @return the html
*/
@Deprecated //analysis.html has been removed //TODO server.html
public String getAnalysisHtml() {
public String getServerHtml() {
try {
if (!analysisCache.isCached()) {
return "<h1>404 Data was not found in cache</h1>";
}
return HtmlUtils.replacePlaceholders(
HtmlUtils.getStringFromResource("analysis.html"),
HtmlUtils.getStringFromResource("server.html"),
PlaceholderUtils.getAnalysisReplaceRules(analysisCache.getData()));
} catch (FileNotFoundException ex) {
return "<h1>404 analysis.html was not found</h1>";
return "<h1>404 server.html was not found</h1>";
}
}

View File

@ -10,6 +10,6 @@ public class AnalysisPageResponse extends Response {
public AnalysisPageResponse(DataRequestHandler h) {
super.setHeader("HTTP/1.1 200 OK");
super.setContent(h.getAnalysisHtml());
super.setContent(h.getServerHtml());
}
}

View File

@ -141,7 +141,7 @@ public class ExportUtility {
return;
}
serverFolder.mkdirs();
String analysisHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getStringFromResource("analysis.html"), //TODO server.html
String analysisHtml = HtmlUtils.replacePlaceholders(HtmlUtils.getStringFromResource("server.html"),
PlaceholderUtils.getAnalysisReplaceRules(analysisData))
.replace(HtmlUtils.getInspectUrl(""), "../player/");
File analysisHtmlFile = new File(serverFolder, "index.html");

View File

@ -89,7 +89,7 @@ public class TestInit {
// Html Files
File analysis = new File(getClass().getResource("/server.html").getPath());
when(planMock.getResource("analysis.html")).thenReturn(new FileInputStream(analysis));
when(planMock.getResource("server.html")).thenReturn(new FileInputStream(analysis));
File player = new File(getClass().getResource("/player.html").getPath());
when(planMock.getResource("player.html")).thenReturn(new FileInputStream(player));