From: Andrew Kim Date: Fri, 13 Sep 2013 22:32:44 +0000 (-0500) Subject: Fix flows detail X-Git-Tag: releasepom-0.1.0~91 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=962f8fca2c071ea388f69d18e5a3b427f66120c3 Fix flows detail - Fix flow with same names not correctly updating details table - Add extra check to differentiate between flows on different nodes - Minor refactor in backend to consolidate Gson Change-Id: Ifffa051d574a0a81af4de9472842ec82194dfb42 Signed-off-by: Andrew Kim --- diff --git a/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java b/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java index a96d3efcec..4cd71a3764 100644 --- a/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java +++ b/opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java @@ -52,8 +52,11 @@ public class Flows implements IDaylightWeb { private static final String WEB_ID = "flows"; private static final short WEB_ORDER = 2; + private final Gson gson; + public Flows() { ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null); + gson = new Gson(); } @Override @@ -246,8 +249,8 @@ public class Flows implements IDaylightWeb { return null; } - Gson gson = new Gson(); FlowConfig flow = gson.fromJson(body, FlowConfig.class); + Node node = Node.fromString(nodeId); flow.setNode(node); Status result = new Status(StatusCode.BADREQUEST, "Invalid request"); @@ -332,7 +335,6 @@ public class Flows implements IDaylightWeb { return "Forwarding Rules Manager is not available"; } - Gson gson = new Gson(); List> flowList = new ArrayList>(); flowList = gson.fromJson(body, flowList.getClass()); Status result = new Status(StatusCode.BADREQUEST, "Invalid request"); diff --git a/opendaylight/web/flows/src/main/resources/js/page.js b/opendaylight/web/flows/src/main/resources/js/page.js index a3d9422dfe..f3bbf7559b 100644 --- a/opendaylight/web/flows/src/main/resources/js/page.js +++ b/opendaylight/web/flows/src/main/resources/js/page.js @@ -420,9 +420,9 @@ one.f.flows = { var flows = one.f.flows.registry.flows; var flow; $(flows).each(function(index, value) { - if (value['name'] == id) { - flow = value; - } + if (value.name == id && value.nodeId == node) { + flow = value; + } }); if (one.f.flows.registry.privilege === 'WRITE') { // remove button @@ -1420,4 +1420,4 @@ $('.dash .nav a', '#main').click(function() { // activate first tab on each dashlet $('.dash .nav').each(function(index, value) { $($(value).find('li')[0]).find('a').click(); -}); \ No newline at end of file +});