Skip to content

Commit b78aba1

Browse files
authored
Merge pull request #35 from oslabs-beta/ui-changes
UI changes
2 parents 3757168 + 31c505a commit b78aba1

File tree

6 files changed

+116
-84
lines changed

6 files changed

+116
-84
lines changed

src/components/css/metric.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
.legend-container {
22
display: flex;
33
flex-direction: column;
4-
align-items: flex-start;
54
width: 170px;
5+
align-items: center;
6+
margin-top: 5px;
67
}
78

9+
.legend-container p {
10+
margin-left: 8px;
11+
}
812
.aggregate-conatiner {
913
display: grid;
1014
grid-template-columns: 1fr 1fr 1fr;

src/components/css/styles.css

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
header {
1111
display: flex;
1212
justify-content: center;
13+
color: #042331;
1314
}
1415

1516
body {
@@ -19,7 +20,8 @@ body {
1920

2021
i {
2122
color: rgb(105, 105, 72);
22-
transition: 0.3s;
23+
transition: 0.7s;
24+
margin-right: 8px;
2325
}
2426

2527
ul {
@@ -60,7 +62,7 @@ h4 {
6062
padding: 0px 25px 0px 25px;
6163
min-width: 78vw;
6264
height: 100%;
63-
/* flex-wrap: wrap; */
65+
flex-wrap: wrap;
6466
overflow: scroll;
6567
border-radius: 0.3rem;
6668
background: #e1e4e6;
@@ -90,6 +92,10 @@ h4 {
9092
padding-bottom: 120px;
9193
}
9294

95+
.container-heading{
96+
margin: 10px;
97+
}
98+
9399
.settings-container.inner-box {
94100
border-radius: 0.7rem;
95101
}
@@ -110,6 +116,7 @@ h4 {
110116
}
111117

112118
.tabTitle {
119+
margin: 20px 15px;
113120
font-weight: bolder;
114121
font-size: 30px;
115122
}
@@ -120,10 +127,10 @@ h4 {
120127
}
121128

122129
.containers {
123-
background-color: #e1e4e6;
124-
max-height: 800px;
125130
display: flex;
126131
flex-wrap: wrap;
132+
background-color: #e1e4e6;
133+
max-height: 800px;
127134
overflow-y: auto;
128135
}
129136

@@ -155,7 +162,7 @@ h4 {
155162

156163
.box {
157164
margin-top: 20px;
158-
margin-left: 20px;
165+
margin-right: 20px;
159166
min-width: 250px;
160167
background: white;
161168
padding-bottom: 10px;
@@ -220,11 +227,13 @@ h4 {
220227
}
221228

222229
.tab ul li:hover {
223-
border-left: #e1e4e6 12px solid;
230+
/* border-left: #e1e4e6 5px solid; */
231+
224232
}
225233

226234
.tab ul li a:hover {
227235
font-weight: 900;
236+
color: #ecfffe;
228237
}
229238

230239
.tab ul li a:hover i {
@@ -379,12 +388,9 @@ h4 {
379388

380389
.users-container {
381390
border-radius: 0.5rem;
382-
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3),
383-
0 0 40px rgba(0, 0, 0, 0.1) inset;
384-
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3),
385-
0 0 40px rgba(0, 0, 0, 0.1) inset;
386-
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
387-
/* overflow: hidden; */
391+
box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
392+
-webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
393+
-moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
388394
}
389395

390396
.settings-container {
@@ -394,13 +400,11 @@ h4 {
394400
flex-direction: column;
395401
background-color: white;
396402
margin: 20px 0px 20px 0px;
397-
padding: 15px;
398-
-webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3),
399-
0 0 40px rgba(0, 0, 0, 0.1) inset;
400-
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3),
401-
0 0 40px rgba(0, 0, 0, 0.1) inset;
402-
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
403+
padding: 30px;
403404
border-radius: 0.5rem;
405+
box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
406+
-webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
407+
-moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
404408
line-height: 1.5rem;
405409
}
406410

@@ -790,4 +794,9 @@ h4 {
790794
padding: 1vh 1vw;
791795
width: 50vw;
792796
margin: 1vh 1vw 0 0;
797+
border-radius: 0.2rem;
798+
}
799+
800+
.user-table{
801+
height: calc(100% - 70px) !important;
793802
}

src/components/display/LineChartDisplay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ const LineChartDisplay = () => {
550550
return (
551551
<div>
552552
<div className="metric-section-title">
553-
<h3>Metrics Over Time</h3>
553+
<h3 className="container-heading">Metrics Over Time</h3>
554554
</div>
555555
<div className="metrics-options-form">
556556
<form

src/components/tabs/Metrics.js

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
/* eslint-disable no-tabs */
22
/* eslint-disable react/prop-types */
3-
import React from 'react';
4-
import { convertToMetricsArr } from '../helper/parseContainerFormat';
5-
import { Chart } from 'react-chartjs-2';
6-
import LineChartDisplay from '../display/LineChartDisplay';
7-
import { useSelector } from 'react-redux';
3+
import React from 'react'
4+
import { convertToMetricsArr } from '../helper/parseContainerFormat'
5+
import { Chart } from 'react-chartjs-2'
6+
import LineChartDisplay from '../display/LineChartDisplay'
7+
import { useSelector } from 'react-redux'
88

99
/**
1010
* Display general metrics
1111
*
1212
* @param {*} props
1313
*/
1414
const Metrics = (props) => {
15-
const hostStats = useSelector((state) => state.containersList.hostStats);
16-
const fullRunningList = props.runningList;
15+
const hostStats = useSelector((state) => state.containersList.hostStats)
16+
const fullRunningList = props.runningList
1717
// const result = convertToMetricsArr(props.runningList)
18-
const result = hostStats;
19-
const cpuData = 100 - result.cpuPerc; // .toFixed(2) // 60%
20-
const memoryData = 100 - result.memPerc; // .toFixed(2)
21-
const cpuThreshold = props.threshold[0];
22-
const memThreshold = props.threshold[1];
18+
const result = hostStats
19+
const cpuData = 100 - result.cpuPerc // .toFixed(2) // 60%
20+
const memoryData = 100 - result.memPerc // .toFixed(2)
21+
const cpuThreshold = props.threshold[0]
22+
const memThreshold = props.threshold[1]
2323

24-
let cpuFails = 0;
25-
let memFails = 0;
24+
let cpuFails = 0
25+
let memFails = 0
2626

2727
// used to monitor threshold and fail counts
2828
for (const each of fullRunningList) {
29-
const cpu = parseFloat(each['CPUPerc'].replace(/([%])+/g, ''));
30-
const memory = parseFloat(each['MemPerc'].replace(/([%])+/g, ''));
31-
if (cpu >= cpuThreshold) cpuFails++;
32-
if (memory >= memThreshold) memFails++;
29+
const cpu = parseFloat(each['CPUPerc'].replace(/([%])+/g, ''))
30+
const memory = parseFloat(each['MemPerc'].replace(/([%])+/g, ''))
31+
if (cpu >= cpuThreshold) cpuFails++
32+
if (memory >= memThreshold) memFails++
3333
}
3434

3535
const cpu = {
3636
labels: [`Available: ${cpuData}%`, `Usage: ${result.cpuPerc}%`],
3737
datasets: [
3838
{
3939
label: 'CPU',
40-
backgroundColor: ['rgba(44, 130, 201, 1)', 'rgba(19, 221, 29, 1)'],
40+
backgroundColor: ['#4594ce', '#67f267'],
4141
data: [cpuData, result.cpuPerc],
4242
},
4343
],
44-
};
44+
}
4545

4646
const memory = {
4747
labels: [`Available: ${memoryData}%`, `Usage: ${result.memPerc}%`],
4848
datasets: [
4949
{
5050
label: 'Memory',
51-
backgroundColor: ['rgba(44, 130, 201, 1)', 'rgba(19, 221, 29, 1)'],
51+
backgroundColor: ['#4594ce', '#67f267'],
5252
data: [memoryData, result.memPerc],
5353
},
5454
],
55-
};
55+
}
5656

5757
const memOptions = {
5858
responsive: true,
@@ -63,18 +63,18 @@ const Metrics = (props) => {
6363
legend: { display: false },
6464
datalabels: {
6565
formatter: (value, ctx) => {
66-
let sum = 0;
67-
const dataArr = ctx.chart.data.datasets[0].data;
66+
let sum = 0
67+
const dataArr = ctx.chart.data.datasets[0].data
6868
dataArr.map((data) => {
69-
sum += data;
70-
});
71-
const percentage = (value * 100) / sum + '%';
72-
return percentage;
69+
sum += data
70+
})
71+
const percentage = (value * 100) / sum + '%'
72+
return percentage
7373
},
7474
color: '#fff',
7575
},
7676
},
77-
};
77+
}
7878

7979
const cpuOptions = {
8080
responsive: true,
@@ -85,26 +85,26 @@ const Metrics = (props) => {
8585
legend: { display: false },
8686
datalabels: {
8787
formatter: (value, ctx) => {
88-
let sum = 0;
89-
const dataArr = ctx.chart.data.datasets[0].data;
88+
let sum = 0
89+
const dataArr = ctx.chart.data.datasets[0].data
9090
dataArr.map((data) => {
91-
sum += data;
92-
});
93-
const percentage = (value * 100) / sum + '%';
94-
return percentage;
91+
sum += data
92+
})
93+
const percentage = (value * 100) / sum + '%'
94+
return percentage
9595
},
9696
color: '#fff',
9797
},
9898
},
99-
};
99+
}
100100

101101
return (
102102
<div className="renderContainers">
103103
<div className="header">
104104
<h1 className="tabTitle">Metrics</h1>
105105
</div>
106106
<div className="metric-section-title">
107-
<h3>Host Metrics</h3>
107+
<h3 className="container-heading">Host Metrics</h3>
108108
</div>
109109
<div className="aggregate-conatiner">
110110
<div className="pieChart">
@@ -123,7 +123,10 @@ const Metrics = (props) => {
123123
</div>
124124
<div className="legend-section">
125125
<div className="usage-box"></div>
126-
<p className="legend-text"> Usage {Math.round(result.cpuPerc)}%</p>
126+
<p className="legend-text">
127+
{' '}
128+
Usage {Math.round(result.cpuPerc)}%
129+
</p>
127130
</div>
128131
</div>
129132
</div>
@@ -140,11 +143,17 @@ const Metrics = (props) => {
140143
<div className="legend-container">
141144
<div className="legend-section">
142145
<div className="avaliable-box"></div>
143-
<p className="legend-text"> Available {Math.round(memoryData)}%</p>
146+
<p className="legend-text">
147+
{' '}
148+
Available {Math.round(memoryData)}%
149+
</p>
144150
</div>
145151
<div className="legend-section">
146152
<div className="usage-box"></div>
147-
<p className="legend-text"> Usage {Math.round(result.memPerc)}%</p>
153+
<p className="legend-text">
154+
{' '}
155+
Usage {Math.round(result.memPerc)}%
156+
</p>
148157
</div>
149158
</div>
150159
</div>
@@ -178,7 +187,7 @@ const Metrics = (props) => {
178187
for more information on these metrics
179188
</p> */}
180189
</div>
181-
);
182-
};
190+
)
191+
}
183192

184-
export default Metrics;
193+
export default Metrics

0 commit comments

Comments
 (0)