MCSM: компонент WebConsole
This commit is contained in:
@@ -26,6 +26,7 @@ public class MCSM_WebModule extends WebModule {
|
||||
private final String MODULE_NAME = "mcsmanager";
|
||||
private final String MODULE_URL = "/"+MODULE_NAME;
|
||||
private final Pattern URL_PATTERN_JS = Pattern.compile(MODULE_URL+"/(\\w+)\\.js");
|
||||
private final Pattern URL_PATTERN_CSS = Pattern.compile(MODULE_URL+"/(\\w+)\\.css");
|
||||
private Manager manager;
|
||||
|
||||
MCSM_WebModule(Manager manager) {
|
||||
@@ -66,6 +67,19 @@ public class MCSM_WebModule extends WebModule {
|
||||
this.sendContent(httpExchange, 0, stream);
|
||||
return true;
|
||||
}
|
||||
|
||||
//FIXME дублирование кода
|
||||
matcher = URL_PATTERN_CSS.matcher(urlPath);
|
||||
if (matcher.find()) {
|
||||
InputStream stream = getClass().getResourceAsStream("/" + matcher.group(1) + ".css");
|
||||
if (stream == null) {
|
||||
this.sendHttpCode(httpExchange, 404, "not found");
|
||||
return true;
|
||||
}
|
||||
httpExchange.getResponseHeaders().add("Content-Type", "text/css;charset=utf-8");
|
||||
this.sendContent(httpExchange, 0, stream);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -29,6 +29,10 @@ var NvLineChart = React.createClass({
|
||||
this.d3ChartData.datum(this.props.datum);
|
||||
this.d3ChartData.transition().duration(500).call(this.chart);
|
||||
nv.utils.windowResize(this.chart.update);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
var nvtooltip = document.querySelector('div[class~="nvtooltip"]');
|
||||
nvtooltip.parentElement.removeChild(nvtooltip)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -58,6 +62,24 @@ var Tabs = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
var WebConsole = React.createClass({
|
||||
render: function(){return(
|
||||
ce('div', {id: 'webconsole'},
|
||||
ce('p', null, '[19:50:18 WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!'),
|
||||
ce('p', null, '[19:50:18 WARN]: The server will make no attempt to authenticate usernames. Beware.'),
|
||||
ce('p', null, '[19:50:18 WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.'),
|
||||
ce('p', null, '[19:50:18 WARN]: To change this, set "online-mode" to "true" in the server.properties file.'),
|
||||
ce('p', null, '[19:50:18 INFO]: **** Beginning UUID conversion, this may take A LONG time ****'),
|
||||
ce('p', null, '[19:50:18 INFO]: Preparing level "voidworld"'),
|
||||
ce('p', null, '[19:50:18 INFO]: -------- World Settings For [voidworld] --------'),
|
||||
ce('p', null, '[19:50:18 INFO]: Arrow Despawn Rate: 1200'),
|
||||
ce('p', null, '[19:50:18 INFO]: Item Merge Radius: 2.5'),
|
||||
ce('p', null, '[19:50:18 INFO]: Item Despawn Rate: 6000'),
|
||||
ce('p', null, '[19:50:18 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true')
|
||||
)
|
||||
)}
|
||||
});
|
||||
|
||||
var ServerInfo = React.createClass({
|
||||
getInitialState: function(){return {
|
||||
title: null,
|
||||
@@ -77,7 +99,7 @@ var ServerInfo = React.createClass({
|
||||
area: true,
|
||||
values: this.state.data
|
||||
}]}),
|
||||
ce('p', null, 'fake console element')
|
||||
ce(WebConsole)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -60,6 +60,8 @@ var ContentModule = React.createClass({
|
||||
function(){ _this.setState({nvScriptReady: -5}); console.error('d3 - error'); }
|
||||
);
|
||||
|
||||
loadStyle("/mcsmanager/moduleStyle.css");
|
||||
|
||||
this.requestServerList();
|
||||
},
|
||||
render: function(){
|
||||
|
||||
11
mcserver-manager/src/main/resources/moduleStyle.css
Normal file
11
mcserver-manager/src/main/resources/moduleStyle.css
Normal file
@@ -0,0 +1,11 @@
|
||||
#webconsole {
|
||||
background-color: #1e1e1e;
|
||||
color: #eee;
|
||||
height: 500px;
|
||||
padding: 8px;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
#webconsole p {
|
||||
margin: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user