datastore status: do not count empty groups
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
ba857cbe68
commit
b44483a853
|
@ -568,15 +568,19 @@ fn get_snapshots_count(store: &DataStore, filter_owner: Option<&Authid>) -> Resu
|
||||||
.try_fold(Counts::default(), |mut counts, group| {
|
.try_fold(Counts::default(), |mut counts, group| {
|
||||||
let snapshot_count = group.list_backups(&base_path)?.len() as u64;
|
let snapshot_count = group.list_backups(&base_path)?.len() as u64;
|
||||||
|
|
||||||
let type_count = match group.backup_type() {
|
// only include groups with snapshots (avoid confusing users
|
||||||
"ct" => counts.ct.get_or_insert(Default::default()),
|
// by counting/displaying emtpy groups)
|
||||||
"vm" => counts.vm.get_or_insert(Default::default()),
|
if snapshot_count > 0 {
|
||||||
"host" => counts.host.get_or_insert(Default::default()),
|
let type_count = match group.backup_type() {
|
||||||
_ => counts.other.get_or_insert(Default::default()),
|
"ct" => counts.ct.get_or_insert(Default::default()),
|
||||||
};
|
"vm" => counts.vm.get_or_insert(Default::default()),
|
||||||
|
"host" => counts.host.get_or_insert(Default::default()),
|
||||||
|
_ => counts.other.get_or_insert(Default::default()),
|
||||||
|
};
|
||||||
|
|
||||||
type_count.groups += 1;
|
type_count.groups += 1;
|
||||||
type_count.snapshots += snapshot_count;
|
type_count.snapshots += snapshot_count;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(counts)
|
Ok(counts)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue