From 1a8bbb6bb80708f8febfba7189198edff3da625c Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Fri, 27 Jun 2025 21:59:56 -0500 Subject: [PATCH] Reorder columns --- apps/accounts/serializers.py | 2 + frontend/src/components/tables/UsersTable.jsx | 44 ++++++++++--------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/apps/accounts/serializers.py b/apps/accounts/serializers.py index 81b5037f..865d29af 100644 --- a/apps/accounts/serializers.py +++ b/apps/accounts/serializers.py @@ -45,6 +45,8 @@ class UserSerializer(serializers.ModelSerializer): "is_superuser", "last_login", "date_joined", + "first_name", + "last_name", ] def create(self, validated_data): diff --git a/frontend/src/components/tables/UsersTable.jsx b/frontend/src/components/tables/UsersTable.jsx index 2ee40176..6572b418 100644 --- a/frontend/src/components/tables/UsersTable.jsx +++ b/frontend/src/components/tables/UsersTable.jsx @@ -134,6 +134,16 @@ const UsersTable = () => { */ const columns = useMemo( () => [ + { + header: 'User Level', + accessorKey: 'user_level', + size: 120, + cell: ({ getValue }) => ( + + {USER_LEVEL_LABELS[getValue()]} + + ), + }, { header: 'Username', accessorKey: 'username', @@ -195,14 +205,17 @@ const UsersTable = () => { ), }, { - header: 'User Level', - accessorKey: 'user_level', - size: 120, - cell: ({ getValue }) => ( - - {USER_LEVEL_LABELS[getValue()]} - - ), + header: 'Date Joined', + accessorKey: 'date_joined', + size: 140, + cell: ({ getValue }) => { + const date = getValue(); + return ( + + {date ? new Date(date).toLocaleDateString() : '-'} + + ); + }, }, { header: 'Last Login', @@ -217,23 +230,11 @@ const UsersTable = () => { ); }, }, - { - header: 'Date Joined', - accessorKey: 'date_joined', - size: 140, - cell: ({ getValue }) => { - const date = getValue(); - return ( - - {date ? new Date(date).toLocaleDateString() : '-'} - - ); - }, - }, { header: 'XC Password', accessorKey: 'custom_properties', size: 120, + enableSorting: false, cell: ({ getValue, row }) => { const userId = row.original.id; const isVisible = visiblePasswords[userId]; @@ -270,6 +271,7 @@ const UsersTable = () => { id: 'actions', size: 80, header: 'Actions', + enableSorting: false, cell: ({ row }) => (