Skip to content

Commit 69910d3

Browse files
authored
Merge pull request #728 from utmstack/bugfix/10.5.1/727-In-some-clients-all-charts-don't-load
Fixed: In some clients all charts don't load and the page isn't functioning
2 parents 3bc614c + 2268e91 commit 69910d3

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

frontend/src/app/shared/util/elastic-health.util.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
import {ElasticHealthStatsType} from '../types/elasticsearch/elastic-health-stats.type';
2-
32
export function getElasticClusterHealth(clusterHealth: ElasticHealthStatsType,
43
connection: 'UP' | 'DOWN'): 'CRITIC' | 'MEDIUM' | 'UP' | 'DOWN' {
54
if (clusterHealth) {
6-
if (clusterHealth.diskUsedPercent > 84) {
7-
return 'CRITIC';
8-
}
9-
if (clusterHealth.heapPercent > 85) {
5+
const { diskUsedPercent, heapPercent } = clusterHealth;
6+
7+
if (diskUsedPercent > 84 || heapPercent > 85) {
108
return 'CRITIC';
119
}
12-
if (clusterHealth.diskUsedPercent > 75 && this.clusterHealth.diskUsedPercent <= 85) {
10+
11+
if ((diskUsedPercent > 75 && diskUsedPercent <= 85) || (heapPercent >= 50 && heapPercent <= 85)) {
1312
return 'MEDIUM';
14-
} else if (clusterHealth.diskUsedPercent <= 50) {
15-
return 'UP';
1613
}
17-
if (clusterHealth.heapPercent >= 50 && this.clusterHealth.heapPercent <= 85) {
18-
return 'MEDIUM';
19-
} else if (clusterHealth.heapPercent < 50) {
14+
15+
if (diskUsedPercent <= 50 && heapPercent < 50) {
2016
return 'UP';
21-
} else {
22-
return connection;
2317
}
18+
19+
return connection;
20+
2421
} else {
2522
return connection;
2623
}

0 commit comments

Comments
 (0)