Skip to content

Commit 74c96c5

Browse files
authored
Merge pull request #1013 from layer5io/workspaces
update workspace tables
2 parents 1879b9d + 0b6d1ad commit 74c96c5

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ interface ColumnConfigProps {
2929
handleCopyUrl: (type: string, name: string, id: string) => void;
3030
handleClone: (name: string, id: string) => void;
3131
handleShowDetails: (designId: string, designName: string) => void;
32+
handleOpenInDesigner?: (designId: string, designName: string) => void;
3233
handleDownload?: (design: Pattern) => void;
3334
getDownloadUrl?: (id: string) => string;
3435
isDownloadAllowed: boolean;
@@ -40,6 +41,7 @@ interface ColumnConfigProps {
4041
isFromWorkspaceTable?: boolean;
4142
isRemoveAllowed?: boolean;
4243
theme?: Theme;
44+
showPlaygroundActions: boolean;
4345
}
4446

4547
export const colViews: ColView[] = [
@@ -69,6 +71,8 @@ export const createDesignsColumnsConfig = ({
6971
isDownloadAllowed,
7072
isRemoveAllowed,
7173
theme,
74+
handleOpenInDesigner,
75+
showPlaygroundActions = true,
7276
isFromWorkspaceTable = false
7377
}: ColumnConfigProps): MUIDataTableColumn[] => {
7478
return [
@@ -209,6 +213,7 @@ export const createDesignsColumnsConfig = ({
209213
},
210214
{
211215
title: 'Open in Playground',
216+
hidden: showPlaygroundActions == false,
212217
onClick: () => {
213218
window.open(
214219
`https://playground.meshery.io/extension/meshmap?mode=${
@@ -221,6 +226,18 @@ export const createDesignsColumnsConfig = ({
221226
<KanvasIcon width={24} height={24} primaryFill={theme?.palette.icon.secondary} />
222227
)
223228
},
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+
224241
{
225242
title: isFromWorkspaceTable ? 'Remove Design' : 'Delete',
226243
disabled: isFromWorkspaceTable ? !isRemoveAllowed : !isDeleteAllowed,
@@ -231,7 +248,7 @@ export const createDesignsColumnsConfig = ({
231248
<L5DeleteIcon />
232249
)
233250
}
234-
];
251+
].filter((a) => a.hidden != true);
235252

236253
const publishAction = {
237254
title: 'Publish',

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ interface ViewsTableProps {
3939
isRemoveAllowed: boolean;
4040
isAssignAllowed: boolean;
4141
handleShowDetails: (viewId: string, viewName: string, filterType: string) => void;
42+
handleOpenInOperator?: (designId: string, viewName: string, filterType: string) => void;
43+
showPlaygroundActions?: boolean;
4244
}
4345

4446
const colViews: ColView[] = [

0 commit comments

Comments
 (0)