1
+ import RemoveCircleIcon from '@mui/icons-material/RemoveCircle' ;
1
2
import { Theme } from '@mui/material' ;
2
3
import { MUIDataTableColumn , MUIDataTableMeta } from 'mui-datatables' ;
3
4
import { Typography } from '../../base' ;
@@ -28,6 +29,7 @@ interface ColumnConfigProps {
28
29
handleCopyUrl : ( type : string , name : string , id : string ) => void ;
29
30
handleClone : ( name : string , id : string ) => void ;
30
31
handleShowDetails : ( designId : string , designName : string ) => void ;
32
+ handleOpenInDesigner ?: ( designId : string , designName : string ) => void ;
31
33
handleDownload ?: ( design : Pattern ) => void ;
32
34
getDownloadUrl ?: ( id : string ) => string ;
33
35
isDownloadAllowed : boolean ;
@@ -39,6 +41,7 @@ interface ColumnConfigProps {
39
41
isFromWorkspaceTable ?: boolean ;
40
42
isRemoveAllowed ?: boolean ;
41
43
theme ?: Theme ;
44
+ showPlaygroundActions : boolean ;
42
45
}
43
46
44
47
export const colViews : ColView [ ] = [
@@ -68,6 +71,8 @@ export const createDesignsColumnsConfig = ({
68
71
isDownloadAllowed,
69
72
isRemoveAllowed,
70
73
theme,
74
+ handleOpenInDesigner,
75
+ showPlaygroundActions = true ,
71
76
isFromWorkspaceTable = false
72
77
} : ColumnConfigProps ) : MUIDataTableColumn [ ] => {
73
78
return [
@@ -208,6 +213,7 @@ export const createDesignsColumnsConfig = ({
208
213
} ,
209
214
{
210
215
title : 'Open in Playground' ,
216
+ hidden : showPlaygroundActions == false ,
211
217
onClick : ( ) => {
212
218
window . open (
213
219
`https://playground.meshery.io/extension/meshmap?mode=${
@@ -220,13 +226,29 @@ export const createDesignsColumnsConfig = ({
220
226
< KanvasIcon width = { 24 } height = { 24 } primaryFill = { theme ?. palette . icon . secondary } />
221
227
)
222
228
} ,
229
+
230
+ {
231
+ hidden : ! handleOpenInDesigner ,
232
+ title : 'Open in Designer' ,
233
+ // disabled : !handleOpenInDesigner,
234
+ onClick : ( ) =>
235
+ handleOpenInDesigner && handleOpenInDesigner ( rowData ?. id , rowData ?. name ) ,
236
+ icon : (
237
+ < KanvasIcon width = { 24 } height = { 24 } primaryFill = { theme ?. palette . icon . secondary } />
238
+ )
239
+ } ,
240
+
223
241
{
224
- title : isFromWorkspaceTable ? 'Move Design' : 'Delete' ,
242
+ title : isFromWorkspaceTable ? 'Remove Design' : 'Delete' ,
225
243
disabled : isFromWorkspaceTable ? ! isRemoveAllowed : ! isDeleteAllowed ,
226
244
onClick : ( ) => handleDeleteModal ( rowData ) ( ) ,
227
- icon : < L5DeleteIcon />
245
+ icon : isFromWorkspaceTable ? (
246
+ < RemoveCircleIcon style = { { color : theme ?. palette . icon . default } } />
247
+ ) : (
248
+ < L5DeleteIcon />
249
+ )
228
250
}
229
- ] ;
251
+ ] . filter ( ( a ) => a ?. hidden != true ) ;
230
252
231
253
const publishAction = {
232
254
title : 'Publish' ,
@@ -243,6 +265,7 @@ export const createDesignsColumnsConfig = ({
243
265
} ;
244
266
245
267
const cloneAction = {
268
+ hidden : false ,
246
269
title : 'Clone' ,
247
270
onClick : ( ) => handleClone ( rowData ?. name , rowData ?. id ) ,
248
271
icon : < CopyIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
0 commit comments