Skip to content

Commit c3e4762

Browse files
committed
Merge branch 'dev' into nathan
2 parents b02c863 + 2b11762 commit c3e4762

File tree

12 files changed

+152
-164
lines changed

12 files changed

+152
-164
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/ImagesUser.js renamed to src/components/tabs/ImagesUser.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/* eslint-disable react/prop-types */
2-
import React, { useState } from 'react';
2+
import React, { useState, MouseEvent } from 'react';
33
import * as helper from '../helper/commands';
4+
import { ImagesProps } from '../../../types';
45

56
/**
67
* Render Images of the user has
78
*
89
* @param {*} props
910
*/
10-
const Images = (props) => {
11+
const Images = (props: ImagesProps) => {
1112
const [repo, setRepo] = useState('');
1213

13-
const handleClick = (e) => {
14+
const handleClick = (e: MouseEvent) => {
1415
e.preventDefault();
1516
helper.pullImage(repo);
1617
};

src/components/tabs/Metrics.js renamed to src/components/tabs/Metrics.tsx

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,56 @@
11
/* eslint-disable no-tabs */
22
/* eslint-disable react/prop-types */
33
import React from 'react';
4-
import { convertToMetricsArr } from '../helper/parseContainerFormat';
54
import { Chart } from 'react-chartjs-2';
65
import LineChartDisplay from '../display/LineChartDisplay';
76
import { useSelector } from 'react-redux';
7+
import { MetricsProps } from '../../../types';
88

99
/**
1010
* Display general metrics
1111
*
1212
* @param {*} props
1313
*/
14-
const Metrics = (props) => {
15-
const hostStats = useSelector((state) => state.containersList.hostStats);
14+
const Metrics = (props: MetricsProps) => {
1615
const fullRunningList = props.runningList;
17-
// 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)
16+
const hostStats = useSelector((state: any) => state.containersList.hostStats);
17+
const cpuData = 100 - hostStats.cpuPerc;
18+
const memoryData = 100 - hostStats.memPerc;
2119
const cpuThreshold = props.threshold[0];
2220
const memThreshold = props.threshold[1];
2321

24-
let cpuFails = 0;
25-
let memFails = 0;
22+
let cpuFails = 0
23+
let memFails = 0
2624

2725
// used to monitor threshold and fail counts
2826
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++;
27+
const cpu = parseFloat(each['CPUPerc'].replace(/([%])+/g, ''))
28+
const memory = parseFloat(each['MemPerc'].replace(/([%])+/g, ''))
29+
if (cpu >= cpuThreshold) cpuFails++
30+
if (memory >= memThreshold) memFails++
3331
}
3432

3533
const cpu = {
36-
labels: [`Available: ${cpuData}%`, `Usage: ${result.cpuPerc}%`],
34+
labels: [`Available: ${cpuData}%`, `Usage: ${hostStats.cpuPerc}%`],
3735
datasets: [
3836
{
3937
label: 'CPU',
40-
backgroundColor: ['rgba(44, 130, 201, 1)', 'rgba(19, 221, 29, 1)'],
41-
data: [cpuData, result.cpuPerc],
38+
backgroundColor: ['#4594ce', '#67f267'],
39+
data: [cpuData, hostStats.cpuPerc],
4240
},
4341
],
44-
};
42+
}
4543

4644
const memory = {
47-
labels: [`Available: ${memoryData}%`, `Usage: ${result.memPerc}%`],
45+
labels: [`Available: ${memoryData}%`, `Usage: ${hostStats.memPerc}%`],
4846
datasets: [
4947
{
5048
label: 'Memory',
51-
backgroundColor: ['rgba(44, 130, 201, 1)', 'rgba(19, 221, 29, 1)'],
52-
data: [memoryData, result.memPerc],
49+
backgroundColor: ['#4594ce', '#67f267'],
50+
data: [memoryData, hostStats.memPerc],
5351
},
5452
],
55-
};
53+
}
5654

5755
const memOptions = {
5856
responsive: true,
@@ -62,10 +60,10 @@ const Metrics = (props) => {
6260
tooltips: { enabled: true, mode: 'index' },
6361
legend: { display: false },
6462
datalabels: {
65-
formatter: (value, ctx) => {
63+
formatter: (value: number, ctx: any) => {
6664
let sum = 0;
6765
const dataArr = ctx.chart.data.datasets[0].data;
68-
dataArr.map((data) => {
66+
dataArr.map((data: any) => {
6967
sum += data;
7068
});
7169
const percentage = (value * 100) / sum + '%';
@@ -74,7 +72,7 @@ const Metrics = (props) => {
7472
color: '#fff',
7573
},
7674
},
77-
};
75+
}
7876

7977
const cpuOptions = {
8078
responsive: true,
@@ -84,10 +82,10 @@ const Metrics = (props) => {
8482
tooltips: { enabled: false },
8583
legend: { display: false },
8684
datalabels: {
87-
formatter: (value, ctx) => {
85+
formatter: (value: number, ctx: any) => {
8886
let sum = 0;
8987
const dataArr = ctx.chart.data.datasets[0].data;
90-
dataArr.map((data) => {
88+
dataArr.map((data: any) => {
9189
sum += data;
9290
});
9391
const percentage = (value * 100) / sum + '%';
@@ -96,15 +94,15 @@ const Metrics = (props) => {
9694
color: '#fff',
9795
},
9896
},
99-
};
97+
}
10098

10199
return (
102100
<div className="renderContainers">
103101
<div className="header">
104102
<h1 className="tabTitle">Metrics</h1>
105103
</div>
106104
<div className="metric-section-title">
107-
<h3>Host Metrics</h3>
105+
<h3 className="container-heading">Host Metrics</h3>
108106
</div>
109107
<div className="aggregate-conatiner">
110108
<div className="pieChart">
@@ -123,7 +121,7 @@ const Metrics = (props) => {
123121
</div>
124122
<div className="legend-section">
125123
<div className="usage-box"></div>
126-
<p className="legend-text"> Usage {Math.round(result.cpuPerc)}%</p>
124+
<p className="legend-text"> Usage {Math.round(hostStats.cpuPerc)}%</p>
127125
</div>
128126
</div>
129127
</div>
@@ -140,11 +138,14 @@ const Metrics = (props) => {
140138
<div className="legend-container">
141139
<div className="legend-section">
142140
<div className="avaliable-box"></div>
143-
<p className="legend-text"> Available {Math.round(memoryData)}%</p>
141+
<p className="legend-text">
142+
{' '}
143+
Available {Math.round(memoryData)}%
144+
</p>
144145
</div>
145146
<div className="legend-section">
146147
<div className="usage-box"></div>
147-
<p className="legend-text"> Usage {Math.round(result.memPerc)}%</p>
148+
<p className="legend-text"> Usage {Math.round(hostStats.memPerc)}%</p>
148149
</div>
149150
</div>
150151
</div>
@@ -178,7 +179,7 @@ const Metrics = (props) => {
178179
for more information on these metrics
179180
</p> */}
180181
</div>
181-
);
182-
};
182+
)
183+
}
183184

184-
export default Metrics;
185+
export default Metrics

src/components/tabs/ProcessLogs.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)