Skip to content

Commit a277819

Browse files
committed
Graphs
1 parent ab5028e commit a277819

4 files changed

Lines changed: 41 additions & 100 deletions

File tree

app/components/ServiceDetails.jsx

Lines changed: 4 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,17 @@
11
/* eslint-disable react/jsx-one-expression-per-line */
22
import React, { useState } from 'react';
3-
import Modal from './Modal.jsx';
3+
// import Modal from './Modal.jsx';
4+
import GraphsContainer from '../containers/GraphsContainer.jsx';
45

56
// Renders charts created with health and communication data for a selected database.
67
const ServiceDetails = (props) => {
78
// Renders health info detail buttons
89
const { service } = props;
9-
// console.log(service);
10-
// Hook used to toggle whether or not the Modal component renders
11-
const [modalDisplay, toggleModalDisplay] = useState(false);
12-
// Hook used to set the chart that the Modal displays. The
13-
// modalDisplay state is drilled into the Modal component.
14-
const [modalChart, setModalChart] = useState();
15-
// Hook used to set the Modal Component title. The "alt" attribute
16-
// is grabbed from the onClick event via event.path[0].alt
17-
const [chartTitle, setChartTitle] = useState();
18-
19-
// Dictionary used by the healthInfoButtons loop below
20-
21-
const buttonProperties = [
22-
{ id: 'Request', alt: 'Request Data', src: 'app/assets/pieChart.png' },
23-
{ id: 'Response', alt: 'Response Data', src: 'app/assets/pieChart.png' },
24-
{ id: 'Speed', alt: 'Speed Data', src: 'app/assets/speedChart.png' },
25-
{
26-
id: 'Processes',
27-
alt: 'Processes Data',
28-
src: 'app/assets/processingChart.png',
29-
},
30-
{ id: 'Latency', alt: 'Latency Data', src: 'app/assets/latencyChart.png' },
31-
{
32-
id: 'Temperature',
33-
alt: 'Temperature Data',
34-
src: 'app/assets/tempChart.png',
35-
},
36-
{ id: 'Memory', alt: 'Memory Data', src: 'app/assets/memoryChart.png' },
37-
];
38-
39-
// Create the Health Info buttons and their associated properties. Each time a button is clicked,
40-
// setChartTitle will grab a title to render in the Modal component, setModalChart will grab the
41-
// correct chart to render, and toggleModalDisplay will actually render the Modal display
42-
const healthInfoButtons = [];
43-
for (let i = 0; i < buttonProperties.length; i += 1) {
44-
healthInfoButtons.push(
45-
<div>
46-
<div className="healthChartContainer">
47-
<input
48-
onClick={() => {
49-
setChartTitle(event.path[0].alt);
50-
setModalChart(event.path[0].id);
51-
toggleModalDisplay(!modalDisplay);
52-
}}
53-
service={service}
54-
type="image"
55-
id={buttonProperties[i].id}
56-
src={buttonProperties[i].src}
57-
width="60px"
58-
alt={buttonProperties[i].alt}
59-
/>
60-
<br />
61-
<div>{buttonProperties[i].id}</div>
62-
</div>
63-
</div>
64-
);
65-
}
66-
10+
6711
return (
6812
<div id="serviceDetailsContainer">
69-
{modalDisplay ? (
70-
<Modal
71-
chartTitle={chartTitle}
72-
service={service}
73-
modalChart={modalChart}
74-
toggleModalDisplay={toggleModalDisplay}
75-
onClick={() => {
76-
toggleModalDisplay(!modalDisplay);
77-
}}
78-
/>
79-
) : null}
80-
8113
<h3 id="microserviceHealthTitle">Microservice Health - {service}</h3>
82-
<div id="healthGrid">{healthInfoButtons}</div>
83-
<button
84-
className="backButton"
85-
type="button"
86-
onClick={() => {
87-
// document.location.reload()
88-
console.log('should clear data');
89-
// setDetails(null);
90-
}}
91-
>
92-
Clear Health Data
93-
</button>
14+
<GraphsContainer service={service} />
9415
</div>
9516
);
9617
};

app/containers/GraphsContainer.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react';
2+
import RequestTypesChart from '../charts/request-type-chart.jsx';
3+
import ResponseCodesChart from '../charts/response-code-chart.jsx';
4+
import SpeedChart from '../charts/speed-chart.jsx';
5+
import ProcessesChart from '../charts/processes-chart.jsx';
6+
import TemperatureChart from '../charts/temperature-chart.jsx';
7+
import LatencyChart from '../charts/latency-chart.jsx';
8+
import MemoryChart from '../charts/memory-chart.jsx';
9+
import RouteTrace from '../charts/route-trace.jsx';
10+
import MicroServiceTraffic from '../charts/microservice-traffic.jsx';
11+
import '../stylesheets/graphs.css';
12+
13+
const GraphsContainer = (props) => {
14+
const { service } = props;
15+
16+
return (
17+
<div className="graphsGrid">
18+
<RequestTypesChart service={service} />
19+
<RouteTrace service={service} />
20+
<ResponseCodesChart service={service} />
21+
<SpeedChart service={service} />
22+
<ProcessesChart service={service} />
23+
<LatencyChart service={service} />
24+
<MicroServiceTraffic service={service} />
25+
<TemperatureChart service={service} />
26+
<MemoryChart service={service} />
27+
</div>
28+
);
29+
};
30+
31+
export default GraphsContainer;

app/containers/MonitoringContainer.jsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,7 @@ const MonitoringContainer = (props) => {
8080

8181
return (
8282
<div className="mainContainer">
83-
<MonitorHeader />
84-
{modalDisplay ? (
85-
<Modal
86-
chartTitle={chartTitle}
87-
modalChart={modalChart}
88-
service=""
89-
toggleModalDisplay={toggleModalDisplay}
90-
onClick={() => {
91-
toggleModalDisplay(!modalDisplay);
92-
}}
93-
/>
94-
) : null}
95-
<div id="routeAndTrafficDisplay">
96-
{routes}
97-
{traffic}
98-
</div>
99-
<br />{detailsSelected || null}
83+
{detailsSelected || null}
10084
</div>
10185
);
10286
};

app/stylesheets/graphs.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.graphsGrid {
2+
display: grid;
3+
grid-template-columns: auto auto auto;
4+
grid-gap: 60px;
5+
}

0 commit comments

Comments
 (0)