Skip to content

Commit 0d5b034

Browse files
committed
remove chart buttons, fix tick space, and development mode for what to load in main.js
1 parent f099081 commit 0d5b034

File tree

10 files changed

+65
-54
lines changed

10 files changed

+65
-54
lines changed

__tests__2022/test_settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"setupRequired":false,"services":[["myPostgres","SQL","postgres://zwezmnqm:[email protected]:5432/zwezmnqm","Online bookstore with that keeps track of orders and customers","Jun 28, 2020 4:58 PM"],["ToddDB","MongoDB","mongodb+srv://tdwolf6:[email protected]/Chronos?retryWrites=true&w=majority","Web app deployed on AWS","Jul 3, 2020 7:12AM"]],"mode":"dark mode","splash":true,"landingPage":"login"}
1+
{"setupRequired":false,"services":[["myPostgres","SQL","postgres://zwezmnqm:[email protected]:5432/zwezmnqm","Online bookstore with that keeps track of orders and customers","Jun 28, 2020 4:58 PM"],["ToddDB","MongoDB","mongodb+srv://tdwolf6:[email protected]/Chronos?retryWrites=true&w=majority","Web app deployed on AWS","Jul 3, 2020 7:12AM"]],"mode":"dark mode","splash":true,"landingPage":"dashBoard"}

app/charts/LatencyChart.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ const LatencyChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) =>
1717
const { healthData } = useContext(HealthContext);
1818
const [data, setData] = useState<Array<Array<string | (string | number)[]>>>([]);
1919

20-
useEffect(() => {
20+
useEffect(() => {
2121
if (healthData.length) {
2222
const tempArr: ((string | number)[] | string)[][] = [];
2323
// loop over each
2424
healthData.forEach(
25-
(service: {
26-
time: string[];
27-
latency: (string | number)[];
28-
service: string[]
29-
}) => {
25+
(service: { time: string[]; latency: (string | number)[]; service: string[] }) => {
3026
let timeArr: string[] = [];
3127
// perform this when we 'setTime'
3228
if (service.time !== undefined) {
@@ -69,28 +65,27 @@ useEffect(() => {
6965
mode: any;
7066
marker: { color: string };
7167
}[] = [];
72-
68+
7369
plotlyData = data.map(dataArr => {
7470
// eslint-disable-next-line no-bitwise
7571
const randomColor = `#${(((1 << 24) * Math.random()) | 0).toString(16)}`;
76-
72+
7773
return {
7874
name: dataArr[2],
7975
x: data[0][0],
8076
y: dataArr[1],
8177
type: 'scattergl',
8278
mode: 'lines',
83-
marker: { color: randomColor }
79+
marker: { color: randomColor },
8480
};
8581
});
8682

87-
8883
const sizeSwitch = sizing === 'all' ? all : solo;
8984

90-
9185
return (
9286
<Plot
9387
data={[...plotlyData]}
88+
config={{ displayModeBar: false }}
9489
layout={{
9590
title: 'Latency',
9691
...sizeSwitch,
@@ -110,7 +105,7 @@ useEffect(() => {
110105
},
111106
xaxis: {
112107
title: 'Time',
113-
tickmode: 'linear',
108+
tickmode: 'auto',
114109
tick0: 0,
115110
dtick: 10,
116111
rangemode: 'nonnegative',

app/charts/MemoryChart.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ const MemoryChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
151151
return (
152152
<Plot
153153
data={[...plotlyData.flat()]}
154+
config={{ displayModeBar: false }}
154155
layout={{
155156
title: 'Memory Traces',
156157
...sizeSwitch,
@@ -165,13 +166,13 @@ const MemoryChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
165166
orientation: 'h',
166167
xanchor: 'center',
167168
x: 0.5,
168-
y: -1,
169+
y: 0,
169170
font: {
170171
size: 9,
171172
},
172173
},
173174
xaxis: {
174-
tickmode: 'linear',
175+
tickmode: 'auto',
175176
tick0: 0,
176177
dtick: 10,
177178
title: 'Time Elapsed (min)',

app/charts/ProcessesChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** FOR THE NEXT TEAM
22
* You should probably take a look and fix the legend for the graph.
3-
* Can compare services, but hard to tell which points of data belong to which server.
4-
*/
3+
* Can compare services, but hard to tell which points of data belong to which server.
4+
*/
55

66
/* eslint-disable no-useless-concat */
77
import React, { useContext, useState, useEffect } from 'react';
@@ -54,8 +54,6 @@ const ProcessesChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) =
5454
service.sleepingprocesses,
5555
];
5656
tempArr.push(temp);
57-
58-
5957
}
6058
);
6159
setData(tempArr);
@@ -139,6 +137,7 @@ const ProcessesChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) =
139137
return (
140138
<Plot
141139
data={[...plotlyData.flat()]}
140+
config={{ displayModeBar: false }}
142141
layout={{
143142
title: 'Process Overview',
144143
...sizeSwitch,
@@ -159,6 +158,7 @@ const ProcessesChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) =
159158
},
160159
},
161160
xaxis: {
161+
tickmode: 'auto',
162162
dtick: 10,
163163
title: 'Time Elapsed (min)',
164164
},

app/charts/SpeedChart.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const SpeedChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
7474
x: data[0][0],
7575
y: dataArr[1],
7676
type: 'scatter',
77-
mode: 'lines+markers',
77+
mode: 'lines',
7878
marker: {
7979
color: randomColor,
8080
},
@@ -86,6 +86,7 @@ const SpeedChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
8686
return (
8787
<Plot
8888
data={[...plotlyData]}
89+
config={{ displayModeBar: false }}
8990
layout={{
9091
title: 'Speed Chart',
9192
...sizeSwitch,
@@ -96,7 +97,7 @@ const SpeedChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
9697
},
9798
xaxis: {
9899
title: 'Time (EST)',
99-
tickmode: 'linear',
100+
tickmode: 'auto',
100101
dtick: 2,
101102
tickformat: '%H %M %p',
102103
// tickangle: 30,
@@ -116,7 +117,7 @@ const SpeedChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
116117
showlegend: true,
117118
legend: {
118119
orientation: 'h',
119-
xanchor: 'center',
120+
xanchor: 'auto',
120121
x: 0.5,
121122
y: 5,
122123
},

app/charts/TemperatureChart.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@ interface SoloStyles {
1616
const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
1717
const { healthData } = useContext(HealthContext);
1818
const [data, setData] = useState<Array<Array<string | (string | number)[]>>>([]);
19-
19+
2020
useEffect(() => {
2121
if (healthData.length) {
2222
const tempArr: ((string | number)[] | string)[][] = [];
2323
// loop over each
2424
healthData.forEach(
25-
(service: {
26-
time: string[];
27-
cputemp: (string | number)[];
28-
service: string[]
29-
}) => {
25+
(service: { time: string[]; cputemp: (string | number)[]; service: string[] }) => {
3026
let timeArr: string[] = [];
3127
// perform this when we 'setTime'
3228
if (service.time !== undefined) {
@@ -47,16 +43,13 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
4743

4844
const [solo, setSolo] = useState<SoloStyles | null>(null);
4945

50-
setInterval(() => {
51-
if (solo !== soloStyle) {
52-
setSolo(soloStyle);
53-
}
54-
}, 20);
55-
46+
setInterval(() => {
47+
if (solo !== soloStyle) {
48+
setSolo(soloStyle);
49+
}
50+
}, 20);
5651

5752
const createChart = () => {
58-
59-
6053
let plotlyData: {
6154
name: any;
6255
x: any;
@@ -66,11 +59,11 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
6659
mode: any;
6760
showlegend: any;
6861
}[] = [];
69-
62+
7063
plotlyData = data.map(dataArr => {
7164
// eslint-disable-next-line no-bitwise
7265
const randomColor = `#${(((1 << 24) * Math.random()) | 0).toString(16)}`;
73-
66+
7467
return {
7568
name: dataArr[2],
7669
x: data[0][0],
@@ -81,15 +74,13 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
8174
showlegend: true,
8275
};
8376
});
84-
77+
8578
const sizeSwitch = sizing === 'all' ? all : solo;
8679

8780
return (
8881
<Plot
89-
data={[
90-
...plotlyData
91-
]}
92-
config={{ responsive: true }}
82+
data={[...plotlyData]}
83+
config={{ responsive: true, displayModeBar: false }}
9384
layout={{
9485
title: 'CPU Temperature',
9586
...sizeSwitch,
@@ -108,7 +99,7 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
10899
},
109100
xaxis: {
110101
title: 'Time (EST)',
111-
tickmode: 'linear',
102+
tickmode: 'auto',
112103
tickformat: '%H %M %p',
113104
mirror: false,
114105
ticks: 'outside',

app/charts/TrafficChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const TrafficChart = React.memo(() => {
3838
showlegend: false,
3939
},
4040
]}
41+
config={{ displayModeBar: false }}
4142
layout={{
4243
title: 'Server Traffic',
4344
height: 300,
@@ -55,7 +56,7 @@ const TrafficChart = React.memo(() => {
5556
x: 0.5,
5657
y: 5,
5758
},
58-
yaxis: {
59+
yaxis: {
5960
rangemode: 'nonnegative',
6061
title: 'Times Server Pinged',
6162
showline: true,

app/charts/sizeSwitch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ window.addEventListener('resize', () => {
1111
});
1212

1313
export const all = {
14-
height: 300,
15-
width: 300,
14+
height: 400,
15+
width: 400,
1616
};
1717

1818
export let solo = {

electron/Main.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ const createWindow = () => {
3030
},
3131
});
3232

33-
// Development: load the application window to port 8080
34-
win.loadURL('http://localhost:8080/');
35-
36-
//Production
37-
// win.loadFile(path.resolve('./resources/app/index.html').replace(/\\/g, '/'));
38-
33+
if (process.env.NODE_ENV === 'development') {
34+
// Development: load the application window to port 8080
35+
win.loadURL('http://localhost:8080/');
36+
} else {
37+
//Production
38+
win.loadFile(path.resolve('./resources/app/index.html').replace(/\\/g, '/'));
39+
}
3940
ipc.on('max', () => {
4041
if (!win.isMaximized()) win.maximize();
4142
else win.unmaximize();

settings.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
{"setupRequired":false,"services":[["myPostgres","SQL","postgres://zwezmnqm:[email protected]:5432/zwezmnqm","Online bookstore with that keeps track of orders and customers","Jun 28, 2020 4:58 PM"],["ToddDB","MongoDB","mongodb+srv://tdwolf6:[email protected]/Chronos?retryWrites=true&w=majority","Web app deployed on AWS","Jul 3, 2020 7:12AM"]],"mode":"dark mode","splash":true,"landingPage":"dashBoard"}
1+
{
2+
"setupRequired": false,
3+
"services": [
4+
[
5+
"myPostgres",
6+
"SQL",
7+
"postgres://zwezmnqm:[email protected]:5432/zwezmnqm",
8+
"Online bookstore with that keeps track of orders and customers",
9+
"Jun 28, 2020 4:58 PM"
10+
],
11+
[
12+
"ToddDB",
13+
"MongoDB",
14+
"mongodb+srv://tdwolf6:[email protected]/Chronos?retryWrites=true&w=majority",
15+
"Web app deployed on AWS",
16+
"Jul 3, 2020 7:12AM"
17+
]
18+
],
19+
"mode": "dark mode",
20+
"splash": true,
21+
"landingPage": "dashBoard"
22+
}

0 commit comments

Comments
 (0)