From 2fadf53dea616f125e4afa4ea961d2a95edb8994 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 2 Nov 2024 18:40:06 +0100 Subject: [PATCH] Sort VM groups --- virtweb_backend/src/libvirt_client.rs | 4 +++- virtweb_backend/src/libvirt_rest_structures/vm.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/virtweb_backend/src/libvirt_client.rs b/virtweb_backend/src/libvirt_client.rs index 7adefdb..9cbe77c 100644 --- a/virtweb_backend/src/libvirt_client.rs +++ b/virtweb_backend/src/libvirt_client.rs @@ -117,7 +117,9 @@ impl LibVirtClient { out.insert(g); } } - Ok(out.into_iter().collect()) + let mut out: Vec<_> = out.into_iter().collect(); + out.sort(); + Ok(out) } /// Update a network configuration diff --git a/virtweb_backend/src/libvirt_rest_structures/vm.rs b/virtweb_backend/src/libvirt_rest_structures/vm.rs index 4ce4118..6543644 100644 --- a/virtweb_backend/src/libvirt_rest_structures/vm.rs +++ b/virtweb_backend/src/libvirt_rest_structures/vm.rs @@ -10,7 +10,9 @@ use crate::utils::files_utils::convert_size_unit_to_mb; use lazy_regex::regex; use num::Integer; -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)] +#[derive( + Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, Ord, PartialOrd, +)] pub struct VMGroupId(pub String); #[derive(serde::Serialize, serde::Deserialize)]