Skip to content

Commit cbbddfd

Browse files
authored
Merge pull request ceph#59891 from rhcs-dashboard/fix-68162-main
mgr/dashboard: fix handling NaN values in dashboard charts Reviewed-by: Nizamudeen A <[email protected]>
2 parents 25734ec + 49ee682 commit cbbddfd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export class PrometheusService {
143143
}
144144
this.timerGetPrometheusDataSub = timer(0, this.timerTime).subscribe(() => {
145145
selectedTime = this.updateTimeStamp(selectedTime);
146-
147146
for (const queryName in queries) {
148147
if (queries.hasOwnProperty(queryName)) {
149148
const query = queries[queryName];
@@ -163,13 +162,12 @@ export class PrometheusService {
163162
queriesResults[queryName] !== '' &&
164163
checkNan
165164
) {
166-
queriesResults[queryName].forEach((valueArray: string[]) => {
167-
if (valueArray.includes('NaN')) {
168-
const index = valueArray.indexOf('NaN');
169-
if (index !== -1) {
170-
valueArray[index] = '0';
165+
queriesResults[queryName].forEach((valueArray: any[]) => {
166+
valueArray.forEach((val, index) => {
167+
if (isNaN(parseFloat(val[1]))) {
168+
valueArray[index][1] = '0';
171169
}
172-
}
170+
});
173171
});
174172
}
175173
});

0 commit comments

Comments
 (0)