@@ -15,7 +15,9 @@ import {snackActions} from '../../utilities/Snackbar';
15
15
import { MythicStyledTooltip } from '../../MythicComponents/MythicStyledTooltip' ;
16
16
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
17
17
import MythicResizableGrid from '../../MythicComponents/MythicResizableGrid' ;
18
- import { faList , faTrashAlt , faSkullCrossbones , faCamera , faSyringe , faFolder , faFolderOpen , faFileArchive , faCog , faFileWord , faFileExcel , faFilePowerpoint , faFilePdf , faDatabase , faKey , faFileCode , faDownload , faUpload , faFileImage , faCopy , faBoxOpen , faFileAlt } from '@fortawesome/free-solid-svg-icons' ;
18
+ import { faList , faTrashAlt , faSkullCrossbones , faCamera , faSyringe , faFolder , faFolderOpen , faFileArchive , faCog ,
19
+ faFileWord , faFileExcel , faFilePowerpoint , faFilePdf , faDatabase , faKey , faFileCode , faDownload , faUpload ,
20
+ faFileImage , faCopy , faBoxOpen , faFileAlt , faCirclePlus , faCheck , faSquareXmark , faRotate } from '@fortawesome/free-solid-svg-icons' ;
19
21
import { Dropdown , DropdownMenuItem } from "../../MythicComponents/MythicNestedMenus" ;
20
22
21
23
const onCopyToClipboard = ( data ) => {
@@ -28,6 +30,14 @@ const onCopyToClipboard = (data) => {
28
30
}
29
31
export const getIconName = ( iconName ) => {
30
32
switch ( iconName . toLowerCase ( ) ) {
33
+ case "add" :
34
+ return faCirclePlus ;
35
+ case "x" :
36
+ return faSquareXmark ;
37
+ case "check" :
38
+ return faCheck ;
39
+ case "refresh" :
40
+ return faRotate ;
31
41
case "openfolder" :
32
42
case "folder" :
33
43
return faFolderOpen ;
@@ -79,6 +89,24 @@ export const getIconName = (iconName) => {
79
89
return faFileAlt ;
80
90
}
81
91
}
92
+ export const getIconColor = ( theme , color ) => {
93
+ switch ( color ) {
94
+ case "info" :
95
+ return theme . palette . info . main ;
96
+ case "warning" :
97
+ return theme . palette . warning . main ;
98
+ case "primary" :
99
+ return theme . palette . primary . main ;
100
+ case "error" :
101
+ return theme . palette . error . main ;
102
+ case "success" :
103
+ return theme . palette . success . main ;
104
+ case "secondary" :
105
+ return theme . palette . success . main ;
106
+ default :
107
+ return color ;
108
+ }
109
+ }
82
110
const doubleClickRow = ( ) => {
83
111
84
112
}
@@ -214,6 +242,7 @@ const ResponseDisplayTableActionCell = ({cellData, callback_id, rowData}) => {
214
242
) ;
215
243
}
216
244
const ResponseDisplayTableActionCellButton = ( { cellData, callback_id} ) => {
245
+ const theme = useTheme ( ) ;
217
246
const [ openButton , setOpenButton ] = React . useState ( false ) ;
218
247
const [ openTaskingButton , setOpenTaskingButton ] = React . useState ( false ) ;
219
248
const [ openDictionaryButton , setOpenDictionaryButton ] = React . useState ( false ) ;
@@ -272,7 +301,7 @@ const ResponseDisplayTableActionCellButton = ({cellData, callback_id}) => {
272
301
< MythicStyledTooltip title = { cellData ?. button ?. hoverText || "View Data" } >
273
302
< Button size = "small" color = "info"
274
303
onClick = { ( ) => setOpenButton ( true ) } disabled = { cellData ?. button ?. disabled || false }
275
- startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : cellData ?. button ?. startIconColor } } /> : null }
304
+ startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : getIconColor ( theme , cellData ?. button ?. startIconColor ) } } /> : null }
276
305
style = { { ...actionCellButtonStyle } }
277
306
> { cellData ?. button ?. name } </ Button >
278
307
</ MythicStyledTooltip >
@@ -291,7 +320,7 @@ const ResponseDisplayTableActionCellButton = ({cellData, callback_id}) => {
291
320
< MythicStyledTooltip title = { cellData ?. button ?. hoverText || "View Data" } >
292
321
< Button size = "small" color = "info"
293
322
onClick = { ( ) => setOpenButton ( true ) } disabled = { cellData ?. button ?. disabled || false }
294
- startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : cellData ?. button ?. startIconColor } } /> : null }
323
+ startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : getIconColor ( theme , cellData ?. button ?. startIconColor ) } } /> : null }
295
324
style = { { ...actionCellButtonStyle } }
296
325
> { cellData ?. button ?. name } </ Button >
297
326
</ MythicStyledTooltip >
@@ -308,7 +337,7 @@ const ResponseDisplayTableActionCellButton = ({cellData, callback_id}) => {
308
337
< MythicStyledTooltip title = { cellData ?. button ?. hoverText || "View Data" } >
309
338
< Button size = "small" color = "info"
310
339
onClick = { ( ) => setOpenButton ( true ) } disabled = { cellData ?. button ?. disabled || false }
311
- startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : cellData ?. button ?. startIconColor || "" } } /> : null }
340
+ startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : getIconColor ( theme , cellData ?. button ?. startIconColor || "" ) } } /> : null }
312
341
style = { { ...actionCellButtonStyle } }
313
342
> { cellData ?. button ?. name } </ Button >
314
343
</ MythicStyledTooltip >
@@ -326,7 +355,7 @@ const ResponseDisplayTableActionCellButton = ({cellData, callback_id}) => {
326
355
< React . Fragment >
327
356
< MythicStyledTooltip title = { cellData ?. button ?. hoverText || "Submit Task" } >
328
357
< Button size = "small" onClick = { ( ) => setOpenTaskingButton ( true ) } disabled = { cellData ?. button ?. disabled || false } color = "warning"
329
- startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : cellData ?. button ?. startIconColor || "" } } /> : null }
358
+ startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : getIconColor ( theme , cellData ?. button ?. startIconColor || "" ) } } /> : null }
330
359
style = { { ...actionCellButtonStyle } }
331
360
> { cellData ?. button ?. name ? cellData ?. button ?. name : cellData ?. button ?. startIcon ? null : "Submit Task" } </ Button >
332
361
</ MythicStyledTooltip >
@@ -376,7 +405,7 @@ const ResponseDisplayTableActionCellButton = ({cellData, callback_id}) => {
376
405
}
377
406
< Button size = "small" color = "info" ref = { dropdownAnchorRef }
378
407
onClick = { ( ) => setOpenDropdownButton ( true ) } disabled = { cellData ?. button ?. disabled || false }
379
- startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : cellData ?. button ?. startIconColor || "" } } /> : null }
408
+ startIcon = { cellData ?. button ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( cellData ?. button ?. startIcon ) } style = { { color : cellData ?. button ?. disabled ? "unset" : getIconColor ( theme , cellData ?. button ?. startIconColor || "" ) } } /> : null }
380
409
style = { { ...actionCellButtonStyle } }
381
410
> { cellData ?. button ?. name || " " } </ Button >
382
411
< ClickAwayListener onClickAway = { handleClose } mouseEvent = { "onMouseDown" } >
@@ -392,7 +421,7 @@ const ResponseDisplayTableActionCellButton = ({cellData, callback_id}) => {
392
421
onClick = { ( event ) => handleMenuItemClick ( event , index ) }
393
422
>
394
423
< MythicStyledTooltip title = { option ?. hoverText || ( option . type === "task" ? "Task an Agent" : "Display Data" ) } >
395
- { option ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( option ?. startIcon ) } style = { { color : option ?. startIconColor || "" , marginRight : "5px" } } /> : null }
424
+ { option ?. startIcon ? < FontAwesomeIcon icon = { getIconName ( option ?. startIcon ) } style = { { color : getIconColor ( theme , cellData ?. button ?. startIconColor || "" ) , marginRight : "5px" } } /> : null }
396
425
{ option . name }
397
426
</ MythicStyledTooltip >
398
427
</ DropdownMenuItem >
0 commit comments