|
1 | | -import React, { useState, useContext } from 'react'; |
2 | | -import MonitorHeader from '../AComp/MonitorHeader.jsx'; |
3 | | -import Modal from '../components/Modal.jsx'; |
4 | | -import OverviewContext from '../context/OverviewContext'; |
5 | | -import HealthInformationContext from '../context/DetailsContext'; |
6 | | -import routeChart from '../assets/routeChart.png'; |
| 1 | +import React from 'react'; |
7 | 2 |
|
8 | 3 | const MonitoringContainer = (props) => { |
9 | 4 | const { detailsSelected } = props; |
10 | 5 |
|
11 | | - // Contexts have data added to them following successful IPC return. Data is later used to create charts. |
12 | | - const serviceComponents = useContext(OverviewContext); |
13 | | - const healthdata = useContext(HealthInformationContext); |
14 | | - |
15 | | - // Hook used to toggle whether or not the Modal component renders |
16 | | - const [modalDisplay, toggleModalDisplay] = useState(false); |
17 | | - // Hook used to set the chart that the Modal displays. The |
18 | | - // modalDisplay state is drilled into the Modal component. |
19 | | - const [modalChart, setModalChart] = useState(); |
20 | | - // Hook used to set the Modal Component title. The "alt" attribute |
21 | | - // is grabbed from the onClick event via event.path[0].alt |
22 | | - const [chartTitle, setChartTitle] = useState(); |
23 | | - |
24 | | - // route button AND traffic button property |
25 | | - const routeButtonProperty = { |
26 | | - traffic: { |
27 | | - id: 'Traffic', |
28 | | - alt: 'Microservice Traffic', |
29 | | - src: 'app/assets/chartModal.png', |
30 | | - }, |
31 | | - routes: { id: 'routesImage', alt: 'Route Trace', src: routeChart }, |
32 | | - }; |
33 | | - |
34 | | - // declare routes array to display routes when modal is toggled |
35 | | - const routes = []; |
36 | | - // declare traffic array to display traffic when modal is toggled |
37 | | - const traffic = []; |
38 | | - |
39 | | - // push traffic component logic traffic |
40 | | - traffic.push( |
41 | | - <div className="healthChartContainer"> |
42 | | - <input |
43 | | - onClick={() => { |
44 | | - setChartTitle(event.path[0].alt); |
45 | | - setModalChart(event.path[0].id); |
46 | | - toggleModalDisplay(!modalDisplay); |
47 | | - }} |
48 | | - type="image" |
49 | | - id={routeButtonProperty.traffic.id} |
50 | | - src={routeButtonProperty.traffic.src} |
51 | | - width="60px" |
52 | | - alt={routeButtonProperty.traffic.alt} |
53 | | - /> |
54 | | - <br /> |
55 | | - <div style={{ color: 'white', paddingLeft: '7px' }}> |
56 | | - {routeButtonProperty.traffic.id} |
57 | | - </div> |
58 | | - </div> |
59 | | - ); |
60 | | - |
61 | | - // push routes component logic traffic |
62 | | - routes.push( |
63 | | - <div className="healthChartContainer"> |
64 | | - <input |
65 | | - onClick={() => { |
66 | | - setChartTitle(event.path[0].alt); |
67 | | - setModalChart(event.path[0].id); |
68 | | - toggleModalDisplay(!modalDisplay); |
69 | | - }} |
70 | | - type="image" |
71 | | - id={routeButtonProperty.routes.id} |
72 | | - src="app/assets/routeChart.png" |
73 | | - width="60px" |
74 | | - alt={routeButtonProperty.routes.alt} |
75 | | - /> |
76 | | - <br /> |
77 | | - <div style={{ color: 'white', paddingLeft: '7px' }}>Routes</div> |
78 | | - </div> |
79 | | - ); |
80 | | - |
81 | 6 | return ( |
82 | 7 | <div className="mainContainer"> |
83 | 8 | {detailsSelected || null} |
|
0 commit comments