Skip to content

Commit

Permalink
fix: wrong sort direction
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Amrutiya <[email protected]>
  • Loading branch information
amitamrutiya committed Dec 16, 2024
1 parent 4cf7f84 commit 53b8d24
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/custom/CatalogDesignTable/CatalogDesignTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface CatalogDesignsTableProps {
setPage: (page: number) => void;
columnVisibility: Record<string, boolean>;
colViews: ColView[];
rowsPerPageOptions?: number[];
handleBulkDeleteModal: (patterns: Pattern[], modalRef: React.RefObject<PromptRef>) => void;
setSearch?: (search: string) => void;
handleBulkpatternsDataUnpublishModal: (
Expand All @@ -49,6 +50,7 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
colViews = [],
handleBulkDeleteModal,
setSearch,
rowsPerPageOptions = [10, 25, 50, 100],
handleBulkpatternsDataUnpublishModal
}) => {
const theme = useTheme();
Expand Down Expand Up @@ -195,7 +197,7 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
data={patterns || []}
rowsPerPageOptions={[15, 30, 45, 60, 75]}
rowsPerPageOptions={rowsPerPageOptions}
options={options}
colViews={colViews}
tableCols={processedColumns}
Expand Down
2 changes: 1 addition & 1 deletion src/custom/CatalogDesignTable/DesignTableColumnConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const createDesignsColumnsConfig = ({
},
{
name: 'name',
label: 'Pattern Name',
label: 'Name',
options: {
filter: false,
sort: true,
Expand Down
18 changes: 13 additions & 5 deletions src/custom/TeamTable/TeamTableConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export default function TeamTableConfiguration({
['name', 'xs'],
['description', 'm'],
['owner', 'l'],
['created_at', 'xl'],
['created_at', 'na'],
['updated_at', 'xl'],
['deleted_at', 'na'],
['actions', 'xs']
];
Expand Down Expand Up @@ -165,6 +166,16 @@ export default function TeamTableConfiguration({
sortDescFirst: true
}
},
{
name: 'updated_at',
label: 'Updated At',
options: {
filter: false,
sort: true,
searchable: false,
sortDescFirst: true
}
},
{
name: 'deleted_at',
label: 'Deleted At',
Expand Down Expand Up @@ -290,10 +301,7 @@ export default function TeamTableConfiguration({
backgroundColor: '#f3f1f1'
}
},
sortOrder: {
name: 'created_at',
direction: 'desc'
},

viewColumns: false,
search: false,
rowsExpanded: [ExpandedRowIdx],
Expand Down
6 changes: 3 additions & 3 deletions src/custom/UsersTable/UsersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const UsersTable: React.FC<UsersTableProps> = ({
}) => {
const [page, setPage] = useState<number>(0);
const [pageSize, setPageSize] = useState<number>(10);
const [sortOrder, setSortOrder] = useState<string>('');
const [sortOrder, setSortOrder] = useState<string>('last_login_time desc');
const [search, setSearch] = useState<string>('');
const availableRoles: string[] = [];
const { handleError, handleSuccess, handleInfo } = useNotificationHandlers();
Expand Down Expand Up @@ -176,8 +176,8 @@ const UsersTable: React.FC<UsersTableProps> = ({
elevation: 0,
serverSide: true,
sortOrder: {
name: 'last_login_time',
direction: 'desc'
name: sortOrder.split(' ')[0],
direction: sortOrder.split(' ')[1]
},
onTableChange: (action: string, tableState: any) => {
const sortInfo = tableState.announceText ? tableState.announceText.split(' : ') : [];
Expand Down
2 changes: 1 addition & 1 deletion src/custom/Workspaces/DesignTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const DesignTable: React.FC<DesignTableProps> = ({
const modalRef = useRef(null);
const [page, setPage] = useState<number>(0);
const [pageSize, setPageSize] = useState<number>(10);
const [sortOrder, setSortOrder] = useState<string>('');
const [sortOrder, setSortOrder] = useState<string>('updated_at desc');
const [isSearchExpanded, setIsSearchExpanded] = useState(false);

const handlePublishModal = (pattern: Pattern): void => {
Expand Down
6 changes: 3 additions & 3 deletions src/custom/Workspaces/EnvironmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const EnvironmentTable: React.FC<EnvironmentTableProps> = ({
const [isSearchExpanded, setIsSearchExpanded] = useState(false);
const [page, setPage] = useState<number>(0);
const [pageSize, setPageSize] = useState<number>(10);
const [sortOrder, setSortOrder] = useState<string>('');
const [sortOrder, setSortOrder] = useState<string>('updated_at desc');
const { data: environmentsOfWorkspace } = useGetEnvironmentsOfWorkspaceQuery({
workspaceId,
page: page,
Expand Down Expand Up @@ -197,8 +197,8 @@ const EnvironmentTable: React.FC<EnvironmentTableProps> = ({
page,
elevation: 0,
sortOrder: {
name: 'updated_at',
direction: 'desc'
name: sortOrder.split(' ')[0],
direction: sortOrder.split(' ')[1]
},
serverSide: true,
onTableChange: (action: string, tableState: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/custom/Workspaces/WorkspaceTeamsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
}) => {
const [page, setPage] = useState<number>(0);
const [pageSize, setPageSize] = useState<number>(10);
const [sortOrder, setSortOrder] = useState<string>('');
const [sortOrder, setSortOrder] = useState<string>('updated_at desc');
const [bulkSelect, setBulkSelect] = useState<boolean>(false);
const [expanded, setExpanded] = useState<boolean>(true);
const handleAccordionChange = () => {
Expand Down

0 comments on commit 53b8d24

Please sign in to comment.