add SPA config UI, wire media/rss adapters, event-driven layout push

- React SPA: dashboard, data sources CRUD, widgets CRUD, layout builder,
  presets. TanStack Router + Query, shadcn/ui, Vite proxy to :3000
- wire media + rss adapters into polling loop, remove xtb source type
- media adapter: read username/password from headers, proper subsonic auth
- event handler: subscribe to LayoutChanged, push screen update to clients
- fix clippy warnings across workspace (Default impls, collapsible ifs,
  redundant closures, is_none_or, unused imports)
This commit is contained in:
2026-06-19 00:12:42 +02:00
parent 21c08911df
commit 26ebfad3a2
175 changed files with 12338 additions and 801 deletions

View File

@@ -1,13 +1,12 @@
mod support;
use std::time::Duration;
use domain::{
ConfigRepository, DisplayHint, DomainEvent, KeyMapping, WidgetConfig,
DataSource, DataSourceConfig, DataSourceType,
Layout, LayoutNode, ContainerNode, LayoutChild, Direction, Sizing,
LayoutPreset,
};
use application::ConfigService;
use domain::{
ConfigRepository, ContainerNode, DataSource, DataSourceConfig, DataSourceType, Direction,
DisplayHint, DomainEvent, KeyMapping, Layout, LayoutChild, LayoutNode, LayoutPreset, Sizing,
WidgetConfig,
};
use std::time::Duration;
use support::{InMemoryConfigRepository, InMemoryEventPublisher};
#[tokio::test]
@@ -21,9 +20,10 @@ async fn create_widget_persists_and_emits_event() {
"weather".into(),
DisplayHint::IconValue,
1,
vec![
KeyMapping { source_path: "$.temp".into(), target_key: "temperature".into() },
],
vec![KeyMapping {
source_path: "$.temp".into(),
target_key: "temperature".into(),
}],
);
service.create_widget(config).await.unwrap();
@@ -99,8 +99,14 @@ async fn update_layout_persists_and_emits_event() {
gap: 4,
padding: 2,
children: vec![
LayoutChild { sizing: Sizing::Flex(1), node: LayoutNode::Leaf(1) },
LayoutChild { sizing: Sizing::Flex(1), node: LayoutNode::Leaf(2) },
LayoutChild {
sizing: Sizing::Flex(1),
node: LayoutNode::Leaf(1),
},
LayoutChild {
sizing: Sizing::Flex(1),
node: LayoutNode::Leaf(2),
},
],
}),
};
@@ -111,7 +117,10 @@ async fn update_layout_persists_and_emits_event() {
assert_eq!(stored, Some(layout));
assert_eq!(events.emitted().len(), 1);
assert!(matches!(events.emitted()[0], DomainEvent::LayoutChanged { .. }));
assert!(matches!(
events.emitted()[0],
DomainEvent::LayoutChanged { .. }
));
}
#[tokio::test]
@@ -125,9 +134,10 @@ async fn load_preset_replaces_active_layout() {
direction: Direction::Column,
gap: 0,
padding: 0,
children: vec![
LayoutChild { sizing: Sizing::Flex(1), node: LayoutNode::Leaf(5) },
],
children: vec![LayoutChild {
sizing: Sizing::Flex(1),
node: LayoutNode::Leaf(5),
}],
}),
};
@@ -146,6 +156,9 @@ async fn load_preset_replaces_active_layout() {
let emitted = events.emitted();
assert_eq!(emitted.len(), 2);
assert!(matches!(emitted[0], DomainEvent::LayoutPresetLoaded { id: 1 }));
assert!(matches!(
emitted[0],
DomainEvent::LayoutPresetLoaded { id: 1 }
));
assert!(matches!(emitted[1], DomainEvent::LayoutChanged { .. }));
}