Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for deletion of runs in the Results view. The selected …

…runs output directories will be deleted.
  • Loading branch information...
commit 5434a57b4a9266ab5e0b52c5d9db7bd01049c8c2 1 parent 1aea9bd
@shanti shanti authored
View
27 harness/src/com/sun/faban/harness/webclient/ResultAction.java
@@ -23,6 +23,7 @@
*/
package com.sun.faban.harness.webclient;
+import com.sun.faban.common.SortableTableModel;
import com.sun.faban.harness.ParamRepository;
import com.sun.faban.harness.common.BenchmarkDescription;
import com.sun.faban.harness.common.Config;
@@ -38,6 +39,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import java.io.*;
import java.net.URL;
import java.text.ParseException;
@@ -77,6 +79,8 @@ public String takeAction(HttpServletRequest request,
return editAnalysis(process, request, response);
if ("Archive".equals(process))
return editArchive(request, response);
+ if ("Delete".equals(process))
+ return deleteResults(request, response);
return null;
}
@@ -456,6 +460,29 @@ public String archive(HttpServletRequest request,
return "/archive_results.jsp";
}
+ public String deleteResults(HttpServletRequest request,
+ HttpServletResponse response) {
+ String[] runIds = request.getParameterValues("select");
+ if (runIds != null) {
+ for (String r : runIds) {
+ RunResult runResult = RunResult.getInstance(new RunId(r));
+ runResult.delete(r);
+ }
+ }
+ HttpSession session = request.getSession();
+ UserEnv usrEnv = (UserEnv) session.getAttribute("usrEnv");
+ if (usrEnv == null) {
+ usrEnv = new UserEnv();
+ session.setAttribute("usrEnv", usrEnv);
+ }
+ SortableTableModel resultTable = RunResult.getResultTable(usrEnv.getSubject(), 5, "DESCENDING");
+ String feedURL = "/controller/results/feed";
+ request.setAttribute("feedURL", feedURL );
+ request.setAttribute("table.model", resultTable);
+ return "/resultlist.jsp";
+
+ }
+
@SuppressWarnings("empty-statement")
private void prepareUpload(HttpServletRequest request, RunResult result,
HashSet<String> uploadedRuns, HashSet<File> uploadSet)
View
14 harness/src/com/sun/faban/harness/webclient/RunResult.java
@@ -699,6 +699,20 @@ else if(result.status.equals("UNKNOWN"))
return table;
}
+ /*
+ * Deletes a certain run.
+ * @param RunId of run run to delete
+ * @return true if delete succeeds, false otherwise
+ */
+ public boolean delete(String runIdStr) {
+ RunId runId = new RunId(runIdStr);
+ File f = runId.getResultDir();
+ if (f.isDirectory()) {
+ return(FileHelper.recursiveDelete(f));
+ }
+ return(true);
+ }
+
private static HashMap<String, String> getAchievedMetricForTarget(String tags)
throws IOException {
HashMap<String, String> achievedMetricMap = new HashMap<String, String>();
View
2  harness/web/resultlist.jsp
@@ -64,6 +64,7 @@
<form name="processrun" method="post" action="/controller/result_action/take_action">
<center>
+ <input type="submit" name="process" value="Delete">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="process" value="Compare">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!-- Commented out until FenXi supports averaging again.
<input type="submit" name="process" value="Average">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@ -152,6 +153,7 @@
<br/>
<br/>
<center>
+ <input type="submit" name="process" value="Delete">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="process" value="Compare">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!-- Commented out until FenXi supports averaging again.
<input type="submit" name="action" value="edit_average>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Please sign in to comment.
Something went wrong with that request. Please try again.