sda.dashboard.state#
State Management Package.
Consolidated state management for the SDA Dashboard.
Submodules#
Classes#
Centralized dashboard state management. |
|
Definition of a state variable. |
|
High-level state management interface. |
|
Scope of state storage. |
Functions#
|
Get the global state manager instance. |
Package Contents#
- class sda.dashboard.state.DashboardState(verbose=False)#
Centralized dashboard state management.
- verbose = False#
- define_state(definition)#
Define a new state variable.
- Parameters:
definition (
StateDefinition) – State variable definition
- create_stores(initial_values=None)#
Create Dash Store components for all defined state.
- Parameters:
initial_values (
Dict[str,Any], optional) – Initial values to set in stores- Returns:
List of Store components to add to layout
- Return type:
List[dcc.Store]
- get_store_id(state_key)#
Get the store ID for a state key.
- validate_state(state_key, value)#
Validate a state value.
- class sda.dashboard.state.StateDefinition#
Definition of a state variable.
- default_value: Any = None#
- scope: StateScope#
- class sda.dashboard.state.StateManager(dashboard_state, verbose=False)#
High-level state management interface.
- state#
- verbose = False#
- batch_update(updates)#
Batch multiple state updates.
- Parameters:
updates (
Dict[str,Any]) – Dictionary of state_key: new_value pairs- Returns:
List of validation errors, if any
- Return type:
List[str]
- get_update_queue()#
Get and clear the update queue.
- Returns:
Queued updates
- Return type:
List[Dict[str,Any]]
- create_consolidated_layout()#
Create consolidated state layout component.
- Returns:
Div containing all state stores
- Return type:
html.Div
- class sda.dashboard.state.StateScope(*args, **kwds)#
Bases:
enum.EnumScope of state storage.
- SESSION = 'session'#
- LOCAL = 'local'#
- MEMORY = 'memory'#