webui

Web interface for choosing what the six tiles show.

The page (webpage.py) is static; it loads and saves the tiles through the JSON endpoints here. Storage, the data source’s catalog and the reaction to a save are injected, so the handlers run on the host in tests.

Classes

WebUI

Handlers for the settings page and its JSON endpoints.

Module Contents

class webui.WebUI(load_tiles, save_tiles, catalog, on_saved, link_tile, load_alerts=lambda : ..., save_alerts=None, version=None)

Handlers for the settings page and its JSON endpoints.

routes()

Return the routes to serve with webapi.handle.

page()

GET /: the settings page.

get_tiles()

GET /api/tiles: the tiles, warning sources and their limits.

post_tiles(body)

POST /api/tiles: save {“tiles”: […], “alerts”: […]}.

“alerts” is optional. Both are checked before anything is stored.

get_catalog()

GET /api/catalog: the source’s values, fetched once and cached.