Skip to content

Commit 2d45055

Browse files
committed
update
1 parent 0ec9450 commit 2d45055

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dashboard/src/components/controls/MonitorControls.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ const fetchMetric = async (state: AppState, metric: string, setProp: SetPropFunc
2727
message: { name: metric },
2828
},
2929
);
30-
const { message: newHistory } = res;
30+
let { message: newHistory } = res;
3131

3232
const type: AppState['monitorData']['type'] = Array.isArray(newHistory[0][1]) ? 'array' : 'number';
3333
setProp('type', type);
3434

35-
let minValue = '';
35+
let minValue = '-';
3636
let maxValue;
3737

3838
if (type === 'number') {
@@ -53,7 +53,11 @@ const fetchMetric = async (state: AppState, metric: string, setProp: SetPropFunc
5353
);
5454
} else if (type === 'array') {
5555
// Just show the data in the maxValue label
56-
maxValue = newHistory.slice(-1)[1].join(', ');
56+
const lastArrValue = newHistory.slice(-1)[0][1];
57+
maxValue = lastArrValue.length ? lastArrValue.join(', ') : '-';
58+
59+
// No points needed
60+
newHistory = [];
5761
}
5862

5963
const minTime = shortDateTime(newHistory[0][0]);

0 commit comments

Comments
 (0)