all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-flutter-frontend] fix #4749: correctly show lxc rrd data
Date: Tue,  4 Jul 2023 15:53:50 +0200	[thread overview]
Message-ID: <20230704135350.3291371-1-d.csapak@proxmox.com> (raw)

like we do for qemu guest, by multiplying cpu usage by 100

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 lib/bloc/pve_lxc_overview_bloc.dart | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/bloc/pve_lxc_overview_bloc.dart b/lib/bloc/pve_lxc_overview_bloc.dart
index daa43d9..2900e3a 100644
--- a/lib/bloc/pve_lxc_overview_bloc.dart
+++ b/lib/bloc/pve_lxc_overview_bloc.dart
@@ -43,8 +43,7 @@ class PveLxcOverviewBloc
           current: true);
       yield latestState.rebuild((b) => b..config.replace(config!));
 
-      final rrdData = (await apiClient.getNodeQemuRRDdata(
-          latestState.nodeID, guestID, PveRRDTimeframeType.hour));
+      final rrdData = await _preProcessRRDdata();
       yield latestState.rebuild((b) => b..rrdData.replace(rrdData));
     }
     if (event is PerformLxcAction) {
@@ -90,6 +89,16 @@ class PveLxcOverviewBloc
       }
     }
   }
+
+  Future<List<PveGuestRRDdataModel>> _preProcessRRDdata() async {
+    final rrddata = (await apiClient.getNodeQemuRRDdata(
+            latestState.nodeID, guestID, PveRRDTimeframeType.hour))
+        .map((element) => element.cpu != null
+            ? element.rebuild((e) => e..cpu = e.cpu! * 100)
+            : element)
+        .toList();
+    return rrddata;
+  }
 }
 
 abstract class PveLxcOverviewEvent {}
-- 
2.30.2





             reply	other threads:[~2023-07-04 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 13:53 Dominik Csapak [this message]
2023-07-04 15:29 ` [pve-devel] applied: " Thomas Lamprecht

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=20230704135350.3291371-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-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