1+ /* eslint-disable react/jsx-one-expression-per-line */
12import React , { useState } from 'react' ;
23import Modal from './Modal.jsx' ;
34
45// Renders charts created with health and communication data for a selected database.
56const ServiceDetails = ( props ) => {
67 // Renders health info detail buttons
7- const { service } = props ;
8+ const { service, setDetails } = props ;
89 // Hook used to toggle whether or not the Modal component renders
910 const [ modalDisplay , toggleModalDisplay ] = useState ( false ) ;
1011 // Hook used to set the chart that the Modal displays. The
@@ -13,18 +14,17 @@ const ServiceDetails = (props) => {
1314 // Hook used to set the Modal Component title. The "alt" attribute
1415 // is grabbed from the onClick event via event.path[0].alt
1516 const [ chartTitle , setChartTitle ] = useState ( ) ;
16- const { currentMicroservice } = props ;
1717
1818 // Dictionary used by the healthInfoButtons loop below
1919
2020 const buttonProperties = [
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' } ,
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' } ,
2828 ] ;
2929
3030 // Create the Health Info buttons and their associated properties. Each time a button is clicked,
@@ -49,7 +49,7 @@ const ServiceDetails = (props) => {
4949 alt = { buttonProperties [ i ] . alt }
5050 />
5151 < br />
52- < div style = { { color : 'white' , paddingLeft : '7px' } } >
52+ < div >
5353 { buttonProperties [ i ] . id }
5454 </ div >
5555 </ div >
@@ -71,11 +71,21 @@ const ServiceDetails = (props) => {
7171 } }
7272 />
7373 ) : null }
74- < button className = "backButton" type = "button" onClick = { ( ) => document . location . reload ( ) } > Back </ button >
75- < h3 id = "microserviceHealthTitle" > Microservice Health</ h3 >
74+
75+ < h3 id = "microserviceHealthTitle" > Microservice Health - { service } </ h3 >
7676 < div id = "healthGrid" >
7777 { healthInfoButtons }
7878 </ 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 >
7989 </ div >
8090 ) ;
8191} ;
0 commit comments