@@ -7,7 +7,7 @@ import * as helper from "../helper/commands";
7
7
import { DataGrid } from "@mui/x-data-grid" ;
8
8
import { FormControlLabel , Checkbox } from "@mui/material" ;
9
9
import { RootState } from "../../renderer/store" ;
10
- import { AnyAction } from "redux" ;
10
+ import { auxObjType , obType } from '../../../types' ;
11
11
12
12
/**
13
13
* Displays linegraph and github metrics
@@ -26,10 +26,10 @@ const LineChartDisplay = () => {
26
26
const readIO = useSelector ( ( state : RootState ) => state . graphs [ "graphReadIO" ] ) ;
27
27
const axis = useSelector ( ( state : RootState ) => state . graphs [ "graphAxis" ] ) ;
28
28
const runningList = useSelector (
29
- ( state : RootState ) => state . containersList . runningList
29
+ ( state : RootState ) => state . containersList [ ' runningList' ]
30
30
) ;
31
31
const stoppedList = useSelector (
32
- ( state : RootState ) => state . containersList . stoppedList
32
+ ( state : RootState ) => state . containersList [ ' stoppedList' ]
33
33
) ;
34
34
35
35
const dispatch = useDispatch ( ) ;
@@ -64,7 +64,7 @@ const LineChartDisplay = () => {
64
64
labels : axis ,
65
65
datasets : cpu ,
66
66
} ;
67
- const writtenIOObj = {
67
+ const writtenIOObj = {
68
68
labels : axis ,
69
69
datasets : writtenIO ,
70
70
} ;
@@ -145,27 +145,7 @@ const LineChartDisplay = () => {
145
145
146
146
const containerMetrics = await getContainerMetrics ( ) ;
147
147
148
- interface auxObjType {
149
- container ?: ContainerInterface ;
150
- currentContainer ?: any ;
151
- containerName ?: string ;
152
- }
153
-
154
- interface ContainerInterface {
155
- memory ?: any ;
156
- cpu ?: any ;
157
- writtenIO ?: any ;
158
- readIO ?: any ;
159
- }
160
-
161
- // interface ContainerNameInterface{
162
-
163
- // }
164
-
165
- //const container: keyof auxObjType = 'container'
166
-
167
148
const auxObj : auxObjType = { } ;
168
- //const container: keyof typeof auxObj;
169
149
Object . keys ( activeContainers ) . forEach ( ( container ) => {
170
150
auxObj [ container as keyof typeof auxObj ] = {
171
151
memory : buildLineGraphObj ( container ) ,
@@ -207,7 +187,7 @@ const LineChartDisplay = () => {
207
187
buildAxis ( timeStamp ) ;
208
188
} ) ;
209
189
210
- let longest = 0 ; // 32
190
+ let longest = 0 ;
211
191
212
192
Object . keys ( auxObj ) . forEach ( ( containerName : string ) => {
213
193
if (
@@ -248,9 +228,6 @@ const LineChartDisplay = () => {
248
228
} ) ;
249
229
} ;
250
230
251
- interface obType {
252
- containerName ?: any ;
253
- }
254
231
255
232
//Fetching the data from github API and turning it into an object with keys of objects that contain the data of each container
256
233
const fetchGitData = async ( containerName : string ) => {
@@ -273,7 +250,7 @@ const LineChartDisplay = () => {
273
250
new URLSearchParams ( {
274
251
since : `${ date } ` ,
275
252
} ) ;
276
- //need an actual url to test this, right now it can't connect
253
+ //need a url to test this, right now it can't connect
277
254
const data = await fetch ( url ) ;
278
255
const jsonData = await data . json ( ) ;
279
256
@@ -322,10 +299,6 @@ const LineChartDisplay = () => {
322
299
{ field : "message" , headerName : "Message" , width : 525 , align : "left" } ,
323
300
] ;
324
301
325
- // interface elType {
326
- // name: {};
327
- // }
328
-
329
302
gitData = gitUrls . map ( ( el , index : any ) => {
330
303
const name = Object . keys ( el ) ;
331
304
type rowsType = any [ ] ;
@@ -399,9 +372,9 @@ const LineChartDisplay = () => {
399
372
const result : any [ ] = [ ] ;
400
373
const completeContainerList = [ ...runningList , ...stoppedList ] ;
401
374
completeContainerList . forEach ( ( container , index ) => {
402
- const containerNameKey = container . Name
403
- ? container . Name
404
- : container . Names ;
375
+ const containerNameKey = container [ ' Name' ]
376
+ ? container [ ' Name' ]
377
+ : container [ ' Names' ] ;
405
378
result . push (
406
379
< FormControlLabel
407
380
key = { `formControl-${ index } ` }
0 commit comments