1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 10:31:51 +00:00

Fix mptcp graph

This commit is contained in:
Ycarus 2018-05-22 11:13:28 +02:00
parent e10f778c34
commit a15336068d
2 changed files with 26 additions and 24 deletions

View file

@ -32,14 +32,15 @@ function multipath_bandwidth()
local result = { };
local uci = luci.model.uci.cursor()
for _, dev in luci.util.vspairs(luci.sys.net.devices()) do
if dev ~= "lo" then
local multipath = uci:get("network", dev, "multipath")
uci:foreach("network", "interface", function(s)
local dev = s["ifname"]
if dev ~= "lo" and dev ~= "" then
local multipath = s["multipath"] or "off"
if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then
result[dev] = "[" .. string.gsub((luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev)), '[\r\n]', '') .. "]"
end
end
end
end)
luci.http.prepare_content("application/json")
luci.http.write_json(result)

View file

@ -3,6 +3,7 @@
-- Copyright 2015 OVH (OverTheBox@ovh.net)
-- Simon Lelievre (simon.lelievre@corp.ovh.com)
-- Sebastien Duponcheel (sebastien.duponcheel@ovh.net)
-- Copyright 2018 Ycarus - Yannick Chabanois (ycarus@zugaina.org)
--
-- This file is part of OverTheBox for OpenWrt.
--
@ -48,28 +49,28 @@
<script type="text/javascript">//<![CDATA[
function stringToColour(str) {
if(str == "free1")
if(str == "wan")
return "FireBrick";
if(str == "ovh1")
if(str == "wan1")
return "DeepSkyBlue";
if(str == "ovh2")
if(str == "wan2")
return "LightGreen";
if(str == "if1")
return "PaleGreen";
if(str == "if2")
return "PowderBlue";
if(str == "if3")
return "Salmon";
if(str == "if4")
return "SeaGreen";
if(str == "if5")
return "PaleTurquoise";
// Generate a color folowing the name
Math.seedrandom(str);
var rand = Math.random() * Math.pow(255,3);
Math.seedrandom(); // don't leave a non-random seed in the generator
for (var i = 0, colour = "#"; i < 3; colour += ("00" + ((rand >> i++ * 8) & 0xFF).toString(16)).slice(-2));
return colour;
if(str == "wan3")
return "PaleGreen";
if(str == "wan4")
return "PowderBlue";
if(str == "wan5")
return "Salmon";
if(str == "wan6")
return "SeaGreen";
if(str == "wan7")
return "PaleTurquoise";
// Generate a color folowing the name
Math.seedrandom(str);
var rand = Math.random() * Math.pow(255,3);
Math.seedrandom(); // don't leave a non-random seed in the generator
for (var i = 0, colour = "#"; i < 3; colour += ("00" + ((rand >> i++ * 8) & 0xFF).toString(16)).slice(-2));
return colour;
}
function bandwidth_label(bytes, br)
@ -313,7 +314,7 @@
tr.setAttribute('id', itf + '_upload');
// Create cells of the table
var itflabel = tr.insertCell(0);
// Crete itf legend
// Create itf legend
var strong = document.createElement('strong')
strong.appendChild(document.createTextNode(itf));
strong.setAttribute('style', 'border-bottom:2px solid ' + color);