Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
f0b2e632
Commit
f0b2e632
authored
2 years ago
by
lemoer
Browse files
Options
Downloads
Patches
Plain Diff
gluon-web-network: initial draft of role configuration
parent
7cd4a189
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua
+15
-29
15 additions, 29 deletions
...work/luasrc/lib/gluon/config-mode/model/admin/network.lua
with
15 additions
and
29 deletions
package/gluon-web-network/luasrc/lib/gluon/config-mode/model/admin/network.lua
+
15
−
29
View file @
f0b2e632
...
@@ -9,13 +9,12 @@ http://www.apache.org/licenses/LICENSE-2.0
...
@@ -9,13 +9,12 @@ http://www.apache.org/licenses/LICENSE-2.0
]]
--
]]
--
local
uci
=
require
(
"simple-uci"
).
cursor
()
local
uci
=
require
(
"simple-uci"
).
cursor
()
local
sysconfig
=
require
'gluon.sysconfig'
local
util
=
require
'gluon.util'
local
wan
=
uci
:
get_all
(
"network"
,
"wan"
)
local
wan
=
uci
:
get_all
(
"network"
,
"wan"
)
local
wan6
=
uci
:
get_all
(
"network"
,
"wan6"
)
local
wan6
=
uci
:
get_all
(
"network"
,
"wan6"
)
local
dns_static
=
uci
:
get_first
(
"gluon-wan-dnsmasq"
,
"static"
)
local
dns_static
=
uci
:
get_first
(
"gluon-wan-dnsmasq"
,
"static"
)
local
f
=
Form
(
translate
(
"WAN connection"
))
local
f
=
Form
(
translate
(
"WAN connection"
))
local
s
=
f
:
section
(
Section
)
local
s
=
f
:
section
(
Section
)
...
@@ -76,36 +75,22 @@ end
...
@@ -76,36 +75,22 @@ end
s
=
f
:
section
(
Section
)
s
=
f
:
section
(
Section
)
local
wired_mesh_help
=
{
uci
:
foreach
(
'gluon'
,
'interface'
,
function
(
config
)
single
=
translate
(
'Enable meshing on the Ethernet interface'
),
local
section_name
=
config
[
'.name'
]
wan
=
translate
(
'Enable meshing on the WAN interface'
),
local
ifaces
=
s
:
option
(
MultiListValue
,
section_name
,
config
.
name
)
lan
=
translate
(
'Enable meshing on the LAN interface'
),
}
ifaces
.
orientation
=
'horizontal'
ifaces
:
value
(
'uplink'
,
'Uplink'
)
-- TODO: Uplink and Client should be mutually exclusive.
local
function
wired_mesh
(
iface
)
ifaces
:
value
(
'mesh'
,
'Mesh'
)
if
not
sysconfig
[
iface
..
'_ifname'
]
then
return
end
ifaces
:
value
(
'client'
,
'Client'
)
local
iface_roles
=
uci
:
get_list
(
'gluon'
,
'iface_'
..
iface
,
'role'
)
ifaces
.
default
=
config
.
role
local
option
=
s
:
option
(
Flag
,
'mesh_'
..
iface
,
wired_mesh_help
[
iface
])
option
.
default
=
util
.
contains
(
iface_roles
,
'mesh'
)
~=
false
function
option
:
write
(
data
)
local
roles
=
uci
:
get_list
(
'gluon'
,
'iface_'
..
iface
,
'role'
)
if
data
then
util
.
add_to_set
(
roles
,
'mesh'
)
else
util
.
remove_from_set
(
roles
,
'mesh'
)
end
uci
:
set_list
(
'gluon'
,
'iface_'
..
iface
,
'role'
,
roles
)
-- Reconfigure on next reboot
function
ifaces
:
write
(
data
)
uci
:
set
(
'
gluon
'
,
'core'
,
'reconfigure'
,
true
)
uci
:
set
_list
(
"
gluon
"
,
section_name
,
"role"
,
data
)
end
end
end
end
)
wired_mesh
(
'single'
)
wired_mesh
(
'wan'
)
wired_mesh
(
'lan'
)
local
section
local
section
uci
:
foreach
(
"system"
,
"gpio_switch"
,
function
(
si
)
uci
:
foreach
(
"system"
,
"gpio_switch"
,
function
(
si
)
...
@@ -166,4 +151,5 @@ function f:write()
...
@@ -166,4 +151,5 @@ function f:write()
uci
:
commit
(
'system'
)
uci
:
commit
(
'system'
)
end
end
return
f
return
f
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment