1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.gwe.app.client.web.view;
18
19 import org.gwe.app.client.web.request.Param;
20 import org.gwe.persistence.model.JobExecutionInfo;
21 import org.gwe.persistence.model.JobInfo;
22 import org.gwe.persistence.model.OrderInfo;
23 import org.gwe.utils.web.HtmlLink;
24 import org.gwe.utils.web.HtmlTable;
25 import org.gwe.utils.web.HtmlTableCell;
26
27
28
29
30
31 public class HtmlJobsTable extends HtmlTable {
32
33 public HtmlJobsTable(String clusterId, OrderInfo order) {
34 super("Status", "Number", "Failures", "Allocation", "Started", "Prepared", "Dispatched", "Processed", "Completed", "Failed");
35 for (JobInfo job : order.getJobs()) {
36 HtmlTableCell num = new HtmlTableCell("[ " + job.getJobNum() + " ]", "", new HtmlJobLink(clusterId, job)) ;
37 JobExecutionInfo exec = job.getExecution();
38 HtmlTableCell status = new HtmlTableCell("", "", null, HtmlExecPropsTable.getStatusImage(exec));
39 if (exec != null) {
40 Object allocId = (exec.getAllocation() != null) ? exec.getAllocation().getId() : null;
41 addRow(status, num, job.getFailures(), allocId, exec.getWhenCreated(), exec.getWhenPrepared(),
42 exec.getWhenDispatched(), exec.getWhenProcessed(), exec.getWhenCompleted(), exec.getWhenFailed());
43 } else {
44 addRow(status, num, null, null, null, null, null, null, null, null);
45 }
46 }
47 }
48 }
49
50 class HtmlJobLink extends HtmlLink {
51
52 public HtmlJobLink(String clusterId, JobInfo job) {
53 super(false, "job");
54 addParam(Param.CLUSTER_ID, clusterId);
55 addParam(Param.ORDER_ID, job.getOrder().getId());
56 addParam(Param.JOB_NUM, job.getJobNum());
57 }
58 }