Service webgui

webgui.py

The web-based graphical user interface of mercure.

class webgui.ExtendedUser(username: str, is_admin: bool = False)[source]

Bases: starlette.authentication.SimpleUser

property is_admin: bool
class webgui.SessionAuthBackend[source]

Bases: starlette.authentication.AuthenticationBackend

async authenticate(request)[source]
async webgui.configuration(request) starlette.responses.Response[source]

Shows the current configuration of the mercure appliance.

async webgui.configuration_edit(request) starlette.responses.Response[source]

Shows a configuration editor

async webgui.configuration_edit_post(request) starlette.responses.Response[source]

Updates the configuration after post from editor

async webgui.control_services(request) starlette.responses.Response[source]
async webgui.emergency_response(request) starlette.responses.Response[source]

Shows emergency message about invalid configuration.

async webgui.error(request)[source]

An example error. Switch the debug setting to see either tracebacks or 500 pages.

webgui.get_nomad_logs(service) bytes[source]
async webgui.homepage(request) starlette.responses.Response[source]

Renders the index page that shows information about the system status.

webgui.launch_emergency_app() None[source]

Launches a minimal application to inform the user about the incorrect configuration

async webgui.login(request) starlette.responses.Response[source]

Shows the login page.

async webgui.login_post(request) starlette.responses.Response[source]

Evaluate the submitted login information. Redirects to index page if login information valid, otherwise back to login. On the first login, the user will be directed to the settings page and asked to change the password.

async webgui.logout(request)[source]

Logouts the users by clearing the session cookie.

webgui.main(args=['-b', 'html', '-d', '_build/doctrees', '.', '_build/html']) None[source]
async webgui.not_found(request, exc) starlette.responses.Response[source]

Return an HTTP 404 page.

async webgui.server_error(request, exc) starlette.responses.Response[source]

Return an HTTP 500 page.

async webgui.settings_edit(request) starlette.responses.Response[source]

Shows the settings for the current user. Renders the same template as the normal user edit, but with parameter own_settings=True.

async webgui.show_first_log(request) starlette.responses.Response[source]

Get the first service entry and forward to corresponding log entry point.

async webgui.show_log(request) starlette.responses.Response[source]

Render the log for the given service. The time range can be specified via URL parameters.