WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit da4e355

Browse files
committed
fix: types
Signed-off-by: Amit Amrutiya <[email protected]>
1 parent be19b85 commit da4e355

File tree

9 files changed

+24
-23
lines changed

9 files changed

+24
-23
lines changed

src/constants/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export const DEFAULT_STROKE_WIDTH = '2';
99
export const CLOUD_URL = 'https://cloud.layer5.io';
1010
export const PLAYGROUND_MODES = {
1111
DESIGNER: 'design',
12-
VISUALIZER: 'visualize'
12+
OPERATOR: 'operator'
1313
} as const;

src/custom/CatalogDesignTable/CatalogDesignTable.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import _ from 'lodash';
3+
import { MUIDataTableColumn } from 'mui-datatables';
34
import { useCallback, useMemo, useRef } from 'react';
45
import { PublishIcon } from '../../icons';
56
import { CHARCOAL, useTheme } from '../../theme';
@@ -14,7 +15,7 @@ import UnpublishTooltipIcon from './UnpublishTooltipIcon';
1415
interface CatalogDesignsTableProps {
1516
patterns: Pattern[];
1617
filter: any;
17-
columns: Array<any>;
18+
columns: MUIDataTableColumn[];
1819
totalCount: number;
1920
sortOrder: string;
2021
setSortOrder: (order: string) => void;
@@ -63,7 +64,7 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
6364
return new Date(date).toLocaleDateString('en-US', dateOptions);
6465
}, []);
6566

66-
const processedColumns = useMemo(() => {
67+
const processedColumns: MUIDataTableColumn[] = useMemo(() => {
6768
return columns.map((col) => {
6869
const newCol = { ...col };
6970
if (!newCol.options) newCol.options = {};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
3+
export const getColumnValue = (tableMeta: any, targetColumn: string): any => {
4+
const rowData = tableMeta.tableData[tableMeta.rowIndex];
5+
return (rowData as any)[targetColumn] || '';
6+
};

src/custom/CatalogDesignTable/helper.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/custom/ResponsiveDataTable.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Theme, ThemeProvider, createTheme, styled } from '@mui/material';
2-
import MUIDataTable from 'mui-datatables';
2+
import MUIDataTable, { MUIDataTableColumn } from 'mui-datatables';
33
import React, { useCallback } from 'react';
44
import { Checkbox, Collapse, ListItemIcon, ListItemText, Menu, MenuItem } from '../base';
55
import { ShareIcon } from '../icons';
@@ -278,10 +278,10 @@ export interface Column {
278278

279279
export interface ResponsiveDataTableProps {
280280
data: string[][];
281-
columns: Column[];
281+
columns: MUIDataTableColumn[];
282282
options?: object;
283-
tableCols?: Column[];
284-
updateCols?: ((columns: Column[]) => void) | undefined;
283+
tableCols?: MUIDataTableColumn[];
284+
updateCols?: ((columns: MUIDataTableColumn[]) => void) | undefined;
285285
columnVisibility: Record<string, boolean> | undefined;
286286
theme?: object;
287287
colViews?: ColView[];

src/custom/TeamTable/TeamTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { Grid, TableCell } from '@mui/material';
3+
import { MUIDataTableColumn } from 'mui-datatables';
34
import { ErrorBoundary } from '../ErrorBoundary/ErrorBoundary.js';
45
import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx/index.js';
56
import ResponsiveDataTable from '../ResponsiveDataTable.js';
@@ -11,7 +12,7 @@ interface TeamTableProps {
1112
columnVisibility: Record<string, boolean>;
1213
colViews: ColView[];
1314
tableCols: any[];
14-
columns: any[];
15+
columns: MUIDataTableColumn[];
1516
updateCols: (cols: any) => void;
1617
isRemoveFromTeamAllowed: boolean;
1718
org_id: string;

src/custom/TeamTable/TeamTableConfiguration.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
import { MUIDataTableColumn } from 'mui-datatables';
23
import { useState } from 'react';
34
import { DeleteIcon, EditIcon } from '../../icons';
45
import LogoutIcon from '../../icons/Logout/LogOutIcon';
@@ -114,7 +115,7 @@ export default function TeamTableConfiguration({
114115
['actions', 'xs']
115116
];
116117

117-
const columns = [
118+
const columns: MUIDataTableColumn[] = [
118119
{
119120
name: 'id',
120121
label: 'ID',

src/custom/UsersTable/UsersTable.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
import { MUIDataTableColumn } from 'mui-datatables';
23
import { useRef, useState } from 'react';
34
import { Avatar, Box, Grid, Tooltip, Typography } from '../../base';
45
import { EditIcon, PersonIcon } from '../../icons';
@@ -121,7 +122,7 @@ const UsersTable: React.FC<UsersTableProps> = ({
121122
}
122123
};
123124

124-
const getValidColumnValue = (rowData: any, columnName: string, columns: any) => {
125+
const getValidColumnValue = (rowData: any, columnName: string, columns: MUIDataTableColumn[]) => {
125126
const columnIndex = columns.findIndex((column: any) => column.name === columnName);
126127
return rowData[columnIndex];
127128
};
@@ -233,7 +234,7 @@ const UsersTable: React.FC<UsersTableProps> = ({
233234
// ["actions", "xs"]
234235
];
235236

236-
const columns: any[] = [
237+
const columns: MUIDataTableColumn[] = [
237238
{
238239
name: 'user_id',
239240
label: 'User ID',
@@ -445,7 +446,7 @@ const UsersTable: React.FC<UsersTableProps> = ({
445446
}
446447
];
447448

448-
const [tableCols, updateCols] = useState<any[]>(columns);
449+
const [tableCols, updateCols] = useState<MUIDataTableColumn[]>(columns);
449450

450451
const [columnVisibility] = useState<Record<string, boolean>>(() => {
451452
const showCols: Record<string, boolean> = updateVisibleColumns(colViews, width);

src/custom/Workspaces/EnvironmentTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
3-
import { MUIDataTableMeta } from 'mui-datatables';
3+
import { MUIDataTableColumn, MUIDataTableMeta } from 'mui-datatables';
44
import React, { useState } from 'react';
55
import { Accordion, AccordionDetails, AccordionSummary, Typography } from '../../base';
66
import { DeleteIcon, EnvironmentIcon } from '../../icons';
@@ -80,7 +80,7 @@ const EnvironmentTable: React.FC<EnvironmentTableProps> = ({
8080
});
8181
const { width } = useWindowDimensions();
8282
const [unassignEnvironmentFromWorkspace] = useUnassignEnvironmentFromWorkspaceMutation();
83-
const columns: any[] = [
83+
const columns: MUIDataTableColumn[] = [
8484
{
8585
name: 'id',
8686
label: 'ID',

0 commit comments

Comments
 (0)