/nkadmin

NetComposer Admin Package

Primary LanguageErlangApache License 2.0Apache-2.0

NkADMIN

API

Introduction

Once the user is authenticated, it must first create an admin session, connected to an specific domain, using the create command. The server will send the information to draw:

  • Frame: Information not related to any specific domain like user name, icon, etc.
  • Tree: Information to build the menu tree for this domain.
  • Detail: Information to build the detail pane for this domain

If the user selects another domain, the switch_domain command can be used, and a new tree and detail block will be sent from the server.

If the user selects an specific object (or entry in the tree), the command switch_object can be used, and a new detail block will be returned.

All commands must use class: "admin" and subclass: "session".

Commands

create_session

You must supply the domain, and the server will return frame, tree and detail (or an error). You can also subscribe to events related to this object. See events for currently supported events.

Example:

{
    class: "admin",
    subclass: "session",
    cmd: "create",
    data: {
        domain: "/",
        session_events: ["updated", "destroyed"]
    },
    tid: 1
}

-->

{
    result: "ok",
    data: {
        admin_session_id: "59c03l30ddlekvd93",
        frame: { ... },
        tree: { ... },
        detail: { ... }
    },
    tid: 1
}

switch_domain

You must supply the admin_session_id and domain parameters, and the server will return the new tree and detail.

switch_object

You must supply the admin_session_id and obj_id parameters, and the server will return the new detail.

destroy

If you want to stop the admin session (and free resources on the server), you can call this command, using admin_session_id parameter (or directly close the connection).

Events

The admin session supports the following events:

created

Sent when the session is first created.

updated

Sent when some of the fields currently present at the client have been updated and must be redrawn (to be done)

destroyed

Sent if the admin session is destroyed.