Skip to content

Commit ee49801

Browse files
committed
card title wraped, aws graph container added
1 parent 9a8d995 commit ee49801

File tree

7 files changed

+90
-39
lines changed

7 files changed

+90
-39
lines changed

app/components/Occupied.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const Occupied = React.memo(() => {
8080

8181
// Handle clicks on Application cards
8282
const handleClick = (event: ClickEvent, selectedApp: string, i: number) => {
83+
console.log(selectedApp, i);
8384
if (delRef.current[i] && !delRef.current[i].contains(event.target)) {
8485
setIndex(i);
8586
setApp(selectedApp);
@@ -311,7 +312,7 @@ const Occupied = React.memo(() => {
311312
/>
312313
<CardContent>
313314
{/* <p id="databaseName">Name:</p> */}
314-
<Typography id="databaseName" className={classes.fontStyles}>
315+
<Typography noWrap id="databaseName" className={classes.fontStyles}>
315316
{application[0]}
316317
</Typography>
317318
<p id="serviceName">Service:</p>

app/components/TransferColumns.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ const TransferColumns = React.memo(() => {
6262
} else if (eventMetricsReady) {
6363
setMetricsPool(eventMetrics);
6464
}
65-
}
65+
}
6666
// JJ-ADDITION (CAN ALSO JUST ADD OR OPERATOR TO ABOVE CONDITIONAL)
6767
else if (service === 'kubernetesmetrics') {
6868
if (healthDataList && healthDataList.length > 0) {
6969
setMetricsPool(getMetrics('health', healthDataList));
7070
} else if (healthMetricsReady) {
7171
setMetricsPool(healthMetrics);
7272
}
73-
}
74-
else if (!service.includes('kafkametrics')) {
73+
} else if (!service.includes('kafkametrics')) {
7574
if (healthDataList && healthDataList.length > 0) {
7675
setMetricsPool(getMetrics('health', healthDataList));
7776
} else if (healthMetricsReady) {
@@ -129,7 +128,7 @@ const TransferColumns = React.memo(() => {
129128
// setSelectedMetrics
130129
const temp: any[] = [];
131130
const categorySet = new Set();
132-
console.log('targetKeys is: ', targetKeys)
131+
console.log('targetKeys is: ', targetKeys);
133132
for (let i = 0; i < targetKeys.length; i++) {
134133
const str: string = targetKeys[i];
135134
const strArr: string[] = str.split(' | ');
@@ -149,12 +148,12 @@ const TransferColumns = React.memo(() => {
149148
temp.push(newCategory);
150149
}
151150
}
152-
console.log('temp is: ', temp);
151+
console.log('SelectedMetrics is: ', temp);
153152
setSelectedMetrics(temp);
154153
};
155154

156155
const columns = [
157-
{ field: 'id', headerName: 'ID', width: 100},
156+
{ field: 'id', headerName: 'ID', width: 100 },
158157
{
159158
field: 'tag',
160159
headerName: 'Category',
@@ -168,7 +167,7 @@ const TransferColumns = React.memo(() => {
168167
editable: true,
169168
},
170169
];
171-
170+
172171
const rows: any[] = [];
173172

174173
metricsPool.forEach((el, index) => {
@@ -182,17 +181,19 @@ const TransferColumns = React.memo(() => {
182181
const selectedRows: any[] = [];
183182

184183
targetKeys.forEach(el => {
185-
selectedRows.push(<li style={{marginLeft: '30px', marginTop: '5px', color: currentMode.color}}>{el}</li>)
186-
})
184+
selectedRows.push(
185+
<li style={{ marginLeft: '30px', marginTop: '5px', color: currentMode.color }}>{el}</li>
186+
);
187+
});
187188

188189
return (
189190
<>
190191
<div id="getChartsContainer">
191-
<Button id="getCharts" onClick={getCharts} variant='contained' color='primary'>
192+
<Button id="getCharts" onClick={getCharts} variant="contained" color="primary">
192193
Get Charts
193194
</Button>
194195
</div>
195-
<div id='transferTest'>
196+
<div id="transferTest">
196197
<div style={{ height: '500px', width: '100%' }}>
197198
<DataGrid
198199
style={currentMode}
@@ -205,18 +206,18 @@ const TransferColumns = React.memo(() => {
205206
const metrics: any[] = [];
206207
metricIndeces.forEach(el => {
207208
metrics.push(metricsPool[el].key);
208-
})
209+
});
209210
setTargetKeys(metrics);
210211
}}
211212
/>
212213
</div>
213-
{selectedRows.length > 0 && <h3 style={{marginTop: '20px', color: currentMode.color}}>Selected Rows:</h3>}
214-
<ol id="selectedRows">
215-
{selectedRows}
216-
</ol>
214+
{selectedRows.length > 0 && (
215+
<h3 style={{ marginTop: '20px', color: currentMode.color }}>Selected Rows:</h3>
216+
)}
217+
<ol id="selectedRows">{selectedRows}</ol>
217218
</div>
218219
</>
219220
);
220221
});
221222

222-
export default TransferColumns;
223+
export default TransferColumns;

app/containers/AWSGraphsContainer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* eslint-disable no-bitwise */
2+
import React, { useEffect, useState, useContext } from 'react';
3+
import { useNavigate, useParams } from 'react-router-dom';
4+
import { ApplicationContext } from '../context/ApplicationContext';
5+
import * as DashboardContext from '../context/DashboardContext';
6+
import lightAndDark from '../components/Styling';

app/containers/GraphsContainer.tsx

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ interface Params {
3838
// }
3939

4040
const GraphsContainer: React.FC = React.memo(props => {
41-
4241
const navigate = useNavigate();
4342
const { app, service } = useParams<keyof Params>() as Params;
4443
const [live, setLive] = useState<boolean>(false);
@@ -59,11 +58,11 @@ const GraphsContainer: React.FC = React.memo(props => {
5958
const serviceArray = service.split(' ');
6059
// You would think you should add "kubernetesmetrics" into the below for consistency's sake but it makes it
6160
// not work correctly, so it has been omitted
62-
const healthServiceArray = serviceArray.filter((value: string) => (value !== 'kafkametrics')
63-
);
61+
const healthServiceArray = serviceArray.filter((value: string) => value !== 'kafkametrics');
6462
if (live) {
6563
setIntervalID(
6664
setInterval(() => {
65+
//HERE fetching health data when on Live
6766
fetchCommsData(app, live);
6867
fetchHealthData(healthServiceArray);
6968
if (service.includes('kafkametrics')) {
@@ -97,8 +96,7 @@ const GraphsContainer: React.FC = React.memo(props => {
9796
};
9897
}, [service, live]);
9998

100-
const currentMode =
101-
mode === 'light' ? lightAndDark.lightModeText : lightAndDark.darkModeText;
99+
const currentMode = mode === 'light' ? lightAndDark.lightModeText : lightAndDark.darkModeText;
102100

103101
const routing = (route: string) => {
104102
if (location.href.includes('communications')) {
@@ -180,21 +178,25 @@ const GraphsContainer: React.FC = React.memo(props => {
180178
Docker
181179
</button>
182180
)}
183-
{commsData.length > 0 && <button
184-
id="communication-button"
185-
className={chart === 'communications' ? 'selected' : undefined}
186-
onClick={() => {
187-
if (!location.href.includes('communications')) setPrevRoute(services.join(' '));
188-
setChart('communications');
189-
}}
190-
key="3"
191-
>
192-
Communication
193-
</button>}
181+
{commsData.length > 0 && (
182+
<button
183+
id="communication-button"
184+
className={chart === 'communications' ? 'selected' : undefined}
185+
onClick={() => {
186+
if (!location.href.includes('communications')) setPrevRoute(services.join(' '));
187+
setChart('communications');
188+
}}
189+
key="3"
190+
>
191+
Communication
192+
</button>
193+
)}
194194
<button
195195
id="modify-metrics-button"
196196
className={chart === 'modifyMetrics' ? 'selected' : undefined}
197-
onClick={() => {routing('modifyMetrics')}}
197+
onClick={() => {
198+
routing('modifyMetrics');
199+
}}
198200
key="4"
199201
>
200202
Modify Metrics
@@ -212,7 +214,12 @@ const GraphsContainer: React.FC = React.memo(props => {
212214
</div>
213215
) : (
214216
<div className="graphs">
215-
{chart === 'all' && <div className="transferColumns"><h2 style={currentMode}>Search Your Metrics to Display</h2><TransferColumns /></div>}
217+
{chart === 'all' && (
218+
<div className="transferColumns">
219+
<h2 style={currentMode}>Search Your Metrics to Display</h2>
220+
<TransferColumns />
221+
</div>
222+
)}
216223
{chart.startsWith('health_') && (
217224
<HealthContainer
218225
colourGenerator={stringToColour}

app/containers/HealthContainer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const HealthContainer: React.FC<HealthContainerProps> = React.memo(props => {
2828
let counter: number = 0;
2929
const datalist: any[] = healthData.healthDataList;
3030
const timelist: any[] = healthData.healthTimeList;
31+
console.log('datalist in healthcontainer is:', datalist); //array of healthDataList
32+
console.log('timelist in healthcontainer is:', timelist);
3133

3234
if (healthData && datalist && timelist && datalist.length > 0 && timelist.length > 0) {
3335
let selectedMetricsList: string[] = [];
@@ -49,6 +51,8 @@ const HealthContainer: React.FC<HealthContainerProps> = React.memo(props => {
4951
const metric: string = Object.keys(serviceMetric)[0];
5052
const valueList = Object.values(serviceMetric)[0];
5153
const newTimeList: any = getTime(timelist, serviceName, metric, categoryName);
54+
// console.log('valueList is', valueList); -> 50 values in an array
55+
// console.log('newTimeList array is:', newTimeList); -> 50 values in an array
5256
if (selectedMetricsList.includes(metric)) {
5357
const newHealthChart = (
5458
<HealthChart

app/stylesheets/Occupied.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,10 @@ select:-webkit-autofill:focus {
557557
}
558558

559559
#databaseName {
560-
margin-top: 20px;
560+
margin-top: 14px;
561561
margin-bottom: 0;
562-
color: $header;
563-
font-size: 36px;
562+
font-size: 40px;
563+
width: 280px;
564564
}
565565

566566
#serviceName {

settings.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,37 @@
55
"email": "",
66
"services": [],
77
"mode": "light"
8+
},
9+
"ty": {
10+
"username": "ty",
11+
"password": "$2b$12$1QNK6Y7tVuwxfUKCJfJlneik0m/oJsbrsWtDhkBi8sW13MhZmsZgK",
12+
"email": "[email protected]",
13+
"services": [
14+
[
15+
"test",
16+
"MongoDB",
17+
"mongodb+srv://taylrzhang:[email protected]/?retryWrites=true&w=majority",
18+
"",
19+
"Microservices",
20+
"Feb 8, 2023 1:48 PM"
21+
],
22+
[
23+
"test cluster",
24+
"SQL",
25+
"not real",
26+
"",
27+
"AWS",
28+
"Feb 13, 2023 11:23 AM"
29+
],
30+
[
31+
"realllllonggggname",
32+
"SQL",
33+
"dsfadsf",
34+
"",
35+
"AWS",
36+
"Feb 13, 2023 11:46 AM"
37+
]
38+
],
39+
"mode": "light"
840
}
941
}

0 commit comments

Comments
 (0)