From: Stefan Hanreich <s.hanreich@proxmox.com>
To: Proxmox Datacenter Manager development discussion
<pdm-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pdm-devel] [PATCH datacenter-manager v3 5/8] ui: tasks: add helper to summarize task categories
Date: Mon, 25 Aug 2025 11:54:37 +0200 [thread overview]
Message-ID: <aa4e7899-04c4-4fd3-83e4-3b8d35817c14@proxmox.com> (raw)
In-Reply-To: <20250825081042.797559-6-d.csapak@proxmox.com>
On 8/25/25 10:10 AM, Dominik Csapak wrote:
> one for mapping UPID worker types to shortahnds that can be used for
> pre-filtering via the api (have to filter on the client side a bit more
> since we'll return more than what we want with the current filtering
> api)
>
> and one for creating a title for each type
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> ui/src/tasks.rs | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/ui/src/tasks.rs b/ui/src/tasks.rs
> index 0e7899c..a94cc9a 100644
> --- a/ui/src/tasks.rs
> +++ b/ui/src/tasks.rs
> @@ -120,3 +120,32 @@ pub fn format_optional_remote_upid(upid: &str, include_remote: bool) -> String {
> format_upid(&upid)
> }
> }
> +
> +/// Map worker types to sensible categories (that can also be used as filter for the api)
> +///
> +/// Note: if using as filter for the api, the result has to be filtered with this again, since
> +/// more records will be returned. E.g. using 'vz' will also return 'vzdump' tasks which are
> +/// not desired.
> +pub fn map_worker_type(worker_type: &str) -> &str {
> + match worker_type {
> + task_type if task_type.contains("migrate") => "migrate",
> + task_type if task_type.starts_with("qm") => "qm",
> + task_type if task_type.starts_with("vz") && task_type != "vzdump" => "vz",
> + task_type if task_type.starts_with("ceph") => "ceph",
> + task_type if task_type.starts_with("ha") => "ha",
> + other => other,
> + }
> +}
> +
> +/// Map a category from [`map_worker_type`] to a title text.
> +pub fn get_type_title(task_type: &str) -> String {
> + match task_type {
> + "migrate" => tr!("Guest Migrations"),
> + "qm" => tr!("Virtual Machine related Tasks"),
> + "vz" => tr!("Container related Tasks"),
> + "ceph" => tr!("Ceph related Tasks"),
> + "vzdump" => tr!("Backup Tasks"),
> + "ha" => tr!("HA related Tasks"),
> + other => other.to_string(),
> + }
> +}
maybe better suited as an enum with FromStr(or From<_> since it's
infallible) + Display?
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-08-25 9:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 8:08 [pdm-devel] [PATCH datacenter-manager v3 0/8] add task summary panels in dashboard Dominik Csapak
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 1/8] server: task cache: treat a limit of 0 as unbounded Dominik Csapak
2025-08-25 9:55 ` Stefan Hanreich
2025-08-25 10:49 ` Dominik Csapak
2025-08-25 13:40 ` Stefan Hanreich
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 2/8] server: api: remote tasks: add 'remote' filter option Dominik Csapak
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 3/8] server: api: add remote-tasks statistics Dominik Csapak
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 4/8] ui: refactor remote upid formatter Dominik Csapak
2025-08-25 10:56 ` Stefan Hanreich
2025-08-26 9:48 ` Dominik Csapak
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 5/8] ui: tasks: add helper to summarize task categories Dominik Csapak
2025-08-25 9:54 ` Stefan Hanreich [this message]
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 6/8] ui: add dialog to show filtered tasks Dominik Csapak
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 7/8] ui: dashboard: add task summaries Dominik Csapak
2025-08-25 10:52 ` Stefan Hanreich
2025-08-25 8:08 ` [pdm-devel] [PATCH datacenter-manager v3 8/8] ui: dashboard: make task summary time range configurable Dominik Csapak
2025-08-25 9:54 ` Stefan Hanreich
2025-08-25 13:17 ` [pdm-devel] [PATCH datacenter-manager v3 0/8] add task summary panels in dashboard Stefan Hanreich
2025-08-26 11:22 ` [pdm-devel] superseded: " Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa4e7899-04c4-4fd3-83e4-3b8d35817c14@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox