From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon`
Date: Wed, 30 Apr 2025 09:29:36 +0200 [thread overview]
Message-ID: <20250430072936.447054-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250430072936.447054-1-d.csapak@proxmox.com>
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
next prev parent reply other threads:[~2025-04-30 7:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Dominik Csapak [this message]
2025-05-06 11:40 ` [pdm-devel] applied: [PATCH datacenter-manager 1/1] ui: adapt to deprecation of `to_fa_icon` Dietmar Maurer
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=20250430072936.447054-3-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 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