[pdm-devel] [PATCH proxmox-yew-comp v2 3/4] firewall: add options edit form
Michael Köppl
m.koeppl at proxmox.com
Mon Nov 10 13:36:56 CET 2025
On Wed Nov 5, 2025 at 5:35 PM CET, Hannes Laimer wrote:
> + fn changed(&mut self, ctx: &yew::Context<Self>, _old_props: &Self::Properties) -> bool {
> + self.parse_value(&ctx.props().value);
> + true
> + }
> +
> + fn view(&self, ctx: &yew::Context<Self>) -> Html {
> + let is_empty = self.number.is_none();
> + let number_value = self.number.map(|n| n.to_string()).unwrap_or_default();
> +
> + let units: Vec<AttrValue> = TIME_UNITS.iter().map(|&u| AttrValue::from(u)).collect();
> +
> + Row::new()
> + .style("align-items", "center")
> + .gap(1)
> + .with_child(
> + Number::<u64>::new()
> + .key("rate_number")
> + .value(number_value)
> + .placeholder("1")
> + .min(1)
This should probably also have a .max(99), since in PVE we don't allow
setting values greater than 99.
> + .on_change(ctx.link().callback(|result: Option<Result<u64, String>>| {
> + RateMsg::ChangeNumber(result.and_then(|r| r.ok()))
> + })),
> + )
> + .with_child("/")
More information about the pdm-devel
mailing list