public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 3/4] ui: factor out the 'empty_state' render helper
Date: Fri, 29 May 2026 08:53:27 +0200	[thread overview]
Message-ID: <20260529065506.222086-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260529065506.222086-1-d.csapak@proxmox.com>

this is a nice looking hint for empty grids/panels that we should reuse
across the various pages so move it to the renderer module.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/guests.rs   | 22 ++--------------------
 ui/src/renderer.rs | 22 ++++++++++++++++++++--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/ui/src/guests.rs b/ui/src/guests.rs
index 416d5866..f11f0de5 100644
--- a/ui/src/guests.rs
+++ b/ui/src/guests.rs
@@ -24,7 +24,7 @@ use proxmox_yew_comp::{
     LoadableComponentScopeExt, LoadableComponentState, rrd_value_renderer,
 };
 
-use pwt::css::{AlignItems, ColorScheme, FlexFit, FontStyle, JustifyContent};
+use pwt::css::{AlignItems, ColorScheme, FlexFit, JustifyContent};
 use pwt::prelude::*;
 use pwt::props::{
     ContainerBuilder, CssPaddingBuilder, ExtractPrimaryKey, StorageLocation, WidgetBuilder,
@@ -44,7 +44,7 @@ use pdm_search::SearchTerm;
 
 use crate::pve::utils::{guest_is_live, guest_status_label, render_guest_tags};
 use crate::pve::{GuestInfo, GuestType};
-use crate::renderer::{render_resource_name, render_status_icon, render_tree_column};
+use crate::renderer::{empty_state, render_resource_name, render_status_icon, render_tree_column};
 use crate::{
     get_deep_url, get_resource_node,
     widget::{MigrateWindow, SnapshotWindow},
@@ -606,24 +606,6 @@ impl LoadableComponent for GuestPanelComp {
     }
 }
 
-/// A centered, large-icon empty state with a title and an explanatory hint.
-fn empty_state(icon: &str, title: String, hint: String) -> Html {
-    Column::new()
-        .class(FlexFit)
-        .class(JustifyContent::Center)
-        .class(AlignItems::Center)
-        .gap(2)
-        .padding(4)
-        .with_child(Fa::new(icon).large_3x())
-        .with_child(
-            Container::from_tag("span")
-                .class(FontStyle::TitleMedium)
-                .with_child(title),
-        )
-        .with_child(Container::from_tag("span").with_child(hint))
-        .into()
-}
-
 fn failed_remotes_banner(failed: &[String]) -> Html {
     Row::new()
         .padding(2)
diff --git a/ui/src/renderer.rs b/ui/src/renderer.rs
index 1d152977..be3a94b4 100644
--- a/ui/src/renderer.rs
+++ b/ui/src/renderer.rs
@@ -1,8 +1,8 @@
 use proxmox_yew_comp::MeterLabel;
-use pwt::css::AlignItems;
+use pwt::css::{AlignItems, FlexFit, FontStyle, JustifyContent};
 use pwt::prelude::*;
 use pwt::props::ContainerBuilder;
-use pwt::widget::{Container, Fa, Row};
+use pwt::widget::{Column, Container, Fa, Row};
 
 use proxmox_human_byte::HumanByte;
 
@@ -109,3 +109,21 @@ pub(crate) fn render_title_row(title: String, icon: &str) -> Row {
         .with_child(Fa::new(icon))
         .with_child(title)
 }
+
+/// A centered, large-icon empty state with a title and an explanatory hint.
+pub(crate) fn empty_state(icon: &str, title: String, hint: String) -> Html {
+    Column::new()
+        .class(FlexFit)
+        .class(JustifyContent::Center)
+        .class(AlignItems::Center)
+        .gap(2)
+        .padding(4)
+        .with_child(Fa::new(icon).large_3x())
+        .with_child(
+            Container::from_tag("span")
+                .class(FontStyle::TitleMedium)
+                .with_child(title),
+        )
+        .with_child(Container::from_tag("span").with_child(hint))
+        .into()
+}
-- 
2.47.3





  parent reply	other threads:[~2026-05-29  6:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  6:53 [PATCH datacenter-manager 0/4] ui: dashboard improvements Dominik Csapak
2026-05-29  6:53 ` [PATCH datacenter-manager 1/4] ui: views: vertically center gauge charts Dominik Csapak
2026-05-29  6:53 ` [PATCH datacenter-manager 2/4] ui: renderer: cleanup import structure Dominik Csapak
2026-05-29  6:53 ` Dominik Csapak [this message]
2026-05-29 10:11   ` [PATCH datacenter-manager 3/4] ui: factor out the 'empty_state' render helper Thomas Lamprecht
2026-05-29  6:53 ` [PATCH datacenter-manager 4/4] ui: dashboard: show special empty state when no remotes are configured 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=20260529065506.222086-4-d.csapak@proxmox.com \
    --to=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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal