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
1 changed files with 3 additions and 1 deletions

View File

@ -42,7 +42,9 @@ export class PolicyStatusChart extends AKChart<PolicyMetrics> {
})).pagination.count; })).pagination.count;
this.centerText = count.toString(); this.centerText = count.toString();
return { 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, cached: cached,
unbound: unbound, unbound: unbound,
}; };