mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-18 19:14:54 +00:00
Add thumbnails for the kpi pngs.
Needs some html work still it seems, thumbnails are too large.
This commit is contained in:
63
gui/kpi.java
63
gui/kpi.java
@@ -105,19 +105,24 @@ public class kpi {
|
|||||||
File f2 = file2.toFile(); // this is the test case dir in the test run
|
File f2 = file2.toFile(); // this is the test case dir in the test run
|
||||||
// Directory full of test results?
|
// Directory full of test results?
|
||||||
if (f2.isDirectory()) {
|
if (f2.isDirectory()) {
|
||||||
File kf = new File(f2.getAbsolutePath() + File.separator + "kpi.csv");
|
DirectoryStream<Path> stream3 = Files.newDirectoryStream(file2);
|
||||||
try {
|
Test test = new Test(f2.getName());
|
||||||
BufferedReader br = new BufferedReader(new FileReader(kf));
|
|
||||||
if (test_names.get(f2.getName()) == null) {
|
|
||||||
test_names.put(f2.getName(), f2.getName());
|
|
||||||
test_namesv.add(f2.getName());
|
|
||||||
}
|
|
||||||
if (run == null) {
|
if (run == null) {
|
||||||
run = new Run(f.getName());
|
run = new Run(f.getName());
|
||||||
runs.add(run);
|
runs.add(run);
|
||||||
}
|
}
|
||||||
Test test = new Test(f2.getName());
|
|
||||||
run.addTest(test);
|
run.addTest(test);
|
||||||
|
|
||||||
|
for (Path file3: stream3) {
|
||||||
|
File f3 = file3.toFile();
|
||||||
|
String fname = f3.getName();
|
||||||
|
if (fname.equals("kpi.csv")) {
|
||||||
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(f3));
|
||||||
|
if (test_names.get(f2.getName()) == null) {
|
||||||
|
test_names.put(f2.getName(), f2.getName());
|
||||||
|
test_namesv.add(f2.getName());
|
||||||
|
}
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
test.addLine(line);
|
test.addLine(line);
|
||||||
@@ -129,6 +134,11 @@ public class kpi {
|
|||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}// if kpi.csv
|
||||||
|
else if (fname.startsWith("kpi-") && fname.endsWith(".png")) {
|
||||||
|
test.addKpiImage(fname);
|
||||||
|
}
|
||||||
|
}// for all files in the test dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,6 +380,8 @@ public class kpi {
|
|||||||
|
|
||||||
String test_bed = "Test Bed";
|
String test_bed = "Test Bed";
|
||||||
String last_run = "";
|
String last_run = "";
|
||||||
|
String last_run_kpi_images = "";
|
||||||
|
StringBuffer pngs = new StringBuffer();
|
||||||
|
|
||||||
boolean cp = true;
|
boolean cp = true;
|
||||||
for (int i = 0; i<runs.size(); i++) {
|
for (int i = 0; i<runs.size(); i++) {
|
||||||
@@ -378,7 +390,35 @@ public class kpi {
|
|||||||
String row_text = ("<tr><td>" + i + "</td><td><a href=\"" + run.getName() + "/index.html\">" + run.getName() + "</a></td><td>" + run.getDate()
|
String row_text = ("<tr><td>" + i + "</td><td><a href=\"" + run.getName() + "/index.html\">" + run.getName() + "</a></td><td>" + run.getDate()
|
||||||
+ "</td><td>" + run.getDutHwVer() + "</td><td>" + run.getDutSwVer()
|
+ "</td><td>" + run.getDutHwVer() + "</td><td>" + run.getDutSwVer()
|
||||||
+ "</td><td>" + run.getDutModelNum() + "</td></tr>\n");
|
+ "</td><td>" + run.getDutModelNum() + "</td></tr>\n");
|
||||||
|
if (i == (runs.size() - 1)) {
|
||||||
|
int png_row_count = 0;
|
||||||
|
boolean needs_tr = true;
|
||||||
last_run = row_text;
|
last_run = row_text;
|
||||||
|
for (Test t : run.testsv) {
|
||||||
|
for (String png : t.kpi_images) {
|
||||||
|
if (png.indexOf("-print") >= 0) {
|
||||||
|
continue; // skip the print variants of the image.
|
||||||
|
}
|
||||||
|
if (needs_tr) {
|
||||||
|
pngs.append("<tr>");
|
||||||
|
needs_tr = false;
|
||||||
|
}
|
||||||
|
String fname = run.getName() + "/" + t.getName() + "/" + png;
|
||||||
|
pngs.append("<td><a href=\"" + fname + "\"><img src=\"" + fname + "\" width=\"100\"></a></td>\n");
|
||||||
|
png_row_count++;
|
||||||
|
if (png_row_count == 5) {
|
||||||
|
png_row_count = 0;
|
||||||
|
pngs.append("</tr>\n");
|
||||||
|
needs_tr = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needs_tr && pngs.length() > 0) {
|
||||||
|
pngs.append("</tr>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
runs_rows.append(row_text);
|
runs_rows.append(row_text);
|
||||||
|
|
||||||
if (cp) {
|
if (cp) {
|
||||||
@@ -410,7 +450,9 @@ public class kpi {
|
|||||||
line = line.replace("___DATA_GRAPHS___", plots.toString());
|
line = line.replace("___DATA_GRAPHS___", plots.toString());
|
||||||
line = line.replace("___TEST_RUNS___", runs_rows.toString());
|
line = line.replace("___TEST_RUNS___", runs_rows.toString());
|
||||||
line = line.replace("___LATEST_RUN___", last_run);
|
line = line.replace("___LATEST_RUN___", last_run);
|
||||||
|
line = line.replace("___LATEST_RUN_PNGS___", pngs.toString());
|
||||||
bw.write(line);
|
bw.write(line);
|
||||||
|
bw.write(System.lineSeparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
br.close();
|
br.close();
|
||||||
@@ -555,6 +597,7 @@ class Test {
|
|||||||
Vector<String> titles = null;
|
Vector<String> titles = null;
|
||||||
Vector<Row> data = new Vector();
|
Vector<Row> data = new Vector();
|
||||||
Hashtable<String, String> descs = new Hashtable();
|
Hashtable<String, String> descs = new Hashtable();
|
||||||
|
Vector<String> kpi_images = new Vector();
|
||||||
|
|
||||||
long date_ms = 0;
|
long date_ms = 0;
|
||||||
public String date = "NA";
|
public String date = "NA";
|
||||||
@@ -568,6 +611,10 @@ class Test {
|
|||||||
name = n;
|
name = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addKpiImage(String s) {
|
||||||
|
kpi_images.add(s);
|
||||||
|
}
|
||||||
|
|
||||||
long getDateMs() {
|
long getDateMs() {
|
||||||
return date_ms;
|
return date_ms;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
<tr><th>Test ID</th><th>Test Run</th><th>Date</th><th>DUT Hardware</th><th>DUT Sofware</th><th>DUT Model</th></tr>
|
<tr><th>Test ID</th><th>Test Run</th><th>Date</th><th>DUT Hardware</th><th>DUT Sofware</th><th>DUT Model</th></tr>
|
||||||
___LATEST_RUN___
|
___LATEST_RUN___
|
||||||
</table>
|
</table>
|
||||||
|
<table border=0>
|
||||||
|
___LATEST_RUN_PNGS___
|
||||||
|
</table>
|
||||||
<P>
|
<P>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user