Skip to content
Snippets Groups Projects
F

foris-plugin-tutorial Archived

Project ID: 442
Stepan Henek's avatar
Štěpán Henek authored
Starts a program which takes some time to finish.
Wrapper in foris-controller is able to run it asynchronously.
It also reads its output to send notifications according to the matched
lines. The notifications are displayed on the page using javascript.

program/sample.sh
  * program which takes some time
  * it is continuosly sending some output data

Makefile
  * copy sample program into the system

module/foris_controller_modules/sample/schema/sample.json
  * schema for sample_notification, sample_exit notification added
  * schema for sample_trigger, sample_status requests/replies aded

module/foris_controller_modules/sample/__init__.py
  * handle sample_trigger and sample_status actions added
  * note that sample_trigger prepares notification handlers and reset
    notification connection function

module/foris_controller_modules/sample/handlers/openwrt.py
  * link sample_trigger and sample_status with backend functions

module/foris_controller_backends/sample/__init__.py
  * handles command using AsyncCommand class

src/__init__.py
  * ajax call handling added

src/templates/sample_plugin/sample_plugin.tpl
  * javascript handlers to recieve notifications
  * ajax calls for sample_trigger and sample_status
365cc161
Name Last commit Last update