projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
applications/luci-olsr: Update all statuspages; use json reloading on overview, neigh...
[project/luci.git]
/
applications
/
luci-olsr
/
luasrc
/
controller
/
olsr.lua
diff --git
a/applications/luci-olsr/luasrc/controller/olsr.lua
b/applications/luci-olsr/luasrc/controller/olsr.lua
index 6d6dc1ace2c9a7c4ffaa4b0647adaa9335fb358e..a47496b31a9a5c15fd7ec3decad8801fb5489699 100644
(file)
--- a/
applications/luci-olsr/luasrc/controller/olsr.lua
+++ b/
applications/luci-olsr/luasrc/controller/olsr.lua
@@
-91,30
+91,29
@@
function index()
)
end
)
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
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
end
- table.sort(data.Links, compare)
+ table.sort(data.Links, compare
_links
)
luci.template.render("status-olsr/neighbors", {links=data.Links})
end
luci.template.render("status-olsr/neighbors", {links=data.Links})
end