* [pve-devel] [PATCH pve-flutter-frontend] fix #4749: correctly show lxc rrd data
@ 2023-07-04 13:53 Dominik Csapak
2023-07-04 15:29 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2023-07-04 13:53 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH pve-flutter-frontend] fix #4749: correctly show lxc rrd data
2023-07-04 13:53 [pve-devel] [PATCH pve-flutter-frontend] fix #4749: correctly show lxc rrd data Dominik Csapak
@ 2023-07-04 15:29 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-07-04 15:29 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak
Am 04/07/2023 um 15:53 schrieb Dominik Csapak:
> 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(-)
>
applied, thanks!
> +
> + 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;
> + }
> }
The intermediate await could have been avoided using .then(...), but not really nicer:
Future<List<PveGuestRRDdataModel>> _preProcessRRDdata() async {
return apiClient
.getNodeQemuRRDdata(
latestState.nodeID, guestID, PveRRDTimeframeType.hour)
.then((data) => data
.map((element) => element.cpu != null
? element.rebuild((e) => e..cpu = e.cpu! * 100)
: element)
.toList());
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-04 15:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 13:53 [pve-devel] [PATCH pve-flutter-frontend] fix #4749: correctly show lxc rrd data Dominik Csapak
2023-07-04 15:29 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox