Skip to content
Snippets Groups Projects
Verified Commit 365cc161 authored by Štěpán Henek's avatar Štěpán Henek 🐻
Browse files

Starting commands asynchronously

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
parent c7345546
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment