flexmeasures.ui

Modules

flexmeasures.ui.error_handlers

Error views for UI purposes.

flexmeasures.ui.utils

Utility functions for UI logic

flexmeasures.ui.views

This module hosts the views.

Backoffice user interface & charting support.

Functions

flexmeasures.ui.add_jinja_filters(app)
flexmeasures.ui.add_jinja_variables(app)
flexmeasures.ui.fetch_vendor_files_on_first_request(app: Flask)

Have the first request which a process serves start fetching the UI’s missing library files, in the background.

Only web processes serve requests, so CLI commands and job workers never fetch. The request does not wait for the fetch, and browsers load the files from CDNs until they are fetched. Of the web processes on a host, only the first one to get the lock fetches.

flexmeasures.ui.load_vendor_libraries(app: Flask)

Settle which versions of the UI’s libraries the app loads, applying the FLEXMEASURES_JS_VERSIONS setting.

flexmeasures.ui.log_where_vendor_files_load_from(app: Flask)

Tell hosts whether browsers load the UI’s libraries from CDNs, and how to serve them from FlexMeasures instead.

flexmeasures.ui.register_at(app: Flask)

This can be used to register this blueprint together with other ui-related things

flexmeasures.ui.register_rq_dashboard(app)

Classes

class flexmeasures.ui.UIBlueprint(name: str, import_name: str, static_folder: str | PathLike[str] | None = None, static_url_path: str | None = None, template_folder: str | PathLike[str] | None = None, url_prefix: str | None = None, subdomain: str | None = None, url_defaults: dict[str, ~typing.Any] | None=None, root_path: str | None = None, cli_group: str | None = <object object>)

A blueprint whose vendored files, under static/vendor/<lib>/<version>/, browsers may keep for a year.

send_static_file(filename: str)

The view function used to serve files from static_folder. A route is automatically registered for this view at static_url_path if static_folder is set.

Note this is a duplicate of the same method in the Flask class.

Added in version 0.5.