Developing lightweight computation at the DSG edge

qmp.lua 2.85 KB
Newer Older
1
--[[
2
    Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

    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".
--]]

22
module("luci.controller.qmp", package.seeall)
23
24

function index()
25

26
	-- Making qmp as default
27
28
29
30
31
	local root = node()
	root.target = alias("qmp")
	root.index  = true

	-- Main window with auth enabled
p4u's avatar
p4u committed
32
	overview = entry({"qmp"}, template("admin_status/index"), "qMp", 1)
33
34
35
	overview.dependent = false
	overview.sysauth = "root"
	overview.sysauth_authenticator = "htmlauth"
36

37
	-- Rest of entries
38
	entry({"qmp","status"}, template("admin_status/index"), "Status", 2).dependent=false
39

p4u's avatar
p4u committed
40
41
42
43
44
45
46
47
48
49
50
51
	entry({"qmp","configuration"}, cbi("qmp/wizard"), "Configuration", 4).dependent=false
	entry({"qmp","configuration","wizard"}, cbi("qmp/wizard"), "Wizard", 1).dependent=false
	entry({"qmp","configuration","network"}, cbi("qmp/network"), "Network", 2).dependent=false
	entry({"qmp","configuration","network","advanced"}, cbi("qmp/network_adv"), "Advanced networking", 1).dependent=false
	entry({"qmp","configuration","wifi"}, cbi("qmp/wireless"), "WiFi", 3).dependent=false
	entry({"qmp","configuration","node"}, cbi("qmp/node"), "Node", 4).dependent=false

	entry({"qmp","tools"}, call("action_tools"), "Tools", 5).dependent=false
	entry({"qmp","tools","splash"}, call("action_splash"), "Splash", 1).dependent=false
	entry({"qmp","tools","map"}, call("action_map"), "Map", 2).dependent=false

	entry({"qmp","about"}, call("action_status"), "About", 9).dependent=false
52
end
53

54
function action_status()
55
56
57
58
59
	package.path = package.path .. ";/etc/qmp/?.lua"
	local qmp = require "qmpinfo"
	local ipv4 = qmp.get_ipv4()
	local hostname = qmp.get_hostname()
	local uname = qmp.get_uname()
60

61
	luci.template.render("qmp/overview",{ipv4=ipv4,hostname=hostname,uname=uname})
62
end
p4u's avatar
p4u committed
63

64
65
66
67
function action_tools()
	package.path = package.path .. ";/etc/qmp/?.lua"
	local qmp = require "qmpinfo"
	local nodes = qmp.nodes()
68
	local key = qmp.get_key()
69
	luci.template.render("qmp/tools",{nodes=nodes,key=key})
70
71
end

p4u's avatar
p4u committed
72
73
74
function action_splash()
	luci.template.render("qmp/splash")
end
Agustí Moll Garcia's avatar
Agustí Moll Garcia committed
75
76
77
78
79

function action_map()
	luci.template.render("qmp/b6m")
end