mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
#61 Link to remoteMap on /slaves and /nodeDetails if LUAmod is detected
This commit is contained in:
1 parent
84cded0cf9
commit
b9912f09f9
3 files changed
+40
-9
No files matched your search
@@ -16,6 +16,9 @@
|
||||
background-color: #444;
|
||||
height:400px;
|
||||
}
|
||||
#hero .subtitle {
|
||||
margin-left:8px;
|
||||
}
|
||||
|
||||
#header h1 {
|
||||
margin-left: 10px;
|
||||
@@ -40,7 +43,8 @@
|
||||
ul {
|
||||
width:300px;
|
||||
list-style:none;
|
||||
max-height:100px;
|
||||
max-height:400px;
|
||||
min-height:100px;
|
||||
margin:0;
|
||||
overflow:auto;
|
||||
padding:0;
|
||||
|
||||
+19
-6
@@ -56,7 +56,7 @@ populateSlaveInfo();
|
||||
function populateSlaveInfo(){
|
||||
let instanceID = getParameterByName("instanceID");
|
||||
if(!instanceID){
|
||||
throw "We need instanceID! GIVE US SLAVEID! ALL HAIL OUR NEW OVERLORDS!"
|
||||
throw "We need instanceID! Also, *funny joke* but it doesn't work after I standardized on calling it instanceID";
|
||||
}
|
||||
getJSON("/api/slaves", function(err, slaveData){
|
||||
/*
|
||||
@@ -89,17 +89,30 @@ function populateSlaveInfo(){
|
||||
if(slave.publicIP != "localhost"){
|
||||
HTML += "<h6>IP: "+slave.publicIP+":"+slave.serverPort+"</h6>";
|
||||
} else {
|
||||
HTML += "<h6>This server is not configured for incoming connections</h6>"
|
||||
HTML += "<h6>This server is not configured for incoming connections</h6>";
|
||||
}
|
||||
HTML += "</div></div>" // end of header
|
||||
// left container
|
||||
HTML += "<div id='leftHeroContainer'>"
|
||||
HTML += "<div id='displayBody'><p>Last seen: <span id='lastSeenDate'>"+moment(Number(slave.time)).fromNow()+"</span></p>"
|
||||
HTML += "<p>Online players: "+slave.playerCount+"</p>"
|
||||
HTML += "<div id='leftHeroContainer'>";
|
||||
HTML += "<div id='displayBody'><p>Last seen: <span id='lastSeenDate'>"+moment(Number(slave.time)).fromNow()+"</span></p>";
|
||||
HTML += "<p>Online players: "+slave.playerCount+"</p>";
|
||||
|
||||
// detect if remoteMap mod is installed, if it is we want to show the link for it
|
||||
let hasRemoteMap = false;
|
||||
slave.mods.forEach(mod => {
|
||||
console.log(mod.modName)
|
||||
if(mod.modName.includes("remoteMap")){
|
||||
hasRemoteMap = true; // we are still doing the logic on the outside, in case there are multiple instances of remoteMap installed....
|
||||
}
|
||||
});
|
||||
if(hasRemoteMap){
|
||||
HTML += "<a href='/remoteMap?instanceID="+getParameterByName("instanceID")+"'>Remote map</a>";
|
||||
}
|
||||
|
||||
HTML += "</div>" // end of displayBody
|
||||
|
||||
// list mods and other metadata
|
||||
HTML += "<h2>Mods</h2><ul id='modlist'>"
|
||||
HTML += "<h2 class='subtitle'>Mods</h2><ul id='modlist'>"
|
||||
for(let i = 0; i < slave.mods.length; i++){
|
||||
HTML += "<li>"+slave.mods[i].modName+"</li>"
|
||||
}
|
||||
|
||||
+16
-2
@@ -16,8 +16,22 @@ setTimeout(function() {
|
||||
HTML += '<div id="' + slaveData[key].unique + '" class="productionGraph" style="width: calc(100% - 200px);"></div>';
|
||||
HTML += "<a href='nodeDetails?instanceID="+slaveData[key].unique+"'><h2>" + slaveData[key].instanceName + "</h2></a><p>ID: " + slaveData[key].unique + "</p><p>Last seen: "+seenDate+"</p><p>Online players: "+slaveData[key].playerCount+"</p><p>IP: "+slaveData[key].publicIP +":"+ slaveData[key].serverPort+"</p>"
|
||||
HTML += "<p>Host: "+slaveData[key].mac+"</p>";
|
||||
HTML += "<button onclick='hideAllDatasets(\"" + slaveData[key].unique + "\")\'>Hide all</button>";
|
||||
HTML += "<button onclick='showAllDatasets(\"" + slaveData[key].unique + "\")\'>Show all</button>";
|
||||
|
||||
// detect if remoteMap mod is installed, if it is we want to show the link for it
|
||||
let hasRemoteMap = false;
|
||||
slaveData[key].mods.forEach(mod => {
|
||||
console.log(mod.modName);
|
||||
if(mod.modName.includes("remoteMap")){
|
||||
hasRemoteMap = true; // we are still doing the logic on the outside, in case there are multiple instances of remoteMap installed....
|
||||
}
|
||||
});
|
||||
if(hasRemoteMap){
|
||||
HTML += "<a href='/remoteMap?instanceID="+slaveData[key].unique+"'>Remote map</a>"
|
||||
}
|
||||
|
||||
HTML += "<br><p>Graph tools:</p>";
|
||||
HTML += "<button style='width:100px;' onclick='hideAllDatasets(\"" + slaveData[key].unique + "\")\'>Hide all</button>";
|
||||
HTML += "<button style='width:100px;' onclick='showAllDatasets(\"" + slaveData[key].unique + "\")\'>Show all</button>";
|
||||
HTML += "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user