Skip to content

Commit 1d3012d

Browse files
committed
tooltips are functional, and overview restructured
1 parent 13a502d commit 1d3012d

File tree

11 files changed

+3651
-31
lines changed

11 files changed

+3651
-31
lines changed

Main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ ipcMain.on('deleteService', (message, index) => {
196196

197197
// Queries the database for communications information and returns it back to the render process.
198198
ipcMain.on('overviewRequest', (message, index) => {
199+
console.log('hello from overview request');
199200
const { services } = JSON.parse(
200201
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), { encoding: 'UTF-8' }),
201202
);
@@ -238,6 +239,7 @@ ipcMain.on('overviewRequest', (message, index) => {
238239
console.log('Connected to SQL Database');
239240
const queryResults = JSON.stringify(result.rows);
240241
// Asynchronous event emitter used to transmit query results back to the render process.
242+
console.log('ipcMain about to send overviewResponse message');
241243
message.sender.send('overviewResponse', queryResults);
242244
}
243245
});
@@ -246,6 +248,7 @@ ipcMain.on('overviewRequest', (message, index) => {
246248

247249
// Queries the database for computer health information and returns it back to the render process.
248250
ipcMain.on('detailsRequest', (message, index) => {
251+
console.log('detailsRequest message received');
249252
const databaseType = JSON.parse(
250253
fs.readFileSync(path.resolve(__dirname, './user/settings.json'), { encoding: 'UTF-8' }),
251254
).services[index][1];
@@ -269,6 +272,7 @@ ipcMain.on('detailsRequest', (message, index) => {
269272
}
270273
const queryResults = JSON.stringify(result.rows);
271274
// Asynchronous event emitter used to transmit query results back to the render process.
275+
// console.log('healthInfo data about to comeback');
272276
message.sender.send('detailsResponse', queryResults);
273277
});
274278
}

app/assets/tooltip.jpg

11.9 KB
Loading

app/components/AddService.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,19 @@ const AddService = () => {
2929
setDbType(document.getElementById('dbType').value);
3030
}, [dbState, setDbType]);
3131

32+
const tooltipWriteup = `Chronos utilizes user-owned databases to store communications and system health data.
33+
Please enter a valid connection string to a SQL or noSQL database to begin monitoring.`;
34+
3235
return (
3336
<div className="mainContainer">
34-
<img src="app/assets/logo2.png" alt="logo" />
35-
<h2 className="signUpHeader">Enter Your Database Information</h2>
37+
<img src="app/assets/logo2.png" alt="logo" id="addServiceLogo" />
38+
<h2 className="signUpHeader">
39+
Enter Your Database Information
40+
<sup className="tooltip">
41+
&#9432;
42+
<div className="tooltiptext">{tooltipWriteup}</div>
43+
</sup>
44+
</h2>
3645
<form>
3746
Database Type:
3847
<select id="dbType" onChange={() => setDbType(document.getElementById('dbType').value)}>

app/components/Modal.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ const Modal = (props) => {
1616
} = props;
1717
// Dictionary used to render proper data chart within Modal component upon rendering
1818
const dict = {
19-
request: <RequestTypesChart service={service} />,
19+
Request: <RequestTypesChart service={service} />,
2020
routesImage: <RouteTrace service={service} />,
21-
response: <ResponseCodesChart service={service} />,
22-
speed: <SpeedChart service={service} />,
23-
processes: <ProcessesChart service={service} />,
24-
latency: <LatencyChart service={service} />,
21+
Response: <ResponseCodesChart service={service} />,
22+
Speed: <SpeedChart service={service} />,
23+
Processes: <ProcessesChart service={service} />,
24+
Latency: <LatencyChart service={service} />,
2525
Traffic: <MicroServiceTraffic service={service} />,
26-
temperature: <TemperatureChart service={service} />,
27-
memory: <MemoryChart service={service} />,
26+
Temperature: <TemperatureChart service={service} />,
27+
Memory: <MemoryChart service={service} />,
2828
};
2929

3030
// event.stopPropogation allows the user to interact with the chart as opposed to a click on the

app/components/ServiceDetails.jsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
/* eslint-disable react/jsx-one-expression-per-line */
12
import React, { useState } from 'react';
23
import Modal from './Modal.jsx';
34

45
// Renders charts created with health and communication data for a selected database.
56
const 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
};

app/components/ServiceOverview.jsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ const ServiceOverview = (props) => {
2323
useEffect(() => {
2424
// IPC communication used to initiate query for information on microservices.
2525
ipcRenderer.send('overviewRequest', props.index);
26-
2726
// IPC listener responsible for retrieving infomation from asynchronous main process message.
2827
ipcRenderer.on('overviewResponse', (event, data) => {
2928
// Adds to state and context.
29+
console.log(JSON.parse(data));
3030
setOverviewState(Object.values(JSON.parse(data)));
3131
serviceComponents.overviewData = JSON.parse(data);
3232
});
3333
}, []);
3434

35+
console.log('overviewstate: ', overviewState);
3536
// Add routes to the display
3637
// Hook used to toggle whether or not the Modal component renders
3738
const [modalDisplay, toggleModalDisplay] = useState(false);
@@ -43,7 +44,10 @@ const ServiceOverview = (props) => {
4344
const [chartTitle, setChartTitle] = useState();
4445

4546
// route button AND traffic button property
46-
const routeButtonProperty = { traffic: { id: 'Traffic', alt: 'Microservice Traffic', src: 'app/assets/chartModal.png' }, routes: { id: 'routesImage', alt: 'Route Trace', src: routeChart } };
47+
const routeButtonProperty = {
48+
traffic: { id: 'Traffic', alt: 'Microservice Traffic', src: 'app/assets/chartModal.png' },
49+
routes: { id: 'routesImage', alt: 'Route Trace', src: routeChart },
50+
};
4751

4852
// declare routes array to display routes when modal is toggled
4953
const routes = [];
@@ -126,7 +130,8 @@ const ServiceOverview = (props) => {
126130
// Adds returned data to context
127131
healthdata.detailData = Object.values(JSON.parse(data));
128132
// Updates state. Triggers rerender.
129-
setDetails(<ServiceDetails service={element.currentmicroservice} />);
133+
setDetails(<ServiceDetails service={element.currentmicroservice} setDetails={setDetails} />);
134+
console.log('details selected is: ', detailsSelected);
130135
});
131136
}}
132137
>
@@ -175,10 +180,21 @@ const ServiceOverview = (props) => {
175180
return componentButtons;
176181
};
177182

183+
const tooltipWriteup = `Communications data - Routes and Traffic - is not specific to a single microservice,
184+
but combines data from all microservices within a single application network.`;
185+
186+
const tooltipWriteup2 = 'View and toggle between health data for individual services within your microservice network.';
187+
178188
return (
179189
<div className="mainContainer">
180190
<h1 className="overviewTitle">Microservices Overview</h1>
181-
<h2>Communications Data</h2>
191+
<h2>
192+
Communications Data
193+
<sup className="tooltip">
194+
&#9432;
195+
<div className="tooltiptext">{tooltipWriteup}</div>
196+
</sup>
197+
</h2>
182198
{modalDisplay ? (
183199
<Modal
184200
chartTitle={chartTitle}
@@ -194,7 +210,13 @@ const ServiceOverview = (props) => {
194210
{routes}
195211
{traffic}
196212
</div>
197-
<div className="servicesList">{serviceList()}</div>
213+
<div className="servicesList">
214+
{serviceList()}
215+
<sup className="tooltip">
216+
&#9432;
217+
<div className="tooltiptext">{tooltipWriteup2}</div>
218+
</sup>
219+
</div>
198220
<br />
199221
{detailsSelected || null}
200222
</div>

app/components/ServicesDashboard.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
/* eslint-disable react/jsx-one-expression-per-line */
12
import React, { useState, useContext } from 'react';
23
import ServiceOverview from './ServiceOverview.jsx';
34
import DashboardContext from '../context/DashboardContext';
45
import SetupContext from '../context/SetupContext';
56
import AddService from './AddService.jsx';
67
import DeleteService from './DeleteService.jsx';
78

8-
const path = require('path');
9-
109
const ServicesDashboard = (props) => {
1110
// Used to toggle setup required if user wants to add a new database.
1211
const setup = useContext(SetupContext);
@@ -37,13 +36,21 @@ const ServicesDashboard = (props) => {
3736
return buttonStore;
3837
};
3938

39+
const tooltipWriteup = 'Please provide separate databases for additional microservice applications.';
40+
4041
return (
4142
<div className="servicesDashboardContainer">
4243
<div className="left">
4344
<div className="leftTopContainer">
4445
<img alt="Chronos Logo" src="app/assets/icon2Cropped.png" id="serviceDashLogo" />
4546
<div className="left-top">
46-
<h2 className="dashboardHeader">Your Databases</h2>
47+
<h2 className="dashboardHeader">
48+
Your Databases
49+
<sup className="tooltip">
50+
&#9432;
51+
<div className="tooltiptext">{tooltipWriteup}</div>
52+
</sup>
53+
</h2>
4754
{renderServiceList(serviceList)}
4855
</div>
4956
<div className="left-bottom">

app/index.css

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,38 @@ margin-top: -100px;
6565
font-weight: lighter;
6666
}
6767

68+
#addServiceLogo {
69+
margin-bottom: 0px;
70+
}
71+
72+
.tooltip {
73+
font-size: 10px;
74+
position: relative;
75+
/* display: inline-block; */
76+
z-index: 0;
77+
}
78+
79+
.tooltiptext {
80+
visibility: hidden;
81+
font-size: 12px;
82+
width: 180px;
83+
background-color: black;
84+
color: #fff;
85+
text-align: center;
86+
border-radius: 6px;
87+
padding: 5px 0;
88+
89+
/* Position the tooltip */
90+
position: absolute;
91+
z-index: 1;
92+
left: 105%;
93+
top: -5px;
94+
}
95+
96+
.tooltip:hover .tooltiptext {
97+
visibility: visible;
98+
}
99+
68100
.header {
69101
color: white;
70102
height: 50px;
@@ -284,6 +316,7 @@ select {
284316
background-color: #edd9a3;
285317
transition: 0.2s;
286318
margin-left: 0px;
319+
margin-top: 5%;
287320
}
288321

289322
.backButton:hover {
@@ -293,17 +326,26 @@ select {
293326

294327
/* healthInfo visualizer css from 2.0 Team */
295328
#serviceDetailsContainer {
329+
margin-top: 5%;
296330
display: flex;
297331
flex-direction: column;
298332
align-items: center;
299333
justify-content: center;
300334
}
301-
#healthGrid {
335+
336+
/* #healthGrid {
302337
display: grid;
303338
grid-template-columns: 75px 75px 75px;
304339
width: auto;
305340
justify-items: center;
306341
align-items: center;
342+
} */
343+
344+
#healthGrid {
345+
display: grid;
346+
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
347+
justify-items: center;
348+
text-align: center;
307349
}
308350

309351
.healthName {

dist/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Chronos</title>
8+
</head>
9+
<body>
10+
<div id='app'></div>
11+
<script type="text/javascript" src="index_bundle.js"></script></body>
12+
</html>

0 commit comments

Comments
 (0)