Skip to content

Commit 3bc90a2

Browse files
committed
Added comments to multiple files as well as changed a couple of type any
Co-authored-by: Elena Atencio <[email protected]> Co-authored-by: Iris Wong <[email protected]> Co-authored-by: John Donato <[email protected]>
1 parent fcb8ef5 commit 3bc90a2

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

app/context/ApplicationContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo(props =
8787

8888
/**
8989
* @function getSavedMetrics - a function that will wait for backend `savedMetricsResponse` to update metrics using `setSavedMetrics`
90+
* Trying to find what the data type needs to be.
9091
*/
9192
const getSavedMetrics = useCallback(() => {
9293
ipcRenderer.send('savedMetricsRequest');

app/context/CommsContext.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ const CommsContextProvider: React.FC<Props> = React.memo((props) => {
3737
return false;
3838
}
3939

40+
41+
/**
42+
* @function fetchCommsData - uses useCallback Hook returns a memoized callback function.
43+
* One reason to use useCallback is to prevent a component from re-rendering unless its props have changed.
44+
* fetches the data
45+
*/
4046
const fetchCommsData = useCallback((app: string, live: boolean) => {
4147

4248
if (app !== currentApp || live) {
@@ -47,6 +53,7 @@ const CommsContextProvider: React.FC<Props> = React.memo((props) => {
4753
let result: any;
4854
if (tryParseJSON(data)) result = JSON.parse(data);
4955
console.log('communication data from fetch request is: ', result);
56+
console.log(data);
5057
setCommsData(result);
5158
});
5259
}

app/context/EventContext.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ const EventContextProvider: React.FC<Props> = React.memo(({ children }) => {
3434
return false;
3535
}
3636

37+
/**
38+
* @function fetchEventData - takes parameter arg.
39+
* Checks if arg is strictly equals to 'kafkametrics', if so removes the event listerner suing the ipcRenderer.removeAllListeners.
40+
* Sends a message using 'ipcRenderer.send'.
41+
* This function seems to be fetching event data and updating the state accordingly.
42+
* Problem: trying to change type any to something some concrete.
43+
*/
44+
3745
const fetchEventData = useCallback((arg: any) => {
3846
if (arg === 'kafkametrics') {
3947
ipcRenderer.removeAllListeners('kafkaResponse');

app/context/HealthContext.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ const HealthContextProvider: React.FC<Props> = React.memo(({ children }) => {
3434
return false;
3535
}
3636

37+
38+
/**
39+
* @function fetchEventData - sending a request to the backend to retrieve data.
40+
* Data is then parsed and the setHealthData is then set.
41+
*/
3742
const fetchHealthData = useCallback(serv => {
3843
ipcRenderer.removeAllListeners('healthResponse');
3944

40-
let temp: any[] = [];
45+
let temp: string[] = [];
4146
console.log('the cb being passed into fetch health data from graphscontainer is: ', serv);
4247

4348
Promise.all(

electron/routes/data.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ ipcMain.on('dockerRequest', async (message, service) => {
193193
ipcMain.on('savedMetricsRequest', async (message: Electron.IpcMainEvent) => {
194194
try {
195195
let result: any = {};
196-
197196
// Mongo Database
198197
if (currentDatabaseType === 'MongoDB') {
199198
// Get all documents from the services collection

0 commit comments

Comments
 (0)