all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager/yew-comp 0/2] refactor status structs and Fa interaction
@ 2025-04-30  7:29 Dominik Csapak
  2025-04-30  7:29 ` [pdm-devel] [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementation Dominik Csapak
  2025-04-30  7:29 ` [pdm-devel] [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon` Dominik Csapak
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Csapak @ 2025-04-30  7:29 UTC (permalink / raw)
  To: pdm-devel

Instead of having a 'to_fa_icon' for the status structs, implement
From. This is more idiomatic rust, and makes for nicer code.

proxmox-yew-comp:

Dominik Csapak (1):
  status: replace `to_fa_icon` with From implementation

 src/status.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 56 insertions(+), 8 deletions(-)


proxmox-datacenter-manager:

Dominik Csapak (1):
  ui: adapt to deprecation of `to_fa_icon`

 ui/src/dashboard/guest_panel.rs       |  2 +-
 ui/src/dashboard/mod.rs               | 15 +++++++--------
 ui/src/dashboard/remote_panel.rs      |  6 +++---
 ui/src/dashboard/subscription_info.rs |  2 +-
 ui/src/pve/remote.rs                  |  4 ++--
 ui/src/pve/utils.rs                   | 12 +++++-------
 ui/src/remotes/node_url_list.rs       |  4 ++--
 ui/src/widget/migrate_window.rs       |  6 +++---
 ui/src/widget/pve_node_selector.rs    |  4 ++--
 ui/src/widget/resource_tree.rs        | 13 ++++---------
 10 files changed, 30 insertions(+), 38 deletions(-)


Summary over all repositories:
  11 files changed, 86 insertions(+), 46 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] 5+ messages in thread

* [pdm-devel] [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementation
  2025-04-30  7:29 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/2] refactor status structs and Fa interaction Dominik Csapak
@ 2025-04-30  7:29 ` Dominik Csapak
  2025-04-30  9:24   ` [pdm-devel] applied: [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementatio Dietmar Maurer
  2025-04-30  7:29 ` [pdm-devel] [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon` Dominik Csapak
  1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2025-04-30  7:29 UTC (permalink / raw)
  To: pdm-devel

this is a much nicer interface, and more idiomatic rust. To not break
all sites that use it, simply deprecate the old `to_fa_icon` for now

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/status.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 56 insertions(+), 8 deletions(-)

diff --git a/src/status.rs b/src/status.rs
index a2866d1..1004012 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -16,13 +16,25 @@ pub enum Status {
 }
 
 impl Status {
+    #[deprecated]
+    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
     pub fn to_fa_icon(&self) -> Fa {
-        let (icon, class): (&str, Classes) = match self {
+        (*self).into()
+    }
+
+    fn get_icon_classes(&self) -> (&str, Classes) {
+        match self {
             Status::Success => ("check", FontColor::Success.into()),
             Status::Warning => ("exclamation-triangle", FontColor::Warning.into()),
             Status::Error => ("times-circle", FontColor::Error.into()),
             Status::Unknown => ("question-circle", Opacity::Quarter.into()),
-        };
+        }
+    }
+}
+
+impl From<Status> for Fa {
+    fn from(value: Status) -> Self {
+        let (icon, class) = value.get_icon_classes();
         Fa::new(icon).class(class)
     }
 }
@@ -36,12 +48,24 @@ pub enum NodeState {
 }
 
 impl NodeState {
+    #[deprecated]
+    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
     pub fn to_fa_icon(&self) -> Fa {
-        let (icon, class) = match self {
+        (*self).into()
+    }
+
+    fn get_icon_classes(&self) -> (&str, FontColor) {
+        match self {
             NodeState::Online => ("check-circle", FontColor::Success),
             NodeState::Offline => ("times-circle", FontColor::Error),
             NodeState::Unknown => ("question-circle", FontColor::Surface),
-        };
+        }
+    }
+}
+
+impl From<NodeState> for Fa {
+    fn from(value: NodeState) -> Self {
+        let (icon, class) = value.get_icon_classes();
         Fa::new(icon).class(class)
     }
 }
@@ -57,14 +81,26 @@ pub enum GuestState {
 }
 
 impl GuestState {
+    #[deprecated]
+    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
     pub fn to_fa_icon(&self) -> Fa {
-        let (icon, class): (&str, Classes) = match self {
+        (*self).into()
+    }
+
+    fn get_icon_classes(&self) -> (&str, Classes) {
+        match self {
             GuestState::Running => ("play", FontColor::Success.into()),
             GuestState::Paused => ("pause", FontColor::Warning.into()),
             GuestState::Stopped => ("stop", Opacity::Quarter.into()),
             GuestState::Template => ("file-o", "".into()),
             GuestState::Unknown => ("question-circle", Opacity::Quarter.into()),
-        };
+        }
+    }
+}
+
+impl From<GuestState> for Fa {
+    fn from(value: GuestState) -> Self {
+        let (icon, class) = value.get_icon_classes();
         Fa::new(icon).class(class)
     }
 }
@@ -78,12 +114,24 @@ pub enum StorageState {
 }
 
 impl StorageState {
+    #[deprecated]
+    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
     pub fn to_fa_icon(&self) -> Fa {
-        let (icon, class) = match self {
+        (*self).into()
+    }
+
+    fn get_icon_classes(&self) -> (&str, FontColor) {
+        match self {
             StorageState::Available => ("check-circle", FontColor::Success),
             StorageState::Unavailable => ("times-circle", FontColor::Error),
             StorageState::Unknown => ("question-circle", FontColor::Warning),
-        };
+        }
+    }
+}
+
+impl From<StorageState> for Fa {
+    fn from(value: StorageState) -> Self {
+        let (icon, class) = value.get_icon_classes();
         Fa::new(icon).class(class)
     }
 }
-- 
2.39.5



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


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

* [pdm-devel] [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon`
  2025-04-30  7:29 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/2] refactor status structs and Fa interaction Dominik Csapak
  2025-04-30  7:29 ` [pdm-devel] [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementation Dominik Csapak
@ 2025-04-30  7:29 ` Dominik Csapak
  2025-05-06 11:40   ` [pdm-devel] applied: " Dietmar Maurer
  1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2025-04-30  7:29 UTC (permalink / raw)
  To: pdm-devel

this is deprecated in proxmox-yew-comp, so use the From implementation
to convert to Fa or Classes.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/dashboard/guest_panel.rs       |  2 +-
 ui/src/dashboard/mod.rs               | 15 +++++++--------
 ui/src/dashboard/remote_panel.rs      |  6 +++---
 ui/src/dashboard/subscription_info.rs |  2 +-
 ui/src/pve/remote.rs                  |  4 ++--
 ui/src/pve/utils.rs                   | 12 +++++-------
 ui/src/remotes/node_url_list.rs       |  4 ++--
 ui/src/widget/migrate_window.rs       |  6 +++---
 ui/src/widget/pve_node_selector.rs    |  4 ++--
 ui/src/widget/resource_tree.rs        | 13 ++++---------
 10 files changed, 30 insertions(+), 38 deletions(-)

diff --git a/ui/src/dashboard/guest_panel.rs b/ui/src/dashboard/guest_panel.rs
index d885056..8d130c3 100644
--- a/ui/src/dashboard/guest_panel.rs
+++ b/ui/src/dashboard/guest_panel.rs
@@ -63,7 +63,7 @@ fn columns(guest_type: GuestType) -> Rc<Vec<DataTableHeader<StatusRow>>> {
             .width("3em")
             .render(move |item: &StatusRow| {
                 match item {
-                    StatusRow::State(state, _) => state.to_fa_icon(),
+                    StatusRow::State(state, _) => (*state).into(),
                     StatusRow::All(_) => match guest_type {
                         GuestType::Qemu => Fa::new("desktop"),
                         GuestType::Lxc => Fa::new("cubes"),
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 7b7ec81..23ff6b7 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -81,26 +81,25 @@ impl PdmDashboard {
     }
 
     fn create_node_panel(&self, icon: &str, title: String, status: &NodeStatusCount) -> Panel {
-        let (status_icon, text) = match status {
+        let (status_icon, text): (Fa, String) = match status {
             NodeStatusCount {
                 online, offline, ..
             } if *offline > 0 => (
-                Status::Error.to_fa_icon(),
+                Status::Error.into(),
                 tr!("{0} of {1} nodes are offline", offline, online),
             ),
             NodeStatusCount { unknown, .. } if *unknown > 0 => (
-                Status::Warning.to_fa_icon(),
+                Status::Warning.into(),
                 tr!("{0} nodes have an unknown status", unknown),
             ),
             // FIXME, get more detailed status about the failed remotes (name, type, error)?
             NodeStatusCount { online, .. } if self.status.failed_remotes > 0 => (
-                Status::Unknown.to_fa_icon(),
+                Status::Unknown.into(),
                 tr!("{0} of an unknown number of nodes online", online),
             ),
-            NodeStatusCount { online, .. } => (
-                Status::Success.to_fa_icon(),
-                tr!("{0} nodes online", online),
-            ),
+            NodeStatusCount { online, .. } => {
+                (Status::Success.into(), tr!("{0} nodes online", online))
+            }
         };
         Panel::new()
             .flex(1.0)
diff --git a/ui/src/dashboard/remote_panel.rs b/ui/src/dashboard/remote_panel.rs
index 2c1dd75..7471fb6 100644
--- a/ui/src/dashboard/remote_panel.rs
+++ b/ui/src/dashboard/remote_panel.rs
@@ -60,17 +60,17 @@ impl Component for PdmRemotePanel {
 
         let (remote_icon, remote_text, failure) = match (status.failed_remotes, status.remotes) {
             (0, 0) => (
-                Status::Warning.to_fa_icon(),
+                Fa::from(Status::Warning),
                 tr!("No remotes configured."),
                 false,
             ),
             (0, _) => (
-                Status::Success.to_fa_icon(),
+                Fa::from(Status::Success),
                 tr!("Could reach all remotes."),
                 false,
             ),
             (failed, _) => (
-                Status::Error.to_fa_icon(),
+                Fa::from(Status::Error),
                 tr!("{0} remotes failed to reach.", failed),
                 true,
             ),
diff --git a/ui/src/dashboard/subscription_info.rs b/ui/src/dashboard/subscription_info.rs
index 7fb26d4..9677c15 100644
--- a/ui/src/dashboard/subscription_info.rs
+++ b/ui/src/dashboard/subscription_info.rs
@@ -88,7 +88,7 @@ a list of available options. ",
         .class(AlignItems::Center)
         .class(FlexFit)
         .padding(4)
-        .with_child(status.to_fa_icon().large_4x().padding(4))
+        .with_child(Fa::from(status).large_4x().padding(4))
         .with_child(
             Column::new()
                 .class(FlexFit)
diff --git a/ui/src/pve/remote.rs b/ui/src/pve/remote.rs
index aafed5d..e9e3a84 100644
--- a/ui/src/pve/remote.rs
+++ b/ui/src/pve/remote.rs
@@ -174,9 +174,9 @@ impl yew::Component for RemotePanelComp {
                 .with_child(make_row(
                     tr!("Subscription Status"),
                     if status.level.is_empty() {
-                        Status::Error.to_fa_icon()
+                        Status::Error.into()
                     } else {
-                        Status::Success.to_fa_icon()
+                        Status::Success.into()
                     },
                     status.level.to_string(),
                     None,
diff --git a/ui/src/pve/utils.rs b/ui/src/pve/utils.rs
index bb02f56..d0c8ccc 100644
--- a/ui/src/pve/utils.rs
+++ b/ui/src/pve/utils.rs
@@ -46,8 +46,7 @@ fn render_guest_status_icon(base: &str, status: &str, template: bool) -> Contain
     let (status, extra_class) = match (status, template) {
         ("running", false) => (
             Some(
-                GuestState::Running
-                    .to_fa_icon()
+                Fa::from(GuestState::Running)
                     .fixed_width()
                     .class("status-icon"),
             ),
@@ -56,15 +55,14 @@ fn render_guest_status_icon(base: &str, status: &str, template: bool) -> Contain
         ("stopped", false) => (None, Some(Opacity::Quarter)),
         ("paused", false) => (
             Some(
-                GuestState::Paused
-                    .to_fa_icon()
+                Fa::from(GuestState::Paused)
                     .fixed_width()
                     .class("status-icon"),
             ),
             None,
         ),
         (_, true) => (Some(Fa::new(base).fixed_width().class("status-icon")), None),
-        _ => (Some(GuestState::Unknown.to_fa_icon()), None),
+        _ => (Some(GuestState::Unknown.into()), None),
     };
     Container::new()
         .class("pve-guest-icon")
@@ -86,7 +84,7 @@ pub fn render_node_status_icon(node: &PveNodeResource) -> Container {
     Container::new()
         .class("pdm-type-icon")
         .with_child(Fa::new("building").fixed_width())
-        .with_child(extra.to_fa_icon().fixed_width().class("status-icon"))
+        .with_child(Fa::from(extra).fixed_width().class("status-icon"))
 }
 
 /// Renders the status icon for a PveStorage
@@ -98,7 +96,7 @@ pub fn render_storage_status_icon(node: &PveStorageResource) -> Container {
     Container::new()
         .class("pdm-type-icon")
         .with_child(Fa::new("database").fixed_width())
-        .with_child(extra.to_fa_icon().fixed_width().class("status-icon"))
+        .with_child(Fa::from(extra).fixed_width().class("status-icon"))
 }
 
 /// Returns a [`pwt::widget::Row`] with an element for each tag
diff --git a/ui/src/remotes/node_url_list.rs b/ui/src/remotes/node_url_list.rs
index 60f9422..54dbfb9 100644
--- a/ui/src/remotes/node_url_list.rs
+++ b/ui/src/remotes/node_url_list.rs
@@ -13,7 +13,7 @@ use pwt::widget::form::{Field, ManagedFieldContext, ManagedFieldMaster, ManagedF
 use pwt::widget::{ActionIcon, Button, Column, Container, Fa, Row};
 use pwt::{css, prelude::*};
 
-use proxmox_yew_comp::SchemaValidation;
+use proxmox_yew_comp::{SchemaValidation, Status};
 
 use pdm_api_types::remotes::NodeUrl;
 use proxmox_schema::property_string::PropertyString;
@@ -218,7 +218,7 @@ impl ManagedField for PdmNodeUrlField {
                 Row::new()
                     .class(css::AlignItems::Center)
                     .gap(2)
-                    .with_child(Fa::new("exclamation-triangle").class(css::FontColor::Error))
+                    .with_child(Fa::from(Status::Warning).class(css::FontColor::Error))
                     .with_child(err)
             }));
 
diff --git a/ui/src/widget/migrate_window.rs b/ui/src/widget/migrate_window.rs
index 5305084..5f2e225 100644
--- a/ui/src/widget/migrate_window.rs
+++ b/ui/src/widget/migrate_window.rs
@@ -10,7 +10,7 @@ use pwt::css;
 use pwt::prelude::*;
 use pwt::widget::{
     form::{Checkbox, DisplayField, FormContext, Number},
-    Column, Container, InputPanel, Row,
+    Column, Container, Fa, InputPanel, Row,
 };
 use pwt::AsyncPool;
 use pwt_macros::{builder, widget};
@@ -318,7 +318,7 @@ impl PdmMigrateWindow {
                     warnings.push(
                         Row::new()
                             .gap(2)
-                            .with_child(Status::Warning.to_fa_icon())
+                            .with_child(Fa::from(Status::Warning))
                             .with_child(tr!(
                                 "Migration with local disk might take long: {0} ({1})",
                                 disk.volid,
@@ -333,7 +333,7 @@ impl PdmMigrateWindow {
                     warnings.push(
                         Row::new()
                             .gap(2)
-                            .with_child(Status::Error.to_fa_icon())
+                            .with_child(Fa::from(Status::Error))
                             .with_child(tr!("Cannot migrate with local resource: {0}", resource))
                             .into(),
                     );
diff --git a/ui/src/widget/pve_node_selector.rs b/ui/src/widget/pve_node_selector.rs
index f89db45..ca78514 100644
--- a/ui/src/widget/pve_node_selector.rs
+++ b/ui/src/widget/pve_node_selector.rs
@@ -17,7 +17,7 @@ use pwt::{
     widget::{
         data_table::{DataTable, DataTableColumn, DataTableHeader},
         form::{Selector, SelectorRenderArgs},
-        GridPicker, Row,
+        Fa, GridPicker, Row,
     },
     AsyncPool,
 };
@@ -123,7 +123,7 @@ impl Component for PveNodeSelectorComp {
             move |args: &SelectorRenderArgs<Store<ClusterNodeIndexResponse>>| {
                 if let Some(err) = &err {
                     return Row::new()
-                        .with_child(Status::Error.to_fa_icon())
+                        .with_child(Fa::from(Status::Error))
                         .with_child(err)
                         .into();
                 }
diff --git a/ui/src/widget/resource_tree.rs b/ui/src/widget/resource_tree.rs
index feff308..c790a6c 100644
--- a/ui/src/widget/resource_tree.rs
+++ b/ui/src/widget/resource_tree.rs
@@ -278,7 +278,7 @@ impl Component for PdmResourceTree {
                             .border_top(true)
                             .padding(4)
                             .gap(2)
-                            .with_child(Status::Error.to_fa_icon().large())
+                            .with_child(Fa::from(Status::Error).large())
                             .with_child(err.to_string())
                     })),
             )
@@ -322,14 +322,9 @@ fn columns(
                         Container::new()
                             .class("pdm-type-icon")
                             .with_child(Fa::new("server").fixed_width())
-                            .with_optional_child(
-                                err.is_some().then_some(
-                                    Status::Error
-                                        .to_fa_icon()
-                                        .fixed_width()
-                                        .class("status-icon"),
-                                ),
-                            ),
+                            .with_optional_child(err.is_some().then_some(
+                                Fa::from(Status::Error).fixed_width().class("status-icon"),
+                            )),
                         remote.clone(),
                         err.as_ref().map(|err| err.to_string()),
                     ),
-- 
2.39.5



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


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

* [pdm-devel] applied: [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementatio
  2025-04-30  7:29 ` [pdm-devel] [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementation Dominik Csapak
@ 2025-04-30  9:24   ` Dietmar Maurer
  0 siblings, 0 replies; 5+ messages in thread
From: Dietmar Maurer @ 2025-04-30  9:24 UTC (permalink / raw)
  To: Proxmox Datacenter Manager development discussion, Dominik Csapak

applied

> On 30.4.2025 09:29 CEST Dominik Csapak <d.csapak@proxmox.com> wrote:
> 
>  
> this is a much nicer interface, and more idiomatic rust. To not break
> all sites that use it, simply deprecate the old `to_fa_icon` for now
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/status.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 56 insertions(+), 8 deletions(-)
> 
> diff --git a/src/status.rs b/src/status.rs
> index a2866d1..1004012 100644
> --- a/src/status.rs
> +++ b/src/status.rs
> @@ -16,13 +16,25 @@ pub enum Status {
>  }
>  
>  impl Status {
> +    #[deprecated]
> +    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
>      pub fn to_fa_icon(&self) -> Fa {
> -        let (icon, class): (&str, Classes) = match self {
> +        (*self).into()
> +    }
> +
> +    fn get_icon_classes(&self) -> (&str, Classes) {
> +        match self {
>              Status::Success => ("check", FontColor::Success.into()),
>              Status::Warning => ("exclamation-triangle", FontColor::Warning.into()),
>              Status::Error => ("times-circle", FontColor::Error.into()),
>              Status::Unknown => ("question-circle", Opacity::Quarter.into()),
> -        };
> +        }
> +    }
> +}
> +
> +impl From<Status> for Fa {
> +    fn from(value: Status) -> Self {
> +        let (icon, class) = value.get_icon_classes();
>          Fa::new(icon).class(class)
>      }
>  }
> @@ -36,12 +48,24 @@ pub enum NodeState {
>  }
>  
>  impl NodeState {
> +    #[deprecated]
> +    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
>      pub fn to_fa_icon(&self) -> Fa {
> -        let (icon, class) = match self {
> +        (*self).into()
> +    }
> +
> +    fn get_icon_classes(&self) -> (&str, FontColor) {
> +        match self {
>              NodeState::Online => ("check-circle", FontColor::Success),
>              NodeState::Offline => ("times-circle", FontColor::Error),
>              NodeState::Unknown => ("question-circle", FontColor::Surface),
> -        };
> +        }
> +    }
> +}
> +
> +impl From<NodeState> for Fa {
> +    fn from(value: NodeState) -> Self {
> +        let (icon, class) = value.get_icon_classes();
>          Fa::new(icon).class(class)
>      }
>  }
> @@ -57,14 +81,26 @@ pub enum GuestState {
>  }
>  
>  impl GuestState {
> +    #[deprecated]
> +    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
>      pub fn to_fa_icon(&self) -> Fa {
> -        let (icon, class): (&str, Classes) = match self {
> +        (*self).into()
> +    }
> +
> +    fn get_icon_classes(&self) -> (&str, Classes) {
> +        match self {
>              GuestState::Running => ("play", FontColor::Success.into()),
>              GuestState::Paused => ("pause", FontColor::Warning.into()),
>              GuestState::Stopped => ("stop", Opacity::Quarter.into()),
>              GuestState::Template => ("file-o", "".into()),
>              GuestState::Unknown => ("question-circle", Opacity::Quarter.into()),
> -        };
> +        }
> +    }
> +}
> +
> +impl From<GuestState> for Fa {
> +    fn from(value: GuestState) -> Self {
> +        let (icon, class) = value.get_icon_classes();
>          Fa::new(icon).class(class)
>      }
>  }
> @@ -78,12 +114,24 @@ pub enum StorageState {
>  }
>  
>  impl StorageState {
> +    #[deprecated]
> +    /// Deprecated, please use [`Fa::from`] or `.into()` instead.
>      pub fn to_fa_icon(&self) -> Fa {
> -        let (icon, class) = match self {
> +        (*self).into()
> +    }
> +
> +    fn get_icon_classes(&self) -> (&str, FontColor) {
> +        match self {
>              StorageState::Available => ("check-circle", FontColor::Success),
>              StorageState::Unavailable => ("times-circle", FontColor::Error),
>              StorageState::Unknown => ("question-circle", FontColor::Warning),
> -        };
> +        }
> +    }
> +}
> +
> +impl From<StorageState> for Fa {
> +    fn from(value: StorageState) -> Self {
> +        let (icon, class) = value.get_icon_classes();
>          Fa::new(icon).class(class)
>      }
>  }
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pdm-devel mailing list
> pdm-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


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


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

* [pdm-devel] applied: [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon`
  2025-04-30  7:29 ` [pdm-devel] [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon` Dominik Csapak
@ 2025-05-06 11:40   ` Dietmar Maurer
  0 siblings, 0 replies; 5+ messages in thread
From: Dietmar Maurer @ 2025-05-06 11:40 UTC (permalink / raw)
  To: Proxmox Datacenter Manager development discussion, Dominik Csapak

applied


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


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

end of thread, other threads:[~2025-05-06 11:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-30  7:29 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/2] refactor status structs and Fa interaction Dominik Csapak
2025-04-30  7:29 ` [pdm-devel] [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementation Dominik Csapak
2025-04-30  9:24   ` [pdm-devel] applied: [PATCH yew-comp 1/1] status: replace `to_fa_icon` with From implementatio Dietmar Maurer
2025-04-30  7:29 ` [pdm-devel] [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon` Dominik Csapak
2025-05-06 11:40   ` [pdm-devel] applied: " Dietmar Maurer

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal