[pdm-devel] [PATCH datacenter-manager 8/9] ui: register pve tasks

Dominik Csapak d.csapak at proxmox.com
Mon Jan 20 10:30:05 CET 2025


list copied from pve-manager and adapted for register_task_description

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 ui/src/lib.rs   |   3 ++
 ui/src/main.rs  |   6 ++-
 ui/src/tasks.rs | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+), 2 deletions(-)
 create mode 100644 ui/src/tasks.rs

diff --git a/ui/src/lib.rs b/ui/src/lib.rs
index 5c6d076..cee7791 100644
--- a/ui/src/lib.rs
+++ b/ui/src/lib.rs
@@ -32,6 +32,9 @@ pub mod pve;
 
 pub mod renderer;
 
+mod tasks;
+pub use tasks::register_pve_tasks;
+
 pub fn pdm_client() -> pdm_client::PdmClient<std::rc::Rc<proxmox_yew_comp::HttpClientWasm>> {
     pdm_client::PdmClient(proxmox_yew_comp::CLIENT.with(|c| std::rc::Rc::clone(&c.borrow())))
 }
diff --git a/ui/src/main.rs b/ui/src/main.rs
index 2ba7d47..42257a9 100644
--- a/ui/src/main.rs
+++ b/ui/src/main.rs
@@ -13,6 +13,7 @@ use pwt::widget::{Column, DesktopApp, Dialog, Mask};
 
 use proxmox_login::Authentication;
 use proxmox_yew_comp::common_api_types::TaskListItem;
+use proxmox_yew_comp::utils::init_task_descr_table_base;
 use proxmox_yew_comp::{
     authentication_from_cookie, http_get, register_auth_observer, AuthObserver, LoginPanel,
     SubscriptionAlert,
@@ -20,7 +21,7 @@ use proxmox_yew_comp::{
 
 //use pbs::MainMenu;
 use pdm_api_types::subscription::{RemoteSubscriptionState, RemoteSubscriptions};
-use pdm_ui::{MainMenu, RemoteList, TopNavBar};
+use pdm_ui::{register_pve_tasks, MainMenu, RemoteList, TopNavBar};
 
 type MsgRemoteList = Result<RemoteList, Error>;
 
@@ -274,7 +275,8 @@ fn main() {
 
     yew::set_custom_panic_hook(panic_hook());
 
-    //init_task_descr_table_pbs();
+    init_task_descr_table_base();
+    register_pve_tasks();
     proxmox_yew_comp::http_setup(&proxmox_yew_comp::ExistingProduct::PDM);
 
     pwt::props::set_http_get_method(
diff --git a/ui/src/tasks.rs b/ui/src/tasks.rs
new file mode 100644
index 0000000..6aa202a
--- /dev/null
+++ b/ui/src/tasks.rs
@@ -0,0 +1,101 @@
+use proxmox_yew_comp::utils::register_task_description;
+use pwt::tr;
+
+pub fn register_pve_tasks() {
+    register_task_description("qmstart", ("VM", tr!("Start")));
+    register_task_description("acmedeactivate", ("ACME Account", tr!("Deactivate")));
+    register_task_description("acmenewcert", ("SRV", tr!("Order Certificate")));
+    register_task_description("acmerefresh", ("ACME Account", tr!("Refresh")));
+    register_task_description("acmeregister", ("ACME Account", tr!("Register")));
+    register_task_description("acmerenew", ("SRV", tr!("Renew Certificate")));
+    register_task_description("acmerevoke", ("SRV", tr!("Revoke Certificate")));
+    register_task_description("acmeupdate", ("ACME Account", tr!("Update")));
+    register_task_description("auth-realm-sync", (tr!("Realm"), tr!("Sync")));
+    register_task_description("auth-realm-sync-test", (tr!("Realm"), tr!("Sync Preview")));
+    register_task_description("cephcreatemds", ("Ceph Metadata Server", tr!("Create")));
+    register_task_description("cephcreatemgr", ("Ceph Manager", tr!("Create")));
+    register_task_description("cephcreatemon", ("Ceph Monitor", tr!("Create")));
+    register_task_description("cephcreateosd", ("Ceph OSD", tr!("Create")));
+    register_task_description("cephcreatepool", ("Ceph Pool", tr!("Create")));
+    register_task_description("cephdestroymds", ("Ceph Metadata Server", tr!("Destroy")));
+    register_task_description("cephdestroymgr", ("Ceph Manager", tr!("Destroy")));
+    register_task_description("cephdestroymon", ("Ceph Monitor", tr!("Destroy")));
+    register_task_description("cephdestroyosd", ("Ceph OSD", tr!("Destroy")));
+    register_task_description("cephdestroypool", ("Ceph Pool", tr!("Destroy")));
+    register_task_description("cephdestroyfs", ("CephFS", tr!("Destroy")));
+    register_task_description("cephfscreate", ("CephFS", tr!("Create")));
+    register_task_description("cephsetpool", ("Ceph Pool", tr!("Edit")));
+    register_task_description("cephsetflags", tr!("Change global Ceph flags"));
+    register_task_description("clustercreate", tr!("Create Cluster"));
+    register_task_description("clusterjoin", tr!("Join Cluster"));
+    register_task_description("dircreate", (tr!("Directory Storage"), tr!("Create")));
+    register_task_description("dirremove", (tr!("Directory"), tr!("Remove")));
+    register_task_description("download", (tr!("File"), tr!("Download")));
+    register_task_description("hamigrate", ("HA", tr!("Migrate")));
+    register_task_description("hashutdown", ("HA", tr!("Shutdown")));
+    register_task_description("hastart", ("HA", tr!("Start")));
+    register_task_description("hastop", ("HA", tr!("Stop")));
+    register_task_description("imgcopy", tr!("Copy data"));
+    register_task_description("imgdel", tr!("Erase data"));
+    register_task_description("lvmcreate", (tr!("LVM Storage"), tr!("Create")));
+    register_task_description("lvmremove", ("Volume Group", tr!("Remove")));
+    register_task_description("lvmthincreate", (tr!("LVM-Thin Storage"), tr!("Create")));
+    register_task_description("lvmthinremove", ("Thinpool", tr!("Remove")));
+    register_task_description("migrateall", tr!("Bulk migrate VMs and Containers"));
+    register_task_description("move_volume", ("CT", tr!("Move Volume")));
+    register_task_description("pbs-download", ("VM/CT", tr!("File Restore Download")));
+    register_task_description("pull_file", ("CT", tr!("Pull file")));
+    register_task_description("push_file", ("CT", tr!("Push file")));
+    register_task_description("qmclone", ("VM", tr!("Clone")));
+    register_task_description("qmconfig", ("VM", tr!("Configure")));
+    register_task_description("qmcreate", ("VM", tr!("Create")));
+    register_task_description("qmdelsnapshot", ("VM", tr!("Delete Snapshot")));
+    register_task_description("qmdestroy", ("VM", tr!("Destroy")));
+    register_task_description("qmigrate", ("VM", tr!("Migrate")));
+    register_task_description("qmmove", ("VM", tr!("Move disk")));
+    register_task_description("qmpause", ("VM", tr!("Pause")));
+    register_task_description("qmreboot", ("VM", tr!("Reboot")));
+    register_task_description("qmreset", ("VM", tr!("Reset")));
+    register_task_description("qmrestore", ("VM", tr!("Restore")));
+    register_task_description("qmresume", ("VM", tr!("Resume")));
+    register_task_description("qmrollback", ("VM", tr!("Rollback")));
+    register_task_description("qmshutdown", ("VM", tr!("Shutdown")));
+    register_task_description("qmsnapshot", ("VM", tr!("Snapshot")));
+    register_task_description("qmstart", ("VM", tr!("Start")));
+    register_task_description("qmstop", ("VM", tr!("Stop")));
+    register_task_description("qmsuspend", ("VM", tr!("Hibernate")));
+    register_task_description("qmtemplate", ("VM", tr!("Convert to template")));
+    register_task_description("resize", ("VM/CT", tr!("Resize")));
+    register_task_description("spiceproxy", ("VM/CT", tr!("Console") + " (Spice)"));
+    register_task_description("spiceshell", tr!("Shell") + " (Spice)");
+    register_task_description("startall", tr!("Bulk start VMs and Containers"));
+    register_task_description("stopall", tr!("Bulk shutdown VMs and Containers"));
+    register_task_description("suspendall", tr!("Suspend all VMs"));
+    register_task_description("unknownimgdel", tr!("Destroy image from unknown guest"));
+    register_task_description("wipedisk", ("Device", tr!("Wipe Disk")));
+    register_task_description("vncproxy", ("VM/CT", tr!("Console")));
+    register_task_description("vncshell", tr!("Shell"));
+    register_task_description("vzclone", ("CT", tr!("Clone")));
+    register_task_description("vzcreate", ("CT", tr!("Create")));
+    register_task_description("vzdelsnapshot", ("CT", tr!("Delete Snapshot")));
+    register_task_description("vzdestroy", ("CT", tr!("Destroy")));
+    register_task_description("vzdump", |_ty, id| match id {
+        Some(id) => format!("VM/CT {id} - {}", tr!("Backup")),
+        None => tr!("Backup Job"),
+    });
+    register_task_description("vzmigrate", ("CT", tr!("Migrate")));
+    register_task_description("vzmount", ("CT", tr!("Mount")));
+    register_task_description("vzreboot", ("CT", tr!("Reboot")));
+    register_task_description("vzrestore", ("CT", tr!("Restore")));
+    register_task_description("vzresume", ("CT", tr!("Resume")));
+    register_task_description("vzrollback", ("CT", tr!("Rollback")));
+    register_task_description("vzshutdown", ("CT", tr!("Shutdown")));
+    register_task_description("vzsnapshot", ("CT", tr!("Snapshot")));
+    register_task_description("vzstart", ("CT", tr!("Start")));
+    register_task_description("vzstop", ("CT", tr!("Stop")));
+    register_task_description("vzsuspend", ("CT", tr!("Suspend")));
+    register_task_description("vztemplate", ("CT", tr!("Convert to template")));
+    register_task_description("vzumount", ("CT", tr!("Unmount")));
+    register_task_description("zfscreate", (tr!("ZFS Storage"), tr!("Create")));
+    register_task_description("zfsremove", ("ZFS Pool", tr!("Remove")));
+}
-- 
2.39.5





More information about the pdm-devel mailing list