Merry christmas! Redesign of JavaScript code and many other things (graph, nodes view, etc.)
This commit is contained in:
parent
0f2f0dc943
commit
53da163724
17 changed files with 875 additions and 95 deletions
|
@ -28,6 +28,7 @@ function index()
|
|||
local place = {}
|
||||
local ucim = require "luci.model.uci"
|
||||
local uci = ucim.cursor()
|
||||
|
||||
-- checking if ignore is on
|
||||
if uci:get("luci-bmx6","luci","ignore") == "1" then
|
||||
return nil
|
||||
|
@ -47,28 +48,34 @@ function index()
|
|||
-- Starting with the pages
|
||||
---------------------------
|
||||
|
||||
--- neighbours/descriptions (default)
|
||||
entry(place,call("action_neighbours_j"),place[#place])
|
||||
--- status (default)
|
||||
entry(place,call("action_status_j"),place[#place])
|
||||
|
||||
table.insert(place,"neighbours_nojs")
|
||||
entry(place, call("action_neighbours"), nil)
|
||||
-- not visible
|
||||
table.insert(place,"nodes_nojs")
|
||||
entry(place, call("action_nodes"), nil)
|
||||
table.remove(place)
|
||||
|
||||
--- status (this is default one)
|
||||
table.insert(place,"Status")
|
||||
entry(place,call("action_status"),"Status")
|
||||
--- nodes
|
||||
table.insert(place,"Nodes")
|
||||
entry(place,call("action_nodes_j"),"Nodes",1)
|
||||
table.remove(place)
|
||||
|
||||
--- links
|
||||
--- links
|
||||
table.insert(place,"Links")
|
||||
entry(place,call("action_links"),"Links").leaf = true
|
||||
entry(place,call("action_links"),"Links",2).leaf = true
|
||||
table.remove(place)
|
||||
|
||||
-- Gateways
|
||||
table.insert(place,"Gateways")
|
||||
entry(place,call("action_gateways_j"),"Gateways").leaf = true
|
||||
-- Tunnels
|
||||
table.insert(place,"Tunnels")
|
||||
entry(place,call("action_tunnels_j"), "Tunnels", 3).leaf = true
|
||||
table.remove(place)
|
||||
|
||||
-- Gateways (deprecated)
|
||||
--table.insert(place,"Gateways")
|
||||
--entry(place,call("action_gateways_j"),"Gateways").leaf = true
|
||||
--table.remove(place)
|
||||
|
||||
--- chat
|
||||
table.insert(place,"Chat")
|
||||
entry(place,call("action_chat"),"Chat")
|
||||
|
@ -76,7 +83,7 @@ function index()
|
|||
|
||||
--- Graph
|
||||
table.insert(place,"Graph")
|
||||
entry(place, template("bmx6/graph"), "Graph")
|
||||
entry(place, template("bmx6/graph",4), "Graph")
|
||||
table.remove(place)
|
||||
|
||||
--- Topology (hidden)
|
||||
|
@ -86,22 +93,30 @@ function index()
|
|||
|
||||
--- configuration (CBI)
|
||||
table.insert(place,"Configuration")
|
||||
entry(place, cbi("bmx6/main"), "Configuration").dependent=false
|
||||
entry(place, cbi("bmx6/main"), "Configuration",6).dependent=false
|
||||
|
||||
table.insert(place,"General")
|
||||
entry(place, cbi("bmx6/main"), "General",1)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Advanced")
|
||||
entry(place, cbi("bmx6/advanced"), "Advanced")
|
||||
entry(place, cbi("bmx6/advanced"), "Advanced",5)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Interfaces")
|
||||
entry(place, cbi("bmx6/interfaces"), "Interfaces")
|
||||
entry(place, cbi("bmx6/interfaces"), "Interfaces",2)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Tunnels")
|
||||
entry(place, cbi("bmx6/tunnels"), "Tunnels",3)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"Plugins")
|
||||
entry(place, cbi("bmx6/plugins"), "Plugins")
|
||||
entry(place, cbi("bmx6/plugins"), "Plugins",6)
|
||||
table.remove(place)
|
||||
|
||||
table.insert(place,"HNA")
|
||||
entry(place, cbi("bmx6/hna"), "HNA")
|
||||
table.insert(place,"HNAv6")
|
||||
entry(place, cbi("bmx6/hna"), "HNAv6",4)
|
||||
table.remove(place)
|
||||
|
||||
table.remove(place)
|
||||
|
@ -119,7 +134,12 @@ function action_status()
|
|||
end
|
||||
end
|
||||
|
||||
function action_neighbours()
|
||||
function action_status_j()
|
||||
luci.template.render("bmx6/status_j", {})
|
||||
end
|
||||
|
||||
|
||||
function action_nodes()
|
||||
local orig_list = bmx6json.get("originators").originators or nil
|
||||
|
||||
if orig_list == nil then
|
||||
|
@ -143,38 +163,27 @@ function action_neighbours()
|
|||
name = o.name
|
||||
end
|
||||
|
||||
--Not sure about that, but trying to find main ipv4 from HNA6 published by each node
|
||||
if desc.DESC_ADV ~= nil then
|
||||
for _,h in ipairs(desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do
|
||||
|
||||
if h ~= nil and string.find(h.address,"::ffff:") then
|
||||
ipv4=string.gsub(h.address,"::ffff:","")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ipv4 == "" then
|
||||
ipv4="0.0.0.0"
|
||||
end
|
||||
|
||||
table.insert(originators,{name=name,ipv4=ipv4,orig=orig,desc=desc})
|
||||
table.insert(originators,{name=name,orig=orig,desc=desc})
|
||||
end
|
||||
|
||||
luci.template.render("bmx6/neighbours", {originators=originators})
|
||||
luci.template.render("bmx6/nodes", {originators=originators})
|
||||
end
|
||||
|
||||
function action_neighbours_j()
|
||||
function action_nodes_j()
|
||||
local http = require "luci.http"
|
||||
local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/neighbours_nojs'
|
||||
local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/nodes_nojs'
|
||||
|
||||
luci.template.render("bmx6/neighbours_j", {link_non_js=link_non_js})
|
||||
luci.template.render("bmx6/nodes_j", {link_non_js=link_non_js})
|
||||
end
|
||||
|
||||
function action_gateways_j()
|
||||
luci.template.render("bmx6/gateways_j", {})
|
||||
end
|
||||
|
||||
function action_tunnels_j()
|
||||
luci.template.render("bmx6/tunnels_j", {})
|
||||
end
|
||||
|
||||
|
||||
function action_links(host)
|
||||
local links = bmx6json.get("links", host)
|
||||
|
@ -199,39 +208,65 @@ function action_topology()
|
|||
local originators = bmx6json.get("originators/all")
|
||||
local o,i,l,i2
|
||||
local first = true
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write('[ ')
|
||||
local topology = '[ '
|
||||
local cache = '/tmp/bmx6-topology.json'
|
||||
local offset = 60
|
||||
|
||||
for i,o in ipairs(originators) do
|
||||
local links = bmx6json.get("links",o.primaryIp)
|
||||
if links then
|
||||
if first then
|
||||
first = false
|
||||
else
|
||||
luci.http.write(', ')
|
||||
end
|
||||
local cachefd = io.open(cache,r)
|
||||
local update = false
|
||||
|
||||
luci.http.write('{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+"))
|
||||
|
||||
local first2 = true
|
||||
|
||||
for i2,l in ipairs(links.links) do
|
||||
if first2 then
|
||||
first2 = false
|
||||
else
|
||||
luci.http.write(', ')
|
||||
end
|
||||
|
||||
luci.http.write('{ "globalId": "%s", "rxRate": %s, "txRate": %s }'
|
||||
%{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate })
|
||||
|
||||
end
|
||||
|
||||
luci.http.write(']}')
|
||||
if cachefd ~= nil then
|
||||
local lastupdate = tonumber(cachefd:read("*line")) or 0
|
||||
if os.time() >= lastupdate + offset then
|
||||
update = true
|
||||
else
|
||||
topology = cachefd:read("*all")
|
||||
end
|
||||
|
||||
cachefd:close()
|
||||
end
|
||||
luci.http.write(' ]')
|
||||
|
||||
if cachefd == nil or update then
|
||||
for i,o in ipairs(originators) do
|
||||
local links = bmx6json.get("links",o.primaryIp)
|
||||
if links then
|
||||
if first then
|
||||
first = false
|
||||
else
|
||||
topology = topology .. ', '
|
||||
end
|
||||
|
||||
topology = topology .. '{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+")
|
||||
|
||||
local first2 = true
|
||||
|
||||
for i2,l in ipairs(links.links) do
|
||||
if first2 then
|
||||
first2 = false
|
||||
else
|
||||
topology = topology .. ', '
|
||||
end
|
||||
|
||||
topology = topology .. '{ "globalId": "%s", "rxRate": %s, "txRate": %s }'
|
||||
%{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate }
|
||||
|
||||
end
|
||||
|
||||
topology = topology .. ']}'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
topology = topology .. ' ]'
|
||||
|
||||
-- Upgrading the content of the cache file
|
||||
cachefd = io.open(cache,'w+')
|
||||
cachefd:write(os.time()..'\n')
|
||||
cachefd:write(topology)
|
||||
cachefd:close()
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write(topology)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -163,3 +163,57 @@ function wget(url, timeout)
|
|||
end
|
||||
end
|
||||
|
||||
function getOptions(name)
|
||||
-- Getting json and Checking if bmx6-json is avaiable
|
||||
local options = get("options")
|
||||
if options == nil or options.OPTIONS == nil then
|
||||
m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6"
|
||||
return nil
|
||||
else
|
||||
options = options.OPTIONS
|
||||
end
|
||||
|
||||
-- Filtering by the option name
|
||||
local i,_
|
||||
local namedopt = nil
|
||||
if name ~= nil then
|
||||
for _,i in ipairs(options) do
|
||||
if i.name == name and i.CHILD_OPTIONS ~= nil then
|
||||
namedopt = i.CHILD_OPTIONS
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return namedopt
|
||||
end
|
||||
|
||||
-- Rturns a help string formated to be used in HTML scope
|
||||
function getHtmlHelp(opt)
|
||||
if opt == nil then return nil end
|
||||
|
||||
local help = ""
|
||||
if opt.help ~= nil then
|
||||
help = text2html(opt.help)
|
||||
end
|
||||
if opt.syntax ~= nil then
|
||||
help = help .. "<br/><b>Syntax: </b>" .. text2html(opt.syntax)
|
||||
end
|
||||
|
||||
return help
|
||||
end
|
||||
|
||||
function testandreload()
|
||||
local test = sys.call('bmx6 -c --test > /tmp/bmx6-luci.err.tmp')
|
||||
if test ~= 0 then
|
||||
return sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
|
||||
local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp')
|
||||
if err ~= 0 then
|
||||
return sys.exec("cat /tmp/bmx6-luci.err.tmp")
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
|
|
@ -23,18 +23,18 @@ local sys = require("luci.sys")
|
|||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
local hna = m:section(TypedSection,"hna","HNA")
|
||||
local hna = m:section(TypedSection,"hna","IPv6 HNA")
|
||||
hna.addremove = true
|
||||
hna.anonymous = false
|
||||
local hna_option = hna:option(Value,"hna", "Host Network Announcement")
|
||||
hna.anonymous = true
|
||||
local hna_option = hna:option(Value,"hna", "Host Network Announcement IPv6")
|
||||
|
||||
function hna_option:validate(value)
|
||||
local err = sys.call('bmx6 -c --test -a ' .. value)
|
||||
if err ~= 0 then
|
||||
return nil
|
||||
end
|
||||
return value
|
||||
end
|
||||
--function hna_option:validate(value)
|
||||
-- local err = sys.call('bmx6 -c --test -a ' .. value)
|
||||
-- if err ~= 0 then
|
||||
-- return nil
|
||||
-- end
|
||||
-- return value
|
||||
--end
|
||||
|
||||
function m.on_commit(self,map)
|
||||
local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp')
|
||||
|
|
|
@ -38,10 +38,10 @@ local eth_int = luci.sys.net.devices()
|
|||
-- Getting the most important options from general
|
||||
local general = m:section(NamedSection,"general","general","General")
|
||||
general.addremove = false
|
||||
general:option(Value,"globalPrefix","Global ip prefix","Specify global prefix for interfaces: NETADDR/LENGTH")
|
||||
general:option(Value,"globalPrefix","Global ip prefix","Specify global prefix for interfaces: NETADDR/LENGTH. If you are using IPv6 leave blank to let bmx6 autoassign an ULA IPv6 address.")
|
||||
|
||||
if m:get("ipVersion","ipVersion") == "6" then
|
||||
general:option(Value,"tun4Address","NIIT IPv4 tunnel address","specify default IPv4 tunnel address and announced range (IP SHOULD be assigned to niit4to6 interface!)")
|
||||
general:option(Value,"tun4Address","IPv4 address or range","specify default IPv4 tunnel address and announced range")
|
||||
end
|
||||
|
||||
-- IP section
|
||||
|
@ -90,7 +90,7 @@ end
|
|||
-- Interfaces section
|
||||
local interfaces = m:section(TypedSection,"dev","Devices","")
|
||||
interfaces.addremove = true
|
||||
interfaces.anonymous = false
|
||||
interfaces.anonymous = true
|
||||
local intlv = interfaces:option(ListValue,"dev","Device")
|
||||
|
||||
for _,i in ipairs(eth_int) do
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
local sys = require("luci.sys")
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
plugins_dir = {"/usr/lib/","/var/lib","/lib"}
|
||||
|
||||
plugin = m:section(TypedSection,"plugin","Plugin")
|
||||
plugin.addremove = true
|
||||
plugin.anonymous = false
|
||||
plugin.anonymous = true
|
||||
plv = plugin:option(ListValue,"plugin", "Plugin")
|
||||
|
||||
for _,d in ipairs(plugins_dir) do
|
||||
|
@ -38,5 +38,13 @@ for _,d in ipairs(plugins_dir) do
|
|||
end
|
||||
|
||||
|
||||
function m.on_commit(self,map)
|
||||
local err = sys.call('/etc/init.d/bmx6 restart')
|
||||
if err ~= 0 then
|
||||
m.message = sys.exec("Cannot restart bmx6")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
|
||||
|
|
75
files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua
Normal file
75
files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua
Normal file
|
@ -0,0 +1,75 @@
|
|||
--[[
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
--]]
|
||||
|
||||
local sys = require("luci.sys")
|
||||
local bmx6json = require("luci.model.bmx6json")
|
||||
|
||||
m = Map("bmx6", "bmx6")
|
||||
|
||||
-- tunOut
|
||||
local tunnelsOut = m:section(TypedSection,"tunOut",translate("Networks to fetch"),translate("Tunnel announcements to fetch if possible"))
|
||||
tunnelsOut.addremove = true
|
||||
tunnelsOut.anonymous = true
|
||||
tunnelsOut:option(Value,"tunOut","Name")
|
||||
tunnelsOut:option(Value,"network", translate("Network to fetch"))
|
||||
|
||||
local tunoptions = bmx6json.getOptions("tunOut")
|
||||
local _,o
|
||||
for _,o in ipairs(tunoptions) do
|
||||
if o.name ~= nil and o.name ~= "network" then
|
||||
help = bmx6json.getHtmlHelp(o)
|
||||
value = tunnelsOut:option(Value,o.name,o.name,help)
|
||||
value.optional = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--tunIn
|
||||
local tunnelsIn = m:section(TypedSection,"tunInNet",translate("Networks to offer"),translate("Tunnels to announce in the network"))
|
||||
tunnelsIn.addremove = true
|
||||
tunnelsIn.anonymous = true
|
||||
|
||||
local net = tunnelsIn:option(Value,"tunInNet", translate("Network to offer"))
|
||||
net.default = "10.0.0.0/8"
|
||||
|
||||
local bwd = tunnelsIn:option(Value,"bandwidth",translate("Bandwidth (Bytes)"))
|
||||
bwd.default = "1000000"
|
||||
|
||||
local tuninoptions = bmx6json.getOptions("tunInNet")
|
||||
local _,o
|
||||
for _,o in ipairs(tuninoptions) do
|
||||
if o.name ~= nil and o.name ~= "tunInNet" and o.name ~= "bandwidth" then
|
||||
help = bmx6json.getHtmlHelp(o)
|
||||
value = tunnelsIn:option(Value,o.name,o.name,help)
|
||||
value.optional = true
|
||||
end
|
||||
end
|
||||
|
||||
function m.on_commit(self,map)
|
||||
--Not working. If test returns error the changes are still commited
|
||||
local msg = bmx6json.testandreload()
|
||||
if msg ~= nil then
|
||||
m.message = msg
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
|
@ -1,15 +1,23 @@
|
|||
<%#
|
||||
LuCI - Lua Configuration Interface
|
||||
Copyright 2012 Jo-Philipp Wich <xm@subsignal.org>
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Jo-Philip
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
$Id$
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
-%>
|
||||
|
||||
<%
|
||||
|
@ -26,6 +34,17 @@ $Id$
|
|||
<script type="text/javascript" src="<%=resource%>/bmx6/js/jquery-1.4.2.min.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/dracula_graph.js"></script>
|
||||
|
||||
<button id="redraw" onclick="redraw();">  redraw  </button>
|
||||
|
||||
<div id="wait" style="text-align: center">
|
||||
<br /><br />
|
||||
<img src="<%=resource%>/icons/loading.gif" />
|
||||
<%:Collecting data...%>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="canvas" style="min-width:800px; min-height:800px"></div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var redraw;
|
||||
|
||||
|
@ -54,7 +73,7 @@ $Id$
|
|||
g.addEdge(data[i].globalId, data[i].links[j].globalId,
|
||||
{ label: rxRate + '/' + txRate,
|
||||
directed: false, stroke: '#aaaaaa', fill: '#ffffff',
|
||||
'label-style': { 'font-size': 10 }});
|
||||
'label-style': { 'font-size': 8 }});
|
||||
seen[key] = true;
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +91,9 @@ $Id$
|
|||
var layouter = new Graph.Layout.Spring(g);
|
||||
layouter.layout();
|
||||
|
||||
var divwait = document.getElementById("wait");
|
||||
divwait.parentNode.removeChild(divwait);
|
||||
|
||||
var renderer = new Graph.Renderer.Raphael(canvas.id, g, canvas.offsetWidth, canvas.offsetHeight);
|
||||
renderer.draw();
|
||||
|
||||
|
@ -84,8 +106,5 @@ $Id$
|
|||
);
|
||||
//]]></script>
|
||||
|
||||
<button id="redraw" onclick="redraw();">redraw</button>
|
||||
<div id="canvas" style="min-width:800px; min-height:800px"></div>
|
||||
|
||||
|
||||
<%+footer%>
|
||||
|
|
87
files/usr/lib/lua/luci/view/bmx6/nodes.htm
Normal file
87
files/usr/lib/lua/luci/view/bmx6/nodes.htm
Normal file
|
@ -0,0 +1,87 @@
|
|||
<%+header%>
|
||||
<style type="text/css">
|
||||
|
||||
table {
|
||||
width:90%;
|
||||
border-top:1px solid #e5eaf8;
|
||||
border-right:1px solid #e5eaf8;
|
||||
margin:1em auto;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
|
||||
td {
|
||||
color:#678197;
|
||||
border-bottom:1px solid #e6eff8;
|
||||
border-left:1px solid #e6eff8;
|
||||
padding:.3em 1em;
|
||||
text-align:center;
|
||||
}
|
||||
th {
|
||||
background:#f4f9fe;
|
||||
text-align:center;
|
||||
font:bold 1.2em/2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif;
|
||||
color:#66a3d3;
|
||||
}
|
||||
|
||||
|
||||
#neighbour {
|
||||
position:relative;
|
||||
margin:5px;
|
||||
}
|
||||
|
||||
#orig_id {
|
||||
background-color: black;
|
||||
color: white;
|
||||
text-ident:10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2><a id="content" name="content"><%:Nodes%></a></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">IPv6</th>
|
||||
<th scope="col">Via Dev</th>
|
||||
<th scope="col">Via IP</th>
|
||||
<th scope="col">Routes</th>
|
||||
<th scope="col">Metric</th>
|
||||
<th scope="col">Last Desc</th>
|
||||
<th scope="col">Last Ref</th>
|
||||
</tr>
|
||||
|
||||
<% for i,o in ipairs(originators) do %>
|
||||
<tr>
|
||||
<td><%=o.name%></td>
|
||||
<td><a href="http://[<%=o.orig.primaryIp%>]"><%=o.orig.primaryIp%></a></td>
|
||||
<td><%=o.orig.viaDev%></td>
|
||||
<td><%=o.orig.viaIp%></td>
|
||||
<td><%=o.orig.routes%></td>
|
||||
<td><%=o.orig.metric%></td>
|
||||
<td><%=o.orig.lastDesc%></td>
|
||||
<td><%=o.orig.lastRef%></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="col">Node</th>
|
||||
<th scope="col">Announced networks</th>
|
||||
</tr>
|
||||
|
||||
<% for i,o in ipairs(originators) do %>
|
||||
<tr>
|
||||
<td><%=o.name%></td>
|
||||
<td style="text-align:left;">
|
||||
<% if o.desc.DESC_ADV ~= nil then %>
|
||||
<% for j,h in ipairs(o.desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do %>
|
||||
<%=h.address%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
<%+footer%>
|
193
files/usr/lib/lua/luci/view/bmx6/nodes_j.htm
Normal file
193
files/usr/lib/lua/luci/view/bmx6/nodes_j.htm
Normal file
|
@ -0,0 +1,193 @@
|
|||
<%#
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Lluis Esquerda <eskerda@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/polling.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
div.hideme{
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.info{
|
||||
background: #FFF;
|
||||
border: solid 0px;
|
||||
height: 90px;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.inforow{
|
||||
text-align:left;
|
||||
display:inline-block;
|
||||
width:20%;
|
||||
margin:5px;
|
||||
vertical-align:top;
|
||||
|
||||
}
|
||||
|
||||
#extra-info ul { list-style: none outside none; margin-left: 0em; }
|
||||
|
||||
</style>
|
||||
<div class="cbi-map">
|
||||
|
||||
<h2>Node originators</h2>
|
||||
<div class="cbi-map-descr"></div>
|
||||
<div id="extra-info" class="info">
|
||||
<br />
|
||||
<center>
|
||||
Click icon <img src="<%=resource%>/bmx6/world.png" /> to see individual node information
|
||||
</center>
|
||||
</div>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Mesh nodes%></legend>
|
||||
<table class="cbi-section-table" id="descriptions_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"></th>
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:Primary IP%></th>
|
||||
<th class="cbi-section-table-cell"><%:Via Device%></th>
|
||||
<th class="cbi-section-table-cell"><%:Metric%></th>
|
||||
<th class="cbi-section-table-cell"><%:Last Desc%></th>
|
||||
<th class="cbi-section-table-cell"><%:Last Ref%></th>
|
||||
<th class="cbi-section-table-cell"><%:Blocked%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="8"><br /><center><em><%:Collecting data...%></em></center></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<a href="<%=link_non_js%>">Go to non JavaScript view</a>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var displayExtraInfo = function ( id ) {
|
||||
document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
|
||||
}
|
||||
|
||||
new TablePooler(5,"/cgi-bin/bmx6-info", {'$neighbours':''}, "descriptions_table", function(st){
|
||||
var infoicon = "<%=resource%>/bmx6/world_small.png";
|
||||
var nodeicon = "<%=resource%>/bmx6/world.png";
|
||||
var originators = st.neighbours[0].originators;
|
||||
var descriptions = st.neighbours[1].descriptions;
|
||||
var res = Array();
|
||||
var error = "";
|
||||
|
||||
if ( originators.length != descriptions.length )
|
||||
{
|
||||
error = '<em><br /><%:Some problem with JSON: lenght of originators and descriptions differs. %> \
|
||||
<%: Please perform a cache flush from a console it this persists: bmx6 -c --flushAll %></em>';
|
||||
res.push([[error,7]]);
|
||||
return res;
|
||||
}
|
||||
|
||||
for ( var i = 0; i < descriptions.length; i++ ){
|
||||
var nodename = descriptions[i].DESC_ADV.globalId.replace(/\.[^\.]+$/,"");
|
||||
var extensions = descriptions[i].DESC_ADV.extensions;
|
||||
//var extrainfo = '<a onclick="displayExtraInfo(\'ip-' + i + '\')"><img src="' + infoicon + '" / ></a>';
|
||||
var extrainfo_link = '<a onclick="displayExtraInfo(\'ip-' + i + '\')">' + '<img src="' + infoicon + '" />' + '</a>';
|
||||
// Looking for the extensions
|
||||
var hna6 = [];
|
||||
var tun4in6 = [];
|
||||
var tun6 = [];
|
||||
for( var e = 0; e < extensions.length; e++)
|
||||
{
|
||||
if( extensions[e].HNA6_EXTENSION )
|
||||
hna6 = extensions[e].HNA6_EXTENSION;
|
||||
if ( extensions[e].TUN4IN6_NET_EXTENSION )
|
||||
tun4in6 = extensions[e].TUN4IN6_NET_EXTENSION;
|
||||
}
|
||||
|
||||
// Gateways
|
||||
var gateways = '<ul>';
|
||||
for ( var t = 0; t < tun4in6.length; t++)
|
||||
{
|
||||
if ( tun4in6[t].networklen == "32" )
|
||||
gateways += '<li><a href="http://' + tun4in6[t].network + '">' + tun4in6[t].network + '</a></li>';
|
||||
else
|
||||
gateways += "<li>"+tun4in6[t].network+'/'+tun4in6[t].networklen + ' | ' + tun4in6[t].bandwidth+'</li>';
|
||||
}
|
||||
gateways += '</ul>';
|
||||
|
||||
//Adding HNAs with prefix=128 as main address
|
||||
var ipstxt = '';
|
||||
var address;
|
||||
var first = 1;
|
||||
var ipstxt_hidden = '<ul>';
|
||||
var hna6list = '<ul>';
|
||||
var extrainfo = "";
|
||||
|
||||
for( var e = 0; e < hna6.length; e++ )
|
||||
{
|
||||
address = hna6[e].address;
|
||||
prefix = hna6[e].prefixlen;
|
||||
if ( prefix == '128' )
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
ipstxt += address;
|
||||
ipstxt_hidden += '<li><a href="http://['+address+']" >'+address+"</a></li>";
|
||||
first = 0;
|
||||
}
|
||||
else {
|
||||
ipstxt_hidden += '<li><a href="http://['+address+']" >'+address+"</a></li>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
hna6list += '<li>'+address+'/'+prefix+'</li>';
|
||||
}
|
||||
}
|
||||
hna6list += '</ul>';
|
||||
ipstxt_hidden += '</ul>';
|
||||
|
||||
extrainfo = '<div id="ip-'+ i +'" class="hideme">'
|
||||
+ "<div class='inforow'>"
|
||||
+ "<h4>" + nodename + '</h4>\n' + '<img src="' + nodeicon + '" />'+ "</div>"
|
||||
|
||||
+ "<div class='inforow'>"
|
||||
+ "<h5>Available IPs</h5>\n"
|
||||
+ ipstxt_hidden + "</div>\n"
|
||||
|
||||
+ "<div class='inforow'>"
|
||||
+ "<h5>Gateways announced</h5>\n"
|
||||
+ gateways + "</div>\n"
|
||||
|
||||
+ "<div class='inforow'>"
|
||||
+ "<h5>Networks announced</h5>\n"
|
||||
+ hna6list + "</div>\n"
|
||||
+ "\n</div>";
|
||||
|
||||
res.push([extrainfo_link,nodename, ipstxt, originators[i].viaDev, originators[i].metric,
|
||||
originators[i].lastDesc, originators[i].lastRef, originators[i].blocked, extrainfo]);
|
||||
|
||||
}
|
||||
return res;
|
||||
});
|
||||
//]]></script>
|
||||
|
||||
<%+footer%>
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
<%+header%>
|
||||
<link rel="stylesheet" type="text/css" href="/luci-static/resources/bmx6/style.css" />
|
||||
|
||||
<img src="<%=resource%>/bmx6/bmx6logo.png" />
|
||||
|
||||
Bmx6 is a routing protocol for Linux based operating systems. Visit <a href="http://bmx6.net">bmx6.net</a> for more info.
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h2>Status of bmx6</h2>
|
||||
|
||||
<table>
|
||||
|
|
114
files/usr/lib/lua/luci/view/bmx6/status_j.htm
Normal file
114
files/usr/lib/lua/luci/view/bmx6/status_j.htm
Normal file
|
@ -0,0 +1,114 @@
|
|||
<%+header%>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/polling.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
div.hideme{
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.info{
|
||||
background: #FFF;
|
||||
border: solid 1px;
|
||||
height: 80px;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.inforow{
|
||||
text-align:left;
|
||||
display:inline-block;
|
||||
width:20%;
|
||||
margin:5px;
|
||||
vertical-align:top;
|
||||
|
||||
}
|
||||
|
||||
#extra-info ul { list-style: none outside none; margin-left: 0em; }
|
||||
|
||||
</style>
|
||||
<div class="cbi-map">
|
||||
<center>
|
||||
<img src="<%=resource%>/bmx6/bmx6logo.png" />
|
||||
<br />
|
||||
<br />
|
||||
a mesh routing protocol for Linux devices.<br />
|
||||
Visit <a href="http://bmx6.net">bmx6.net</a> for more info.
|
||||
<br />
|
||||
<br />
|
||||
</center>
|
||||
|
||||
<h2>status</h2>
|
||||
<div class="cbi-map-descr"></div>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:status%></legend>
|
||||
<table class="cbi-section-table" id="status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Version%></th>
|
||||
<th class="cbi-section-table-cell"><%:Compat%></th>
|
||||
<th class="cbi-section-table-cell"><%:Code Version%></th>
|
||||
<th class="cbi-section-table-cell"><%:Global ID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Primary IP%></th>
|
||||
<th class="cbi-section-table-cell"><%:Tun6Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Tun4Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Local ID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Uptime%></th>
|
||||
<th class="cbi-section-table-cell"><%:Cpu load%></th>
|
||||
<th class="cbi-section-table-cell"><%:Nodes seen%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="11"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
|
||||
<legend><%:Network devices%></legend>
|
||||
<table class="cbi-section-table" id="ifaces_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Name%></th>
|
||||
<th class="cbi-section-table-cell"><%:State%></th>
|
||||
<th class="cbi-section-table-cell"><%:Type%></th>
|
||||
<th class="cbi-section-table-cell"><%:Rate%></th>
|
||||
<th class="cbi-section-table-cell"><%:Local IP%></th>
|
||||
<th class="cbi-section-table-cell"><%:Global IP%></th>
|
||||
<th class="cbi-section-table-cell"><%:Multicast IP%></th>
|
||||
<th class="cbi-section-table-cell"><%:is Primary%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="8"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
new TablePooler(5,"/cgi-bin/bmx6-info", {'status':''}, "status_table", function(st){
|
||||
var res = Array();
|
||||
var sta = st.status;
|
||||
|
||||
res.push([sta.version,sta.compatibility,sta.codeVersion,sta.globalId,sta.primaryIp,sta.tun6Address,
|
||||
sta.tun4Address,sta.myLocalId,sta.uptime,sta.cpu,sta.nodes]);
|
||||
return res;
|
||||
});
|
||||
|
||||
new TablePooler(5,"/cgi-bin/bmx6-info", {'interfaces':''}, "ifaces_table", function(st){
|
||||
var res = Array();
|
||||
var ifaces = st.interfaces;
|
||||
|
||||
for ( var i = 0; i < ifaces.length; i++)
|
||||
{
|
||||
res.push([ifaces[i].devName,ifaces[i].state,ifaces[i].type,ifaces[i].rateMin+"/"+ifaces[i].rateMax,
|
||||
ifaces[i].llocalIp,ifaces[i].globalIp,ifaces[i].multicastIp,ifaces[i].primary]);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
//]]></script>
|
||||
|
||||
|
||||
<%+footer%>
|
||||
|
107
files/usr/lib/lua/luci/view/bmx6/tunnels_j.htm
Normal file
107
files/usr/lib/lua/luci/view/bmx6/tunnels_j.htm
Normal file
|
@ -0,0 +1,107 @@
|
|||
<%#
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Lluis Esquerda <eskerda@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
-%>
|
||||
|
||||
|
||||
<%+header%>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/bmx6/js/polling.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
div.hideme{
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.info{
|
||||
background: #FFF;
|
||||
border: solid 1px;
|
||||
height: 80px;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div.inforow{
|
||||
text-align:left;
|
||||
display:inline-block;
|
||||
width:20%;
|
||||
margin:5px;
|
||||
vertical-align:top;
|
||||
|
||||
}
|
||||
|
||||
#extra-info ul { list-style: none outside none; margin-left: 0em; }
|
||||
|
||||
</style>
|
||||
<div class="cbi-map">
|
||||
|
||||
<h2>Gateways tunnel announcements</h2>
|
||||
<div class="cbi-map-descr"></div>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Mesh gateways%></legend>
|
||||
<table class="cbi-section-table" id="descriptions_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"></th>
|
||||
<th class="cbi-section-table-cell"><%:Tunnel%></th>
|
||||
<th class="cbi-section-table-cell"><%:Node%></th>
|
||||
<th class="cbi-section-table-cell"><%:Network%></th>
|
||||
<th class="cbi-section-table-cell"><%:Bandwidth%></th>
|
||||
<th class="cbi-section-table-cell"><%:SearchNet%></th>
|
||||
<th class="cbi-section-table-cell"><%:Type%></th>
|
||||
<th class="cbi-section-table-cell"><%:Path Metric%></th>
|
||||
<th class="cbi-section-table-cell"><%:IP metric%></th>
|
||||
<th class="cbi-section-table-cell"><%:Tun metric%></th>
|
||||
<th class="cbi-section-table-cell"><%:Bonus%></th>
|
||||
<th class="cbi-section-table-cell"><%:search id%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="10"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
new TablePooler(5,"/cgi-bin/bmx6-info", {'$tunnels':''}, "descriptions_table", function(st){
|
||||
var tunicon = "<%=resource%>/icons/tunnel.png";
|
||||
var tunicon_dis = "<%=resource%>/icons/tunnel_disabled.png";
|
||||
var applyicon = "<%=resource%>/cbi/apply.gif";
|
||||
var res = Array();
|
||||
for ( var k in st.tunnels ){
|
||||
var tunnel = st.tunnels[k];
|
||||
var nodename = tunnel.remoteId.replace(/\..+$/,'');
|
||||
var advnet = tunnel.advNet;
|
||||
var status = '<img src="'+tunicon_dis+'"/>';
|
||||
|
||||
if ( tunnel.tunName != "---" ) status = '<img src="'+tunicon+'"/>';
|
||||
if ( advnet == "0.0.0.0/0" ) advnet = "<b>Internet</b>";
|
||||
|
||||
res.push([status, tunnel.name, nodename, advnet, tunnel.advBw, tunnel.searchNet, tunnel.advType,
|
||||
tunnel.pathMtc, tunnel.ipMtc, tunnel.tunMtc, tunnel.bonus, tunnel.searchId]);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
//]]></script>
|
||||
|
||||
<%+footer%>
|
||||
|
BIN
files/www/luci-static/resources/bmx6/bmx6logo.png
Normal file
BIN
files/www/luci-static/resources/bmx6/bmx6logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
81
files/www/luci-static/resources/bmx6/js/polling.js
Normal file
81
files/www/luci-static/resources/bmx6/js/polling.js
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
Copyright (C) 2011 Pau Escrich <pau@dabax.net>
|
||||
Contributors Lluis Esquerda <eskerda@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
The full GNU General Public License is included in this distribution in
|
||||
the file called "COPYING".
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Table pooler is a function to easy call XHR poller.
|
||||
|
||||
new TablePooler(5,"/cgi-bin/bmx6-info", {'status':''}, "status_table", function(st){
|
||||
var table = Array()
|
||||
table.push(st.first,st.second)
|
||||
return table
|
||||
}
|
||||
Parameters are:
|
||||
polling_time: time between pollings
|
||||
json_url: the json url to fetch the data
|
||||
json_call: the json call
|
||||
output_table_id: the table where javascript will put the data
|
||||
callback_function: the function that will be executed each polling_time
|
||||
|
||||
The callback_function must return an array of arrays (matrix).
|
||||
In the code st is the data obtained from the json call
|
||||
*/
|
||||
|
||||
function TablePooler (time, jsonurl, getparams, table_id, callback) {
|
||||
this.table = document.getElementById(table_id);
|
||||
this.callback = callback;
|
||||
this.jsonurl = jsonurl;
|
||||
this.getparams = getparams;
|
||||
this.time = time;
|
||||
|
||||
this.clear = function(){
|
||||
/* clear all rows */
|
||||
while( this.table.rows.length > 1 ) this.table.deleteRow(1);
|
||||
}
|
||||
this.start = function(){
|
||||
XHR.poll(this.time, this.jsonurl, this.getparams, function(x, st){
|
||||
var data = this.callback(st);
|
||||
var content, tr, td;
|
||||
this.clear();
|
||||
for (var i = 0; i < data.length; i++){
|
||||
tr = this.table.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
for (var j = 0; j < data[i].length; j++){
|
||||
td = tr.insertCell(-1);
|
||||
if (data[i][j].length == 2) {
|
||||
td.colSpan = data[i][j][1];
|
||||
content = data[i][j][0];
|
||||
}
|
||||
else content = data[i][j];
|
||||
td.innerHTML = content;
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
files/www/luci-static/resources/bmx6/world.png
Normal file
BIN
files/www/luci-static/resources/bmx6/world.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
files/www/luci-static/resources/bmx6/world_small.png
Normal file
BIN
files/www/luci-static/resources/bmx6/world_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 923 B |
Loading…
Reference in a new issue