Skip to content

Commit def0b2b

Browse files
committed
changed awsChart component name, removed console logs
1 parent 9bdc46f commit def0b2b

File tree

6 files changed

+25
-37
lines changed

6 files changed

+25
-37
lines changed

app/App.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@ import React, { useState } from 'react';
22
import Splash from './components/Splash';
33
import DashboardContainer from './containers/DashboardContainer';
44
import './stylesheets/scrollBar.scss';
5-
import { QueryClient, QueryClientProvider } from 'react-query';
6-
import { ReactQueryDevtools } from 'react-query/devtools'
7-
8-
const queryClient = new QueryClient();
95

106
const App: React.FC = React.memo(() => {
117
return (
12-
<QueryClientProvider client={queryClient}>
13-
<ReactQueryDevtools initialIsOpen={false} />
8+
<div>
149
<Splash />
1510
<DashboardContainer />
16-
</QueryClientProvider>
11+
</div>
1712

1813
)
1914
});
File renamed without changes.

app/containers/AWSGraphsContainer.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useQuery } from 'react-query';
77
import { AwsContext } from '../context/AwsContext';
88

99
import '../stylesheets/AWSGraphsContainer.scss';
10-
import AwsCpuChart from '../charts/AwsCpuChart';
10+
import AwsChart from '../charts/AwsChart';
1111

1212
const AwsGraphsContainer: React.FC = React.memo(props => {
1313
const { awsData, awsAppInfo, fetchAwsData, fetchAwsAppInfo } = useContext(AwsContext);
@@ -22,15 +22,11 @@ const AwsGraphsContainer: React.FC = React.memo(props => {
2222

2323
setIntervalID(
2424
setInterval(() => {
25-
console.log('intervalId after click live', intervalID)
2625
fetchAwsData(user, appIndex);
2726
fetchAwsAppInfo(user, appIndex);
28-
}, 2000)
27+
}, 10000)
2928
)
30-
31-
console.log('intervalId after click live', intervalID)
3229
} else {
33-
console.log('interval id after stop live', intervalID)
3430
console.log('not fetching data')
3531
if(intervalID) clearInterval(intervalID);
3632
fetchAwsData(user, appIndex);
@@ -40,9 +36,7 @@ const AwsGraphsContainer: React.FC = React.memo(props => {
4036

4137
useEffect(() => {
4238
return () => {
43-
console.log('changed page, shut down fetching');
44-
console.log('intervalId when unmounting ', intervalID)
45-
39+
console.log('unmounting, shut down fetch process');
4640
if(intervalID) clearInterval(intervalID);
4741
}
4842
}, [])
@@ -82,17 +76,17 @@ const AwsGraphsContainer: React.FC = React.memo(props => {
8276
</button>
8377
</div>
8478
<div className="charts">
85-
<AwsCpuChart
79+
<AwsChart
8680
className='chart'
8781
// key={`Chart${counter}`}
8882
renderService='CPU Utilization'
89-
metric='Percent'
83+
metric={awsData.CPUUtilization[0]?.unit}
9084
timeList={awsData.CPUUtilization?.map(el => el.time)}
9185
valueList={awsData.CPUUtilization?.map(el => el.value)}
9286
// sizing={props.sizing}
9387
colourGenerator={stringToColor}
9488
/>
95-
<AwsCpuChart
89+
<AwsChart
9690
className='chart'
9791
// key={`Chart${counter}`}
9892
renderService='Network In'
@@ -102,7 +96,7 @@ const AwsGraphsContainer: React.FC = React.memo(props => {
10296
// sizing={props.sizing}
10397
colourGenerator={stringToColor}
10498
/>
105-
<AwsCpuChart
99+
<AwsChart
106100
className='chart'
107101
// key={`Chart${counter}`}
108102
renderService='Network Out'
@@ -112,7 +106,7 @@ const AwsGraphsContainer: React.FC = React.memo(props => {
112106
// sizing={props.sizing}
113107
colourGenerator={stringToColor}
114108
/>
115-
<AwsCpuChart
109+
<AwsChart
116110
className='chart'
117111
// key={`Chart${counter}`}
118112
renderService='DiskReadBytes'

app/context/AwsContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useCallback, useState, useEffect, useContext } from 'react';
22
import Electron from 'electron';
33
import { transformData } from './helpers';
44
const { ipcRenderer } = window.require('electron');
5-
import { useQuery } from 'react-query';
65
import { ApplicationContext } from './ApplicationContext';
76

87
export const AwsContext = React.createContext<any>(null);

app/modals/AwsModal.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,21 @@ const AwsModal: React.FC<AddModalProps> = React.memo(({ setOpen }) => {
7676
<option value="AWS/ECS">Elastic Container Service (ECS)</option>
7777
</select>
7878
</div>
79-
<div>
80-
<label htmlFor="instance">
81-
Instance/Cluster Name<span>*</span>
82-
</label>
83-
<input
84-
id="aws-instance"
85-
name="instance"
86-
value={instance}
87-
onChange={e => handleChange(e)}
88-
placeholder="AWS Instance/Cluster Name"
89-
required
90-
/>
91-
</div>
79+
{typeOfService === 'AWS/EC2' &&
80+
<div>
81+
<label htmlFor="instance">
82+
Instance/Cluster Name<span>*</span>
83+
</label>
84+
<input
85+
id="aws-instance"
86+
name="instance"
87+
value={instance}
88+
onChange={e => handleChange(e)}
89+
placeholder="AWS Instance/Cluster Name"
90+
required
91+
/>
92+
</div>
93+
}
9294
<div>
9395
<label htmlFor="region">
9496
Region<span>*</span>

electron/routes/dashboard.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ class User {
1414
password: string;
1515
email: string;
1616
services: string[][];
17-
cloudServices: string[][];
1817
mode: string;
1918

2019
constructor(username: string, password: string, email: string) {
2120
this.username = username;
2221
this.password = this.hashPassword(password);
2322
this.email = email;
2423
this.services = [];
25-
this.cloudServices = [];
2624
this.mode = 'light';
2725
}
2826

0 commit comments

Comments
 (0)