Package s3 :: Module s3dashboard :: Class S3Dashboard
[frames] | no frames]

Class S3Dashboard

source code

object --+
         |
        S3Dashboard


Class to build and manage dashboards

def my_controller():

    config = {
        # The default layout for the dashboard
        "layout": "...",

        # Available widgets
        "widgets": {...},

        # Default Widget Configurations
        "default": [...],

        # Allow the user to configure this dashboard
        "configurable": True,
    }

    dashboard = S3Dashboard(config)
    return dashboard()

Instance Methods
 
__init__(self, config, layouts=None)
Initializes the dashboard
source code
 
config(self)
Lazy property to load the current configuration from the database
source code
 
agents(self)
Lazy property to instantiate the dashboard agents
source code
 
__call__(self, **attr)
Dispatch requests - this method is called by the controller.
source code
 
build(self, **attr)
Build the dashboard and all its contents
source code
 
do(self, command, context)
Execute a dashboard global command
source code
 
get_active_layout(self, config)
Get the active layout
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
inject_script(dashboard_id, options=None)
Inject the JS to instantiate the client-side widget controller
source code
Class Variables
  layouts = {"boxes":("Boxes", S3DashboardBoxesLayout), "columns...
Properties

Inherited from object: __class__

Method Details

__init__(self, config, layouts=None)
(Constructor)

source code 

Initializes the dashboard

Parameters:
  • config - the default configuration for this dashboard
  • layouts - custom layouts to override/extend the available layouts, as dict {name: (label, class)}
Overrides: object.__init__

config(self)

source code 

Lazy property to load the current configuration from the database

Returns:
the S3DashboardConfig
Decorators:
  • @property

agents(self)

source code 

Lazy property to instantiate the dashboard agents

Returns:
a dict {agent_id: agent}
Decorators:
  • @property

__call__(self, **attr)
(Call operator)

source code 

Dispatch requests - this method is called by the controller.

Parameters:
  • attr - keyword arguments from the controller
  • _id - the node ID for the dashboard (default: "dashboard")
Returns:
the output for the view

build(self, **attr)

source code 

Build the dashboard and all its contents

Parameters:
  • attr - keyword arguments from the controller
Returns:
the output dict for the view

do(self, command, context)

source code 

Execute a dashboard global command

Parameters:
  • command - the command
  • context - the current S3DashboardContext

To Do: implement global commands

get_active_layout(self, config)

source code 

Get the active layout

Parameters:
  • config - the active dashboard configuration
Returns:
an instance of the active layout

inject_script(dashboard_id, options=None)
Static Method

source code 

Inject the JS to instantiate the client-side widget controller

Parameters:
  • dashboard_id - the dashboard DOM node ID
  • options - JSON-serializable dict with script options

Class Variable Details

layouts

Value:
{"boxes":("Boxes", S3DashboardBoxesLayout), "columns":("Columns", S3Da\
shboardColumnsLayout), "grid":("Grid", S3DashboardGridLayout),}