Skip to content

Commit a028ae5

Browse files
authored
Merge pull request #12 from oslabs-beta/graphContainer/refactor
Graph container/refactor
2 parents 3833b31 + 524cc1e commit a028ae5

26 files changed

Lines changed: 128 additions & 144 deletions

__backend-tests__/mockdbsetup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ const connectDB = async () => {
1212
useNewUrlParser: true,
1313
useUnifiedTopology: true,
1414
}).then((result) => {
15-
console.log(result.connection.readyState)
16-
console.log(result.connection.host)
15+
// console.log(result.connection.readyState)
16+
// console.log(result.connection.host)
1717
}).catch((err) => {
18-
console.log('Unable to connect to MongoMemoryServer')
18+
// console.log('Unable to connect to MongoMemoryServer')
1919
});
2020
};
2121

app/charts/GrafanaEventChart.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ const GrafanaEventChart: React.FC<EventChartProps> = React.memo(props => {
2323
const [type, setType] = useState(['timeserie']);
2424
const [timeFrame, setTimeFrame] = useState('5m');
2525

26-
console.log("graphType: ", graphType)
27-
console.log("type: ", type)
28-
console.log("inside GrafanaEventChart")
26+
// console.log("graphType: ", graphType)
27+
// console.log("type: ", type)
28+
// console.log("inside GrafanaEventChart")
2929

30-
console.log("metricName: ", metricName)
30+
// console.log("metricName: ", metricName)
3131
let uid = metricName.replace(/.*\/.*\//g, '')
3232
if (uid.length >= 40) {
3333
uid = metricName.slice(metricName.length - 39);
3434
}
3535

3636
let parsedName = metricName.replace(/.*\/.*\//g, '')
37-
console.log("uid: ", uid)
38-
console.log("parsedName: ", parsedName)
37+
// console.log("uid: ", uid)
38+
// console.log("parsedName: ", parsedName)
3939

4040
const handleSelectionChange = async (event) => {
4141
setType([...type, graphType]);

app/components/AwsEC2Graphs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const AwsEC2Graphs: React.FC = React.memo(props => {
2727
colour += `00${value.toString(16)}`.substring(-2);
2828
}
2929

30-
console.log(colour);
30+
// console.log(colour);
3131
return colour;
3232
}
3333
};

app/components/Login.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const Login = React.memo(() => {
2525
// inputFields.forEach(input => (input.value = ''));
2626
const response: boolean | string = ipcRenderer.sendSync('login', { username, password });
2727
if (typeof (response) === 'string') {
28-
console.log('Hi, login successful and response string (mode) is:', response);
29-
console.log('Redirected to Occupied from Login.');
28+
// console.log('Hi, login successful and response string (mode) is:', response);
29+
// console.log('Redirected to Occupied from Login.');
3030
setUser(username);
3131
setMode(response);
3232
navigate('/');

app/components/SignUp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ const SignUp:React.FC = React.memo(() => {
4343

4444
ipcRenderer.invoke('addUser', { username, email, password})
4545
.then((message) => {
46-
console.log('message', message)
46+
// console.log('message', message)
4747
if (message === false) {
4848
setFailedSignUp(<p>Sorry, your sign up failed. Please try a different username or email</p>)
4949
} else {
50-
console.log('in frontend', username)
50+
// console.log('in frontend', username)
5151
// setUser(username);
5252
navigate('/login');
5353
alert('USER CREATED: PLEASE LOG IN')

app/components/TransferColumns.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const TransferColumns = React.memo(() => {
121121
const createSelectedMetricsList = () => {
122122
const temp: any[] = [];
123123
const categorySet = new Set();
124-
console.log('Inside TransferColumns.txs line 124 targetKeys: ', targetKeys)
124+
// console.log('Inside TransferColumns.txs line 124 targetKeys: ', targetKeys)
125125
for (let i = 0; i < targetKeys.length; i++) {
126126
const str: string = targetKeys[i];
127127
const strArr: string[] = str.split(' | ');
@@ -141,7 +141,7 @@ const TransferColumns = React.memo(() => {
141141
temp.push(newCategory);
142142
}
143143
}
144-
console.log('temp', temp)
144+
// console.log('temp', temp)
145145
setSelectedMetrics(temp);
146146
};
147147

app/containers/AWSGraphsContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const AwsGraphsContainer: React.FC = React.memo(props => {
4545
if (awsLive) {
4646
setIntervalID(
4747
setInterval(() => {
48-
console.log('intervalId after click live', intervalID);
48+
// console.log('intervalId after click live', intervalID);
4949
fetchAwsAppInfo(user, appIndex);
5050

5151
if (typeOfService === 'AWS/EC2') fetchAwsData(user, appIndex) ;

app/containers/DockerHealthContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ const DockerHealthContainer: React.FC<HealthContainerProps> = React.memo(props =
114114
const chartData = metricObjects[metricName];
115115
const token = chartData.token;
116116

117-
console.log("plotting grafana")
117+
// console.log("plotting grafana")
118118
grafanaChartsArray.push(
119119
<GrafanaEventChart metricName={metricName} token={token} />);
120120

121121
}
122122
}
123-
console.log(grafanaChartsArray)
123+
// console.log(grafanaChartsArray)
124124
setHealthChartsArr(grafanaChartsArray);
125125
setCurrChunk(grafanaChartsArray.slice(currIndex, currIndex + chunkSize));
126126
setCurrIndex(currIndex + chunkSize);

app/containers/EventContainer.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
5656
const filteredEventData = {};
5757
// use this array of selected metrics to filter the eventData down to only the metrics we want to see
5858
const selectedArr = selectedMetrics[0].Event;
59-
console.log('selectedArr IS: ', selectedArr)
59+
// console.log('selectedArr IS: ', selectedArr)
6060
// only one service... 'Event'
6161
for (const service in eventDataObj) {
6262
filteredEventData[service] = {};
6363
// define the object of all the metrics
6464
const serviceMetricsObject = eventDataObj[service];
65-
console.log('serviceMetricsObject IS: ', serviceMetricsObject)
65+
// console.log('serviceMetricsObject IS: ', serviceMetricsObject)
6666
// iterate through all the metrics
6767
for (const metricName in serviceMetricsObject) {
6868
// if the metric name matches a string in the selectedArr, we add it to our filtered object
@@ -71,7 +71,7 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
7171
}
7272
};
7373
};
74-
console.log('filteredEventData IS: ', filteredEventData)
74+
// console.log('filteredEventData IS: ', filteredEventData)
7575
return filteredEventData;
7676
};
7777

@@ -97,11 +97,11 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
9797
for (const service in filteredEventDataObj) {
9898
const metricObject = filteredEventDataObj[service];
9999
for (const metricName in metricObject) {
100-
console.log('metricName IS: ', metricName)
100+
// console.log('metricName IS: ', metricName)
101101
const chartData = metricObject[metricName];
102-
console.log('chartData IS: ', chartData)
102+
// console.log('chartData IS: ', chartData)
103103
const token = chartData.token;
104-
console.log('token IS: ', token);
104+
// console.log('token IS: ', token);
105105
// plotting using plotly
106106
// if (!isGrafana) {
107107
// console.log("plotting plotly")
@@ -117,7 +117,7 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
117117
// } else {
118118

119119
// plotting using grafana
120-
console.log("plotting grafana")
120+
// console.log("plotting grafana")
121121
grafanaChartsArray.push(
122122
<GrafanaEventChart metricName={metricName} token={token} />);
123123

@@ -126,7 +126,7 @@ const EventContainer: React.FC<EventContainerProps> = React.memo(props => {
126126
}
127127
// currently, we only display graph using grafana. It can be implement as a option to choose between ploty and grafana for future iterations
128128
// if (isGrafana) {
129-
console.log(grafanaChartsArray)
129+
// console.log(grafanaChartsArray)
130130
setEventChartsArr(grafanaChartsArray);
131131
setCurrChunk(grafanaChartsArray.slice(currIndex, currIndex + chunkSize));
132132
setCurrIndex(currIndex + chunkSize);

app/containers/GrafanaIFrame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const GrafanaIFrame: React.FC<Props> = ({ awsUrl }) => {
2626

2727
useEffect(() => {
2828
const url = `${awsUrl}/api/search?folderIds=0`
29-
console.log(awsUrl)
29+
// console.log(awsUrl)
3030
const fetchDashboards = async () => {
3131
const response = await fetch(url, {
3232
method: 'GET',

0 commit comments

Comments
 (0)