problem referencing users using the addPrivateMenu in the demo application

12 views
Skip to first unread message

MPC

unread,
Jun 15, 2020, 12:42:16 PM6/15/20
to LoRaWAN Server Users
Hi.

I have added in the demo application for the microchip motes and it work great.

Just wanting to extend the admin menu options and the demo shows a great example but I am having problems understand how to reference the users.


In the main admin java script file 'admin.js' you can have a 'reference_many' to add many users to an item but if I try this in the demo application it fails.

Example below 

function addPrivateMenu(nga, admin, dashL, dashR) {
    var motes = nga.entity('motes')
        .identifier(nga.field('devaddr'));

    // ---- motes
    motes.listView().fields([
        nga.field('devaddr').label('DevAddr').isDetailLink(true),
        nga.field('Site'),
        nga.field('Tank')
    ]);
    motes.creationView().fields([
        nga.field('devaddr').label('DevAddr').isDetailLink(true),
        nga.field('Site'),
        nga.field('Tank'),
nga.field('admins', 'reference_many').label('Administrators')                         <<<-------  THIS IS THE PROBLEM.
            .targetEntity(users)
            .targetField(nga.field('name'))
    ]);
    // add to the admin application
    admin.addEntity(motes);

    admin.menu()
        .addChild(nga.menu(motes).icon('<span class="fa fa-map-marker fa-fw"></span>'));

}


because the demo app is extending the angular module I am not sure how you can reference the targetEntity is the main module.

Any thoughts or advice greatly appreciated.

MPC.


Petr Gotthard

unread,
Jun 15, 2020, 1:51:47 PM6/15/20
to MPC, LoRaWAN Server Users

Hello,

 

the "users" variable is not available in the addPrivateMenu().

See

https://github.com/gotthardp/lorawan-server/blob/master/priv/admin/admin.js#L1273

 

If you add "users" to the list it should work.

 

 

Petr

______________________________________________________________
> Od: "MPC" <melvinp...@gmail.com>
> Komu: "LoRaWAN Server Users" <lorawan...@googlegroups.com>
> Datum: 15.06.2020 18:42
> Předmět: problem referencing users using the addPrivateMenu in the demo application
>

Reply all
Reply to author
Forward
0 new messages