1
- import React , { useEffect , useState } from " react" ;
2
- import { useDispatch } from " react-redux" ;
3
- import { buildOptionsObj } from " ../helper/processLogHelper" ;
4
- import { getLogs } from " ../helper/commands" ;
5
- import * as actions from " ../../redux/actions/actions" ;
6
- import " ./ProcessLogsCard" ;
1
+ import React , { useEffect , useState } from ' react' ;
2
+ import { useDispatch } from ' react-redux' ;
3
+ import { buildOptionsObj } from ' ../helper/processLogHelper' ;
4
+ import { getLogs } from ' ../helper/commands' ;
5
+ import * as actions from ' ../../redux/actions/actions' ;
6
+ import ' ./ProcessLogsCard' ;
7
7
8
8
import store from "../../renderer/store" ;
9
9
import { DataGrid } from "@mui/x-data-grid" ;
@@ -25,7 +25,7 @@ const ProcessLogsTable = () => {
25
25
26
26
// grab clicked container
27
27
const urlString = window . location . href ;
28
- const containerID = urlString . split ( "/" ) ;
28
+ const containerID = urlString . split ( '/' ) ;
29
29
const id = containerID [ containerID . length - 1 ] ;
30
30
31
31
// access runningList from state - store has issue with runningList, ignore until updated
@@ -36,7 +36,7 @@ const ProcessLogsTable = () => {
36
36
const [ rows , setRows ] = useState ( [ ] ) ;
37
37
38
38
const [ csvData , setCsvData ] = useState ( [
39
- [ " container" , " type" , " time" , " message" ] ,
39
+ [ ' container' , ' type' , ' time' , ' message' ] ,
40
40
] ) ;
41
41
42
42
const [ logs , setLogs ] = useState ( { stdout : [ ] , stderr : [ ] } ) ;
@@ -63,10 +63,10 @@ const ProcessLogsTable = () => {
63
63
} ;
64
64
65
65
const columns = [
66
- { field : " container" , headerName : " Container" , width : 150 } ,
67
- { field : " type" , headerName : " Log Type" , width : 120 } ,
68
- { field : " time" , headerName : " Timestamp" , width : 200 } ,
69
- { field : " message" , headerName : " Message" , width : 550 } ,
66
+ { field : ' container' , headerName : ' Container' , width : 150 } ,
67
+ { field : ' type' , headerName : ' Log Type' , width : 120 } ,
68
+ { field : ' time' , headerName : ' Timestamp' , width : 200 } ,
69
+ { field : ' message' , headerName : ' Message' , width : 550 } ,
70
70
] ;
71
71
72
72
const createContainerCheckboxes = ( currId : string ) => {
@@ -142,12 +142,12 @@ const ProcessLogsTable = () => {
142
142
) ;
143
143
newRows . push ( {
144
144
container : currCont . Name ,
145
- type : " stdout" ,
146
- time : log [ " timeStamp" ] ,
147
- message : log [ " logMsg" ] ,
145
+ type : ' stdout' ,
146
+ time : log [ ' timeStamp' ] ,
147
+ message : log [ ' logMsg' ] ,
148
148
id : Math . random ( ) * 100 ,
149
149
} ) ;
150
- newCSV . push ( [ currCont . Name , " stdout" , log [ " timeStamp" ] , log [ " logMsg" ] ] ) ;
150
+ newCSV . push ( [ currCont . Name , ' stdout' , log [ ' timeStamp' ] , log [ ' logMsg' ] ] ) ;
151
151
} ) ;
152
152
153
153
stderr . forEach ( ( log , index ) => {
@@ -156,16 +156,16 @@ const ProcessLogsTable = () => {
156
156
) ;
157
157
newRows . push ( {
158
158
container : currCont . Name ,
159
- type : " stderr" ,
160
- time : log [ " timeStamp" ] ,
161
- message : log [ " logMsg" ] ,
159
+ type : ' stderr' ,
160
+ time : log [ ' timeStamp' ] ,
161
+ message : log [ ' logMsg' ] ,
162
162
id : parseInt ( `stderr ${ index } ` ) ,
163
163
} ) ;
164
- newCSV . push ( [ currCont . Name , " stderr" , log [ " timeStamp" ] , log [ " logMsg" ] ] ) ;
164
+ newCSV . push ( [ currCont . Name , ' stderr' , log [ ' timeStamp' ] , log [ ' logMsg' ] ] ) ;
165
165
} ) ;
166
166
167
167
setRows ( newRows as keyof typeof setRows ) ;
168
- setCsvData ( [ [ " container" , " type" , " time" , " message" ] , ...newCSV ] ) ;
168
+ setCsvData ( [ [ ' container' , ' type' , ' time' , ' message' ] , ...newCSV ] ) ;
169
169
}
170
170
} ;
171
171
@@ -174,30 +174,54 @@ const ProcessLogsTable = () => {
174
174
< div className = "settings-container" >
175
175
< form >
176
176
< h1 style = { { margin : 10 } } > Container Process Logs</ h1 >
177
-
177
+ < h3 >
178
+ < a
179
+ style = { { margin : 5 } }
180
+ target = "_blank"
181
+ rel = "noreferrer"
182
+ href = "https://docs.docker.com/engine/reference/commandline/logs/"
183
+ >
184
+ Click here
185
+ </ a > { '' }
186
+ for more information on logs
187
+ </ h3 >
188
+ < br > </ br >
178
189
< input
179
190
style = { { margin : 5 } }
180
191
type = "radio"
181
192
id = "sinceInput"
182
193
name = "logOption"
183
194
/>
184
- < label style = { { margin : 5 } } htmlFor = "sinceInput" >
195
+ < label
196
+ style = { { margin : 5 } }
197
+ htmlFor = "sinceInput"
198
+ >
185
199
Since
186
200
</ label >
187
- < input type = "text" id = "sinceText" />
201
+ < input
202
+ type = "text"
203
+ id = "sinceText"
204
+ />
188
205
< br > </ br >
189
206
< input
190
207
style = { { margin : 5 } }
191
208
type = "radio"
192
209
id = "tailInput"
193
210
name = "logOption"
194
211
/>
195
- < label style = { { margin : 5 } } htmlFor = "tailInput" >
212
+ < label
213
+ style = { { margin : 5 } }
214
+ htmlFor = "tailInput"
215
+ >
196
216
Tail
197
217
</ label >
198
- < input style = { { marginLeft : 14 } } type = "text" id = "tailText" />
218
+ < input
219
+ style = { { marginLeft : 14 } }
220
+ type = "text"
221
+ id = "tailText"
222
+ />
199
223
200
- < FormGroup style = { { display : " flex" , flexDirection : " row" } } >
224
+ < FormGroup style = { { display : ' flex' , flexDirection : ' row' } } >
201
225
{ containerSelectors } { /** Checkboxes for running containers */ }
202
226
</ FormGroup >
203
227
< Button
@@ -226,9 +250,9 @@ const ProcessLogsTable = () => {
226
250
>
227
251
< CSVLink
228
252
style = { {
229
- textDecoration : " none" ,
230
- color : " white" ,
231
- fontFamily : " Roboto, Helvetica, Arial, sans-serif" ,
253
+ textDecoration : ' none' ,
254
+ color : ' white' ,
255
+ fontFamily : ' Roboto, Helvetica, Arial, sans-serif' ,
232
256
} }
233
257
data = { csvData }
234
258
>
@@ -239,16 +263,16 @@ const ProcessLogsTable = () => {
239
263
240
264
< div
241
265
className = "process-logs-container"
242
- style = { { height : 660 , width : " 100%" } }
266
+ style = { { height : 660 , width : ' 100%' } }
243
267
>
244
268
< DataGrid
245
269
key = "DataGrid"
246
270
rows = { rows }
247
271
columns = { columns }
248
- getRowHeight = { ( ) => " auto" }
272
+ getRowHeight = { ( ) => ' auto' }
249
273
initialState = { {
250
274
sorting : {
251
- sortModel : [ { field : " time" , sort : " desc" } ] , // default sorts table by time
275
+ sortModel : [ { field : ' time' , sort : ' desc' } ] , // default sorts table by time
252
276
} ,
253
277
} }
254
278
/>
0 commit comments