orangeqs.juice.dashboard.dashboard_load#

Logic for loading entrypoints from the dashboard config file.

Module Contents#

Classes#

DashboardEntry

Dashboard page entry. Appears on the homepage and the navigation bar.

DashboardCategory

Dashboard category. Appears on the home page and the navigation bar.

DashboardHandler

An extra location for static files to be served by the StaticFileHandler.

HandlersConfig

Container for extra handlers registered by extensions.

DashboardConfig

Configuration for the dashboard.

Functions#

collect_dashboard_applications

Collect all dashboard applications defined by extensions.

Data#

API#

orangeqs.juice.dashboard.dashboard_load.TORNADO_APPLICATIONS#

‘collect_entry_points(…)’

orangeqs.juice.dashboard.dashboard_load.collect_dashboard_applications() tuple[list[tuple[str, type[tornado.web.RequestHandler], dict[str, Any]]], dict[str, collections.abc.Callable[..., panel.template.Template] | bokeh.application.Application]]#

Collect all dashboard applications defined by extensions.

Returns#

  • (dict[str, type[web.RequestHandler], dict[str, Any]]): A dictionary mapping URL paths to Tornado request handlers and their initialization arguments.

  • (dict[str, Application]): A dictionary mapping URL paths to Bokeh applications.

class orangeqs.juice.dashboard.dashboard_load.DashboardEntry(/, **data: Any)#

Bases: orangeqs.juice.settings.BaseConfigurable

Dashboard page entry. Appears on the homepage and the navigation bar.

name: str#

None

Human-readable name of the entry.

url: str | None#

None

URL path of the entry, or None if not a link.

If entry_point is defined, this will be the URL the page will be served at. If not provided, will be determined automatically by using the key of the category and page, i.e. {category_key}/{page_key}.

Otherwise this can be any URL pointing to an internal or external resource. In that case it applies the following rules to determine how to handle the URL:

  • If the URL starts with http:// or https://, it’s considered an absolute URL.

  • If the URL starts with a /, it’s considered an absolute path on the current domain.

  • Otherwise the URL is considered relative to the dashboard base URL, which is useful for linking to specific dashboard pages.

The URL supports the following placeholders. All placeholders have a leading /, but no trailing /.

image: str | None#

None

Optional image for the entry.

Must be of the form importable.module:filepath, where filepath is the path to the image file relative to the module. For example, my_module.static:images/my_image.png.

Don’t forget to include the image file in the package data of your package, see for example https://setuptools.pypa.io/en/latest/userguide/datafiles.html for how to do this using setuptools.

entry_point: str | None#

None

Object reference to the function that instantiates the page this entry links to.

Also referred to as the “entry point”. This function will be called to instantiate the page that this entry refers to. Must be of the form importable.module:callable.

description: str | None#

None

Optional description of the entry, shown on the homepage.

order: int#

‘Field(…)’

Order of the entry in the navigation bar and home page.

Lower numbers appear first.

new_tab: bool#

False

Whether to open the link in a new tab.

highlight: Literal[off, once, always]#

‘off’

Whether/how to show this entry highlighted on the home page.

  • "off" (default): never highlighted.

  • "once": highlighted the first time a given browser visits the home page, then never again on that browser. Useful for drawing attention to a new or important entry without it becoming permanent background noise.

  • "always": always highlighted. Useful on a demo installation to permanently draw attention to a specific entry.

class orangeqs.juice.dashboard.dashboard_load.DashboardCategory(/, **data: Any)#

Bases: orangeqs.juice.dashboard.dashboard_load.DashboardEntry

Dashboard category. Appears on the home page and the navigation bar.

Note that a category entry also supports linking to a page. However, this link will only show up in the navigation bar, not on the homepage.

pages: dict[str, orangeqs.juice.dashboard.dashboard_load.DashboardEntry]#

‘Field(…)’

Sub-pages under this category, keyed by unique keys.

class orangeqs.juice.dashboard.dashboard_load.DashboardHandler(/, **data: Any)#

Bases: orangeqs.juice.settings.BaseConfigurable

An extra location for static files to be served by the StaticFileHandler.

pattern: str#

None

Regex pattern for the handler.

entry_point: str#

None

Object reference to the function that instantiates the page this entry links to.

Must be of the form importable.module:callable.

class orangeqs.juice.dashboard.dashboard_load.HandlersConfig(/, **data: Any)#

Bases: orangeqs.juice.settings.BaseConfigurable

Container for extra handlers registered by extensions.

extensions: dict[str, dict[str, orangeqs.juice.dashboard.dashboard_load.DashboardHandler]]#

‘Field(…)’

Handlers registered by extensions.

Keyed first by extension name, then by a unique handler key within that extension, e.g. handlers.extensions.grace.statics.

class orangeqs.juice.dashboard.dashboard_load.DashboardConfig(/, **data: Any)#

Bases: orangeqs.juice.settings.Configurable

Configuration for the dashboard.

Defines the pages and categories that appears on the home page and navigation bar.

filename: ClassVar[str]#

‘dashboard’

categories: dict[str, orangeqs.juice.dashboard.dashboard_load.DashboardCategory]#

‘Field(…)’

Categories for the dashboard pages, keyed by unique keys.

handlers: orangeqs.juice.dashboard.dashboard_load.HandlersConfig#

‘Field(…)’

Extra handlers registered by extensions.

log_level: str#

‘INFO’

Can be one of DEBUG, INFO, WARNING, ERROR, or CRITICAL.