Skip to content
Snippets Groups Projects
  1. Nov 08, 2017
    • Štěpán Henek's avatar
      Starting commands asynchronously · 365cc161
      Š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
      stop
      365cc161
  2. Oct 31, 2017
    • Štěpán Henek's avatar
      Sub forms handling · c7345546
      Štěpán Henek authored
      Create two forms which are able to modify a content of an anonymous section
      in uci config.
      
      module/foris_controller_modules/sample/schema/sample.json
        * added schema for get_stored_data, store_current_data and delete_stored_data calls
      
      module/foris_controller_modules/sample/__init__.py
        * actions get_stored_data, store_current_data and delete_stored_data added
      
      module/foris_controller_modules/sample/handlers/openwrt.py
        * binded functions get_stored_data, store_current_data and delete_stored_data to openwrt backend
      
      module/foris_controller_backends/sample/__init__.py
        * implement functions get_stored_data, store_current_data and delete_stored_data
      
      program/sample.config
        * add sample data
      
      src/__init__.py:
        * obtain stored data
        * handle action to remove the stored data
        * handle an action to append the current data to the stored data
      
      src/static/css/sample_plugin.css
        * format the table which displays the stored data
      
      src/templates/sample_plugin/sample_plugin.tpl
        * new tables and forms
      c7345546
    • Štěpán Henek's avatar
      Process incomming data flow · 76aff99c
      Štěpán Henek authored
      Data are periodically generated inside the sample program. The program sends
      an notification to connected clients. The notification is processed by
      the browser.
      
      program/sample
        * periodically sends a validated notification via foris infrastructure
      
      module/foris_controller_modules/sample/schema/sample.json
        * new_data notification added into the schema
      
      src/templates/sample_plugin/sample_plugin.tpl
        * added hooks to update the chart and the table when a new_data
          notification is recieved
      
      src/templates/javascript/sample_plugin/sample_plugin.js.tpl
        * another type of chart is used
        * function to dynamically update chart with new data added
      76aff99c
    • Štěpán Henek's avatar
      Update data on config update · ac1db1fa
      Štěpán Henek authored
      Dynamically update table and chart when the slices config option
      changes. It uses an ajax call to acquire current data set.
      
      src/__init__.py
        * an ajax call handler added
      
      src/templates/sample_plugin/sample_plugin.tpl
        * data table moved to a separate template
        * make an ajax call when a notification from websocket server is recieved
      
      src/templates/sample_plugin/_table.tpl
        * table template (used in ajax call and in the main template)
      ac1db1fa
    • Štěpán Henek's avatar
      Displaying data · 7def9a21
      Štěpán Henek authored
      Statically displays data obtained via the configuration backend.
      A sample program and and an init script were implemented to act as a data source.
      Data are displayed in a table an inside a chart.
      
      Makefile
        * sample program installation added
      
      program/sample
        * sample program to provide data
        * listens on a unix socket and provides data to clients
        * the data are lost whenever the program exits
        * it takes cmd line argument to specify how many data elements
          should be passed to clients
      
      program/sample.init
        * an init script which binds sample program with sample uci config
      
      module/foris_controller_backends/sample/__init__.py
        * calls sample program function via unix socket
        * restart sample program whenever slice count option changes
          (current data are lost)
      
      module/foris_controller_modules/sample/__init__.py
        * action get_data added
      
      module/foris_controller_modules/sample/handlers/openwrt.py
        * action get_data binded to appropriate backend action
      
      module/foris_controller_modules/sample/schema/sample.json
        * get_data request and reply msg types added
      
      src/__init__.py
        * links to js and css files was set and rendered
      
      src/static/css/sample_plugin.css
        * css file of the plugin
      
      src/static/js/Chart.bundle.min.js
        * static js file containing 3rd party chart library
      
      src/templates/sample_plugin/sample_plugin.tpl
        * table and a chart containers were added into the template
      
      src/templates/javascript/sample_plugin/sample_plugin.js.tpl
        * dynamically generated js file (contains translations)
        * reads data from the sample table and prepares the chart
      7def9a21
    • Štěpán Henek's avatar
      Handle notification on configuration change · 7d996c5a
      Štěpán Henek authored
      Dynamically update the page whenever the configuration changes.
      Opens a websocket connection to listen for configuration updates and
      calls a dedicated handler function.
      
      module/foris_controller_modules/sample/schema/sample.json
        * add notification message into the schema
      
      module/foris_controller_modules/sample/__init__.py
        * send a notification if configuration was updated
      
      src/templates/sample_plugin/sample_plugin.tpl
        * add a js notification handler
      7d996c5a
    • Štěpán Henek's avatar
      Custom messages · 05ee99be
      Štěpán Henek authored
      Display a custom message when a form is saved.
      
      __init__.py
        * append a message
        * disable the default message
      05ee99be
    • Štěpán Henek's avatar
      Changing configuration · b4193c2e
      Štěpán Henek authored
      A form was added to change a single option in the configuration backend.
      The backend module was created to process the requests from the web
      frontend.
      
      Makefile
        * updated to deploy the foris-controller sample module
      
      module/foris_controller_modules/sample/schema/sample.json
        * the communication schema between the backend (foris-controller) and
          the client (foris)
      
      module/foris_controller_modules/sample/__init__.py
        * the main module file
        * contains actions which are defined in the schema and calls handler
          functions the prepare the response
        * backend independent module
      
      module/foris_controller_modules/sample/handlers/openwrt.py
        * openwrt handler
        * links handler functions to appropriate backend functions
      
      module/foris_controller_sample_module/__init__.py
        * contains a version of the module
      
      module/foris_controller_backends/sample/__init__.py
        * calls uci to modify the configuration
      
      program/sample.config
        * uci config which will be modified
      
      src/__init__.py
        * prepares a form and fills it with a value obtained from the
          configuration backend
        * trigger for value update
      
      * src/templates/sample_plugin/sample_plugin.tpl
        * renders a form
      b4193c2e
    • Štěpán Henek's avatar
      Minimal plugin · cb4a62e3
      Štěpán Henek authored
      This is a minimal version of the foris plugin.
      It just adds a menu item into the main menu and renders the page.
      
      src/__init__.py
        * This file contains the main logic of the plugin
        * Requtests should be process through this file and a template is
          rendered
      
      src/templates/sample_plugin/sample_plugin.tpl
        * contains a mininal template skeleton
        * %include("_messages.tpl") - serves to render messages from foris
      
      Makefile
        * makefile to deploy the plugin
      start
      cb4a62e3
  3. Oct 25, 2017
  4. Jun 12, 2017