web/admin: fix negative count for policies when more cached than total policies

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-22 00:01:28 +02:00
parent 253f345fc4
commit 7f25b6311d

View file

@ -42,7 +42,9 @@ export class PolicyStatusChart extends AKChart<PolicyMetrics> {
})).pagination.count;
this.centerText = count.toString();
return {
count: count - cached - unbound,
// If we have more cache than total policies, only show that
// otherwise show count without unbound
count: cached >= count ? cached : count - unbound,
cached: cached,
unbound: unbound,
};