Skip to content

Commit a696b8f

Browse files
committed
added X button and MS name to Modal, slight style fixes
1 parent 48b8d58 commit a696b8f

4 files changed

Lines changed: 29 additions & 9 deletions

File tree

app/components/Modal.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import LatencyChart from '../charts/latency-chart.jsx';
88
import MemoryChart from '../charts/memory-chart.jsx';
99

1010
const Modal = (props) => {
11-
const { modalChart } = props;
12-
const { service } = props;
13-
const { toggleModalDisplay } = props;
14-
const { chartTitle } = props;
11+
// Destructuring props to make linter happy
12+
const {
13+
modalChart, service, toggleModalDisplay, chartTitle,
14+
} = props;
15+
// Dictionary used to render proper data chart within Modal component upon rendering
1516
const dict = {
1617
request: <RequestTypesChart service={service} />,
1718
response: <ResponseCodesChart service={service} />,
@@ -22,10 +23,13 @@ const Modal = (props) => {
2223
memory: <MemoryChart service={service} />,
2324
};
2425

26+
// event.stopPropogation allows the user to interact with the chart as opposed to a click on the
27+
// chart bubbling out and closing the Modal.
2528
return (
2629
<div id="modalWindow" onClick={() => toggleModalDisplay(!toggleModalDisplay)}>
2730
<div id="modalContent" onClick={(event) => event.stopPropagation()}>
28-
<h3 id="chartTitle">{chartTitle}</h3>
31+
<h3 id="chartTitle">{`${service} - ${chartTitle}`}</h3>
32+
<button id="modalCloseButton" onClick={() => toggleModalDisplay(!toggleModalDisplay)}>&times;</button>
2933
{dict[modalChart]}
3034
</div>
3135
</div>

app/components/ServiceDetails.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const ServiceDetails = (props) => {
1313
// Hook used to set the Modal Component title. The "alt" attribute
1414
// is grabbed from the onClick event via event.path[0].alt
1515
const [chartTitle, setChartTitle] = useState();
16+
const { currentMicroservice } = props;
1617

1718
// Dictionary used by the healthInfoButtons loop below
1819
const buttonProperties = [
@@ -38,6 +39,7 @@ const ServiceDetails = (props) => {
3839
setModalChart(event.path[0].id);
3940
toggleModalDisplay(!modalDisplay);
4041
}}
42+
service={service}
4143
type="image"
4244
id={buttonProperties[i].id}
4345
src={buttonProperties[i].src}

app/components/ServiceOverview.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ const ServiceOverview = (props) => {
4444
if (!(element.currentmicroservice in serviceCache)) {
4545
const button = (
4646
<button
47-
className='servicesBtn'
47+
className="servicesBtn"
48+
currentMicroservice={element.currentmicroservice}
4849
type="button"
4950
key={`serviceItem${props.index}${i}`}
5051
onClick={() => {
@@ -72,7 +73,7 @@ const ServiceOverview = (props) => {
7273
if (!(element.currentMicroservice in serviceCache)) {
7374
const button = (
7475
<button
75-
className='servicesBtn'
76+
className="servicesBtn"
7677
type="button"
7778
key={`serviceItem${props.index}${i}`}
7879
onClick={() => {
@@ -104,7 +105,7 @@ const ServiceOverview = (props) => {
104105
return (
105106
<div className="mainContainer">
106107
<div>
107-
<h1 className='overviewTitle'>Microservices Overview</h1>
108+
<h1 className="overviewTitle">Microservices Overview</h1>
108109
</div>
109110
<div />
110111
<div className="servicesList">{serviceList()}</div>

app/index.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ select {
210210
/* width: 35px; */
211211
background-color: #edd9a3;
212212
transition: 0.2s;
213-
margin-left: 10px;
213+
margin-left: 0px;
214214

215215
}
216216

@@ -292,4 +292,17 @@ form {
292292
#chartTitle {
293293
text-align: center;
294294
margin-bottom: 50px;
295+
margin-left: 0px;
296+
}
297+
298+
#modalCloseButton {
299+
position: absolute;
300+
right: 0px;
301+
top: 0px;
302+
background-color: Transparent;
303+
border: none;
304+
color: white;
305+
font-size: 28px;
306+
padding: 0px;
307+
margin-right: 10px;
295308
}

0 commit comments

Comments
 (0)