Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The node pico engine includes a developer UI consisting of two web pages,a single page application written using React:

  1. the

    My Picos

    main page

    which

    lets you see a visual representation of all of your picos, including their parent/child relationships and subscriptions

    the Engine Rulesets

    as lines connecting them

  2. a detail page which lets you see

    the list of rulesets registered with the engine

    information about one of your picos, organized into tabs

Although you can use the pico engine directly* from your own applications, you may find these this developer UI pages useful to get things set up, and to have an independent view of the state of your application's picos.

Assuming your pico engine is running on localhost port 8080 3000, the two pages are located, respectivelypage is located, at

Code Block
http://localhost:

...

3000/#/

Using the pico engine through the UI

Pico Engine Developer UI -- My Picos pagePico Engine main page

Developer UI -- Logging tab

Developer UI -- Testing tab

Developer UI -- Engine Rulesets pageSubscriptions tab

*Using the pico engine directly

You can make requests to your engine over HTTP (using curl in a linux shell, or Postman, or a browser location bar). For example, the request

Code Block
http://localhost:

...

3000/api/

...

ui-context

will allow you to know which version of the pico engine you are running . For example,  {"version":"0.7.2"}http://localhost:8080/api/owner-eci will give you the secret and give you an event channel identifier (ECI) for your owner the engine's root pico, so that you can begin interacting with it programmatically. For example, 

Code Block
{"version":"1.0.2","eci":"

...

ckj5q44eq00017a2rcvxs8evv"}


The pico engine installs two the following rulesets in the owner root pico:

  1. io.picolabs.wrangler - provides an operating system or the pico and includes functions and rules that make interacting with the pico more convenient.

  2. io.picolabs

...

  1. .subscription - provides functions and rules that support pico-to-pico bi-directional subscriptions.

  2. io.picolabs.pico-engine-ui - provides an API for the engine UI.

The ui channel has policies in place which allow the UI application to send events that are handled by the io.picolabs.pico-engine-ui ruleset, and to make queries to functions defined and shared by that same ruleset.

For example, a request like:

Code Block
http://localhost:

...

3000/sky/cloud/ckj5q44eq00017a2rcvxs8evv/io.picolabs.pico-engine-ui/box

will return information about the root pico:

Code Block
{
  "eci": "ckj5q44eq00017a2rcvxs8evv",
  "children": [
    "ckj61req3000aor2r6p5k49zs",
    ...
    "ckja93fod000vuq2rfgn87l3a"
  ],
  "name": "Pico",
  "backgroundColor": "#87cefa",
  "x": 366,
  "y": 91,
  "width": 100,
  "height": 100
}

This will confirm the engine ui channel of the pico (line 2), and give you the engine ui channel for each of its direct children (lines 3-7), along with the pico's name (line 8), its background color, position and size in the UI.

To install a ruleset in the pico, use an event like this (here using the hello_world ruleset as an example):

Code Block
http://localhost:

...

3000/sky/event

...

/ckj5q44eq00017a2rcvxs8evv/none/engine_ui/install?url=https://raw.githubusercontent.com/Picolab/pico_lessons/master/hello_world.krl

Your ruleset could, upon installation, create a channel and return it to you in a directive, and you could then continue on to do other things, directly, without using the developer UI.

A command line UI

Some developers prefer using the command line. You can do this using the curl command, or you can try pico-debug an experimental command line interface.