Skip to content

Commit 412937c

Browse files
authored
Merge branch 'master' into M-DEV-1/add-sistent-instructions
2 parents fc7dcb9 + d43e72c commit 412937c

File tree

23 files changed

+888
-503
lines changed

23 files changed

+888
-503
lines changed

package-lock.json

Lines changed: 24 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"commitlint": "commitlint --edit",
1919
"coverage": "jest --coverage",
2020
"dev": "NODE_ENV=development tsup",
21+
"dev:watch": "NODE_ENV=development tsup",
2122
"format:check": "prettier --check \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
2223
"format:write": "prettier --write \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
2324
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
@@ -99,6 +100,7 @@
99100
"@emotion/react": "^11.11.3",
100101
"@emotion/styled": "^11.11.0",
101102
"@layer5/meshery-design-embed": "^0.4.0",
103+
"@layer5/schemas": "^0.0.6-14",
102104
"@mui/material": "^5.15.11",
103105
"@types/mui-datatables": "*",
104106
"billboard.js": "^3.14.3",
@@ -108,6 +110,7 @@
108110
"mui-datatables": "*",
109111
"re-resizable": "^6.10.3",
110112
"react-draggable": "^4.4.6",
111-
"react-share": "^5.1.0"
113+
"react-share": "^5.1.0",
114+
"use-debounce": "^10.0.4"
112115
}
113116
}

site/package-lock.json

Lines changed: 49 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"postcss": "^8.4.31",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0",
24-
"react-router-dom": "^6.17.0",
24+
"react-router-dom": "^7.5.2",
2525
"tailwindcss": "^3.3.5"
2626
},
2727
"overrides": {

src/constants/constants.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,24 @@ export const CARIBBEAN_GREEN_FILL = '#00D3A9';
77
export const DEFAULT_STROKE = '#000';
88
export const DEFAULT_STROKE_WIDTH = '2';
99
export const CLOUD_URL = 'https://cloud.layer5.io';
10-
export const PLAYGROUND_MODES = {
10+
11+
export const KANVAS_MODE = {
1112
DESIGNER: 'design',
1213
OPERATOR: 'operator'
1314
} as const;
15+
16+
export const PLAYGROUND_MODES = KANVAS_MODE;
17+
18+
export const VISIBILITY = {
19+
PUBLIC: 'public',
20+
PRIVATE: 'private'
21+
};
22+
23+
export const RESOURCE_TYPE = {
24+
FILTER: 'filter',
25+
DESIGN: 'design',
26+
CATALOG: 'catalog',
27+
VIEW: 'view'
28+
} as const;
29+
30+
export type ResourceType = (typeof RESOURCE_TYPE)[keyof typeof RESOURCE_TYPE];

src/custom/CatalogDesignTable/CatalogDesignTable.tsx

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import _ from 'lodash';
33
import { MUIDataTableColumn } from 'mui-datatables';
4-
import { useCallback, useMemo, useRef } from 'react';
4+
import { useCallback, useMemo, useRef, useState } from 'react';
55
import { PublishIcon } from '../../icons';
66
import { CHARCOAL } from '../../theme';
7-
import { FormattedTime } from '../../utils';
87
import { Pattern } from '../CustomCatalog/CustomCard';
98
import { ErrorBoundary } from '../ErrorBoundary';
109
import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx/responsive-column';
@@ -56,37 +55,7 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
5655
handleBulkpatternsDataUnpublishModal
5756
}) => {
5857
const modalRef = useRef<PromptRef>(null);
59-
60-
const processedColumns: MUIDataTableColumn[] = useMemo(() => {
61-
return columns.map((col) => {
62-
const newCol = { ...col };
63-
if (!newCol.options) newCol.options = {};
64-
newCol.options.display = columnVisibility[col.name];
65-
if (
66-
[
67-
'updated_at',
68-
'created_at',
69-
'deleted_at',
70-
'last_login_time',
71-
'joined_at',
72-
'last_run',
73-
'next_run'
74-
].includes(col.name)
75-
) {
76-
newCol.options.customBodyRender = (value: any) => {
77-
if (!value || value === 'NA') return <>NA</>;
78-
if (typeof value === 'object' && 'Valid' in value) {
79-
if (value.Valid && value.Time) {
80-
return <FormattedTime date={value.Time} />;
81-
}
82-
return <>NA</>;
83-
}
84-
return <FormattedTime date={value.Time} />;
85-
};
86-
}
87-
return newCol;
88-
});
89-
}, [columns, columnVisibility]);
58+
const [tableCols, updateCols] = useState(columns);
9059

9160
const handleTableChange = useCallback(
9261
(action: string, tableState: any) => {
@@ -176,22 +145,19 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
176145
]
177146
);
178147

179-
if (!processedColumns.length) {
180-
return null;
181-
}
182-
183148
return (
184149
<ErrorBoundary>
185150
<PromptComponent ref={modalRef} />
186151
<ResponsiveDataTable
187-
columns={processedColumns}
152+
columns={columns}
188153
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
189154
//@ts-ignore
190155
data={patterns || []}
191156
rowsPerPageOptions={rowsPerPageOptions}
192157
options={options}
193158
colViews={colViews}
194-
tableCols={processedColumns}
159+
tableCols={tableCols}
160+
updateCols={updateCols}
195161
columnVisibility={columnVisibility}
196162
/>
197163
</ErrorBoundary>

0 commit comments

Comments
 (0)