luci-app-bmx6: Fix topology graph with backwards compatibility
[feed/routing.git] / luci-app-bmx6 / files / usr / lib / lua / luci / controller / bmx6.lua
index 26e1cb37fb8d3d933f7c5c508b713441a79d9532..9529cf882a68884ffd40e133e1306d6f3eb9cc67 100644 (file)
@@ -240,10 +240,10 @@ function action_topology()
                                if first then
                                        first = false
                                else
-                                       topology = topology .. ', '
+                                               topology = topology .. ', '
                                end
            
-                               topology = topology .. '{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+")
+                                       topology = topology .. '{ "name": "%s", "links": [' %o.name
            
                                local first2 = true
            
@@ -252,10 +252,10 @@ function action_topology()
                                                first2 = false
                                        else
                                                topology = topology .. ', '
-                                       end
-           
-                                       topology = topology .. '{ "globalId": "%s", "rxRate": %s, "txRate": %s }'
-                                               %{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate }
+                                               end
+                                               name = l.name or l.llocalIp or "unknown"
+                                               topology = topology .. '{ "name": "%s", "rxRate": %s, "txRate": %s }'
+                                                       %{ name, l.rxRate, l.txRate }
            
                                end