From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D1B0C1FF14C for ; Fri, 29 May 2026 08:55:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6954A1BEF; Fri, 29 May 2026 08:55:10 +0200 (CEST) From: Dominik Csapak 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 Message-ID: <20260529065506.222086-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260529065506.222086-1-d.csapak@proxmox.com> References: <20260529065506.222086-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [guests.rs] Message-ID-Hash: RGG7KBE6ULYBX3TH5UKQZ2FRCZEBCNDA X-Message-ID-Hash: RGG7KBE6ULYBX3TH5UKQZ2FRCZEBCNDA X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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