[pdm-devel] [PATCH proxmox-yew-comp 1/1] apt repositories: add 'status_only' property
Lukas Wagner
l.wagner at proxmox.com
Thu Nov 27 11:44:34 CET 2025
If enabled, this will only show the upper status message table (e.g. 'You
get updates for ...').
While it would be better to split out the status message table into its
own little component, this is a much bigger task than just adding the
new property and a couple of if-guards in the render function. Given the
time constaints this was the better choice. Extracting the component
can always be done at a later point in time.
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
src/apt_repositories.rs | 41 ++++++++++++++++++++++++++++++++++-------
1 file changed, 34 insertions(+), 7 deletions(-)
diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs
index fc5c1a9..5cd0ffa 100644
--- a/src/apt_repositories.rs
+++ b/src/apt_repositories.rs
@@ -47,6 +47,11 @@ pub struct AptRepositories {
#[builder(IntoPropValue, into_prop_value)]
#[prop_or_default]
pub product: Option<ExistingProduct>,
+
+ /// Show status message table only.
+ #[builder(IntoPropValue, into_prop_value)]
+ #[prop_or_default]
+ pub status_only: bool,
}
impl Default for AptRepositories {
@@ -545,7 +550,25 @@ impl LoadableComponent for ProxmoxAptRepositories {
}
}
+ fn changed(
+ &mut self,
+ ctx: &LoadableComponentContext<Self>,
+ old_props: &Self::Properties,
+ ) -> bool {
+ let props = ctx.props();
+
+ if props.base_url != old_props.base_url || props.product != old_props.product {
+ ctx.link().send_reload();
+ true
+ } else {
+ false
+ }
+ }
+
fn toolbar(&self, ctx: &LoadableComponentContext<Self>) -> Option<Html> {
+ if ctx.props().status_only {
+ return None;
+ }
let selected_record = self.selected_record();
let toolbar = Toolbar::new()
@@ -581,7 +604,17 @@ impl LoadableComponent for ProxmoxAptRepositories {
Some(toolbar.into())
}
- fn main_view(&self, _ctx: &LoadableComponentContext<Self>) -> Html {
+ fn main_view(&self, ctx: &LoadableComponentContext<Self>) -> Html {
+ let status = DataTable::new(self.status_columns.clone(), self.status_store.clone())
+ .class("pwt-flex-fit")
+ .show_header(false)
+ .striped(false)
+ .borderless(true);
+
+ if ctx.props().status_only {
+ return status.into();
+ }
+
let table = DataTable::new(self.columns.clone(), self.tree_store.clone())
.selection(self.selection.clone())
.class("pwt-flex-fit pwt-border-top")
@@ -589,12 +622,6 @@ impl LoadableComponent for ProxmoxAptRepositories {
let mut panel = Column::new().class("pwt-flex-fit");
- let status = DataTable::new(self.status_columns.clone(), self.status_store.clone())
- .class("pwt-flex-fit")
- .show_header(false)
- .striped(false)
- .borderless(true);
-
panel.add_child(Row::new().padding(4).with_child(status));
panel.with_child(table).into()
--
2.47.3
More information about the pdm-devel
mailing list