TODO API¶
The TODO API is specific for the Server Manager web application. It is designed to execute a list of checks and possibly report the outcome to the admin user.
An RPM can install one or more executable scripts under
/etc/nethserver/todos.d/
.
The script must print the results formatted according to JSON [1] and the following schema:
{ "text": "free text", "icon": "info-circle", "action": { "url": "/User", "label": "Link label" } }
icon
andaction
keys are optional. The only required key istext
. Theurl
value is actually an absolute path to the Server Manager module. Future versions may support real URLs.If the script exit code is non-zero, or if the output is not correctly JSON-encoded, an error message is sent to the system log.
The script must be aware of locale settings, as its output is displayed on the user’s browser [2].
The executable helper /usr/libexec/nethserver/admin-todos
is
responsible for the invocation of scripts, validation of output and
error reporting. It is executed by the AdminTodo
UI module.
The AdminTodo
known callers are:
- Dashboard
- Software center
- Network
- Backup (configuration)
Translations¶
A TODO script must be locale-aware. Use the gettext
library for
code internationalization (i18n) and follow guidelines from
Internationalization.
References
[1] | JSON (JavaScript Object Notation) is a lightweight data-interchange format. http://json.org/ |
[2] | GNU gettext utilities http://www.gnu.org/software/gettext/ |