Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
C-D-Lewis committed Aug 17, 2024
1 parent 0ec9450 commit 2d45055
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dashboard/src/components/controls/MonitorControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const fetchMetric = async (state: AppState, metric: string, setProp: SetPropFunc
message: { name: metric },
},
);
const { message: newHistory } = res;
let { message: newHistory } = res;

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

let minValue = '';
let minValue = '-';
let maxValue;

if (type === 'number') {
Expand All @@ -53,7 +53,11 @@ const fetchMetric = async (state: AppState, metric: string, setProp: SetPropFunc
);
} else if (type === 'array') {
// Just show the data in the maxValue label
maxValue = newHistory.slice(-1)[1].join(', ');
const lastArrValue = newHistory.slice(-1)[0][1];
maxValue = lastArrValue.length ? lastArrValue.join(', ') : '-';

// No points needed
newHistory = [];
}

const minTime = shortDateTime(newHistory[0][0]);
Expand Down

0 comments on commit 2d45055

Please sign in to comment.