Commit 765f783c authored by jonasled's avatar jonasled

Merge branch 'develop'

parents f5e6b42d 8a1c4ace
......@@ -91,6 +91,11 @@ public class ClusterActivity extends AppCompatActivity {
totpToken = HelperFunctions.decryptMsg(android.util.Base64.decode(cursor.getString(7), android.util.Base64.DEFAULT));
}
HelperFunctions.hostname = urlString.split("//")[1].split("/")[0];
if(HelperFunctions.hostname.contains(":")){
HelperFunctions.hostname = HelperFunctions.hostname.split(":")[0];
}
postContent = "username=" + username + "@" + cursor.getString(3) + "&password=" + password;
new loginAsync().execute(urlString, postContent, totpToken);//login to server
......@@ -194,8 +199,6 @@ public class ClusterActivity extends AppCompatActivity {
sb.append(line + "\n");
}
System.out.println("output: " + sb.toString());
login = (JSONObject) (new JSONObject(sb.toString())).get("data");//parse the JSON
ticket = login.getString("ticket");//get the ticket
CSRFPreventionToken = login.getString("CSRFPreventionToken");//get the CSRFPreventionToken
......
......@@ -47,6 +47,7 @@ public class HelperFunctions {
public static SSLContext context;
public static HostnameVerifier hostnameVerifier;
public static String lastConnectName = ""; //we declare this variable here, becuase if we restart the ClusterActivity Class it will reset the variable
public static String hostname = ""; // used for the hostname verifier
public static String humanReadableByteCountBin(long bytes) { //Convert a byte long to a String with suitable extension
......@@ -101,8 +102,8 @@ public class HelperFunctions {
try {
hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true; //allow all hostnames
public boolean verify(String hostname_, SSLSession session) {
return hostname_.equals(hostname);
}
};
......
......@@ -236,6 +236,11 @@ public class NewServer extends AppCompatActivity {
return;
}
HelperFunctions.hostname = inputURL.getText().toString().split("//")[1].split("/")[0];
if(HelperFunctions.hostname.contains(":")){
HelperFunctions.hostname = HelperFunctions.hostname.split(":")[0];
}
String totpToken2 = "";
if(checkBoxRequiresTOTP.isChecked())totpToken2 = inputTOTP.getText().toString();
new testLogin().execute(inputURL.getText().toString(), "username=" + inputUser.getText().toString() + "@" + inputRealm.getText().toString() + "&password=" + inputPassword.getText().toString(), totpToken2);
......
......@@ -188,7 +188,10 @@ public class NodeControlActivity extends AppCompatActivity {
Format formatter = new SimpleDateFormat("HH:mm");
return formatter.format(value);
} else {
return super.formatLabel(value, false) + " %";
if(value <= 0) return "0";
else{
return HelperFunctions.humanReadableByteCountBin((long) value);
}
}
}
});
......@@ -232,7 +235,10 @@ public class NodeControlActivity extends AppCompatActivity {
Format formatter = new SimpleDateFormat("HH:mm");
return formatter.format(value);
} else {
return super.formatLabel(value, false) + " kB";
if(value <= 0) return "0";
else{
return HelperFunctions.humanReadableByteCountBin((long) value);
}
}
}
});
......@@ -503,12 +509,12 @@ public class NodeControlActivity extends AppCompatActivity {
for(int i=0; i < graphJson.length(); i++) {
JSONObject temp = graphJson.getJSONObject(i);
try{
ramGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,(temp.getDouble("memused") / temp.getDouble("memtotal")) * 100), true, graphJson.length());
cpuGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,(temp.getDouble("cpu")) * 100), true, graphJson.length());
ramGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("memused") ), true, graphJson.length());
cpuGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("cpu") * 100), true, graphJson.length());
ioGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,(temp.getDouble("iowait")) * 100), true, graphJson.length());
utilizatioGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000, temp.getDouble("loadavg")), true, graphJson.length());
networkInGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netin") / 1000), true, graphJson.length());
networkOutGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netout") / 1000), true, graphJson.length());
networkInGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netin")), true, graphJson.length());
networkOutGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netout")), true, graphJson.length());
} catch (Exception e) {e.printStackTrace();} //Sometimes one entry is missing
}
......
......@@ -227,7 +227,10 @@ public class ServerControlActivity extends AppCompatActivity {
}
return formatter.format(value);
} else {
return super.formatLabel(value, false) + " %";
if(value <= 0) return "0";
else{
return HelperFunctions.humanReadableByteCountBin((long) value);
}
}
}
});
......@@ -259,7 +262,10 @@ public class ServerControlActivity extends AppCompatActivity {
}
return formatter.format(value);
} else {
return super.formatLabel(value, false) + " kB";
if(value <= 0) return "0";
else{
return HelperFunctions.humanReadableByteCountBin((long) value);
}
}
}
});
......@@ -275,7 +281,10 @@ public class ServerControlActivity extends AppCompatActivity {
}
return formatter.format(value);
} else {
return super.formatLabel(value, false) + " kB";
if(value <= 0) return "0";
else{
return HelperFunctions.humanReadableByteCountBin((long) value);
}
}
}
});
......@@ -558,12 +567,12 @@ public class ServerControlActivity extends AppCompatActivity {
for(int i=0; i < graphJson.length(); i++) {
JSONObject temp = graphJson.getJSONObject(i);
try{
ramGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,(temp.getDouble("mem") / temp.getDouble("maxmem")) * 100), true, graphJson.length());
cpuGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,(temp.getDouble("cpu")) * 100), true, graphJson.length());
hddWriteGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("diskwrite") / 1000), true, graphJson.length());
hddReadGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("diskread") / 1000), true, graphJson.length());
networkInGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netin") / 1000), true, graphJson.length());
networkOutGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netout") / 1000), true, graphJson.length());
ramGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("mem")), true, graphJson.length());
cpuGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("cpu") * 100), true, graphJson.length());
hddWriteGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("diskwrite")), true, graphJson.length());
hddReadGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("diskread")), true, graphJson.length());
networkInGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netin")), true, graphJson.length());
networkOutGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000,temp.getDouble("netout")), true, graphJson.length());
} catch (Exception e) {} //Sometimes one entry is missing
}
......
......@@ -122,7 +122,10 @@ public class StorageControlActivity extends AppCompatActivity {
}
return formatter.format(value);
} else {
return super.formatLabel(value, false) + " %";
if(value <= 0) return "0";
else{
return HelperFunctions.humanReadableByteCountBin((long) value);
}
}
}
});
......@@ -222,7 +225,7 @@ public class StorageControlActivity extends AppCompatActivity {
for(int i=0; i < graphJson.length(); i++) {
JSONObject temp = graphJson.getJSONObject(i);
try {
usageGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000, (temp.getDouble("used") / temp.getDouble("total")) * 100), true, graphJson.length());
usageGraphSeries.appendData(new DataPoint(temp.getLong("time") * 1000, temp.getDouble("used")), true, graphJson.length());
} catch (Exception e) {
e.printStackTrace();
}
......
Neue Funktionen:
* Die Einheit der Graphen wird nun automatisch angepasst.
* RAM / Festplattenverwendung Diagramme zeigen reale Werte statt Prozent an.
Fehlerbehebung:
* Schwarzes Design funktioniert nun auch in der VM / Container Steuerung.
* Durchschnitt / Maximum Spinner wurde in der Speicher Ansicht entfernt, da nicht unterstützt von Proxmox
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment