per-source polling, initial client state, webhook, preview, client tracking
- per-source poll intervals: spawn task per source with own interval,
manager re-checks sources every 30s for add/remove
- initial screen update on TCP connect: send layout + widget states
- client tracking: ClientRegistry port, GET /api/clients, dashboard list
- webhook adapter: POST /api/webhook/{source_id} feeds data into projection
- widget preview: GET /api/widgets/{id}/preview returns current state
- serve SPA from Axum: ServeDir + index.html fallback via KFRAME_SPA_DIR
- layout builder delete confirmation with AlertDialog
- form validation: required fields disable save button
- guide page at /guide
- fix architecture: ClientDto to api-types, ClientRegistry + WidgetStateReader
ports in domain, DataProjection has internal Mutex, no adapter cross-deps
- ESP32: full screen clear on layout change (stale pixel fix)
This commit is contained in:
@@ -10,7 +10,10 @@ pub use entities::{
|
||||
LayoutPreset, LayoutPresetId, WidgetConfig, WidgetId,
|
||||
};
|
||||
pub use events::DomainEvent;
|
||||
pub use ports::{BroadcastPort, ConfigRepository, DataSourcePort, EventPublisher};
|
||||
pub use ports::{
|
||||
BroadcastPort, ClientRegistry, ConfigRepository, ConnectedClient, DataSourcePort,
|
||||
EventPublisher, WidgetStateReader,
|
||||
};
|
||||
pub use value_objects::{
|
||||
ContainerNode, Direction, DisplayHint, KeyMapping, Layout, LayoutChild, LayoutNode,
|
||||
LayoutValidationError, Sizing, Value, WidgetError, WidgetState,
|
||||
|
||||
11
crates/domain/src/ports/client_registry.rs
Normal file
11
crates/domain/src/ports/client_registry.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
#[derive(Clone)]
|
||||
pub struct ConnectedClient {
|
||||
pub addr: String,
|
||||
pub connected_at: u64,
|
||||
}
|
||||
|
||||
pub trait ClientRegistry {
|
||||
fn add_client(&self, addr: &str, connected_at: u64);
|
||||
fn remove_client(&self, addr: &str);
|
||||
fn list_clients(&self) -> Vec<ConnectedClient>;
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
mod broadcast;
|
||||
mod client_registry;
|
||||
mod config_repository;
|
||||
mod data_source_port;
|
||||
mod event;
|
||||
mod widget_state_reader;
|
||||
|
||||
pub use broadcast::BroadcastPort;
|
||||
pub use client_registry::{ClientRegistry, ConnectedClient};
|
||||
pub use config_repository::ConfigRepository;
|
||||
pub use data_source_port::DataSourcePort;
|
||||
pub use event::EventPublisher;
|
||||
pub use widget_state_reader::WidgetStateReader;
|
||||
|
||||
14
crates/domain/src/ports/widget_state_reader.rs
Normal file
14
crates/domain/src/ports/widget_state_reader.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use crate::entities::WidgetId;
|
||||
use crate::value_objects::WidgetState;
|
||||
use std::future::Future;
|
||||
|
||||
pub trait WidgetStateReader {
|
||||
fn get_widget_state(&self, id: WidgetId) -> impl Future<Output = Option<WidgetState>> + Send;
|
||||
|
||||
fn apply_raw_data(
|
||||
&self,
|
||||
source_id: u16,
|
||||
raw: &crate::value_objects::Value,
|
||||
widgets: &[crate::entities::WidgetConfig],
|
||||
) -> impl Future<Output = Vec<(WidgetId, WidgetState)>> + Send;
|
||||
}
|
||||
Reference in New Issue
Block a user