Hatohol frontend (web) technical information - project-hatohol/hatohol GitHub Wiki

Overall picture

Each screen (such as Dashbord, events, servers, ...) mainly consists of one HTML file and one javascript file such as (dashboard_ajax.html and dashboard_view.js).

Dialogs

Objects

HatoholConnector

  • calls a Hatohol REST API in conjunction with the session ID.
  • shows a login dialog if a browser doesn't have a session ID.
  • parses the response.
    • shows a login dialog if the error code is HTERR_NOT_FOUND_SESSION_ID.
      • stores the obtained session ID to SessionManager.
    • A caller can specify the custom parser and the error callback handler.
  • shows a message box on connection errors and HTTP errors (such as 404)
  • uses jQuery's ajax() function to send requests.
  • A request (/tunnel/...) is handled by forwardview.py that proxies it.

HatoholReplyParser

  • parses the common header of response.
    • apiVersion
    • errorCode
  • translates an error code into the corresponding message.
  • can be used as the base object for the custom parser.

HatoholMonitoringView

  • provides common functions to show filters and handle the events.

HatoholNavi

  • shows menus depending on the user.
    • For example, 'Action' menu is not shown for users who are not allowed to operate it.

HatoholUserConfig

  • reads/writes data for each user such as
    • the number of displayed items per page.
  • Data itself is managed by Django (actually stored in MySQL DB)
  • Any type (string, integer, ...) of data can be handle seamlessly

HatoholItemRemover

  • A helper to remove items such as (monitoring servers, actions, users).

Multiple languages support

  • uses the Django's framework.
  • Developers have to
    • wrap a message around gettext() in the JS/HTML file.
    • prepare for .po files (under conf/locale/ja/LC_MESSAGES).
  • Currently English and Japanese are supported.