From ebef35a573de90ceac85841c21b6e7d39025c307 Mon Sep 17 00:00:00 2001 From: Cameron Cross Date: Sun, 2 Sep 2018 09:54:49 +1000 Subject: [PATCH] Fixed up documentation for system api. Now correctly matches current behaviour. --- docs/api/system.rst | 70 ++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/docs/api/system.rst b/docs/api/system.rst index b39e0a1ad..c3df02e9a 100644 --- a/docs/api/system.rst +++ b/docs/api/system.rst @@ -38,30 +38,21 @@ List all registered system commands { "action": "shutdown", "name": "Shutdown", - "command": "sudo shutdown -h now", "confirm": "You are about to shutdown the system.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", - "async": true, - "ignore": true, "source": "core", "resource": "http://example.com/api/system/commands/core/shutdown" }, { "action": "reboot", "name": "Reboot", - "command": "sudo reboot", "confirm": "You are about to reboot the system.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", - "async": true, - "ignore": true, "source": "core", "resource": "http://example.com/api/system/commands/core/reboot" }, { "action": "restart", "name": "Restart OctoPrint", - "command": "sudo service octoprint restart", "confirm": "You are about to restart the OctoPrint server.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", - "async": true, - "ignore": true, "source": "core", "resource": "http://example.com/api/system/commands/core/restart" } @@ -99,30 +90,21 @@ List all registered system commands for a source { "action": "shutdown", "name": "Shutdown", - "command": "sudo shutdown -h now", - "confirm": "You are about to shutdown the system.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", - "async": true, - "ignore": true, + "confirm": "You are about to shutdown the system.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", "source": "core", "resource": "http://example.com/api/system/commands/core/shutdown" }, { "action": "reboot", "name": "Reboot", - "command": "sudo reboot", - "confirm": "You are about to reboot the system.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", - "async": true, - "ignore": true, + "confirm": "You are about to reboot the system.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", "source": "core", "resource": "http://example.com/api/system/commands/core/reboot" }, { "action": "restart", "name": "Restart OctoPrint", - "command": "sudo service octoprint restart", - "confirm": "You are about to restart the OctoPrint server.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", - "async": true, - "ignore": true, + "confirm": "You are about to restart the OctoPrint server.

This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).", "source": "core", "resource": "http://example.com/api/system/commands/core/restart" } @@ -184,18 +166,60 @@ List all response - Description * - ``core`` - 0..n - - List of :ref:`command definitions ` + - List of :ref:`client command definitions ` - List of all core commands defined. * - ``custom`` - 0..n - - List of :ref:`command definitions ` + - List of :ref:`client command definitions ` - List of all custom commands defined in ``config.yaml``. +.. _sec-api-client-system-commands-definiton: + +Client command definitions +-------------------------- + +A restricted form of the full :ref:`command definition `. +For exposing via the API. + +.. list-table:: + :widths: 15 5 10 30 + :header-rows: 1 + + * - Name + - Multiplicity + - Type + - Description + * - ``name`` + - 1 + - string + - The name of the command to display in the System menu. + * - ``action`` + - 1 + - string + - An identifier to refer to the command programmatically. The special ``action`` string + ``divider`` signifies a divider in the menu. + * - ``confirm`` + - 0..1 + - string + - If present and set, this text will be displayed to the user in a confirmation dialog + they have to acknowledge in order to really execute the command. + * - ``source`` + - 1 + - string + - Source of the command definition, currently either ``core`` (for system actions defined by + OctoPrint itself) or ``custom`` (for custom system commands defined by the user through ``config.yaml``). + * - ``resource`` + - 1 + - string + - The URL of the command to use for executing it. + .. _sec-api-system-commands-definiton: Command definition ------------------ +The full command definition is not available via the API. + .. list-table:: :widths: 15 5 10 30 :header-rows: 1