Users#

API#

class frontend.users(frontend)#

This portion of the API handles pages dealing with users.

Arguments
  • frontend (*) –

frontend.users.addComponent(c)#

Add a component to display on each user’s page (/#/users/myuser)

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 user picture and descrition, and the “objects” key, which is the list of the user’s objects

  • c.weight (float) – the component’s weight, with heavier components coming below lighter ones. The header has weight 0, and object list has weight 1.

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

Examples:

frontend.users.addComponent({
 key: "myComponentKey",
 weight: 2,
 component: MyComponent
});
frontend.users.addMenu(mf)#

A function that given a user 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.users.addRoute(r)#

Adds a route to the user. Same as objects/apps addRoute. The resulting page will be rendered with prefix /#/users/myuser/.

Adding these paths can only be done during app initialization.

Arguments
  • r (object) – Object containing route information

  • r.path (string) – The subpath at which to mount the route

  • r.component (vue.Component) – The vue component to show at the path. Takes user object as prop.

Examples:

frontend.users.addRoute({
 path: "mysubpath", // will be at /#/users/myuser/mysubpath
 component: MyComponent
});