[pve-devel] [PATCH pve-flutter-frontend] fix #4749: correctly show lxc rrd data

Dominik Csapak d.csapak at proxmox.com
Tue Jul 4 15:53:50 CEST 2023


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

Signed-off-by: Dominik Csapak <d.csapak at 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






More information about the pve-devel mailing list