summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/luasrc/model
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-01-21 20:13:12 +0100
committerGitHub <noreply@github.com>2019-01-21 20:13:12 +0100
commit29c343c5ea7abbe9e81f316264800702479a90ff (patch)
tree0f10f96175ff9803d6c3ce57621423ecbd89f786 /applications/luci-app-statistics/luasrc/model
parenta86c068870dea59844a282ca43885ef4fcbfa07f (diff)
parentc593a210b2305f7901fcb45e0cc1810f4534164c (diff)
Merge pull request #2473 from TDT-AG/pr/20190121-luci-app-statistics
luci-app-statistics: some code cleanup
Diffstat (limited to 'applications/luci-app-statistics/luasrc/model')
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua12
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/memory.lua12
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua3
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua2
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/uptime.lua12
10 files changed, 18 insertions, 48 deletions
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua
index 663a3f12d4..b380febac0 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua
@@ -1,7 +1,7 @@
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require("luci.sys")
+local sys = require("luci.sys")
m = Map("luci_statistics",
@@ -17,7 +17,7 @@ s = m:section( NamedSection, "collectd", "luci_statistics" )
-- general.hostname (Hostname)
hostname = s:option( Value, "Hostname", translate("Hostname") )
-hostname.default = luci.sys.hostname()
+hostname.default = sys.hostname()
hostname.optional = true
-- general.basedir (BaseDir)
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua
index f89cdb1fb8..608144f135 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua
@@ -1,13 +1,5 @@
---[[
-
-Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
-
-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
-
- http://www.apache.org/licenses/LICENSE-2.0
-]]--
+-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
m = Map("luci_statistics",
translate("Conntrack Plugin Configuration"),
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua
index dafcc452cc..4245018661 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua
@@ -1,7 +1,7 @@
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require("luci.sys")
+local sys = require("luci.sys")
m = Map("luci_statistics",
@@ -24,7 +24,7 @@ interfaces.widget = "select"
interfaces.size = 5
interfaces:depends( "enable", 1 )
interfaces:value("any")
-for k, v in pairs(luci.sys.net.devices()) do
+for k, v in pairs(sys.net.devices()) do
interfaces:value(v)
end
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua
index 752212f4d4..60c88d072c 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua
@@ -1,7 +1,7 @@
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require("luci.sys")
+local sys = require("luci.sys")
m = Map("luci_statistics",
@@ -23,7 +23,7 @@ interfaces = s:option( MultiValue, "Interfaces", translate("Monitor interfaces")
interfaces.widget = "select"
interfaces.size = 5
interfaces:depends( "enable", 1 )
-for k, v in pairs(luci.sys.net.devices()) do
+for k, v in pairs(sys.net.devices()) do
interfaces:value(v)
end
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua
index ded3f7f996..375a15bf1a 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua
@@ -1,13 +1,12 @@
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require("luci.sys.iptparser")
+local ip = require("luci.sys.iptparser").IptParser()
-ip = luci.sys.iptparser.IptParser()
-chains = { }
-targets = { }
+local chains = { }
+local targets = { }
-for i, rule in ipairs( ip:find() ) do
+for i, rule in ipairs( ip:find() ) do
if rule.chain and rule.target then
chains[rule.chain] = true
targets[rule.target] = true
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/memory.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/memory.lua
index 5510a5a8e8..fa677b8d12 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/memory.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/memory.lua
@@ -1,13 +1,5 @@
---[[
-
-Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
-
-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
-
- http://www.apache.org/licenses/LICENSE-2.0
-]]--
+-- Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
+-- Licensed to the public under the Apache License 2.0.
m = Map("luci_statistics",
translate("Memory Plugin Configuration"),
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua
index 66449ec467..784ad1fdbb 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua
@@ -1,9 +1,9 @@
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require("luci.sys")
+local sys = require("luci.sys")
-local devices = luci.sys.net.devices()
+local devices = sys.net.devices()
m = Map("luci_statistics",
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua
index 193f0448ae..f0a5ab5930 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua
@@ -1,11 +1,8 @@
-- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require "luci.sys"
-
local m, s, o
-
m = Map("luci_statistics",
translate("OpenVPN Plugin Configuration"),
translate("The OpenVPN plugin gathers information about the current vpn connection status."))
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua
index 77e36bfaff..69066880c3 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua
@@ -1,8 +1,6 @@
-- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
-require "luci.sys"
-
local m, s, o
local sensor_types = {
["12v"] = "voltage",
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/uptime.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/uptime.lua
index 3a6c4644e3..5e32da7ffe 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/uptime.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/uptime.lua
@@ -1,13 +1,5 @@
---[[
-
-Copyright 2013 Thomas Endt <tmo26@gmx.de>
-
-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
-
- http://www.apache.org/licenses/LICENSE-2.0
-]]--
+-- Copyright 2013 Thomas Endt <tmo26@gmx.de>
+-- Licensed to the public under the Apache License 2.0.
m = Map("luci_statistics",
translate("Uptime Plugin Configuration"),