Raxol.Components.Dashboard.Dashboard (Raxol v0.2.0)

View Source

A component responsible for rendering a grid-based dashboard layout. Manages widget placement, drag/drop, and resizing.

Summary

Functions

Initializes the Dashboard state from a saved layout. If no saved layout exists, returns default widgets with the given grid configuration.

Validates a list of widget configurations to ensure they can be properly rendered. Returns true if widgets are valid, false otherwise.

Functions

broadcast(msg)

command(cmd)

init_from_saved_layout(default_widgets, grid_config)

Initializes the Dashboard state from a saved layout. If no saved layout exists, returns default widgets with the given grid configuration.

This function loads widget configurations using LayoutPersistence.load_layout/0 and initializes the dashboard model with those widgets and the provided grid_config.

Returns {:ok, model} on success, or {:error, reason} on failure.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

schedule(msg, delay)

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

validate_widgets(widgets)

Validates a list of widget configurations to ensure they can be properly rendered. Returns true if widgets are valid, false otherwise.