Objects

API

class frontend.objects(frontend)

This portion of the API handles the pages that deal with generic objects.

Arguments
  • frontend (*()) –

frontend.objects.addComponent(c)

Add a component to display on each object’s page (/#/objectss/myobjectid)

Arguments
  • c (object()) – Object containing component and display information

  • c.key (string()) – Key of the component, calling addComponent multiple times with the same key replaces the existing component with the new one. By default, heedy defines the “header” key, which contains the main card containing object icon and main options, and the “body” key, which is a display of the object’s info for unregistered objects, and plots for timeseries. The notifications plugin adds a “notifications” component, which is only rendered when there are notifications for the app.

  • c.weight (float()) – the component’s weight, with heavier components coming below lighter ones. The header has weight 0, and body has weight 5. Notifications have weight 0.1.

  • c.component (vue.Component()) – The vue component object to display. Takes “app” object as a prop.

Examples:

frontend.objects.addComponent({
 key: "myComponentKey",
 weight: 2,
 component: MyComponent
});
frontend.objects.addCreator(c)

Identical to a menu item, it is displayed in a special object creation menu

Arguments
  • c (*()) – The creator to add

frontend.objects.addMenu(mf)

A function that given an object, returns a map where each key is menu item key, and each value is a menu item, and has icon, text, and action props.

Arguments
  • mf (function()) –

Examples:

frontend.objects.addMenu((o)=> ({
 my_menu_item: {
   text: "My Menu Item",
   icon: "fas fa-code",
   path: `myplugin/${o.id}`
 }
}));
frontend.objects.addRoute(r)

Adds a route to objects. It automatically takes /object/:objectid/{r.path}. If the route works only on a specific object type, it is recommended to prefix it with the type, ie: r.path = /timeseries/…

Arguments
  • r.path (string()) – The path, relative to /#/objects/:objectid

  • r.component (vue.Component()) – Vue component object to show as the page at that route. The component should have an object prop of type Object that is given the specific object.

Examples:

frontend.objects.addRoute({
 path: "myplugin/path", // This means /#/objects/:objectid/myplugin/path
 component: MyComponent
});
frontend.objects.get(oid)

Returns a promise that gets the given object

Arguments
  • oid (*()) – Object ID to get

frontend.objects.setType(c)

Adds or overwrites an object type. It is passed a dictionary of things to set.

Arguments
  • c (*()) –