File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,14 @@ import React from 'react';
4
4
import { Chart } from 'react-chartjs-2' ;
5
5
import LineChartDisplay from '../display/LineChartDisplay' ;
6
6
import { useSelector } from 'react-redux' ;
7
- import { ContainerProps , hostStats , containersList } from '../../../types' ;
8
- import { RootState , AppDispatch } from '../../renderer/store' ;
7
+ import { MetricsProps } from '../../../types' ;
9
8
10
9
/**
11
10
* Display general metrics
12
11
*
13
12
* @param {* } props
14
13
*/
15
- const Metrics = ( props : any ) => {
14
+ const Metrics = ( props : MetricsProps ) => {
16
15
const fullRunningList = props . runningList ;
17
16
const hostStats = useSelector ( ( state : any ) => state . containersList . hostStats ) ;
18
17
const cpuData = 100 - hostStats . cpuPerc ;
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ const AdminView = () => {
57
57
const runningList = useSelector ( ( state : StateType ) => state . containersList . runningList ) ;
58
58
const stoppedList = useSelector ( ( state : StateType ) => state . containersList . stoppedList ) ;
59
59
const imagesList = useSelector ( ( state : StateType ) => state . images . imagesList ) ;
60
+ const { mem_threshold, cpu_threshold } = useSelector ( ( state : StateType ) => state . session ) ;
60
61
// const networkList = useSelector((state: StateType) => state.networkList.networkList);
61
62
62
63
const arrayOfVolumeNames = useSelector (
@@ -249,7 +250,7 @@ const AdminView = () => {
249
250
< Route
250
251
path = '/metrics'
251
252
element = {
252
- < Metrics runningList = { runningList } />
253
+ < Metrics runningList = { runningList } threshold = { [ cpu_threshold , mem_threshold ] } />
253
254
}
254
255
/>
255
256
< Route
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ const UserView = () => {
56
56
const runningList = useSelector ( ( state : StateType ) => state . containersList . runningList ) ;
57
57
const stoppedList = useSelector ( ( state : StateType ) => state . containersList . stoppedList ) ;
58
58
const imagesList = useSelector ( ( state : StateType ) => state . images . imagesList ) ;
59
+ const { mem_threshold, cpu_threshold } = useSelector ( ( state : StateType ) => state . session ) ;
59
60
// const networkList = useSelector((state: StateType) => state.networkList.networkList);
60
61
const arrayOfVolumeNames = useSelector ( ( state : StateType ) => state . volumeList . arrayOfVolumeNames ) ;
61
62
const volumeContainersList = useSelector ( ( state : StateType ) => state . volumeList . volumeContainersList ) ;
@@ -237,7 +238,7 @@ const UserView = () => {
237
238
< Route
238
239
path = '/metrics'
239
240
element = {
240
- < Metrics runningList = { runningList } />
241
+ < Metrics runningList = { runningList } threshold = { [ cpu_threshold , mem_threshold ] } />
241
242
}
242
243
/>
243
244
Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ export type ContainerProps = {
44
44
hostStats ?: hostStats [ ] ;
45
45
}
46
46
47
+ export type MetricsProps = {
48
+ runningList : any [ ] ;
49
+ threshold : any [ ] ;
50
+ }
51
+
47
52
// Stopped containers have a Names key and running containers have a Name key
48
53
export type ContainerType = {
49
54
Name ?: string ;
@@ -251,7 +256,7 @@ interface session {
251
256
export interface containersList {
252
257
runningList : any [ ] ,
253
258
stoppedList : any [ ] ,
254
- hostStats : any ,
259
+ hostStats : string [ ] ,
255
260
}
256
261
257
262
interface imagesList {
You can’t perform that action at this time.
0 commit comments