public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager/yew-widget-toolkit v2 0/2] disable content tab on pbs datastores when they are in maintenance mode "offline"
@ 2025-12-16 14:38 Shannon Sterz
  2025-12-16 14:38 ` [pdm-devel] [PATCH yew-widget-toolkit v2 1/1] tab bar: make `TabBarItem::tip` work as intended Shannon Sterz
  2025-12-16 14:38 ` [pdm-devel] [PATCH datacenter-manager v2 1/1] ui: datastore panel: disable content tab when datastore is offline Shannon Sterz
  0 siblings, 2 replies; 3+ messages in thread
From: Shannon Sterz @ 2025-12-16 14:38 UTC (permalink / raw)
  To: pdm-devel

this disables the content tab of a pbs datastore and shows an
appropriate tooltip.

changes since v1:

* noticed that the `.tip()` function of `TabBarItem` didn't work at all,
  so added a patch that makes it work as intended.
* reworded the tooltip slightly for clarity.

proxmox-yew-widget-toolkit:

Shannon Sterz (1):
  tab bar: make `TabBarItem::tip` work as intended

 src/widget/tab/tab_bar.rs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)


proxmox-datacenter-manager:

Shannon Sterz (1):
  ui: datastore panel: disable content tab when datastore is offline

 ui/src/pbs/datastore.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)


Summary over all repositories:
  2 files changed, 24 insertions(+), 2 deletions(-)

--
Generated by git-murpp 0.8.1


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pdm-devel] [PATCH yew-widget-toolkit v2 1/1] tab bar: make `TabBarItem::tip` work as intended
  2025-12-16 14:38 [pdm-devel] [PATCH datacenter-manager/yew-widget-toolkit v2 0/2] disable content tab on pbs datastores when they are in maintenance mode "offline" Shannon Sterz
@ 2025-12-16 14:38 ` Shannon Sterz
  2025-12-16 14:38 ` [pdm-devel] [PATCH datacenter-manager v2 1/1] ui: datastore panel: disable content tab when datastore is offline Shannon Sterz
  1 sibling, 0 replies; 3+ messages in thread
From: Shannon Sterz @ 2025-12-16 14:38 UTC (permalink / raw)
  To: pdm-devel

previously setting a tooltip via the `tip()` function of an
`TabBarItem` had no effect. so actually render a tooltip with the
provided `VNode` as content if a tooltip is set on a `TabBarItem`

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/widget/tab/tab_bar.rs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/widget/tab/tab_bar.rs b/src/widget/tab/tab_bar.rs
index d3de24f5..44fb9f39 100644
--- a/src/widget/tab/tab_bar.rs
+++ b/src/widget/tab/tab_bar.rs
@@ -8,7 +8,7 @@ use crate::dom::{element_direction_rtl, DomSizeObserver, IntoHtmlElement};
 use crate::props::{IntoStorageLocation, StorageLocation};
 use crate::state::{NavigationContext, NavigationContextExt, PersistentState, Selection};
 use crate::web_sys_ext::{ResizeObserverBoxOptions, ResizeObserverOptions};
-use crate::widget::Container;
+use crate::widget::{Container, Tooltip};
 use crate::{impl_class_prop_builder, impl_yew_std_props_builder, prelude::*};
 
 use super::TabBarItem;
@@ -464,7 +464,7 @@ impl Component for PwtTabBar {
                 let aria_disabled = if disabled { "true" } else { "false" };
                 let style = format!("grid-column: {};", i + 1);
 
-                html! {
+                let content = html! {
                     <a ref={active_ref} aria-disabled={aria_disabled} {style} {onclick} {onkeyup} class={nav_class} {tabindex}>
                         <span ref={size_ref}>
                         if let Some(class) = &panel.icon_class {
@@ -473,6 +473,12 @@ impl Component for PwtTabBar {
                         {panel.label.as_deref().unwrap_or("")}
                         </span>
                     </a>
+                };
+
+                if let Some(tip) = panel.tip.clone() {
+                    Tooltip::new(content).rich_tip(tip).into()
+                } else {
+                    content
                 }
             })
             .collect::<Html>();
-- 
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] 3+ messages in thread

* [pdm-devel] [PATCH datacenter-manager v2 1/1] ui: datastore panel: disable content tab when datastore is offline
  2025-12-16 14:38 [pdm-devel] [PATCH datacenter-manager/yew-widget-toolkit v2 0/2] disable content tab on pbs datastores when they are in maintenance mode "offline" Shannon Sterz
  2025-12-16 14:38 ` [pdm-devel] [PATCH yew-widget-toolkit v2 1/1] tab bar: make `TabBarItem::tip` work as intended Shannon Sterz
@ 2025-12-16 14:38 ` Shannon Sterz
  1 sibling, 0 replies; 3+ messages in thread
From: Shannon Sterz @ 2025-12-16 14:38 UTC (permalink / raw)
  To: pdm-devel

and show a tooltip explaining why.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 ui/src/pbs/datastore.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/ui/src/pbs/datastore.rs b/ui/src/pbs/datastore.rs
index 274c6ef..878c1b8 100644
--- a/ui/src/pbs/datastore.rs
+++ b/ui/src/pbs/datastore.rs
@@ -45,6 +45,13 @@ impl Component for DatastorePanelComp {
 
     fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
         let props = ctx.props();
+        let offline = props
+            .config
+            .maintenance_mode
+            .as_ref()
+            .map(|v| v == "offline")
+            .unwrap_or_default();
+
         pwt::widget::TabPanel::new()
             .router(true)
             .class(FlexFit)
@@ -64,6 +71,15 @@ impl Component for DatastorePanelComp {
                 TabBarItem::new()
                     .key("content")
                     .label(tr!("Content"))
+                    .disabled(offline)
+                    .tip(
+                        offline.then_some(
+                            tr!(
+                                "Not available if the datastore is in maintenance mode \"offline\"."
+                            )
+                            .into(),
+                        ),
+                    )
                     .icon_class("fa fa-th"),
                 {
                     let remote = props.remote.clone();
-- 
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] 3+ messages in thread

end of thread, other threads:[~2025-12-16 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-16 14:38 [pdm-devel] [PATCH datacenter-manager/yew-widget-toolkit v2 0/2] disable content tab on pbs datastores when they are in maintenance mode "offline" Shannon Sterz
2025-12-16 14:38 ` [pdm-devel] [PATCH yew-widget-toolkit v2 1/1] tab bar: make `TabBarItem::tip` work as intended Shannon Sterz
2025-12-16 14:38 ` [pdm-devel] [PATCH datacenter-manager v2 1/1] ui: datastore panel: disable content tab when datastore is offline Shannon Sterz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal