[pdm-devel] [PATCH yew-comp 6/7] tasks: make columns configurable

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jan 20 18:37:12 CET 2025


Am 20.01.25 um 10:29 schrieb Dominik Csapak:
>  impl Default for Tasks {
> @@ -93,6 +98,46 @@ pub struct ProxmoxTasks {
>      start: u64,
>      last_filter: serde_json::Value,
>      load_timeout: Option<Timeout>,
> +    columns: Rc<Vec<DataTableHeader<TaskListItem>>>,
> +}
> +
> +impl ProxmoxTasks {
> +    fn columns(ctx: &LoadableComponentContext<Self>) -> Rc<Vec<DataTableHeader<TaskListItem>>> {
> +        if let Some(columns) = ctx.props().columns.clone() {
> +            columns
> +        } else {
> +            Rc::new(vec![
> +                DataTableColumn::new(tr!("Start Time"))
> +                    .width("130px")
> +                    .render(|item: &TaskListItem| render_epoch_short(item.starttime).into())
> +                    .into(),
> +                DataTableColumn::new(tr!("End Time"))
> +                    .width("130px")
> +                    .render(|item: &TaskListItem| match item.endtime {
> +                        Some(endtime) => render_epoch_short(endtime).into(),
> +                        None => html! {},
> +                    })
> +                    .into(),
> +                DataTableColumn::new(tr!("User name"))
> +                    .width("150px")
> +                    .render(|item: &TaskListItem| {
> +                        html! {&item.user}
> +                    })
> +                    .into(),

pre-existing I know, but just noticing it here:
Username can be quite long, maybe we could make this a flex with a min-width.
The flex ratio should then still be quite a bit lower than the one from the
description.

> +                DataTableColumn::new(tr!("Description"))
> +                    .flex(1)
> +                    .render(move |item: &TaskListItem| html! {format_upid(&item.upid)})
> +                    .into(),
> +                DataTableColumn::new(tr!("Status"))
> +                    .width("200px")
> +                    .render(|item: &TaskListItem| {
> +                        let text = item.status.as_deref().unwrap_or("");
> +                        html! {text}
> +                    })
> +                    .into(),

Also pre-existing, but having that flex (with a bit lower ratio that description)
could also be nice to see more of the task error message when skimming through
the list.




More information about the pdm-devel mailing list