* [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top
@ 2025-10-15 8:15 Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 2/4] ui: qemu: cleanup: use module level imports Dietmar Maurer
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Dietmar Maurer @ 2025-10-15 8:15 UTC (permalink / raw)
To: pdm-devel
So that we can add other tab panels in the future,
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
ui/src/pve/qemu/mod.rs | 81 ++++++++++++++++++++++++
ui/src/pve/{qemu.rs => qemu/overview.rs} | 28 +++-----
2 files changed, 91 insertions(+), 18 deletions(-)
create mode 100644 ui/src/pve/qemu/mod.rs
rename ui/src/pve/{qemu.rs => qemu/overview.rs} (96%)
diff --git a/ui/src/pve/qemu/mod.rs b/ui/src/pve/qemu/mod.rs
new file mode 100644
index 0000000..448b313
--- /dev/null
+++ b/ui/src/pve/qemu/mod.rs
@@ -0,0 +1,81 @@
+mod overview;
+use overview::QemuOverviewPanel;
+
+use std::rc::Rc;
+
+use yew::virtual_dom::{VComp, VNode};
+
+use pwt::prelude::*;
+use pwt::widget::{Fa, Row, TabBarItem, TabPanel};
+
+use pdm_api_types::resource::PveQemuResource;
+
+use crate::pve::utils::render_qemu_name;
+
+#[derive(Clone, Debug, Properties, PartialEq)]
+pub struct QemuPanel {
+ remote: String,
+ node: String,
+ info: PveQemuResource,
+
+ #[prop_or(60_000)]
+ /// The interval for refreshing the rrd data
+ pub rrd_interval: u32,
+
+ #[prop_or(10_000)]
+ /// The interval for refreshing the status data
+ pub status_interval: u32,
+}
+
+impl QemuPanel {
+ pub fn new(remote: String, node: String, info: PveQemuResource) -> Self {
+ yew::props!(Self { remote, node, info })
+ }
+}
+
+pub struct QemuPanelComp {}
+
+impl yew::Component for QemuPanelComp {
+ type Message = ();
+ type Properties = QemuPanel;
+
+ fn create(_ctx: &yew::Context<Self>) -> Self {
+ Self {}
+ }
+
+ fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
+ let props = ctx.props();
+
+ let title: Html = Row::new()
+ .gap(2)
+ .class(pwt::css::AlignItems::Baseline)
+ .with_child(Fa::new("desktop"))
+ .with_child(tr! {"VM '{0}'", render_qemu_name(&props.info, true)})
+ .into();
+
+ TabPanel::new()
+ .class(pwt::css::FlexFit)
+ .title(title)
+ .with_item_builder(
+ TabBarItem::new()
+ .key("status_view")
+ .label(tr!("Overview"))
+ .icon_class("fa fa-tachometer"),
+ {
+ let remote = props.remote.clone();
+ let node = props.node.clone();
+ let info = props.info.clone();
+ move |_| {
+ QemuOverviewPanel::new(remote.clone(), node.clone(), info.clone()).into()
+ }
+ },
+ )
+ .into()
+ }
+}
+
+impl Into<VNode> for QemuPanel {
+ fn into(self) -> VNode {
+ VComp::new::<QemuPanelComp>(Rc::new(self), None).into()
+ }
+}
diff --git a/ui/src/pve/qemu.rs b/ui/src/pve/qemu/overview.rs
similarity index 96%
rename from ui/src/pve/qemu.rs
rename to ui/src/pve/qemu/overview.rs
index 10266f3..f9379df 100644
--- a/ui/src/pve/qemu.rs
+++ b/ui/src/pve/qemu/overview.rs
@@ -27,7 +27,7 @@ use crate::{
};
#[derive(Clone, Debug, Properties)]
-pub struct QemuPanel {
+pub struct QemuOverviewPanel {
remote: String,
node: String,
info: PveQemuResource,
@@ -41,7 +41,7 @@ pub struct QemuPanel {
pub status_interval: u32,
}
-impl PartialEq for QemuPanel {
+impl PartialEq for QemuOverviewPanel {
fn eq(&self, other: &Self) -> bool {
if self.remote == other.remote && self.node == other.node {
// only check some fields, so we don't update when e.g. only the cpu changes
@@ -53,17 +53,17 @@ impl PartialEq for QemuPanel {
}
}
}
-impl Eq for QemuPanel {}
+impl Eq for QemuOverviewPanel {}
-impl QemuPanel {
+impl QemuOverviewPanel {
pub fn new(remote: String, node: String, info: PveQemuResource) -> Self {
yew::props!(Self { remote, node, info })
}
}
-impl Into<VNode> for QemuPanel {
+impl Into<VNode> for QemuOverviewPanel {
fn into(self) -> VNode {
- VComp::new::<QemuPanelComp>(Rc::new(self), None).into()
+ VComp::new::<QemuOverviewPanelComp>(Rc::new(self), None).into()
}
}
@@ -75,7 +75,7 @@ pub enum Msg {
UpdateRrdTimeframe(RRDTimeframe),
}
-pub struct QemuPanelComp {
+pub struct QemuOverviewPanelComp {
status: Option<QemuStatus>,
last_status_error: Option<proxmox_client::Error>,
last_rrd_error: Option<proxmox_client::Error>,
@@ -95,7 +95,7 @@ pub struct QemuPanelComp {
diskwrite: Rc<Series>,
}
-impl QemuPanelComp {
+impl QemuOverviewPanelComp {
async fn reload_status(remote: &str, vmid: u32) -> Result<QemuStatus, proxmox_client::Error> {
let status = crate::pdm_client()
.pve_qemu_status(remote, None, vmid)
@@ -115,10 +115,10 @@ impl QemuPanelComp {
}
}
-impl yew::Component for QemuPanelComp {
+impl yew::Component for QemuOverviewPanelComp {
type Message = Msg;
- type Properties = QemuPanel;
+ type Properties = QemuOverviewPanel;
fn create(ctx: &yew::Context<Self>) -> Self {
ctx.link()
@@ -256,13 +256,6 @@ impl yew::Component for QemuPanelComp {
fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
let props = ctx.props();
- let title: Html = Row::new()
- .gap(2)
- .class(AlignItems::Baseline)
- .with_child(Fa::new("desktop"))
- .with_child(tr! {"VM '{0}'", render_qemu_name(&props.info, true)})
- .into();
-
let mut status_comp = Column::new().gap(2).padding(4);
let status = match &self.status {
@@ -362,7 +355,6 @@ impl yew::Component for QemuPanelComp {
let loading = self.status.is_none() && self.last_status_error.is_none();
Panel::new()
.class(FlexFit)
- .title(title)
.class(ColorScheme::Neutral)
.with_child(
// FIXME: add some 'visible' or 'active' property to the progress
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 2/4] ui: qemu: cleanup: use module level imports
2025-10-15 8:15 [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Dietmar Maurer
@ 2025-10-15 8:15 ` Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 3/4] ui: qemu: cleanup: avoid "use pwt::css::XYZ" imports Dietmar Maurer
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2025-10-15 8:15 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
ui/src/pve/qemu/overview.rs | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/ui/src/pve/qemu/overview.rs b/ui/src/pve/qemu/overview.rs
index f9379df..d9d53c1 100644
--- a/ui/src/pve/qemu/overview.rs
+++ b/ui/src/pve/qemu/overview.rs
@@ -1,30 +1,22 @@
-use core::f64;
use std::rc::Rc;
use gloo_timers::callback::Timeout;
use serde_json::json;
-use yew::{
- virtual_dom::{VComp, VNode},
- Properties,
-};
+use yew::virtual_dom::{VComp, VNode};
use proxmox_human_byte::HumanByte;
use proxmox_yew_comp::{RRDGraph, RRDTimeframe, RRDTimeframeSelector, Series};
-use pwt::{
- css::{AlignItems, ColorScheme, FlexFit, JustifyContent},
- prelude::*,
- props::WidgetBuilder,
- widget::{Column, Container, Fa, Panel, Progress, Row},
- AsyncPool,
-};
+
+use pwt::css::{AlignItems, ColorScheme, FlexFit, JustifyContent};
+use pwt::prelude::*;
+use pwt::props::WidgetBuilder;
+use pwt::widget::{Column, Container, Panel, Progress, Row};
+use pwt::AsyncPool;
use pdm_api_types::{resource::PveQemuResource, rrddata::QemuDataPoint};
use pdm_client::types::{IsRunning, QemuStatus};
-use crate::{
- pve::utils::render_qemu_name,
- renderer::{separator, status_row},
-};
+use crate::renderer::{separator, status_row};
#[derive(Clone, Debug, Properties)]
pub struct QemuOverviewPanel {
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 3/4] ui: qemu: cleanup: avoid "use pwt::css::XYZ" imports
2025-10-15 8:15 [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 2/4] ui: qemu: cleanup: use module level imports Dietmar Maurer
@ 2025-10-15 8:15 ` Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 4/4] ui: qemu: remove wrong PartialEq implementation Dietmar Maurer
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2025-10-15 8:15 UTC (permalink / raw)
To: pdm-devel
The prefix "pwt::css::" is short enough to use inline.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
ui/src/pve/qemu/overview.rs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/ui/src/pve/qemu/overview.rs b/ui/src/pve/qemu/overview.rs
index d9d53c1..62efbae 100644
--- a/ui/src/pve/qemu/overview.rs
+++ b/ui/src/pve/qemu/overview.rs
@@ -7,7 +7,6 @@ use yew::virtual_dom::{VComp, VNode};
use proxmox_human_byte::HumanByte;
use proxmox_yew_comp::{RRDGraph, RRDTimeframe, RRDTimeframeSelector, Series};
-use pwt::css::{AlignItems, ColorScheme, FlexFit, JustifyContent};
use pwt::prelude::*;
use pwt::props::WidgetBuilder;
use pwt::widget::{Column, Container, Panel, Progress, Row};
@@ -346,8 +345,8 @@ impl yew::Component for QemuOverviewPanelComp {
let loading = self.status.is_none() && self.last_status_error.is_none();
Panel::new()
- .class(FlexFit)
- .class(ColorScheme::Neutral)
+ .class(pwt::css::FlexFit)
+ .class(pwt::css::ColorScheme::Neutral)
.with_child(
// FIXME: add some 'visible' or 'active' property to the progress
Progress::new()
@@ -360,14 +359,14 @@ impl yew::Component for QemuOverviewPanelComp {
Row::new()
.padding_x(4)
.padding_y(1)
- .class(JustifyContent::FlexEnd)
+ .class(pwt::css::JustifyContent::FlexEnd)
.with_child(
RRDTimeframeSelector::new()
.on_change(ctx.link().callback(Msg::UpdateRrdTimeframe)),
),
)
.with_child(
- Container::new().class(FlexFit).with_child(
+ Container::new().class(pwt::css::FlexFit).with_child(
Column::new()
.padding(4)
.gap(4)
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] [PATCH datacenter-manager 4/4] ui: qemu: remove wrong PartialEq implementation
2025-10-15 8:15 [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 2/4] ui: qemu: cleanup: use module level imports Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 3/4] ui: qemu: cleanup: avoid "use pwt::css::XYZ" imports Dietmar Maurer
@ 2025-10-15 8:15 ` Dietmar Maurer
2025-10-16 22:17 ` [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Thomas Lamprecht
2025-10-22 5:18 ` [pdm-devel] applied: " Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Dietmar Maurer @ 2025-10-15 8:15 UTC (permalink / raw)
To: pdm-devel
i.e. we want to update the view on cpu property changes.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
ui/src/pve/qemu/overview.rs | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/ui/src/pve/qemu/overview.rs b/ui/src/pve/qemu/overview.rs
index 62efbae..3d715eb 100644
--- a/ui/src/pve/qemu/overview.rs
+++ b/ui/src/pve/qemu/overview.rs
@@ -17,7 +17,7 @@ use pdm_client::types::{IsRunning, QemuStatus};
use crate::renderer::{separator, status_row};
-#[derive(Clone, Debug, Properties)]
+#[derive(Clone, Debug, Properties, PartialEq)]
pub struct QemuOverviewPanel {
remote: String,
node: String,
@@ -32,20 +32,6 @@ pub struct QemuOverviewPanel {
pub status_interval: u32,
}
-impl PartialEq for QemuOverviewPanel {
- fn eq(&self, other: &Self) -> bool {
- if self.remote == other.remote && self.node == other.node {
- // only check some fields, so we don't update when e.g. only the cpu changes
- self.info.name == other.info.name
- && self.info.id == other.info.id
- && self.info.node == other.node
- } else {
- false
- }
- }
-}
-impl Eq for QemuOverviewPanel {}
-
impl QemuOverviewPanel {
pub fn new(remote: String, node: String, info: PveQemuResource) -> Self {
yew::props!(Self { remote, node, info })
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top
2025-10-15 8:15 [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Dietmar Maurer
` (2 preceding siblings ...)
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 4/4] ui: qemu: remove wrong PartialEq implementation Dietmar Maurer
@ 2025-10-16 22:17 ` Thomas Lamprecht
2025-10-22 5:18 ` [pdm-devel] applied: " Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2025-10-16 22:17 UTC (permalink / raw)
To: Proxmox Datacenter Manager development discussion, Dietmar Maurer
On 15/10/2025 10:14, Dietmar Maurer wrote:
> So that we can add other tab panels in the future,
>
If you sent me the same for CTs I'm fine with already applying this
even though it's still just a single tab.
The clean-ups look all OK to me, but as of now they depend on the first
patch, so I cannot apply them earlier already.
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pdm-devel] applied: [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top
2025-10-15 8:15 [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Dietmar Maurer
` (3 preceding siblings ...)
2025-10-16 22:17 ` [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Thomas Lamprecht
@ 2025-10-22 5:18 ` Thomas Lamprecht
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2025-10-22 5:18 UTC (permalink / raw)
To: pdm-devel, Dietmar Maurer
On Wed, 15 Oct 2025 10:15:21 +0200, Dietmar Maurer wrote:
> So that we can add other tab panels in the future,
>
>
Applied, thanks!
[1/4] ui: qemu: move files into subfolder, add Tabbar on top
commit: d4c83a0fcecc1a99524ffdd24d5d2ab706fe4b87
[2/4] ui: qemu: cleanup: use module level imports
commit: 56971a61a1d297fc1c6b4a3f98ac4b8b6c14dffd
[3/4] ui: qemu: cleanup: avoid "use pwt::css::XYZ" imports
commit: a237219815deacccea4e2f4ba537aba0f48a0a59
[4/4] ui: qemu: remove wrong PartialEq implementation
commit: b0b4e2add284fbb9125e3c6cb34d896fb58b73a7
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-22 5:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 8:15 [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 2/4] ui: qemu: cleanup: use module level imports Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 3/4] ui: qemu: cleanup: avoid "use pwt::css::XYZ" imports Dietmar Maurer
2025-10-15 8:15 ` [pdm-devel] [PATCH datacenter-manager 4/4] ui: qemu: remove wrong PartialEq implementation Dietmar Maurer
2025-10-16 22:17 ` [pdm-devel] [PATCH datacenter-manager 1/4] ui: qemu: move files into subfolder, add Tabbar on top Thomas Lamprecht
2025-10-22 5:18 ` [pdm-devel] applied: " Thomas Lamprecht
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.