Skip to content

Commit

Permalink
Revert "Merge pull request layer5io#916 from Karan-Palan/feat/all-col…
Browse files Browse the repository at this point in the history
…umns-tables-sortable-filterable"

This reverts commit a84ed7d, reversing
changes made to b652f90.
  • Loading branch information
amitamrutiya committed Mar 4, 2025
1 parent 9b212ae commit 12efa42
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function ResponsiveDataTable({ data, columns, options = {}, ...props }) {
year: 'numeric'
};

return new Intl.DateTimeFormat('en-US', dateOptions).format(date);
return new Intl.DateTimeFormat('un-US', dateOptions).format(date);
};

const updatedOptions = {
Expand All @@ -37,21 +37,14 @@ export function ResponsiveDataTable({ data, columns, options = {}, ...props }) {
break;
}
}
},
filter: true,
sort: true,
responsive: 'standard',
serverSide: false,
}
};

useEffect(() => {
columns?.forEach((col) => {
if (!col.options) {
col.options = {};
}

col.options.sort = true;
col.options.filter = true;
col.options.display = columnVisibility[col.name];

if (
Expand Down
4 changes: 0 additions & 4 deletions src/custom/CatalogDesignTable/CatalogDesignTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
return columns.map((col) => {
const newCol = { ...col };
if (!newCol.options) newCol.options = {};
newCol.options.sort = true;
newCol.options.filter = true;
newCol.options.display = columnVisibility[col.name];
if (
[
Expand Down Expand Up @@ -149,8 +147,6 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
rowsPerPage: pageSize,
page,
elevation: 0,
sort: true,
filter: true,
sortOrder: {
name: sortOrder.split(' ')[0],
direction: sortOrder.split(' ')[1]
Expand Down
38 changes: 19 additions & 19 deletions src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,15 @@ export const createDesignsColumnsConfig = ({
name: 'id',
label: 'ID',
options: {
filter: true,
sort: true,
searchable: true,
filter: false,
customBodyRender: (value: string) => <ConditionalTooltip value={value} maxLength={10} />
}
},
{
name: 'name',
label: 'Name',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
customBodyRender: (value: string, tableMeta: MUIDataTableMeta) => {
Expand All @@ -97,7 +95,7 @@ export const createDesignsColumnsConfig = ({
name: 'first_name',
label: 'Author',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
customBodyRender: (_, tableMeta: MUIDataTableMeta) => {
Expand All @@ -122,7 +120,7 @@ export const createDesignsColumnsConfig = ({
name: 'created_at',
label: 'Created At',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
setCellHeaderProps: () => {
Expand All @@ -134,7 +132,7 @@ export const createDesignsColumnsConfig = ({
name: 'updated_at',
label: 'Updated At',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
setCellHeaderProps: () => {
Expand All @@ -146,36 +144,38 @@ export const createDesignsColumnsConfig = ({
name: 'visibility',
label: 'Visibility',
options: {
filter: true,
sort: true,
filter: false,
sort: false,
searchable: true
}
},
{
name: 'user_id',
label: 'User ID',
options: {
filter: true,
sort: true,
searchable: true
filter: false,
sort: false,
searchable: false
}
},

{
name: 'email',
label: 'Email',
label: 'email',
options: {
filter: true,
sort: true,
searchable: true
filter: false,
sort: false,
searchable: false
}
},

{
name: 'actions',
label: 'Actions',
options: {
filter: true,
sort: true,
searchable: true,
filter: false,
sort: false,
searchable: false,
setCellHeaderProps: () => ({ align: 'center' as const }),
setCellProps: () => ({ align: 'center' as const }),
customBodyRender: function CustomBody(_, tableMeta: MUIDataTableMeta) {
Expand Down
28 changes: 14 additions & 14 deletions src/custom/CatalogDesignTable/columnConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ export const createDesignColumns = ({
name: 'id',
label: 'ID',
options: {
filter: true,
filter: false,
customBodyRender: (value: string) => <ConditionalTooltip value={value} maxLength={10} />
}
},
{
name: 'name',
label: 'Name',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
customBodyRender: (value: string, tableMeta: MUIDataTableMeta) => {
Expand Down Expand Up @@ -122,7 +122,7 @@ export const createDesignColumns = ({
name: 'first_name',
label: 'Author',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
customBodyRender: (_: string, tableMeta: MUIDataTableMeta) => {
Expand Down Expand Up @@ -154,7 +154,7 @@ export const createDesignColumns = ({
name: 'created_at',
label: 'Created At',
options: {
filter: true,
filter: false,
sort: true,
searchable: true
}
Expand All @@ -163,7 +163,7 @@ export const createDesignColumns = ({
name: 'updated_at',
label: 'Updated At',
options: {
filter: true,
filter: false,
sort: true,
searchable: true
}
Expand All @@ -173,7 +173,7 @@ export const createDesignColumns = ({
label: 'Type',
options: {
filter: true,
sort: true,
sort: false,
searchable: true
}
},
Expand All @@ -182,56 +182,56 @@ export const createDesignColumns = ({
label: 'Class',
options: {
filter: true,
sort: true,
sort: false,
searchable: true
}
},
{
name: 'view_count',
label: 'Opens',
options: {
filter: true,
filter: false,
sort: true
}
},
{
name: 'download_count',
label: 'Downloads',
options: {
filter: true,
filter: false,
sort: true
}
},
{
name: 'clone_count',
label: 'Clones',
options: {
filter: true,
filter: false,
sort: true
}
},
{
name: 'deployment_count',
label: 'Deploys',
options: {
filter: true,
filter: false,
sort: true
}
},
{
name: 'share_count',
label: 'Shares',
options: {
filter: true,
filter: false,
sort: true
}
},
{
name: 'actions',
label: 'Actions',
options: {
filter: true,
sort: true,
filter: false,
sort: false,
searchable: false,
setCellHeaderProps: () => ({ align: 'center' }),
setCellProps: () => ({ align: 'center' }),
Expand Down
8 changes: 0 additions & 8 deletions src/custom/TeamTable/TeamTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ const TeamTable: React.FC<TeamTableProps> = ({
useRemoveUserFromTeamMutation
}) => {
const theme = useTheme();
columns.forEach((col) => {
if (!col.options) {
col.options = {};
}
col.options.sort = true;
col.options.filter = true;
col.options.display = columnVisibility[col.name] ?? true;
});
return (
<ErrorBoundary>
<ResponsiveDataTable
Expand Down
28 changes: 12 additions & 16 deletions src/custom/TeamTable/TeamTableConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export default function TeamTableConfiguration({
name: 'id',
label: 'ID',
options: {
filter: true,
sort: true,
filter: false,
sort: false,
searchable: false,
customBodyRender: (value: string) => <FormatId id={value} />
}
Expand All @@ -132,7 +132,7 @@ export default function TeamTableConfiguration({
name: 'name',
label: 'Name',
options: {
filter: true,
filter: false,
sort: true,
searchable: true
}
Expand All @@ -141,17 +141,17 @@ export default function TeamTableConfiguration({
name: 'description',
label: 'Description',
options: {
filter: true,
filter: false,
sort: true,
searchable: true,
searchable: false,
customBodyRender: (value: string) => <ConditionalTooltip value={value} maxLength={30} />
}
},
{
name: 'owner',
label: 'Owner',
options: {
filter: true,
filter: false,
sort: true,
searchable: true
}
Expand All @@ -160,7 +160,7 @@ export default function TeamTableConfiguration({
name: 'created_at',
label: 'Created At',
options: {
filter: true,
filter: false,
sort: true,
searchable: false,
sortDescFirst: true
Expand All @@ -170,7 +170,7 @@ export default function TeamTableConfiguration({
name: 'updated_at',
label: 'Updated At',
options: {
filter: true,
filter: false,
sort: true,
searchable: false,
sortDescFirst: true
Expand Down Expand Up @@ -200,8 +200,8 @@ export default function TeamTableConfiguration({
name: 'actions',
label: 'Actions',
options: {
filter: true,
sort: true,
filter: false,
sort: false,
searchable: false,
customBodyRender: (_: string, tableMeta: MUIDataTableMeta) => {
if (bulkSelect || tableMeta.rowData[4].Valid) {
Expand Down Expand Up @@ -282,7 +282,7 @@ export default function TeamTableConfiguration({
const ExpandedRowIdx = teams?.findIndex((team) => team.id === teamId);

const options = {
filter: true,
filter: false,
selectableRows: 'none' as const,
filterType: 'dropdown' as const,
expandableRows: true,
Expand Down Expand Up @@ -404,11 +404,7 @@ export default function TeamTableConfiguration({

return {
columns,
tableOptions: {
...options,
filter: true,
sort: true
},
tableOptions: options,
tableCols,
updateCols,
columnVisibility,
Expand Down
Loading

0 comments on commit 12efa42

Please sign in to comment.