* [pdm-devel] [PATCH datacenter-manager] ui: dashboard: allow add PBS remotes via dashboard
@ 2025-09-26 11:45 Christian Ebner
2025-09-26 13:59 ` [pdm-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2025-09-26 11:45 UTC (permalink / raw)
To: pdm-devel
Extend the current add button to a dropdown menu so it is possible to
add PVE as well as PBS remotes.
Instead of using a boolean to show/hide the wizard, set the remote type
as option, not showing the wizard if none is set, otherwise showing the
wizard for the corresponding type.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
ui/src/dashboard/mod.rs | 50 +++++++++++++++++++++++++----------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 27c0944..f54c509 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -19,12 +19,14 @@ use pwt::{
widget::{
error_message,
form::{DisplayField, FormContext, Number},
- Button, Column, Container, Fa, InputPanel, Panel, Row,
+ menu::{Menu, MenuButton, MenuItem},
+ Column, Container, Fa, InputPanel, Panel, Row,
},
AsyncPool,
};
use pdm_api_types::{
+ remotes::RemoteType,
resource::{NodeStatusCount, ResourcesStatus},
TaskStatistics,
};
@@ -116,7 +118,7 @@ pub enum LoadingResult {
pub enum Msg {
LoadingFinished(LoadingResult),
RemoteListChanged(RemoteList),
- CreateWizard(bool),
+ CreateWizard(Option<RemoteType>),
Reload,
ForceReload,
UpdateConfig(DashboardConfig),
@@ -139,7 +141,7 @@ pub struct PdmDashboard {
loading: bool,
load_finished_time: Option<f64>,
remote_list: RemoteList,
- show_wizard: bool,
+ show_wizard: Option<RemoteType>,
show_config_window: bool,
_context_listener: ContextHandle<RemoteList>,
async_pool: AsyncPool,
@@ -415,7 +417,7 @@ impl Component for PdmDashboard {
loading: true,
load_finished_time: None,
remote_list,
- show_wizard: false,
+ show_wizard: None,
show_config_window: false,
_context_listener,
async_pool,
@@ -471,8 +473,8 @@ impl Component for PdmDashboard {
self.remote_list = remote_list;
changed
}
- Msg::CreateWizard(show) => {
- self.show_wizard = show;
+ Msg::CreateWizard(remote_type) => {
+ self.show_wizard = remote_type;
true
}
Msg::Reload => {
@@ -541,9 +543,23 @@ impl Component for PdmDashboard {
.width(300)
.min_height(175)
.with_tool(
- Button::new(tr!("Add"))
- .icon_class("fa fa-plus-circle")
- .on_activate(ctx.link().callback(|_| Msg::CreateWizard(true))),
+ MenuButton::new(tr!("Add")).show_arrow(true).menu(
+ Menu::new()
+ .with_item(
+ MenuItem::new("Proxmox VE")
+ .icon_class("fa fa-building")
+ .on_select(ctx.link().callback(|_| {
+ Msg::CreateWizard(Some(RemoteType::Pve))
+ })),
+ )
+ .with_item(
+ MenuItem::new("Proxmox Backup Server")
+ .icon_class("fa fa-floppy-o")
+ .on_select(ctx.link().callback(|_| {
+ Msg::CreateWizard(Some(RemoteType::Pbs))
+ })),
+ ),
+ ),
)
.with_child(RemotePanel::new(self.status.clone())),
)
@@ -665,18 +681,14 @@ impl Component for PdmDashboard {
Panel::new()
.class(FlexFit)
.with_child(content)
- // FIXME: make pbs also addable?
.with_optional_child(
- self.show_wizard.then_some(
- AddWizard::new(pdm_api_types::remotes::RemoteType::Pve)
- .on_close(ctx.link().callback(|_| Msg::CreateWizard(false)))
+ self.show_wizard.map(|remote_type| {
+ AddWizard::new(remote_type)
+ .on_close(ctx.link().callback(|_| Msg::CreateWizard(None)))
.on_submit(move |ctx| {
- crate::remotes::create_remote(
- ctx,
- pdm_api_types::remotes::RemoteType::Pve,
- )
- }),
- ),
+ crate::remotes::create_remote(ctx, remote_type)
+ })
+ }),
)
.with_optional_child(
self.show_config_window.then_some(
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pdm-devel] applied: [PATCH datacenter-manager] ui: dashboard: allow add PBS remotes via dashboard
2025-09-26 11:45 [pdm-devel] [PATCH datacenter-manager] ui: dashboard: allow add PBS remotes via dashboard Christian Ebner
@ 2025-09-26 13:59 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-09-26 13:59 UTC (permalink / raw)
To: pdm-devel, Christian Ebner
On Fri, 26 Sep 2025 13:45:35 +0200, Christian Ebner wrote:
> Extend the current add button to a dropdown menu so it is possible to
> add PVE as well as PBS remotes.
>
> Instead of using a boolean to show/hide the wizard, set the remote type
> as option, not showing the wizard if none is set, otherwise showing the
> wizard for the corresponding type.
>
> [...]
Applied, thanks!
[1/1] ui: dashboard: allow add PBS remotes via dashboard
commit: 81aede767f3448a9d68c93cc60e1f924450ada3f
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-26 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-26 11:45 [pdm-devel] [PATCH datacenter-manager] ui: dashboard: allow add PBS remotes via dashboard Christian Ebner
2025-09-26 13:59 ` [pdm-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.