summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-olsr/luasrc/controller/olsr.lua
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-11-09 18:12:25 +0000
committerManuel Munz <freifunk@somakoma.de>2011-11-09 18:12:25 +0000
commitb1ef4c398bc2d35b333331ac5f823bc17bf56ff2 (patch)
tree5f95154ae48c1eae2391f7f46223ce87d33b9794 /applications/luci-olsr/luasrc/controller/olsr.lua
parentb0dbb7bd3d6fcc54115191868c06769b92acda09 (diff)
applications/luci-olsr: Update all statuspages; use json reloading on overview, neighbors and topology pages
Diffstat (limited to 'applications/luci-olsr/luasrc/controller/olsr.lua')
-rw-r--r--applications/luci-olsr/luasrc/controller/olsr.lua33
1 files changed, 16 insertions, 17 deletions
diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua
index 6d6dc1ace2..a47496b31a 100644
--- a/applications/luci-olsr/luasrc/controller/olsr.lua
+++ b/applications/luci-olsr/luasrc/controller/olsr.lua
@@ -91,30 +91,29 @@ function index()
)
end
-function action_neigh()
- local data = fetch_txtinfo("links")
+local function compare_links(a, b)
+ local c = tonumber(a.Cost)
+ local d = tonumber(b.Cost)
- if not data or not data.Links then
- luci.template.render("status-olsr/error_olsr")
- return nil
+ if not c or c == 0 then
+ return false
end
- local function compare(a, b)
- local c = tonumber(a.Cost)
- local d = tonumber(b.Cost)
-
- if not c or c == 0 then
- return false
- end
+ if not d or d == 0 then
+ return true
+ end
+ return c < d
+end
- if not d or d == 0 then
- return true
- end
+function action_neigh(json)
+ local data = fetch_txtinfo("links")
- return c < d
+ if not data or not data.Links then
+ luci.template.render("status-olsr/error_olsr")
+ return nil
end
- table.sort(data.Links, compare)
+ table.sort(data.Links, compare_links)
luci.template.render("status-olsr/neighbors", {links=data.Links})
end