1+ import RemoveCircleIcon from '@mui/icons-material/RemoveCircle' ;
12import { Theme } from '@mui/material' ;
23import { MUIDataTableColumn , MUIDataTableMeta } from 'mui-datatables' ;
34import { Typography } from '../../base' ;
@@ -28,6 +29,7 @@ interface ColumnConfigProps {
2829 handleCopyUrl : ( type : string , name : string , id : string ) => void ;
2930 handleClone : ( name : string , id : string ) => void ;
3031 handleShowDetails : ( designId : string , designName : string ) => void ;
32+ handleOpenInDesigner ?: ( designId : string , designName : string ) => void ;
3133 handleDownload ?: ( design : Pattern ) => void ;
3234 getDownloadUrl ?: ( id : string ) => string ;
3335 isDownloadAllowed : boolean ;
@@ -39,6 +41,7 @@ interface ColumnConfigProps {
3941 isFromWorkspaceTable ?: boolean ;
4042 isRemoveAllowed ?: boolean ;
4143 theme ?: Theme ;
44+ showPlaygroundActions : boolean ;
4245}
4346
4447export const colViews : ColView [ ] = [
@@ -68,6 +71,8 @@ export const createDesignsColumnsConfig = ({
6871 isDownloadAllowed,
6972 isRemoveAllowed,
7073 theme,
74+ handleOpenInDesigner,
75+ showPlaygroundActions = true ,
7176 isFromWorkspaceTable = false
7277} : ColumnConfigProps ) : MUIDataTableColumn [ ] => {
7378 return [
@@ -208,6 +213,7 @@ export const createDesignsColumnsConfig = ({
208213 } ,
209214 {
210215 title : 'Open in Playground' ,
216+ hidden : showPlaygroundActions == false ,
211217 onClick : ( ) => {
212218 window . open (
213219 `https://playground.meshery.io/extension/meshmap?mode=${
@@ -220,13 +226,29 @@ export const createDesignsColumnsConfig = ({
220226 < KanvasIcon width = { 24 } height = { 24 } primaryFill = { theme ?. palette . icon . secondary } />
221227 )
222228 } ,
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+
223241 {
224- title : isFromWorkspaceTable ? 'Move Design' : 'Delete' ,
242+ title : isFromWorkspaceTable ? 'Remove Design' : 'Delete' ,
225243 disabled : isFromWorkspaceTable ? ! isRemoveAllowed : ! isDeleteAllowed ,
226244 onClick : ( ) => handleDeleteModal ( rowData ) ( ) ,
227- icon : < L5DeleteIcon />
245+ icon : isFromWorkspaceTable ? (
246+ < RemoveCircleIcon style = { { color : theme ?. palette . icon . default } } />
247+ ) : (
248+ < L5DeleteIcon />
249+ )
228250 }
229- ] ;
251+ ] . filter ( ( a ) => a ?. hidden != true ) ;
230252
231253 const publishAction = {
232254 title : 'Publish' ,
@@ -243,6 +265,7 @@ export const createDesignsColumnsConfig = ({
243265 } ;
244266
245267 const cloneAction = {
268+ hidden : false ,
246269 title : 'Clone' ,
247270 onClick : ( ) => handleClone ( rowData ?. name , rowData ?. id ) ,
248271 icon : < CopyIcon width = { 24 } height = { 24 } fill = { theme ?. palette . icon . secondary } />
0 commit comments