Skip to content

Commit d1c51cc

Browse files
Justinlkirkastholdenwilliamowen65jessllee
committed
Merged final updates
Co-authored-by: Alexander Holden <[email protected]> Co-authored-by: William Owen <[email protected]> Co-authored-by: Jessica Lee <[email protected]>
1 parent 9b2ff9a commit d1c51cc

File tree

6 files changed

+162
-102
lines changed

6 files changed

+162
-102
lines changed

app/charts/RouteChart.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const RouteChart = React.memo(() => {
162162
// },
163163
// };
164164

165-
if (communicationsData.length) {
165+
if (communicationsData[0].endpoint !== '/') {
166166
return (
167167
<div className="traceContainer">
168168
<span id="tracesTitle">Route Traces</span>

app/charts/TemperatureChart.tsx

Lines changed: 2 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,10 @@ interface SoloStyles {
1414
width: number;
1515
}
1616

17-
<<<<<<< HEAD
1817
const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(
1918
({ sizing, colourGenerator }) => {
2019
const { healthData } = useContext(HealthContext);
2120
const [data, setData] = useState<Array<Array<string | (string | number)[]>>>([]);
22-
=======
23-
const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing }) => {
24-
const { healthData } = useContext(HealthContext);
25-
const [data, setData] = useState<Array<Array<string | (string | number)[]>>>([]);
26-
27-
useEffect(() => {
28-
if (healthData.length) {
29-
const tempArr: ((string | number)[] | string)[][] = [];
30-
// loop over each
31-
healthData.forEach(
32-
(service: { time: string[]; cputemp: (string | number)[]; service: string[] }) => {
33-
let timeArr: string[] = [];
34-
// perform this when we 'setTime'
35-
if (service.time !== undefined) {
36-
timeArr = service.time.map((el: any) => moment(el).format('kk:mm:ss'));
37-
}
38-
>>>>>>> will/style_tweaks
3921

4022
useEffect(() => {
4123
if (healthData.length) {
@@ -61,7 +43,6 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
6143

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

64-
<<<<<<< HEAD
6546
setInterval(() => {
6647
if (solo !== soloStyle) {
6748
setSolo(soloStyle);
@@ -104,7 +85,7 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
10485
return (
10586
<Plot
10687
data={[...plotlyData]}
107-
config={{ responsive: true }}
88+
config={{ responsive: true, displayModeBar: false }}
10889
layout={{
10990
title: 'CPU Temperature',
11091
...sizeSwitch,
@@ -123,7 +104,7 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
123104
},
124105
xaxis: {
125106
title: 'Time (EST)',
126-
tickmode: 'linear',
107+
tickmode: 'auto',
127108
tickformat: '%H %M %p',
128109
mirror: false,
129110
ticks: 'outside',
@@ -145,79 +126,6 @@ const TemperatureChart: React.FC<GraphsContainerProps> = React.memo(({ sizing })
145126
<div className="chart" data-testid="Temperature Chart">
146127
{createChart()}
147128
</div>
148-
=======
149-
setInterval(() => {
150-
if (solo !== soloStyle) {
151-
setSolo(soloStyle);
152-
}
153-
}, 20);
154-
155-
const createChart = () => {
156-
let plotlyData: {
157-
name: any;
158-
x: any;
159-
y: any;
160-
type: any;
161-
fillcolor: any;
162-
mode: any;
163-
showlegend: any;
164-
}[] = [];
165-
166-
plotlyData = data.map(dataArr => {
167-
// eslint-disable-next-line no-bitwise
168-
const randomColor = `#${(((1 << 24) * Math.random()) | 0).toString(16)}`;
169-
170-
return {
171-
name: dataArr[2],
172-
x: data[0][0],
173-
y: dataArr[1],
174-
fillcolor: randomColor,
175-
type: 'scatter',
176-
mode: 'lines',
177-
showlegend: true,
178-
};
179-
});
180-
181-
const sizeSwitch = sizing === 'all' ? all : solo;
182-
183-
return (
184-
<Plot
185-
data={[...plotlyData]}
186-
config={{ responsive: true, displayModeBar: false }}
187-
layout={{
188-
title: 'CPU Temperature',
189-
...sizeSwitch,
190-
font: {
191-
color: '#444d56',
192-
size: 11.5,
193-
family: 'Roboto',
194-
},
195-
paper_bgcolor: 'white',
196-
plot_bgcolor: 'white',
197-
legend: {
198-
orientation: 'h',
199-
xanchor: 'center',
200-
x: 0.5,
201-
y: 5,
202-
},
203-
xaxis: {
204-
title: 'Time (EST)',
205-
tickmode: 'auto',
206-
tickformat: '%H %M %p',
207-
mirror: false,
208-
ticks: 'outside',
209-
showline: true,
210-
},
211-
yaxis: {
212-
title: `Temperature (\xB0C)`,
213-
rangemode: 'nonnegative',
214-
mirror: false,
215-
ticks: 'outside',
216-
showline: true,
217-
},
218-
}}
219-
/>
220-
>>>>>>> will/style_tweaks
221129
);
222130
}
223131
);

app/components/Contact.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ const Contact = React.memo(() => {
2121
Please feel free to provide any feedback, concerns, or comments.
2222
</p>
2323
<p style={currentMode}>
24-
<<<<<<< HEAD
25-
You can find issues the team is currently addressing &nbsp;
26-
=======
2724
You can find issues the team is currently working on{' '}
28-
>>>>>>> will/style_tweaks
2925
<a
3026
style={currentMode}
3127
id="issueLink"

app/containers/GraphsContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ const GraphsContainer: React.FC<GraphsContainerProps> = React.memo(props => {
8484
setChart(route);
8585
};
8686

87-
const stringToColour = (string: string) => {
87+
const stringToColour = (string: string, recurses = 0) => {
88+
if (recurses > 20) return string;
8889
function hashString(str: string) {
8990
let hash = 0;
9091
for (let i = 0; i < str.length; i++) {
@@ -103,7 +104,7 @@ const GraphsContainer: React.FC<GraphsContainerProps> = React.memo(props => {
103104
const g = (num >>> 8) & 0xff;
104105
const b = num & 0xff;
105106
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
106-
return yiq <= 50 ? stringToColour(color) : color;
107+
return yiq <= 50 ? stringToColour(color, recurses + 1) : color;
107108
}
108109
for (let salt = 0; salt < 5; salt++) string = hashString(string);
109110
return contrastYiq(string);

app/stylesheets/GraphsContainer.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ nav {
102102
&.selected {
103103
text-decoration: underline;
104104
text-underline-offset: 7px;
105-
color: red;
105+
color: rgb(95, 153, 240);
106106
}
107107
&:hover {
108108
}

package-lock.json

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)