shamim
shamim

Reputation: 6768

How to map with multiple config files

Work on openwrt luci.I have multiple configuration files like: network and wireless face problem in mapping.I use bellow syntax for mapping

m = Map("network", translate("Wireless Settings"))

How to map with multiple config files in one model

Upvotes: 2

Views: 1318

Answers (1)

shamim
shamim

Reputation: 6768

To work with map(),first we need to understand clearly map definition with properties.Here is map definition

class Map (config, title, description)

This is the root object of the model.

  • config: configuration name to be mapped, see uci documentation and the files in /etc/config
  • title: title shown in the UI
  • description: description shown in the UI

you have two config network and wireless. OK let start multiple config file binding process.First we map with network config file then we map with wireless config file

Map with network config file

m = Map("network", translate("Wireless Settings")) -- We want to edit the uci config file /etc/config/network
m:chain("wireless")
s = m:section(NamedSection, "wan", "") -- Especially the "interface"-sections

Note: m:chain("config") bind second config file

Map with wireless config file

m1 = Map("wireless","Wireless Network") -- We want to edit the uci config file /etc/config/network
s1 = m1:section(NamedSection,"wifi-iface", "") -- Especially the "interface"-sections

for render now we need to return my map model objects

return m,m1

In this way you can map multiple config files in one model.

Upvotes: 2

Related Questions