Skip to content

Commit a6e359d

Browse files
authored
Merge pull request #21 from hodesza/Health
Health Data - Rendering
2 parents 8b39aa8 + 03f2b22 commit a6e359d

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

app/charts/ResponseCodesChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ const ResponseCodesChart: React.FC = React.memo(() => {
6767
}
6868
});
6969

70+
console.log(responseCodes);
71+
7072
return (
7173
<Plot
7274
data={[

app/charts/RouteChart.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,21 @@ const RouteChart = React.memo(() => {
9393
// only want one edge per route with the average duration
9494
if (edgeListObj[edgeStr]) {
9595
//? wrong math
96-
duration = (duration + edgeListObj[edgeStr]) / 2
96+
duration = (duration + edgeListObj[edgeStr]) / 2;
9797
}
98-
edgeListObj[edgeStr] = duration
98+
edgeListObj[edgeStr] = duration;
9999
}
100100
}
101101
}
102102

103103
// turn objects into valid arrays to input into graph
104104
const nodeList = Object.values(nodeListObj);
105-
const edgeList = []
105+
const edgeList = [];
106106
for (let [edgeStr, duration] of Object.entries(edgeListObj)) {
107107
const edge = JSON.parse(edgeStr);
108108
console.log(edge.request)
109109
edge.label = edge.request ? `${edge.request} - ${(duration * 10).toFixed(0)} ms` : `${(duration * 10).toFixed(0)} ms`
110-
edgeList.push(edge)
110+
edgeList.push(edge);
111111
}
112112

113113
const graph = {

app/charts/SpeedChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const SpeedChart = React.memo(() => {
77
const { healthData } = useContext(HealthContext);
88
const { time, cpuspeed } = healthData;
99
const yAxis = cpuspeed;
10+
console.log(time);
11+
console.log(cpuspeed);
1012
const createChart = () => {
1113
let timeArr;
1214
if (time !== undefined) {

app/context/HealthContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const HealthContextProvider: React.FC = React.memo(({ children }) => {
4040
// if (result !== undefined) {
4141
// if (result.length !== undefined) console.log('Number of data points (health):', result.length);
4242
// }
43-
43+
console.log(result);
4444
// Update context local state
4545
if (result && result.length) setHealthData(parseHealthData(result));
4646
});

electron/routes/data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ ipcMain.on('healthRequest', async (message: Electron.IpcMainEvent, service: stri
125125
// Mongo Database
126126
if (currentDatabaseType === 'MongoDB') {
127127
// Get document count
128-
let num = await HealthModelFunc(service).countDocuments();
129-
128+
let num = await HealthModelFunc(service).countDocuments({});
129+
console.log(num);
130130
// Get last 50 documents. If less than 50 documents, get all
131131
num = Math.max(num, 10);
132132
result = await HealthModelFunc(service)
133-
.find()
134-
.skip(num - 10);
133+
.find({})
134+
.skip(num - 50);
135135
}
136136

137137
// SQL Database

0 commit comments

Comments
 (0)