pinakes-ui: supply local_state to Conditional and Progress; remove last_refresh
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ib513b5846d6c74bfe821da195b7080af6a6a6964
This commit is contained in:
parent
071ea19c8f
commit
90504609e9
2 changed files with 62 additions and 20 deletions
|
|
@ -41,15 +41,13 @@ pub struct PluginPage {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct PluginRegistry {
|
||||
/// API client for fetching pages from server
|
||||
client: ApiClient,
|
||||
client: ApiClient,
|
||||
/// Cached pages: (`plugin_id`, `page_id`) -> `PluginPage`
|
||||
pages: HashMap<(String, String), PluginPage>,
|
||||
pages: HashMap<(String, String), PluginPage>,
|
||||
/// Cached widgets: (`plugin_id`, `widget_id`) -> `UiWidget`
|
||||
widgets: Vec<(String, UiWidget)>,
|
||||
widgets: Vec<(String, UiWidget)>,
|
||||
/// Merged CSS custom property overrides from all enabled plugins
|
||||
theme_vars: HashMap<String, String>,
|
||||
/// Last refresh timestamp
|
||||
last_refresh: Option<chrono::DateTime<chrono::Utc>>,
|
||||
theme_vars: HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl PluginRegistry {
|
||||
|
|
@ -60,7 +58,6 @@ impl PluginRegistry {
|
|||
pages: HashMap::new(),
|
||||
widgets: Vec::new(),
|
||||
theme_vars: HashMap::new(),
|
||||
last_refresh: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,14 +203,8 @@ impl PluginRegistry {
|
|||
self.pages = tmp.pages;
|
||||
self.widgets = tmp.widgets;
|
||||
self.theme_vars = tmp.theme_vars;
|
||||
self.last_refresh = Some(chrono::Utc::now());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get last refresh time
|
||||
pub const fn last_refresh(&self) -> Option<chrono::DateTime<chrono::Utc>> {
|
||||
self.last_refresh
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PluginRegistry {
|
||||
|
|
@ -346,7 +337,6 @@ mod tests {
|
|||
let registry = PluginRegistry::default();
|
||||
assert!(registry.is_empty());
|
||||
assert_eq!(registry.all_pages().len(), 0);
|
||||
assert!(registry.last_refresh().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue