Add Select all checkbox to all datagrids, remove out port and out vlan columns from... 27/1027/1
authorSapan Shah <sapshah@cisco.com>
Tue, 27 Aug 2013 05:18:08 +0000 (22:18 -0700)
committerSapan Shah <sapshah@cisco.com>
Tue, 27 Aug 2013 16:31:27 +0000 (09:31 -0700)
Signed-off-by: Sapan Shah <sapshah@cisco.com>
Change-Id: I5501698720177e51cfd91127fd9e867823575a44
Signed-off-by: Sapan Shah <sapshah@cisco.com>
opendaylight/web/devices/src/main/resources/js/page.js
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebUtil.java
opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java
opendaylight/web/troubleshoot/src/main/resources/js/page.js

index b90e5cbfa03c786e504a78f0ce8a0a003a09d8ce..6cc2b61d1b2a75f9e2636e21e45f3d174b134caf 100644 (file)
@@ -449,7 +449,8 @@ one.f.switchmanager.subnetGatewayConfig = {
             addIPAddress: "one_f_switchmanager_subnetGatewayConfig_id_dashlet_addIP",
             addPorts: "one_f_switchmanager_subnetGatewayConfig_id_dashlet_addPorts",
             removeIPAddress: "one_f_switchmanager_subnetGatewayConfig_id_dashlet_removeIP",
-            datagrid: "one_f_switchmanager_subnetGatewayConfig_id_dashlet_datagrid"
+            datagrid: "one_f_switchmanager_subnetGatewayConfig_id_dashlet_datagrid",
+            selectAll: "one_f_switchmanager_subnetGatewayConfig_id_dashlet_selectAll"
         }, 
         modal: {
             modal: "one_f_switchmanager_subnetGatewayConfig_id_modal_modal",
@@ -496,11 +497,12 @@ one.f.switchmanager.subnetGatewayConfig = {
                         var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
                         one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
                             if (response.status == true) {
-                                // refresh dashlet by passing dashlet div as param
-                                one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
+                                // refresh dashlet by passing dashlet div as param 
+                                one.lib.alert("Subnet Gateway(s) successfully removed");
                             } else {
-                                alert(response.message);
+                                one.lib.alert(response.message);
                             }
+                            one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
                         });
                     }
                 });
@@ -524,7 +526,25 @@ one.f.switchmanager.subnetGatewayConfig = {
                 }, "table-striped table-condensed");
             $dashlet.append($gridHTML);
             var dataSource = one.f.switchmanager.subnetGatewayConfig.data.devicesgrid(content);
-            $("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).datagrid({dataSource: dataSource});
+            $("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).datagrid({dataSource: dataSource})
+            .on("loaded", function() {
+                $("#"+one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll).click(function() {
+                    $("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).find(':checkbox').prop('checked',
+                        $("#"+one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll).is(':checked'));
+                });
+                $(".subnetGatewayConfig").click(function(){
+                    if (!$('.subnetGatewayConfig[type=checkbox]:not(:checked)').length) {
+                        $("#"+one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll)
+                            .prop("checked",
+                          true);
+                    } else {
+                        $("#"+one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll)
+                            .prop("checked",
+                         false);
+                    }
+                    event.stopPropagation();
+                });
+             });
         });
     },
     ajax : {
@@ -700,7 +720,8 @@ one.f.switchmanager.subnetGatewayConfig = {
                     columns: [
                         {
                             property: 'selector',
-                            label: ' ',
+                            label: "<input type='checkbox'  id='"
+                                +one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll+"'/>",
                             sortable: false
                         },
                         {
@@ -722,7 +743,8 @@ one.f.switchmanager.subnetGatewayConfig = {
                     data: data.nodeData,
                     formatter: function(items) {
                         $.each(items, function(index, tableRow) {
-                            tableRow["selector"] = '<input type="checkbox" id=' + tableRow["name"] + '></input>';
+                            tableRow["selector"] = '<input type="checkbox" class="subnetGatewayConfig" id=' 
+                                + tableRow["name"] + '></input>';
                             var json = tableRow["nodePorts"];
                             var nodePorts = JSON.parse(json);
                             var nodePortHtml = "<div>";
@@ -831,7 +853,8 @@ one.f.switchmanager.staticRouteConfig = {
         dashlet: {
             add: "one_f_switchmanager_staticRouteConfig_id_dashlet_add",
             remove: "one_f_switchmanager_staticRouteConfig_id_dashlet_remove",
-            datagrid: "one_f_switchmanager_staticRouteConfig_id_dashlet_datagrid"
+            datagrid: "one_f_switchmanager_staticRouteConfig_id_dashlet_datagrid",
+            selectAll: "one_f_switchmanager_staticRouteConfig_id_dashlet_selectAll"
         }, 
         modal: {
             modal: "one_f_switchmanager_staticRouteConfig_id_modal_modal",
@@ -875,11 +898,12 @@ one.f.switchmanager.staticRouteConfig = {
                         var url = one.f.switchmanager.rootUrl + "/staticRoute/delete";
                         one.f.switchmanager.staticRouteConfig.ajax.main(url, requestData, function(response) {
                             if (response.status == true) {
-                                // refresh dashlet by passing dashlet div as param
-                                one.f.switchmanager.staticRouteConfig.dashlet($("#left-bottom .dashlet"));
+                                // refresh dashlet by passing dashlet div as param 
+                                one.lib.alert("Static Routes(s) successfully removed");
                             } else {
-                                alert(response.message);
+                                one.lib.alert(response.message);
                             }
+                            one.f.switchmanager.staticRouteConfig.dashlet($("#left-bottom .dashlet"));
                         });
                     }
                 });
@@ -893,7 +917,25 @@ one.f.switchmanager.staticRouteConfig = {
                 }, "table-striped table-condensed");
             $dashlet.append($gridHTML);
             var dataSource = one.f.switchmanager.staticRouteConfig.data.staticRouteConfigGrid(content);
-            $("#" + one.f.switchmanager.staticRouteConfig.id.dashlet.datagrid).datagrid({dataSource: dataSource});
+            $("#" + one.f.switchmanager.staticRouteConfig.id.dashlet.datagrid).datagrid({dataSource: dataSource})
+            .on("loaded", function() {
+                $("#"+one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll).click(function() {
+                    $("#" + one.f.switchmanager.staticRouteConfig.id.dashlet.datagrid).find(':checkbox').prop('checked',
+                        $("#"+one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll).is(':checked'));
+                });
+                $(".staticRoute").click(function(){
+                    if (!$('.staticRoute[type=checkbox]:not(:checked)').length) {
+                        $("#"+one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll)
+                            .prop("checked",
+                          true);
+                    } else {
+                        $("#"+one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll)
+                            .prop("checked",
+                         false);
+                    }
+                    event.stopPropagation();
+                });
+             });
         });
     },
     // device ajax calls
@@ -981,7 +1023,8 @@ one.f.switchmanager.staticRouteConfig = {
                     columns: [
                         {
                             property: 'selector',
-                            label: ' ',
+                            label: "<input type='checkbox'  id='"
+                                +one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll+"'/>",
                             sortable: false
                         },
                         {
@@ -1003,7 +1046,7 @@ one.f.switchmanager.staticRouteConfig = {
                     data: data.nodeData,
                     formatter: function(items) {
                         $.each(items, function(index, item) {
-                            item["selector"] = '<input type="checkbox" id=' + item["name"] + '></input>';
+                            item["selector"] = '<input type="checkbox" class="staticRoute" id=' + item["name"] + '></input>';
                         });
 
                     },
@@ -1037,7 +1080,8 @@ one.f.switchmanager.spanPortConfig = {
         dashlet: {
             add: "one_f_switchmanager_spanPortConfig_id_dashlet_add",
             remove: "one_f_switchmanager_spanPortConfig_id_dashlet_remove",
-            datagrid: "one_f_switchmanager_spanPortConfig_id_dashlet_datagrid"
+            datagrid: "one_f_switchmanager_spanPortConfig_id_dashlet_datagrid",
+            selectAllFlows: "one_f_switchmanager_spanPortConfig_id_dashlet_selectAllFlows"
         }, 
         modal: {
             modal: "one_f_switchmanager_spanPortConfig_id_modal_modal",
@@ -1087,10 +1131,11 @@ one.f.switchmanager.spanPortConfig = {
                         one.f.switchmanager.spanPortConfig.ajax.main(url, requestData, function(response) {
                             if (response.status == true) {
                                 // refresh dashlet by passing dashlet div as param
-                                one.f.switchmanager.spanPortConfig.dashlet($("#right-bottom .dashlet"));
+                                one.lib.alert("Span Port(s) successfully removed");
                             } else {
-                                alert(response.message);
+                                one.lib.alert(response.message);
                             }
+                            one.f.switchmanager.spanPortConfig.dashlet($("#right-bottom .dashlet"));
                         });
                     }
                 });
@@ -1104,10 +1149,25 @@ one.f.switchmanager.spanPortConfig = {
                 }, "table-striped table-condensed");
             $dashlet.append($gridHTML);
             var dataSource = one.f.switchmanager.spanPortConfig.data.spanPortConfigGrid(content);
-            $("#" + one.f.switchmanager.spanPortConfig.id.dashlet.datagrid).datagrid({dataSource: dataSource});
-
-
-
+            $("#" + one.f.switchmanager.spanPortConfig.id.dashlet.datagrid).datagrid({dataSource: dataSource})
+            .on("loaded", function() {
+                $("#"+one.f.switchmanager.spanPortConfig.id.dashlet.selectAll).click(function() {
+                    $("#" + one.f.switchmanager.spanPortConfig.id.dashlet.datagrid).find(':checkbox').prop('checked',
+                        $("#"+one.f.switchmanager.spanPortConfig.id.dashlet.selectAll).is(':checked'));
+                });
+                $(".spanPortConfig").click(function(){
+                    if (!$('.spanPortConfig[type=checkbox]:not(:checked)').length) {
+                        $("#"+one.f.switchmanager.spanPortConfig.id.dashlet.selectAll)
+                            .prop("checked",
+                          true);
+                    } else {
+                        $("#"+one.f.switchmanager.spanPortConfig.id.dashlet.selectAll)
+                            .prop("checked",
+                         false);
+                    }
+                    event.stopPropagation();
+                });
+             });
         });
     },
     // device ajax calls
@@ -1216,7 +1276,8 @@ one.f.switchmanager.spanPortConfig = {
                     columns: [
                         {
                             property: 'selector',
-                            label: ' ',
+                            label: "<input type='checkbox'  id='"
+                                +one.f.switchmanager.spanPortConfig.id.dashlet.selectAll+"'/>",
                             sortable: false
                         },
                         {
@@ -1233,7 +1294,7 @@ one.f.switchmanager.spanPortConfig = {
                     data: data.nodeData,
                     formatter: function(items) {
                         $.each(items, function(index, item) {
-                            item["selector"] = '<input type="checkbox" spanPort=' + encodeURIComponent(item["json"]) + '></input>';
+                            item["selector"] = '<input type="checkbox" class="spanPortConfig" spanPort=' + encodeURIComponent(item["json"]) + '></input>';
                         });
                     },
                     delay: 0
index 3add0e6a40b22d0745421d7f0d4db46a82babbfa..4435dcd58b987a6248977a1d7326f6069d34a0eb 100644 (file)
@@ -61,7 +61,7 @@ public class DaylightWebUtil {
     public static void auditlog(String moduleName, String user, String action, String resource,
             String containerName) {
         String auditMsg = "";
-        String mode = "WEB";
+        String mode = "UI";
         if (containerName != null) {
             auditMsg = "Mode: " + mode + " User " + user + " "  + action + " " + moduleName + " " + resource + " in container "
                     + containerName;
index 71ba687f2d4b16e22c43de7586f6d75c7119b7ac..eab07418b46fa51ff9fd3524dc0160337537c70c 100644 (file)
@@ -21,7 +21,15 @@ import javax.servlet.http.HttpServletRequest;
 
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.Output;
+import org.opendaylight.controller.sal.action.SetDlDst;
+import org.opendaylight.controller.sal.action.SetDlSrc;
+import org.opendaylight.controller.sal.action.SetNwDst;
+import org.opendaylight.controller.sal.action.SetNwSrc;
+import org.opendaylight.controller.sal.action.SetNwTos;
+import org.opendaylight.controller.sal.action.SetTpDst;
+import org.opendaylight.controller.sal.action.SetTpSrc;
 import org.opendaylight.controller.sal.action.SetVlanId;
+import org.opendaylight.controller.sal.action.SetVlanPcp;
 import org.opendaylight.controller.sal.authorization.Privilege;
 import org.opendaylight.controller.sal.authorization.UserLevel;
 import org.opendaylight.controller.sal.core.Description;
@@ -56,7 +64,7 @@ public class Troubleshoot implements IDaylightWeb {
     private static final List<String> flowStatsColumnNames = Arrays.asList("Node", "In Port",
             "DL Src", "DL Dst", "DL Type", "DL Vlan", "NW Src", "NW Dst",
             "NW Proto", "TP Src", "TP Dst", "Actions", "Bytes", "Packets",
-            "Time (s)", "Timeout (s)", "Out Port(s)", "Out Vlan",
+            "Time (s)", "Timeout (s)",
             "Priority");
     private static final List<String> portStatsColumnNames = Arrays.asList("Node Connector",
             "Rx Pkts", "Tx Pkts", "Rx Bytes", "Tx Bytes", "Rx Drops",
@@ -346,29 +354,60 @@ public class Troubleshoot implements IDaylightWeb {
 
         StringBuffer actions = new StringBuffer();
         StringBuffer outPorts = new StringBuffer();
-        String outVlanId = null;
         for (Action action : flow.getActions()) {
-            actions.append(action.getType().toString() + "\n");
+
             if (action instanceof Output) {
                 Output ao = (Output) action;
                 if (outPorts.length() > 0) {
                     outPorts.append(" ");
                 }
-                outPorts.append(ao.getPort().getNodeConnectorIdAsString());
+                actions.append(action.getType().toString() + " = "
+                        + ao.getPort().getNodeConnectorIdAsString() + "<br>");
             } else if (action instanceof SetVlanId) {
                 SetVlanId av = (SetVlanId) action;
-                outVlanId = String.valueOf(av.getVlanId());
+                String outVlanId = String.valueOf(av.getVlanId());
+                actions.append(action.getType().toString() + " = " + outVlanId
+                        + "<br>");
+            } else if (action instanceof SetDlSrc) {
+                SetDlSrc ads = (SetDlSrc) action;
+                actions.append(action.getType().toString() + " = "
+                        + HexEncode.bytesToHexStringFormat(ads.getDlAddress()) + "<br>");
+            } else if (action instanceof SetDlDst) {
+                SetDlDst add = (SetDlDst) action;
+                actions.append(action.getType().toString() + " = "
+                        + HexEncode.bytesToHexStringFormat(add.getDlAddress())
+                        + "<br>");
+            } else if (action instanceof SetNwSrc) {
+                SetNwSrc ans = (SetNwSrc) action;
+                actions.append(action.getType().toString() + " = "
+                        + ans.getAddressAsString() + "<br>");
+            } else if (action instanceof SetNwDst) {
+                SetNwDst and = (SetNwDst) action;
+                actions.append(action.getType().toString() + " = "
+                        + and.getAddressAsString() + "<br>");
+            } else if (action instanceof SetNwTos) {
+                SetNwTos ant = (SetNwTos) action;
+                actions.append(action.getType().toString() + " = "
+                        + ant.getNwTos() + "<br>");
+            } else if (action instanceof SetTpSrc) {
+                SetTpSrc ads = (SetTpSrc) action;
+                actions.append(action.getType().toString() + " = "
+                        + ads.getPort() + "<br>");
+            } else if (action instanceof SetTpDst) {
+                SetTpDst atd = (SetTpDst) action;
+                actions.append(action.getType().toString() + " = "
+                        + atd.getPort() + "<br>");
+            } else if (action instanceof SetVlanPcp) {
+                SetVlanPcp avp = (SetVlanPcp) action;
+                actions.append(action.getType().toString() + " = "
+                        + avp.getPcp() + "<br>");
+                // } else if (action instanceof SetDlSrc) {
+                // SetDlSrc ads = (SetDlSrc) action;
+            } else {
+                actions.append(action.getType().toString() + "<br>");
             }
         }
-        if (outPorts.length() == 0) {
-            outPorts.append("*");
-        }
-        if (outVlanId == null) {
-            outVlanId = "*";
-        }
         row.put("actions", actions.toString());
-        row.put("outPorts", outPorts.toString());
-        row.put("outVlanId", outVlanId);
         row.put("durationSeconds",
                 ((Integer) flowOnNode.getDurationSeconds()).toString());
         row.put("idleTimeout", ((Short) flow.getIdleTimeout()).toString());
index 3f0dc9e81231b50dc098011f20dd53f11ffdcfeb..1eb2cf0094ea3a4d801c6dc0a31955b257a5898c 100644 (file)
@@ -400,16 +400,6 @@ one.f.troubleshooting.existingNodes = {
                             label: 'Idle Timeout',
                             sortable: true
                         },
-                        {
-                            property: 'outPorts',
-                            label: 'Out Ports',
-                            sortable: true
-                        },
-                        {
-                            property: 'outVlanId',
-                            label: 'Out VlanId',
-                            sortable: true
-                        },
                         {
                             property: 'priority',
                             label: 'Priority',
@@ -442,8 +432,6 @@ one.f.troubleshooting.existingNodes = {
                     entry.push(value["packetCount"]);
                     entry.push(value["durationSeconds"]);
                     entry.push(value["idleTimeout"]);
-                    entry.push(value["outPorts"]);
-                    entry.push(value["outVlanId"]);
                     entry.push(value["priority"]);
                     tr.entry = entry;
                     result.push(tr);