1+ /* eslint-disable react/jsx-one-expression-per-line */
12import React , { useState } from 'react' ;
23import Modal from './Modal.jsx' ;
3- import pieChart from '../assets/pieChart.png' ;
4- import memoryChart from '../assets/memoryChart.png' ;
5- import tempChart from '../assets/tempChart.png' ;
6- import speedChart from '../assets/speedChart.png' ;
7- import latencyChart from '../assets/latencyChart.png' ;
8- import processingChart from '../assets/processingChart.png' ;
94
105// Renders charts created with health and communication data for a selected database.
116const ServiceDetails = ( props ) => {
127 // Renders health info detail buttons
13- const { service } = props ;
8+ const { service, setDetails } = props ;
149 // Hook used to toggle whether or not the Modal component renders
1510 const [ modalDisplay , toggleModalDisplay ] = useState ( false ) ;
1611 // Hook used to set the chart that the Modal displays. The
@@ -19,19 +14,17 @@ const ServiceDetails = (props) => {
1914 // Hook used to set the Modal Component title. The "alt" attribute
2015 // is grabbed from the onClick event via event.path[0].alt
2116 const [ chartTitle , setChartTitle ] = useState ( ) ;
22- const { currentMicroservice } = props ;
2317
2418 // Dictionary used by the healthInfoButtons loop below
2519
2620 const buttonProperties = [
27- { id : 'request' , alt : 'Request Data' , src : 'app/assets/pieChart.png' } ,
28- { id : 'response' , alt : 'Response Data' , src : 'app/assets/pieChart.png' } ,
29- // { id: 'routes', alt: 'Route Trace', src: 'https://st2.depositphotos.com/3894705/9581/i/950/depositphotos_95816620-stock-photo-round-button-shows-speedometer.jpg' },
30- { id : 'speed' , alt : 'Speed Data' , src : 'app/assets/speedChart.png' } ,
31- { id : 'processes' , alt : 'Processes Data' , src : 'app/assets/processingChart.png' } ,
32- { id : 'latency' , alt : 'Latency Data' , src : 'app/assets/latencyChart.png' } ,
33- { id : 'temperature' , alt : 'Temperature Data' , src : 'app/assets/tempChart.png' } ,
34- { id : 'memory' , alt : 'Memory Data' , src : 'app/assets/memoryChart.png' } ,
21+ { id : 'Request' , alt : 'Request Data' , src : 'app/assets/pieChart.png' } ,
22+ { id : 'Response' , alt : 'Response Data' , src : 'app/assets/pieChart.png' } ,
23+ { id : 'Speed' , alt : 'Speed Data' , src : 'app/assets/speedChart.png' } ,
24+ { id : 'Processes' , alt : 'Processes Data' , src : 'app/assets/processingChart.png' } ,
25+ { id : 'Latency' , alt : 'Latency Data' , src : 'app/assets/latencyChart.png' } ,
26+ { id : 'Temperature' , alt : 'Temperature Data' , src : 'app/assets/tempChart.png' } ,
27+ { id : 'Memory' , alt : 'Memory Data' , src : 'app/assets/memoryChart.png' } ,
3528 ] ;
3629
3730 // Create the Health Info buttons and their associated properties. Each time a button is clicked,
@@ -56,7 +49,7 @@ const ServiceDetails = (props) => {
5649 alt = { buttonProperties [ i ] . alt }
5750 />
5851 < br />
59- < div style = { { color : 'white' , paddingLeft : '7px' } } >
52+ < div >
6053 { buttonProperties [ i ] . id }
6154 </ div >
6255 </ div >
@@ -78,11 +71,21 @@ const ServiceDetails = (props) => {
7871 } }
7972 />
8073 ) : null }
81- < button className = "backButton" type = "button" onClick = { ( ) => document . location . reload ( ) } > Back </ button >
82- < h3 id = "microserviceHealthTitle" > Microservice Health</ h3 >
74+
75+ < h3 id = "microserviceHealthTitle" > Microservice Health - { service } </ h3 >
8376 < div id = "healthGrid" >
8477 { healthInfoButtons }
8578 </ div >
79+ < button
80+ className = "backButton"
81+ type = "button"
82+ onClick = { ( ) => {
83+ // document.location.reload()
84+ setDetails ( null ) ;
85+ } }
86+ >
87+ Clear Health Data
88+ </ button >
8689 </ div >
8790 ) ;
8891} ;
0 commit comments