- make created sortable field
- prevent sorting on status, display friendly message instead of error

Signed-off-by: Julius Gawlas <[email protected]>
---
 frontend/client/src/autotest/afe/JobTable.java |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/frontend/client/src/autotest/afe/JobTable.java 
b/frontend/client/src/autotest/afe/JobTable.java
index 313822e..8fe52e8 100644
--- a/frontend/client/src/autotest/afe/JobTable.java
+++ b/frontend/client/src/autotest/afe/JobTable.java
@@ -3,6 +3,7 @@ package autotest.afe;
 import autotest.common.table.DynamicTable;
 import autotest.common.table.RpcDataSource;
 import autotest.common.table.DataSource.SortDirection;
+import autotest.common.ui.NotifyManager;
 
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONString;
@@ -17,8 +18,9 @@ public class JobTable extends DynamicTable {
     private static final String[][] JOB_COLUMNS = { {CLICKABLE_WIDGET_COLUMN, 
"Select"}, 
             { "id", "ID" }, { "owner", "Owner" }, { "name", "Name" },
             { "priority", "Priority" }, { "control_type", "Client/Server" },
-            { CREATED_TEXT, "Created" }, { HOSTS_SUMMARY, "Status" } };
-
+            { "created_on", "Created" }, { HOSTS_SUMMARY, "Status" } };
+    private static final int STATUS_COLUMN = JOB_COLUMNS.length-1; 
+    
     public JobTable() {
         super(JOB_COLUMNS, new RpcDataSource("get_jobs_summary", 
"get_num_jobs"));
         sortOnColumn("id", SortDirection.DESCENDING);
@@ -31,6 +33,19 @@ public class JobTable extends DynamicTable {
         row.put(HOSTS_SUMMARY, new JSONString(countString));
         
         // remove seconds from created time
+        if ( row.containsKey(CREATED_TEXT) )
+            row.put("created_on", row.get(CREATED_TEXT));        
         AfeUtils.removeSecondsFromDateField(row, "created_on", CREATED_TEXT);
     }
+
+    @Override
+    protected void onCellClicked(int row, int cell, boolean isRightClick) {
+        if (row == headerRow && cell == STATUS_COLUMN) { 
+            // prevent sorting error on status columns
+            NotifyManager.getInstance().showMessage("Sorting is not supported 
for this column.");
+            return;
+        }
+        super.onCellClicked(row, cell, isRightClick);
+    }
+    
 }
-- 
1.7.7.6

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to