Skip to content

Commit 2fb7114

Browse files
Merge pull request #90 from oslabs-beta/master
Chronos 7.0
2 parents 52451b9 + 85d8d91 commit 2fb7114

17 files changed

+9818
-4954
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@ Chronos is a comprehensive developer tool that monitors the health and web traff
4545
## <img src ="./app/assets/fire.png" height=22 > New Features <img src ="./app/assets/fire.png" height=24>
4646

4747
- New UI Features
48-
- Dark and Light mode options now available across user sessions.
49-
- Updated charts to now also support gRPC calls
50-
- Integrated log to provide users with relational data on request & response cycle
48+
- Developed search bar functionality to filter displayed microservices
49+
- Login system for user authentication
50+
- Any errored connections will now show on the bell icon
51+
- Notification bell will update in real time
5152
- Bug Fixes
52-
- Fixed bug where users could only connect to one MongoDB database and would see its microservices listed even when users clicked on applications using other MongoDB databases
53-
- Chronos now support monitoring for gRPC!
54-
- Distributed tracing across network request
55-
- Currently chronos gRPC tracing for MongoDB and PostgresQL
56-
53+
- Fixed database icons to show the correct icon
5754
## Features
5855

5956
- Distributed tracing enabled across microservices applications
@@ -80,15 +77,15 @@ This is for the latest Chronos version **5.1 release and later**.
8077
- LTS release: 6.1.0
8178

8279
### Pre-Installation
83-
Make sure you're running version 12.18.3 of <a href="#"><img src="./app/assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /></a></a>, which is the most recent LTS (long-term support) version.
80+
Make sure you're running version 14.16.1 of <a href="#"><img src="./app/assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /></a></a>, which is the most recent LTS (long-term support) version.
8481

85-
If you need to roll back from <a href="#"><img src="./app/assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /></a> 14.9.0, make sure to run
82+
If you need to roll back from <a href="#"><img src="./app/assets/node-logo-color.png" alt="Node" title="Node" align="center" height="20" /></a> 16.1.0, make sure to run
8683
```npm rebuild```
8784
in the root directory.
8885

8986
If you're installing Chronos into a microservices application, and you have different folders for each microservice, make sure you also run
9087
```npm rebuild```
91-
in each microservices folder **after you roll back to version 12.18.3.**
88+
in each microservices folder **after you roll back to version 14.16.1.**
9289
<br>
9390

9491
### Install Dependencies

app/charts/RequestTypesChart.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ const RequestTypesChart: React.FC = React.memo(() => {
3131
let type;
3232
commsData.forEach((obj: IObject) => {
3333
type = obj.request;
34-
console.log('L34:', type);
34+
// console.log('L34:', type);
3535
if (type in requestTypes) {
3636
requestTypes[type] += 1;
3737
} else {
3838
requestTypes[type] = 0;
3939
requestTypes[type]++;
4040
}
41-
console.log(requestTypes)
41+
// console.log(requestTypes)
4242
});
4343

4444
return (
@@ -53,7 +53,6 @@ const RequestTypesChart: React.FC = React.memo(() => {
5353
marker: {
5454
colors: ['#fc4039', '#4b54ea', '#32b44f', '#3788fc', '#9c27b0', '#febc2c'],
5555
},
56-
5756
},
5857
]}
5958
config={{
@@ -78,7 +77,7 @@ const RequestTypesChart: React.FC = React.memo(() => {
7877
x: 0.5,
7978
font: {
8079
size: 7,
81-
}
80+
},
8281
},
8382
}}
8483
/>

app/charts/ResponseCodesChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface IObj {
1414
}
1515

1616
type responseCodes = {
17-
[key: string]: number
17+
[key: string]: number;
1818
};
1919

2020
const ResponseCodesChart: React.FC = React.memo(() => {
@@ -65,7 +65,7 @@ const ResponseCodesChart: React.FC = React.memo(() => {
6565
}
6666
});
6767

68-
console.log(responseCodes);
68+
// console.log(responseCodes);
6969

7070
return (
7171
<Plot
@@ -126,7 +126,7 @@ const ResponseCodesChart: React.FC = React.memo(() => {
126126
x: 0.5,
127127
font: {
128128
size: 7,
129-
}
129+
},
130130
},
131131
}}
132132
/>

app/charts/RouteChart.jsx

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { makeStyles } from '@material-ui/core/styles';
22
import React, { useContext } from 'react';
3-
import { CommsContext } from '../context/CommsContext';
43
import Graph from 'react-graph-vis';
4+
import { CommsContext } from '../context/CommsContext';
55

66
const RouteChart = React.memo(() => {
77
const communicationsData = useContext(CommsContext).commsData;
@@ -26,10 +26,10 @@ const RouteChart = React.memo(() => {
2626
resObj[element.correlatingid].push({
2727
microservice: element.microservice,
2828
time: element.time,
29-
request: element.request, //here
29+
request: element.request, // here
3030
});
3131
}
32-
//? What does this else block do?
32+
// ? What does this else block do?
3333
} else {
3434
for (let i = communicationsData.length - 1; i >= 0; i--) {
3535
const element = communicationsData[i];
@@ -49,7 +49,6 @@ const RouteChart = React.memo(() => {
4949
}
5050
}
5151

52-
5352
// Filter the array so that only subarrays w/ len > 1 are kept.
5453
// (len == 1 means there's only one point in the route. There's no meaningful data to be gained from those.)
5554
const tracePoints = Object.values(resObj).filter(subArray => subArray.length > 1);
@@ -72,26 +71,26 @@ const RouteChart = React.memo(() => {
7271
// ======Graphs logic =======//
7372
const nodeListObj = {};
7473
const edgeListObj = {};
75-
for (let route of tracePoints) {
74+
for (const route of tracePoints) {
7675
for (let i = 0; i < route.length; i += 1) {
7776
// check if node exists if not then add node
78-
let id = route[i].microservice;
77+
const id = route[i].microservice;
7978
if (nodeListObj[id] === undefined) {
80-
nodeListObj[id] = {
81-
id: id,
82-
label: id
83-
}
79+
nodeListObj[id] = {
80+
id,
81+
label: id,
82+
};
8483
}
8584
// add edge from node to node (repeat til end)
8685
if (i !== 0) {
87-
let from = route[i - 1].microservice;
88-
let to = id;
89-
let request = route[i - 1].request; //here
90-
let edgeStr = JSON.stringify({ from, to, request })
86+
const from = route[i - 1].microservice;
87+
const to = id;
88+
const { request } = route[i - 1]; // here
89+
const edgeStr = JSON.stringify({ from, to, request });
9190
let duration = new Date(route[i].time) - new Date(route[i - 1].time);
9291
// only want one edge per route with the average duration
9392
if (edgeListObj[edgeStr]) {
94-
//? wrong math
93+
// ? wrong math
9594
duration = (duration + edgeListObj[edgeStr]) / 2;
9695
}
9796
edgeListObj[edgeStr] = duration;
@@ -102,10 +101,12 @@ const RouteChart = React.memo(() => {
102101
// turn objects into valid arrays to input into graph
103102
const nodeList = Object.values(nodeListObj);
104103
const edgeList = [];
105-
for (let [edgeStr, duration] of Object.entries(edgeListObj)) {
104+
for (const [edgeStr, duration] of Object.entries(edgeListObj)) {
106105
const edge = JSON.parse(edgeStr);
107-
console.log(edge.request)
108-
edge.label = edge.request ? `${edge.request} - ${(duration * 10).toFixed(0)} ms` : `${(duration * 10).toFixed(0)} ms`
106+
// console.log(edge.request)
107+
edge.label = edge.request
108+
? `${edge.request} - ${(duration * 10).toFixed(0)} ms`
109+
: `${(duration * 10).toFixed(0)} ms`;
109110
edgeList.push(edge);
110111
}
111112

@@ -120,12 +121,12 @@ const RouteChart = React.memo(() => {
120121
hierarchical: false,
121122
},
122123
edges: {
123-
color: "#444d56",
124+
color: '#444d56',
124125
physics: true,
125126
smooth: {
126-
type: "curvedCCW",
127-
forceDirection: "none",
128-
roundness: 0.3
127+
type: 'curvedCCW',
128+
forceDirection: 'none',
129+
roundness: 0.3,
129130
},
130131
font: {
131132
color: '#444d56',
@@ -141,27 +142,38 @@ const RouteChart = React.memo(() => {
141142
},
142143
highlight: {
143144
background: '#fc4039',
144-
}
145+
},
145146
},
146147
shape: 'circle',
147148
font: {
148149
color: '#ffffff',
149150
size: 10,
150-
face: 'roboto'
151+
face: 'roboto',
151152
},
152-
}
153-
}
153+
},
154+
};
154155

155156
const events = {
156-
select: function (event) {
157-
let { nodes, edges } = event;
157+
select(event) {
158+
const { nodes, edges } = event;
158159
},
159160
};
160161

161162
return (
162-
<div className='traceContainer'>
163-
<span id='tracesTitle'>Route Traces</span>
164-
<Graph className={classes.paper} graph={graph} options={options} events={events} style={{ fontFamily: 'Roboto', boxShadow: '3px 3px 6px 1px rgb(175, 175, 175)', backgroundColor: 'white', borderRadius: '3px' }} />
163+
<div className="traceContainer">
164+
<span id="tracesTitle">Route Traces</span>
165+
<Graph
166+
className={classes.paper}
167+
graph={graph}
168+
options={options}
169+
events={events}
170+
style={{
171+
fontFamily: 'Roboto',
172+
boxShadow: '3px 3px 6px 1px rgb(175, 175, 175)',
173+
backgroundColor: 'white',
174+
borderRadius: '3px',
175+
}}
176+
/>
165177
</div>
166178
);
167179
});

app/components/Home.tsx

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,92 @@
1-
import React from 'react';
1+
import { faGlassMartiniAlt } from '@fortawesome/free-solid-svg-icons';
2+
// import axios from 'axios';
3+
import React, { useState } from 'react';
24
import { Link } from 'react-router-dom';
35

46
import '../stylesheets/Home.scss';
7+
//
8+
const { ipcRenderer } = window.require('electron');
9+
10+
interface PersonProps {
11+
email: string;
12+
password: string;
13+
}
14+
15+
type ClickEvent = React.MouseEvent<HTMLElement>;
16+
17+
// const [email] = React.useState<string>('');
18+
// const [password] = React.useState<string>('');
19+
// function handleChange(e) {
20+
21+
// }
22+
const adminUser = {
23+
24+
password: "admin123"
25+
}
526

627
const Home = React.memo(function Home(props) {
28+
const [open, setOpen] = useState<boolean>(false);
29+
const [loginInfo, setLoginInfo] = React.useState<PersonProps>({
30+
email: '',
31+
password: ''
32+
});
33+
34+
function myFunction() {
35+
location.replace("/applications")
36+
}
37+
function pageRedirect(){
38+
setTimeout(function(){
39+
window.location.href = '/applications';
40+
}, 5000);
41+
}
42+
43+
function submitLogin(e: any) {
44+
e.preventDefault();
45+
// console.log(e);
46+
console.log(loginInfo);
47+
//check local state if the username is there
48+
if(loginInfo.email === adminUser.email && loginInfo.password === adminUser.password){
49+
console.log("Logged In");
50+
myFunction();
51+
// alert('Welcome Back!\n\n (\\__/) \n (=\'.\'=) \n(\'\')__(\'\')')
52+
// // pageRedirect();
53+
// // "window.location='/applications'"
54+
} else {
55+
alert('Log In credentials are wrong!\n\n (\\__/) \n (=\'.\'=) \n(\'\')__(\'\')')
56+
}
57+
}
58+
//database connection/fetch
59+
function checkLoginStatus() {
60+
// axios('http://localhost:3000/loggedIn', {withCredentials: true})
61+
}
62+
63+
64+
765
return (
866
<div className="home">
9-
<p className="welcomeMessage">Your all-in-one application monitoring tool</p>
10-
<Link className="link" to="/applications">
67+
<p className="welcomeMessage">Welcome Back To Chronos! Your all-in-one application monitoring tool</p>
68+
69+
<form className="form" onSubmit={submitLogin}>
70+
<label className="login">
71+
<input type="email" name="email" id="email" placeholder="[email protected]" onChange={e => setLoginInfo({...loginInfo, email: e.target.value})} ></input>
72+
<br></br>
73+
<input type="password" name= "password" id="password" placeholder="enter password" onChange={e => setLoginInfo({...loginInfo, password:e.target.value})} ></input>
74+
<hr />
75+
</label>
76+
<br></br>
77+
<br></br>
78+
<br></br>
79+
<button className="link" id="submitBtn" type="submit" onClick={() => (true)}>
80+
Log In
81+
</button>
82+
</form>
83+
84+
<br></br>
85+
{/* <Link className="link" to="/applications">
1186
Get Started
12-
</Link>
87+
</Link> */}
1388
</div>
1489
);
1590
});
1691

17-
export default Home;
92+
export default Home;

0 commit comments

Comments
 (0)