Skip to content

feat(view): composable, URL-syncable dashboard config - #6

Merged
simontaurus merged 1 commit into
mainfrom
feat/dashboard-config
Jul 23, 2026
Merged

feat(view): composable, URL-syncable dashboard config#6
simontaurus merged 1 commit into
mainfrom
feat/dashboard-config

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

Summary

Makes the dashboard config the complete, JSON-serializable, composable source of truth, bound bidirectionally to the view, with optional URL persistence. Additive/backward-compatible for the view API (LiveDataToolView unaffected at the view level).

Config mirrors the panel composition

  • Component configs: TreeConfig (compact selected-keys, not the full Wunderbaum source), PlotControlsConfig, DownsampleConfig.
  • Each view owns its config class via config_cls; the concrete view configs (DataToolViewConfig, ProcessObjectViewConfig, DataToolPlotControlsConfig) live next to their view. BaseViewConfig has extra="allow" + validate_assignment so subclass/unknown fields and field mutation survive round-trips.

Bidirectional binding (BaseDataView)

get_config / set_config / on_config_change, an overridable _apply_config hook, an _applying_config reentrancy guard, and _coerce_config (a base config passed to a concrete view is upgraded). The JSON editor is removed - every PlotControlsConfig field now has a native widget (grouping, cache, downsampling group, ...). User edits write through into the config and emit a change; set_config applies a config back to the widgets.

URL sync

Generic UrlConfig[T] (Pydantic <-> pn.state.location) with three modes: PLAIN_KEYS (readable dot-flattened, JSON-encoded leaves), JSON (readable single param), COMPRESSED_BASE64 (default). Opt-in per view (url_sync / url_mode); a host can URL-sync one aggregate parent config instead.

Examples

datatool/process use COMPRESSED, downsample JSON, and a new composed_dashboard.py shows the host composition pattern - one AppConfig aggregating per-view sub-configs + active tab, URL-synced in PLAIN_KEYS - in a Panelini shell. Screenshots re-rendered with a synthetic address bar so the URL-synced state is visible.

Tests

Config round-trip (incl. extra field), UrlConfig all three modes, view set/get_config apply, write-through + on_config_change, a full URL<->UI browser round-trip, and the aggregate-config composition. Full offline suite + browser tests green; flake8 clean.

Note

Removes LiveDashboardConfig/LiveConfig from base (the Live view lives in opensemantic.lab). A follow-up lab PR defines its own LiveConfig/LiveDataToolViewConfig and adapts LiveDataToolView to the new binding.

Make the dashboard config the complete, JSON-serializable, composable
source of truth, bound bidirectionally to the view, with optional URL
persistence. Additive and backward compatible for the view API.

Config mirrors the panel composition:
- Component configs: TreeConfig (compact selected-keys, not the full
  Wunderbaum source), PlotControlsConfig, DownsampleConfig.
- Each view owns its config class via config_cls; the concrete view
  configs (DataToolViewConfig, ProcessObjectViewConfig,
  DataToolPlotControlsConfig) live next to their view. Base BaseViewConfig
  has extra="allow" + validate_assignment so subclass/unknown fields and
  field mutation survive round-trips.

Binding (BaseDataView): get_config / set_config / on_config_change, an
overridable _apply_config hook, an _applying_config reentrancy guard, and
_coerce_config so a base config passed to a concrete view is upgraded.
The JSON editor is removed - every PlotControlsConfig field now has a
native widget. User edits write through into the config and emit a
change; set_config applies a config back to the widgets.

URL sync: a generic UrlConfig[T] (Pydantic <-> pn.state.location) with
three modes - PLAIN_KEYS, JSON and COMPRESSED_BASE64 (default). Opt-in
per view via url_sync / url_mode; a host can URL-sync one aggregate
parent config instead. Generic datetime/unit helpers moved to
_channel_utils.

Examples: datatool/process use COMPRESSED, downsample JSON, and a new
composed_dashboard.py shows the host composition pattern (one AppConfig
aggregating per-view sub-configs + active tab, URL-synced in PLAIN_KEYS)
in a Panelini shell. Screenshots re-rendered with a synthetic address
bar so the URL-synced state is visible.

Tests: config round-trip (incl extra field), UrlConfig all three modes,
view set/get_config apply, write-through + on_config_change, a full
URL<->UI browser round-trip, and the aggregate-config composition.
@simontaurus
simontaurus merged commit ecb9218 into main Jul 23, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant