Skip to content

Commit e599776

Browse files
committed
Added service property to application/card
1 parent 7504da9 commit e599776

16 files changed

+120
-68
lines changed

app/components/Occupied.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ interface StyleProps {
5555

5656

5757
const Occupied = React.memo(() => {
58-
const { setServicesData } = useContext(ApplicationContext);
58+
const { setServicesData, app, setApp } = useContext(ApplicationContext);
5959
const { user, applications, getApplications, deleteApp, mode } = useContext(DashboardContext);
6060
const { commsData } = useContext(CommsContext);
6161
const [serviceModalOpen, setServiceModalOpen] = useState<boolean>(false);
6262
const [addModalOpen, setAddModalOpen] = useState<boolean>(false);
6363
const [personModalOpen, setPersonModalOpen] = useState<boolean>(false);
6464
const [index, setIndex] = useState<number>(0);
65-
const [app, setApp] = useState<string>('');
65+
// const [app, setApp] = useState<string>('');
6666
const [searchTerm, setSearchTerm] = useState<string>('');
6767
const [clickedAt, setClickedAt] = useState<string>('2000-01-01T00:00:00Z');
6868

@@ -84,6 +84,7 @@ const Occupied = React.memo(() => {
8484
// Handle clicks on Application cards
8585
const handleClick = (event: ClickEvent, selectedApp: string, i: number) => {
8686
if (delRef.current[i] && !delRef.current[i].contains(event.target)) {
87+
console.log('the application that you clicked is: ', selectedApp)
8788
setIndex(i);
8889
setApp(selectedApp);
8990
setServicesData([]);
@@ -274,7 +275,10 @@ const Occupied = React.memo(() => {
274275
key={`card-${i}`}
275276
className={classes.paper}
276277
variant="outlined"
277-
onClick={event => handleClick(event, application[0], i)}
278+
onClick={event => {
279+
console.log('what are all the applications mapped: ', applications)
280+
handleClick(event, application[0], i)
281+
}}
278282
>
279283
<div className="databaseIconContainer">
280284
<div className="databaseIconHeader">
@@ -308,15 +312,17 @@ const Occupied = React.memo(() => {
308312
}
309313
/>
310314
<CardContent>
311-
<p id="databaseName">Database Name:</p>
315+
<p id="databaseName">Name:</p>
312316
<Typography className={classes.fontStyles}>{application[0]}</Typography>
317+
<p id="databaseName">Service:</p>
318+
<Typography className={classes.fontStyles}>{application[3]}</Typography>
313319
</CardContent>
314320
<hr className="cardLine" />
315321

316322
<div className="cardFooter">
317323
<UpdateIcon className="cardFooterIcon" />
318324
<em>
319-
<p id="cardFooterText">{application[3]}</p>
325+
<p id="cardFooterText">{application[4]}</p>
320326
</em>
321327
</div>
322328
</Card>

app/components/SignUp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const SignUp = React.memo(() => {
1414
return (
1515
<div className="home">
1616
<div className="welcome" data-testid="SignUp">
17-
<h1 className="welcomeMessage">Welcome Chronos!</h1>
17+
<h1 className="welcomeMessage">Welcome to Chronos!</h1>
1818
<h2>Your all-in-one application monitoring tool.</h2>
1919

2020
<form className="form" onSubmit={handleSubmit}>

app/components/Splash.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React, { useState, useEffect } from 'react';
22
import '../stylesheets/Splash.scss';
33

44
const Splash: React.FC = React.memo((props) => {
5-
const [visible, setVisible] = useState(true);
6-
useEffect(() => {
7-
setTimeout(() => setVisible(false), 4000);
8-
}, []);
5+
const [visible, setVisible] = useState(false);
6+
// useEffect(() => {
7+
// setTimeout(() => setVisible(false), 4000);
8+
// }, []);
99

1010
return (
1111
<>

app/components/TransferColumns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const TransferColumns = React.memo(() => {
149149
temp.push(newCategory);
150150
}
151151
}
152-
console.log('temp is: ', temp);
152+
console.log('temp array with requested graphs is: ', temp);
153153
setSelectedMetrics(temp);
154154
};
155155

app/containers/DashboardContainer.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import QueryContextProvider from '../context/QueryContext';
1212
import '../stylesheets/Dashboard.scss';
1313

1414
const DashboardContainer = React.memo(() => {
15-
const [visible, setVisible] = useState(false);
16-
useEffect(() => {
17-
setTimeout(() => setVisible(true), 4000);
18-
}, []);
15+
const [visible, setVisible] = useState(true);
16+
17+
// useEffect(() => {
18+
// setTimeout(() => setVisible(true), 4000);
19+
// }, []);
1920

2021
return (
2122
<>

app/containers/GraphsContainer.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const GraphsContainer: React.FC = React.memo(props => {
7373
if (service.includes('kubernetesmetrics')) {
7474
fetchEventData('kubernetesmetrics');
7575
}
76-
}, 3000)
76+
}, 10000)
7777
);
7878
} else {
7979
if (intervalID) clearInterval(intervalID);
@@ -212,7 +212,12 @@ const GraphsContainer: React.FC = React.memo(props => {
212212
</div>
213213
) : (
214214
<div className="graphs">
215-
{chart === 'all' && <div className="transferColumns"><h2 style={currentMode}>Search Your Metrics to Display</h2><TransferColumns /></div>}
215+
{chart === 'all' &&
216+
<div className="transferColumns">
217+
<h2 style={currentMode}>Search Your Metrics to Display</h2>
218+
<TransferColumns />
219+
</div>
220+
}
216221
{chart.startsWith('health_') && (
217222
<HealthContainer
218223
colourGenerator={stringToColour}

app/context/ApplicationContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo((props)
4444
ipcRenderer.on('servicesResponse', (event: Electron.Event, data: any) => {
4545
let result: any;
4646
if (tryParseJSON(data)) result = JSON.parse(data);
47+
console.log('result from ipcrenderer services response is: ', result);
4748
setServicesData(result);
4849
ipcRenderer.removeAllListeners('servicesResponse');
4950
});
@@ -65,13 +66,14 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo((props)
6566
data.forEach(el => {
6667
store[el.metric] = el;
6768
})
69+
console.log('result from getSavedMetrics is: ', store)
6870
setSavedMetrics(store);
6971
});
7072
}, []);
7173

7274
return (
7375
<ApplicationContext.Provider
74-
value={{ connectToDB, fetchServicesNames, setServicesData, servicesData, app, getSavedMetrics, setSavedMetrics, savedMetrics }}
76+
value={{ connectToDB, fetchServicesNames, setServicesData, servicesData, app, setApp, getSavedMetrics, setSavedMetrics, savedMetrics }}
7577
>
7678
{children}
7779
</ApplicationContext.Provider>

app/context/CommsContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const CommsContextProvider: React.FC<Props> = React.memo((props) => {
4646
ipcRenderer.on('commsResponse', (event: Electron.Event, data: any) => {
4747
let result: any;
4848
if (tryParseJSON(data)) result = JSON.parse(data);
49+
console.log('communication data from fetch request is: ', result);
4950
setCommsData(result);
5051
});
5152
}

app/context/DashboardContext.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React, { useState, createContext, useCallback } from 'react';
44
const { ipcRenderer } = window.require('electron');
55

66
interface IFields {
7+
typeOfService: string;
78
database: string;
89
URI: string;
910
name: string;
@@ -41,12 +42,14 @@ const DashboardContextProvider = React.memo((props: any) => {
4142
}, []);
4243

4344
const addApp = useCallback((fields: IFields) => {
44-
const { database, URI, name, description } = fields;
45+
const { typeOfService, database, URI, name, description } = fields;
46+
console.log('what is the service that was passed into add app: ', typeOfService)
4547
const result = ipcRenderer.sendSync(
4648
'addApp',
47-
JSON.stringify([name, database, URI, description])
49+
JSON.stringify([name, database, URI, description, typeOfService])
4850
);
4951
setApplications(result);
52+
console.log('the current application that was added is : ', result)
5053
}, []);
5154

5255
const deleteApp = useCallback((index: number) => {

app/context/DockerContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const DockerContextProvider: React.FC<Props> = React.memo((props) => {
3939
let result;
4040
if (tryParseJSON(data)) result = JSON.parse(data);
4141
const newDockerData = result[0] || {};
42+
console.log(newDockerData);
4243
setDockerData(newDockerData);
4344
});
4445
}, []);

0 commit comments

Comments
 (0)