Skip to content

Commit 34986a4

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/babel/runtime-7.27.0
2 parents f6b2f5a + 48f5837 commit 34986a4

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import RemoveCircleIcon from '@mui/icons-material/RemoveCircle';
12
import { Theme } from '@mui/material';
23
import { MUIDataTableColumn, MUIDataTableMeta } from 'mui-datatables';
34
import { 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

4447
export 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} />

src/custom/Workspaces/DesignTable.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import useDesignAssignment from './hooks/useDesignAssignment';
2121
import { L5EditIcon, TableHeader, TableRightActionHeader } from './styles';
2222
export interface DesignTableProps {
2323
workspaceId: string;
24+
isKanvasEnabled: boolean;
2425
workspaceName: string;
2526
designsOfWorkspace: any;
2627
meshModelModelsData: any;
@@ -56,6 +57,8 @@ export interface DesignTableProps {
5657
isAssignAllowed: boolean;
5758
isRemoveAllowed: boolean;
5859
setDesignSearch: (value: string) => void;
60+
handleOpenInDesigner?: (designId: string, designName: string) => void;
61+
showPlaygroundActions?: boolean;
5962
}
6063

6164
export interface PublishModalState {
@@ -96,7 +99,9 @@ const DesignTable: React.FC<DesignTableProps> = ({
9699
isAssignAllowed,
97100
isRemoveAllowed,
98101
useGetWorkspaceDesignsQuery,
99-
setDesignSearch
102+
setDesignSearch,
103+
handleOpenInDesigner,
104+
showPlaygroundActions = true
100105
}) => {
101106
const [publishModal, setPublishModal] = useState<PublishModalState>({
102107
open: false,
@@ -132,7 +137,9 @@ const DesignTable: React.FC<DesignTableProps> = ({
132137
isUnpublishAllowed,
133138
isFromWorkspaceTable: true,
134139
isRemoveAllowed,
135-
theme
140+
theme,
141+
handleOpenInDesigner,
142+
showPlaygroundActions
136143
});
137144

138145
const [publishSchema, setPublishSchema] = useState<{

src/custom/Workspaces/WorkspaceViewsTable.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
import RemoveCircleIcon from '@mui/icons-material/RemoveCircle';
23
import { MUIDataTableColumn, MUIDataTableMeta } from 'mui-datatables';
34
import React, { useState } from 'react';
45
import { Box, Typography } from '../../base';
5-
import { DeleteIcon, EnvironmentIcon, ViewIcon } from '../../icons';
6+
import { EnvironmentIcon, ViewIcon } from '../../icons';
67
import { useTheme } from '../../theme';
78
import { NameDiv } from '../CatalogDesignTable/style';
89
import { RESOURCE_TYPES } from '../CatalogDetail/types';
@@ -38,6 +39,8 @@ interface ViewsTableProps {
3839
isRemoveAllowed: boolean;
3940
isAssignAllowed: boolean;
4041
handleShowDetails: (viewId: string, viewName: string, filterType: string) => void;
42+
handleOpenInOperator?: (designId: string, viewName: string, filterType: string) => void;
43+
showPlaygroundActions?: boolean;
4144
}
4245

4346
const colViews: ColView[] = [
@@ -227,7 +230,7 @@ const WorkspaceViewsTable: React.FC<ViewsTableProps> = ({
227230
customBodyRender: (_: string, tableMeta: MUIDataTableMeta) => (
228231
<IconWrapper disabled={!isRemoveAllowed}>
229232
<TooltipIcon
230-
id={`delete_team-${tableMeta.rowIndex}`}
233+
id={`delete_view-${tableMeta.rowIndex}`}
231234
title="Remove View"
232235
onClick={() => {
233236
isRemoveAllowed &&
@@ -238,7 +241,7 @@ const WorkspaceViewsTable: React.FC<ViewsTableProps> = ({
238241
}}
239242
iconType="delete"
240243
>
241-
<DeleteIcon height={28} width={28} fill={theme.palette.icon.default} />
244+
<RemoveCircleIcon style={{ color: theme?.palette.icon.default }} />{' '}
242245
</TooltipIcon>
243246
</IconWrapper>
244247
)

0 commit comments

Comments
 (0)