[luci] LuCI view controller, and bmx6 luci moule

Pau hakais at gmail.com
Sun Jun 5 14:11:47 CEST 2011


Hi all.
I have been working with a "new" version of this freature. Now you can
specify the location with something like this:

---------------------------------------------------------------
config 'bmx6' 'luci'
        option ignore '0'
        option place 'admin status Bmx6'
---------------------------------------------------------------

So now you can speficy as levels as you need.

And here my implementation of the controller (place var is an array
containing the values of UCI configuration):

---------------------------------------------------------------
        local ucim = require "luci.model.uci"
        local uci = ucim.cursor()
        local place = {}

        -- checking if ignore is on
        if uci:get("luci-bmx6","luci","ignore") == "1" then
                return nil
        end

        -- getting value from uci database
        local uci_place = uci:get("luci-bmx6","luci","place")

        -- default values
        if uci_place == nil then
                place = {"bmx6"}
        else
                local util = require "luci.util"
                place = util.split(uci_place," ")
        end

        -- Starting with the pages

        --- status (this is default one)
        entry(place,call("action_status"),place[#place])

        --- interfaces
        table.insert(place,"Interfaces")
        entry(place,call("action_interfaces"),"Interfaces")
        table.remove(place)

       --- neighbours
        table.insert(place,"Neighbours")
        entry(place,call("action_neighbours"),"Neighbours")
        table.remove(place)

        --- wireless links
        table.insert(place,"Wireless")
        entry(place,call("action_wireless"),"Wireless")
        table.remove(place)
---------------------------------------------------------------

With this system you can choose the menu location of the luci module. Very
interesting for openwrt-based-distributions.
You can redistribute or ignore all submenus, so you can adapt it to your
requirements.

Now I need to apply it to luc-admin-full module. How do you see it?
Who is the maintainer of luci-admin-full, maybe Jow?

Thanks.

2011/4/9 Pau <hakais at gmail.com>

> this is a thing many communities need/want and therefore it may be a
>> good idea to join forces. I'm currently on some kind of mission, because
>> i think it may be a good thing to work together on one firmware to avoid
>> work being done twice (or more often). If you like contact me via jabber
>> (soma at jabber.ccc.de) or write a private mail, i'd like to hear more
>> about your plans.
>>
>
> You are right, maybe we can work together. I'll explain you more details
> about our project by private.
>
>
> Just out of curiosity: what does qmp mean and why do you need olsr to be
>> shown there?
>>
> qmp = Quick Mesh Project
>
> Our idea is to have a very simple web interface, with only one or two tabs.
> The main tab will be "qmp", where you are be able to define the main options
> of the system.
>
> We are using three protocols: bmx6 (main), olsr6 and babel at the same
> time. But the OLSR example was only an example.
> But for instance, the Interface and Wireless section from
> luci-mod-admin-core is usefull for us. But not the rest.
> Then, we will have something like this:
>
> qmp -> interfaces
> qmp -> status (bmx6 & olsr6)
> qmp -> wireless links
>
> We are "redesigning" LuCi interface to adapt it to our requirements, this
> is the idea.
>
>
> That feels a bit too static for me, i.e. you assume there are 3
>> levels.If a feature to place modules at custom places should be
>> implemented i think this should be more flexible. But I'm not so sure
>> this is a good idea at all because it can make it hard to write
>> documentation or help users if everything can be everywhere in the menu.
>>
>
> You are right also.
> Meybe the best way to do this is with only one option:
>
> option 'section' 'admin status bmx6'
>
> But I don't know how to implement it.  Because to define a section I have
> to do:
>
> page = node("admin","status", "bmx6")
> or
> entry( {"admin", "services", "olsrd", "plugins"})
>
> Then, I cannot iterate between the section elements because I cannot add
> the elements one-to-one.
>
> Do you know if something like this is possible?:
>
> page = node.add("admin")
> page = node.add("status")
> page = node.add("bmx6")
>
> Thank you!!
>
> /p4u
>
> 2011/4/9 Manuel Munz <freifunk at somakoma.de>
>
>> Hi Pau
>>
>> On 09.04.2011 18:11, Pau wrote:
>> > Hi people.
>> > This is my first mail to this mailing list. I'm Pau from Barcelona (
>> > guifi.net), last week I was in sublab, maybe some of you can remind me.
>> > Well,we are developing an OpenWrt based firmware for quick mesh
>> deployments.
>> > The main freature is going to be the "out of the box" system. Where the
>> user
>> > does not need knowlatges about networking.
>>
>> this is a thing many communities need/want and therefore it may be a
>> good idea to join forces. I'm currently on some kind of mission, because
>> i think it may be a good thing to work together on one firmware to avoid
>> work being done twice (or more often). If you like contact me via jabber
>> (soma at jabber.ccc.de) or write a private mail, i'd like to hear more
>> about your plans.
>>
>> >
>> > I'm working with the LuCI interface, trying to adapt it to our
>> requirements.
>> > We need one thing that seems not suporrted by LuCI system. We need
>> control
>> > over the existing modules and where are them showed in the web
>> interface.
>> > For instance, the OLSR module in placed here:
>> > luci -> admin -> status -> olsr
>> >
>> > And we need to put it here:
>> > luci -> qmp -> olsr
>>
>> Just out of curiosity: what does qmp mean and why do you need olsr to be
>> shown there?
>>
>> >
>> > The only way I found is editing the olsr.lua code, and modify the
>> entry()
>> > function. But with a system upgrade or something like this the changes
>> will
>> > be lost.
>> > Also we need to control if a installed module must be shown or not.
>> >
>> > However, I am also developing a bmx6 luci module (I know jow is also
>> working
>> > on it, maybe we should work togheter). And for this  module I have
>> > implemented the following freature:
>> >
>> > /etc/config/bmx6
>> > ......
>> > config bmx6 luci
>> >     option ignore 0
>> >     option level1 admin
>> >     option level2 status
>> >     option level3 bmx6
>> >     option json http://127.0.0.1:8086/
>> > ......
>> >
>> > You can find the bmx6.lua code here: http://pastebin.com/cYy2bYXN
>> > From line 6 to 26, you can see the code that read the parameters from
>> bmx6
>> > with uci interface.
>> > Then, the position in the luci web site is allways dinamic, you can
>> change
>> > the bmx6.luci options from uci to disable/move it.
>>
>> That feels a bit too static for me, i.e. you assume there are 3
>> levels.If a feature to place modules at custom places should be
>> implemented i think this should be more flexible. But I'm not so sure
>> this is a good idea at all because it can make it hard to write
>> documentation or help users if everything can be everywhere in the menu.
>>
>> [...]
>>
>> Regards, soma
>>
>>
>> _______________________________________________
>> luci mailing list
>> luci at lists.subsignal.org
>> https://lists.subsignal.org/mailman/listinfo/luci
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20110605/13fd0955/attachment.htm 


More information about the luci mailing list