From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C8F311FF184 for ; Thu, 18 Dec 2025 14:27:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8AA1B1CECD; Thu, 18 Dec 2025 14:28:16 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Thu, 18 Dec 2025 14:28:06 +0100 Message-ID: <20251218132809.241210-3-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251218132809.241210-1-l.wagner@proxmox.com> References: <20251218132809.241210-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1766064480635 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.964 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_MAILER 2 Automated Mailer Tag Left in Email SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH proxmox-yew-comp v3 2/3] task descriptions: add PBS task descriptions X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Tried to make these match the JS ones as closely as possible. Some of these could be improved in the future, but this should then be done in tandem with the JS definitions. Signed-off-by: Lukas Wagner --- src/utils/task_descriptions.rs | 196 +++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/src/utils/task_descriptions.rs b/src/utils/task_descriptions.rs index 292c20e..136023c 100644 --- a/src/utils/task_descriptions.rs +++ b/src/utils/task_descriptions.rs @@ -209,3 +209,199 @@ pub fn register_pve_tasks() { register_task_description("zfscreate", (tr!("ZFS Storage"), tr!("Create"))); register_task_description("zfsremove", ("ZFS Pool", tr!("Remove"))); } + +/// Register PBS task descriptions. +pub fn register_pbs_tasks() { + register_task_description("acme-deativate", |_ty, id: Option| { + let id = id.unwrap_or_else(|| "default".to_string()); + tr!("Deactivate ACME Account - {0}", id) + }); + register_task_description("acme-register", |_ty, id: Option| { + let id = id.unwrap_or_else(|| "default".to_string()); + tr!("Register ACME Account - {0}", id) + }); + register_task_description("acme-update", |_ty, id: Option| { + let id = id.unwrap_or_else(|| "default".to_string()); + tr!("Update ACME Account - {0}", id) + }); + register_task_description("acme-new-cert", ("", tr!("Order Certificate"))); + register_task_description("acme-renew-cert", ("", tr!("Renew Certificate"))); + register_task_description("acme-revoke-cert", ("", tr!("Revoke Certificate"))); + register_task_description("backup", |_ty, id: Option| { + render_datastore_worker_id(id, &tr!("Backup")) + }); + register_task_description( + "barcode-label-media", + (tr!("Drive"), tr!("Barcode-Label Media")), + ); + register_task_description("catalog-media", (tr!("Drive"), tr!("Catalog Media"))); + register_task_description( + "create-datastore", + (tr!("Datastore"), tr!("Create Datastore")), + ); + register_task_description( + "delete-datastore", + (tr!("Datastore"), tr!("Remove Datastore")), + ); + register_task_description( + "delete-namespace", + (tr!("Namespace"), tr!("Remove Namespace")), + ); + register_task_description("dircreate", (tr!("Directory Storage"), tr!("Create"))); + register_task_description("dirremove", (tr!("Directory Storage"), tr!("Remove"))); + register_task_description("eject-media", (tr!("Drive"), tr!("Eject Media"))); + register_task_description("format-media", (tr!("Drive"), tr!("Format Media"))); + register_task_description("forget-group", (tr!("Group"), tr!("Remove Group"))); + register_task_description( + "garbage_collection", + (tr!("Datastore"), tr!("Garbage Collect")), + ); + register_task_description("realm-sync", ("Realm", tr!("User Sync"))); + register_task_description("inventory-update", (tr!("Drive"), tr!("Inventory Update"))); + register_task_description("label-media", (tr!("Drive"), tr!("Label Media"))); + register_task_description("load-media", |_ty, id: Option| { + render_drive_load_media_id(&id.unwrap_or_default(), &tr!("Load Media")) + }); + register_task_description("logrotate", tr!("Log Rotation")); + register_task_description("mount-device", (tr!("Datastore"), tr!("Mount Device"))); + register_task_description( + "mount-sync-jobs", + ( + tr!("Datastore"), + tr!("sync jobs handler triggered by mount"), + ), + ); + register_task_description("prune", |_ty, id: Option| { + render_datastore_worker_id(id, &tr!("Prune")) + }); + register_task_description("prunejob", |_ty, id: Option| { + render_prune_job_worker_id(id, &tr!("Prune Job")) + }); + register_task_description("reader", |_ty, id: Option| { + render_datastore_worker_id(id, &tr!("Read Objects")) + }); + register_task_description("rewind-media", (tr!("Drive"), tr!("Rewind Media"))); + register_task_description("s3-refresh", (tr!("Datastore"), tr!("S3 Refresh"))); + register_task_description("sync", (tr!("Datastore"), tr!("Remote Sync"))); + register_task_description("syncjob", (tr!("Sync Job"), tr!("Remote Sync"))); + register_task_description("tape-backup", |_ty, id: Option| { + render_tape_backup_id(id, &tr!("Tape Backup")) + }); + register_task_description("tape-backup-job", |_ty, id: Option| { + render_tape_backup_id(id, &tr!("Tape Backup Job")) + }); + register_task_description("tape-restore", (tr!("Datastore"), tr!("Tape Restore"))); + register_task_description("unload-media", (tr!("Drive"), tr!("Unload Media"))); + register_task_description("unmount-device", (tr!("Datastore"), tr!("Unmount Device"))); + register_task_description( + "verificationjob", + (tr!("Verify Job"), tr!("Scheduled Verification")), + ); + register_task_description("verify", (tr!("Datastore"), tr!("Verification"))); + register_task_description("verify_group", (tr!("Group"), tr!("Verification"))); + register_task_description("verify_snapshot", (tr!("Snapshot"), tr!("Verification"))); + register_task_description("wipedisk", (tr!("Device"), tr!("Wipe Disk"))); + register_task_description("zfscreate", (tr!("ZFS Storage"), tr!("Create"))); +} + +proxmox_schema::const_regex! { + DATASTORE_WORKER_ID_REGEX = r"^(\S+?):(\S+?)/(\S+?)(/(.+))?$"; +} + +fn render_datastore_worker_id(id: Option, what: &str) -> String { + let id = id.as_deref().unwrap_or("unknown"); + + if let Some(caps) = DATASTORE_WORKER_ID_REGEX.captures(id) { + // These capture-groups MUST exist, otherwise the regex does not match as a whole + let datastore = &caps[1]; + let backup_group = format!("{}/{}", &caps[2], &caps[3]); + + if caps.get(4).is_some() { + if let Some(hex_ts) = caps.get(5) { + if let Ok(seconds) = u64::from_str_radix(hex_ts.as_str(), 16) { + let utctime = + proxmox_time::epoch_to_rfc3339_utc(seconds as i64).unwrap_or_default(); + + return format!( + "{ds_translated} {datastore} {what} {backup_group}/{utctime}", + ds_translated = tr!("Datastore") + ); + } + } + } + + return format!( + "{ds_translated} {datastore} {what} {backup_group}", + ds_translated = tr!("Datastore") + ); + } + + format!( + "{ds_translated} {what} {id}", + ds_translated = tr!("Datastore") + ) +} + +proxmox_schema::const_regex! { + PRUNE_JOB_WORKER_ID_REGEX = r"^(\S+?):(\S+)$"; +} + +fn render_prune_job_worker_id(id: Option, what: &str) -> String { + let id = id.as_deref().unwrap_or("unknown"); + + if let Some(cap) = PRUNE_JOB_WORKER_ID_REGEX.captures(id) { + let datastore = cap.get(1).map(|m| m.as_str()); + let namespace = cap.get(2).map(|m| m.as_str()); + + if let (Some(datastore), Some(namespace)) = (datastore, namespace) { + return format!( + "{what} on {ds_translated} {datastore} {ns_translated} {namespace}", + ds_translated = tr! {"Datastore"}, + ns_translated = tr!("Namespace"), + ); + } + } + return format!( + "{what} on {ds_translated} {id}", + ds_translated = tr! {"Datastore"} + ); +} + +proxmox_schema::const_regex! { + TAPE_WORKER_ID_REGEX = r"^(\S+?):(\S+?):(\S+?)(:(.+))?$"; +} + +fn render_tape_backup_id(id: Option, what: &str) -> String { + let id = id.as_deref().unwrap_or("unknown"); + + if let Some(cap) = TAPE_WORKER_ID_REGEX.captures(id) { + let datastore = cap.get(1).map(|m| m.as_str()); + let pool = cap.get(2).map(|m| m.as_str()); + let drive = cap.get(3).map(|m| m.as_str()); + + if let (Some(datastore), Some(pool), Some(drive)) = (datastore, pool, drive) { + return format!("{what} {datastore} (pool {pool}, drive {drive})"); + } + } + format!("{what} {id}") +} + +proxmox_schema::const_regex! { + DRIVE_LOAD_WORKER_ID_REGEX = r"^(\S+?):(\S+?)$"; +} + +fn render_drive_load_media_id(id: &str, what: &str) -> String { + if let Some(caps) = DRIVE_LOAD_WORKER_ID_REGEX.captures(id) { + let drive = caps.get(1).map(|m| m.as_str()); + let label = caps.get(2).map(|m| m.as_str()); + + if let (Some(drive), Some(label)) = (drive, label) { + return format!( + "{drv_translated} {drive} - {what} '{label}'", + drv_translated = tr!("Drive") + ); + } + } + + format!("{what} {id}") +} -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel