[pdm-devel] [PATCH datacenter-manager 1/4] ui: dashboard: use builtin types and methods for styles

Dominik Csapak d.csapak at proxmox.com
Fri Jun 6 09:27:17 CEST 2025


by using the rust types instead of a string for the classes, it's not
possible to mistype it, otherwise the compiler will error out.

Same with the styling of specifying e.g. padding. Just using the built-in
padding methods makes it impossible to mistype.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 ui/src/dashboard/mod.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 23ff6b7..0832ced 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -9,7 +9,7 @@ use yew::{
 
 use proxmox_yew_comp::{http_get, Status};
 use pwt::{
-    css::{AlignItems, FlexFit, FlexWrap, JustifyContent},
+    css::{AlignItems, FlexDirection, FlexFit, FlexWrap, JustifyContent},
     prelude::*,
     widget::{error_message, Button, Column, Container, Fa, Panel, Row},
     AsyncPool,
@@ -243,7 +243,7 @@ impl Component for PdmDashboard {
             .with_child(
                 Container::new()
                     .class("pwt-content-spacer")
-                    .class("pwt-flex-direction-row")
+                    .class(FlexDirection::Row)
                     .class(FlexWrap::Wrap)
                     .with_child(
                         Panel::new()
@@ -336,10 +336,10 @@ impl Component for PdmDashboard {
             .with_child(
                 Container::new()
                     .class("pwt-content-spacer")
-                    .class("pwt-flex-direction-row")
+                    .class(FlexDirection::Row)
                     .class("pwt-align-content-start")
                     .class(pwt::css::Flex::Fill)
-                    .style("padding-top", "0")
+                    .padding_top(0)
                     .class(FlexWrap::Wrap)
                     //.min_height(175)
                     .with_child(self.create_top_entities_panel(
-- 
2.39.5





More information about the pdm-devel mailing list