ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
refactor(settings): move settings tables onto DataTable
Juan Denis5d87b42fa654
diff --git a/frontend/src/components/settings/ActivityTab.jsx b/frontend/src/components/settings/ActivityTab.jsxindex 344247bd..606d55d3 100644--- a/frontend/src/components/settings/ActivityTab.jsx+++ b/frontend/src/components/settings/ActivityTab.jsx@@ -3,6 +3,7 @@ import api from '../../services/api';import ContributionGraph from './ContributionGraph';import { Search, Filter, X, User as UserIcon } from 'lucide-react';import { Button } from '@/components/ui/button';+import { DataTableFooter } from '@/components/ds';import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';import useSettingFocus from '../../hooks/useSettingFocus';@@ -274,28 +275,19 @@ const ActivityTab = () => {</div>)}- {pagination.pages > 1 && (- <div className="pagination">- <Button- variant="outline"- size="sm"- disabled={pagination.page <= 1}- onClick={() => setPagination(prev => ({ ...prev, page: prev.page - 1 }))}- >- Previous- </Button>- <span className="pagination-info">- Page {pagination.page} of {pagination.pages}- </span>- <Button- variant="outline"- size="sm"- disabled={pagination.page >= pagination.pages}- onClick={() => setPagination(prev => ({ ...prev, page: prev.page + 1 }))}- >- Next- </Button>- </div>+ {/* The audit feed is a flex-wrapped log-row layout, not a+ table, so it keeps its own markup; only the pager is+ standardized onto the shared DataTableFooter (paged mode).+ Fetch logic and pagination state are unchanged. */}+ {!feedLoading && logs.length > 0 && (+ <DataTableFooter+ shown={logs.length}+ total={pagination.total}+ noun="log"+ page={pagination.page}+ totalPages={pagination.pages}+ onPageChange={(nextPage) => setPagination(prev => ({ ...prev, page: nextPage }))}+ />)}</div></div>diff --git a/frontend/src/components/settings/ApiSettingsTab.jsx b/frontend/src/components/settings/ApiSettingsTab.jsxindex 699b4308..8ee8d96d 100644--- a/frontend/src/components/settings/ApiSettingsTab.jsx+++ b/frontend/src/components/settings/ApiSettingsTab.jsx@@ -13,6 +13,7 @@ import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Badge } from '@/components/ui/badge';import { Pill } from '@/components/ds/Pill';+import { DataTable, DataTableFooter } from '@/components/ds';const ApiSettingsTab = () => {const { isAdmin } = useAuth();@@ -69,6 +70,107 @@ const ApiKeysSection = () => {setCreatedKey(null);};+ // Columns for the shared DataTable. Cell markup and classNames are+ // identical to the hand-rolled table they replace, so _api-settings.scss+ // keeps applying (.api-settings__key-name, __key-prefix, __scopes,+ // __muted, __actions).+ const keyColumns = [+ {+ key: 'name',+ header: 'Name',+ sortable: true,+ hideable: false,+ sortValue: (key) => key.name || '',+ cellClassName: 'api-settings__key-name',+ render: (key) => key.name,+ },+ {+ key: 'key',+ header: 'Key',+ render: (key) => <code className="api-settings__key-prefix">{key.key_prefix}...</code>,+ },+ {+ key: 'scopes',+ header: 'Scopes',+ render: (key) => (+ <div className="api-settings__scopes">+ {(!key.scopes || key.scopes.length === 0) ? (+ <span className="api-settings__muted">None</span>+ ) : key.scopes.includes('*') ? (+ <Pill kind="violet">Full access</Pill>+ ) : (+ <>+ {key.scopes.slice(0, 3).map(s => (+ <Pill key={s} kind="cyan" dot={false}>{s}</Pill>+ ))}+ {key.scopes.length > 3 && (+ <Pill kind="gray" dot={false}>+{key.scopes.length - 3}</Pill>+ )}+ </>+ )}+ </div>+ ),+ },+ {+ key: 'tier',+ header: 'Tier',+ render: (key) => <Badge variant="outline">{key.tier}</Badge>,+ },+ {+ key: 'lastUsed',+ header: 'Last Used',+ sortable: true,+ sortValue: (key) => (key.last_used_at ? new Date(key.last_used_at).getTime() : null),+ cellClassName: 'api-settings__muted',+ render: (key) => (+ key.last_used_at+ ? new Date(key.last_used_at).toLocaleDateString()+ : 'Never'+ ),+ },+ {+ key: 'status',+ header: 'Status',+ render: (key) => (+ key.is_active && !key.revoked_at ? (+ <Badge variant="success">Active</Badge>+ ) : (+ <Badge variant="destructive">Revoked</Badge>+ )+ ),+ },+ {+ key: 'actions',+ header: 'Actions',+ sortable: false,+ hideable: false,+ cellClassName: 'api-settings__actions',+ render: (key) => (+ key.is_active && !key.revoked_at && (+ <>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => handleRotate(key.id)}+ title="Rotate"+ >+ <RotateCcw size={14} />+ </Button>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => handleRevoke(key.id)}+ title="Revoke"+ className="text-destructive hover:text-destructive"+ >+ <Trash2 size={14} />+ </Button>+ </>+ )+ ),+ },+ ];+return (<div {...register('api-keys', 'settings-card')}><div className="settings-card__header">@@ -93,83 +195,20 @@ const ApiKeysSection = () => {</div>) : (<div className="api-settings__table-wrap">- <table className="api-settings__table">- <thead>- <tr>- <th>Name</th>- <th>Key</th>- <th>Scopes</th>- <th>Tier</th>- <th>Last Used</th>- <th>Status</th>- <th>Actions</th>- </tr>- </thead>- <tbody>- {keys.map(key => (- <tr key={key.id}>- <td className="api-settings__key-name">{key.name}</td>- <td><code className="api-settings__key-prefix">{key.key_prefix}...</code></td>- <td>- <div className="api-settings__scopes">- {(!key.scopes || key.scopes.length === 0) ? (- <span className="api-settings__muted">None</span>- ) : key.scopes.includes('*') ? (- <Pill kind="violet">Full access</Pill>- ) : (- <>- {key.scopes.slice(0, 3).map(s => (- <Pill key={s} kind="cyan" dot={false}>{s}</Pill>- ))}- {key.scopes.length > 3 && (- <Pill kind="gray" dot={false}>+{key.scopes.length - 3}</Pill>- )}- </>- )}- </div>- </td>- <td>- <Badge variant="outline">{key.tier}</Badge>- </td>- <td className="api-settings__muted">- {key.last_used_at- ? new Date(key.last_used_at).toLocaleDateString()- : 'Never'}- </td>- <td>- {key.is_active && !key.revoked_at ? (- <Badge variant="success">Active</Badge>- ) : (- <Badge variant="destructive">Revoked</Badge>- )}- </td>- <td className="api-settings__actions">- {key.is_active && !key.revoked_at && (- <>- <Button- variant="ghost"- size="sm"- onClick={() => handleRotate(key.id)}- title="Rotate"- >- <RotateCcw size={14} />- </Button>- <Button- variant="ghost"- size="sm"- onClick={() => handleRevoke(key.id)}- title="Revoke"- className="text-destructive hover:text-destructive"- >- <Trash2 size={14} />- </Button>- </>- )}- </td>- </tr>- ))}- </tbody>- </table>+ <DataTable+ columns={keyColumns}+ data={keys}+ keyField="id"+ storageKey="serverkit-table-settings-api-keys"+ tableClassName="api-settings__table"+ footer={(+ <DataTableFooter+ shown={keys.length}+ total={keys.length}+ noun="key"+ />+ )}+ /></div>)}@@ -272,6 +311,53 @@ const RateLimitsSection = () => {};// ─── Webhook Subscriptions Section ─────────────────────++// Columns for the deliveries DataTable (compact variant). Cell markup is+// identical to the hand-rolled table it replaces.+const DELIVERY_COLUMNS = [+ {+ key: 'event',+ header: 'Event',+ sortable: true,+ hideable: false,+ sortValue: (d) => d.event_type || '',+ render: (d) => <code>{d.event_type}</code>,+ },+ {+ key: 'status',+ header: 'Status',+ sortable: true,+ sortValue: (d) => d.status || '',+ render: (d) => (+ <Badge variant={d.status === 'success' ? 'success' : d.status === 'failed' ? 'destructive' : 'warning'}>+ {d.status}+ </Badge>+ ),+ },+ {+ key: 'http',+ header: 'HTTP',+ sortable: true,+ sortValue: (d) => d.http_status ?? null,+ render: (d) => d.http_status || '-',+ },+ {+ key: 'duration',+ header: 'Duration',+ sortable: true,+ sortValue: (d) => d.duration_ms ?? null,+ render: (d) => (d.duration_ms ? `${d.duration_ms}ms` : '-'),+ },+ {+ key: 'time',+ header: 'Time',+ sortable: true,+ sortValue: (d) => (d.created_at ? new Date(d.created_at).getTime() : null),+ cellClassName: 'api-settings__muted',+ render: (d) => (d.created_at ? new Date(d.created_at).toLocaleString() : '-'),+ },+];+const WebhookSection = () => {const register = useSettingFocus();const [subscriptions, setSubscriptions] = useState([]);@@ -404,34 +490,13 @@ const WebhookSection = () => {{deliveries[sub.id].length === 0 ? (<p className="api-settings__muted">No deliveries yet</p>) : (- <table className="api-settings__table api-settings__table--compact">- <thead>- <tr>- <th>Event</th>- <th>Status</th>- <th>HTTP</th>- <th>Duration</th>- <th>Time</th>- </tr>- </thead>- <tbody>- {deliveries[sub.id].slice(0, 10).map(d => (- <tr key={d.id}>- <td><code>{d.event_type}</code></td>- <td>- <Badge variant={d.status === 'success' ? 'success' : d.status === 'failed' ? 'destructive' : 'warning'}>- {d.status}- </Badge>- </td>- <td>{d.http_status || '-'}</td>- <td>{d.duration_ms ? `${d.duration_ms}ms` : '-'}</td>- <td className="api-settings__muted">- {d.created_at ? new Date(d.created_at).toLocaleString() : '-'}- </td>- </tr>- ))}- </tbody>- </table>+ <DataTable+ columns={DELIVERY_COLUMNS}+ data={deliveries[sub.id].slice(0, 10)}+ keyField="id"+ storageKey="serverkit-table-settings-webhook-deliveries"+ tableClassName="api-settings__table api-settings__table--compact"+ />)}</div>)}@@ -460,6 +525,48 @@ const WebhookSection = () => {};// ─── Analytics Section ─────────────────────────────────++// Columns for the top-endpoints DataTable (compact variant). Cell markup is+// identical to the hand-rolled table it replaces.+const ENDPOINT_COLUMNS = [+ {+ key: 'method',+ header: 'Method',+ sortable: true,+ hideable: false,+ sortValue: (ep) => ep.method || '',+ render: (ep) => <Badge variant="outline">{ep.method}</Badge>,+ },+ {+ key: 'endpoint',+ header: 'Endpoint',+ sortable: true,+ sortValue: (ep) => ep.endpoint || '',+ render: (ep) => <code>{ep.endpoint}</code>,+ },+ {+ key: 'requests',+ header: 'Requests',+ sortable: true,+ sortValue: (ep) => ep.count ?? null,+ render: (ep) => ep.count.toLocaleString(),+ },+ {+ key: 'avgTime',+ header: 'Avg Time',+ sortable: true,+ sortValue: (ep) => ep.avg_response_time_ms ?? null,+ render: (ep) => `${ep.avg_response_time_ms}ms`,+ },+ {+ key: 'errors',+ header: 'Errors',+ sortable: true,+ sortValue: (ep) => ep.error_count ?? null,+ render: (ep) => (ep.error_count > 0 ? <span className="api-settings__error-count">{ep.error_count}</span> : '-'),+ },+];+const AnalyticsSection = () => {const register = useSettingFocus();const [overview, setOverview] = useState(null);@@ -559,28 +666,20 @@ const AnalyticsSection = () => {{endpoints.length > 0 && (<div className="api-settings__top-endpoints"><h4>Top Endpoints</h4>- <table className="api-settings__table api-settings__table--compact">- <thead>- <tr>- <th>Method</th>- <th>Endpoint</th>- <th>Requests</th>- <th>Avg Time</th>- <th>Errors</th>- </tr>- </thead>- <tbody>- {endpoints.slice(0, 10).map((ep, i) => (- <tr key={i}>- <td><Badge variant="outline">{ep.method}</Badge></td>- <td><code>{ep.endpoint}</code></td>- <td>{ep.count.toLocaleString()}</td>- <td>{ep.avg_response_time_ms}ms</td>- <td>{ep.error_count > 0 ? <span className="api-settings__error-count">{ep.error_count}</span> : '-'}</td>- </tr>- ))}- </tbody>- </table>+ <DataTable+ columns={ENDPOINT_COLUMNS}+ data={endpoints.slice(0, 10)}+ keyField={(ep) => `${ep.method} ${ep.endpoint}`}+ storageKey="serverkit-table-settings-api-endpoints"+ tableClassName="api-settings__table api-settings__table--compact"+ footer={(+ <DataTableFooter+ shown={Math.min(endpoints.length, 10)}+ total={endpoints.length}+ noun="endpoint"+ />+ )}+ /></div>)}</>diff --git a/frontend/src/components/settings/InvitationsTab.jsx b/frontend/src/components/settings/InvitationsTab.jsxindex b09521a1..64c41a0f 100644--- a/frontend/src/components/settings/InvitationsTab.jsx+++ b/frontend/src/components/settings/InvitationsTab.jsx@@ -3,6 +3,7 @@ import api from '../../services/api';import InviteModal from './InviteModal';import { Button } from '@/components/ui/button';import { Badge } from '@/components/ui/badge';+import { DataTable, DataTableFooter } from '@/components/ds';const InvitationsTab = () => {const [invitations, setInvitations] = useState([]);@@ -76,6 +77,94 @@ const InvitationsTab = () => {}}+ // Columns for the shared DataTable. Cell markup and classNames are+ // identical to the hand-rolled table they replace, so _users.scss keeps+ // applying (.users-table, .date-cell, .actions-cell).+ const columns = [+ {+ key: 'recipient',+ header: 'Recipient',+ sortable: true,+ hideable: false,+ sortValue: (inv) => inv.email || '',+ render: (inv) => inv.email || <span className="text-muted">Link only</span>,+ },+ {+ key: 'role',+ header: 'Role',+ render: (inv) => (+ <Badge variant={getRoleBadgeVariant(inv.role)}>+ {inv.role}+ </Badge>+ ),+ },+ {+ key: 'status',+ header: 'Status',+ sortable: true,+ sortValue: (inv) => (inv.is_expired && inv.status === 'pending' ? 'expired' : inv.status || ''),+ render: (inv) => (+ <Badge variant={getStatusBadgeVariant(inv.status, inv.is_expired)}>+ {inv.is_expired && inv.status === 'pending' ? 'expired' : inv.status}+ </Badge>+ ),+ },+ {+ key: 'created',+ header: 'Created',+ sortable: true,+ sortValue: (inv) => (inv.created_at ? new Date(inv.created_at).getTime() : null),+ cellClassName: 'date-cell',+ render: (inv) => formatDate(inv.created_at),+ },+ {+ key: 'expires',+ header: 'Expires',+ cellClassName: 'date-cell',+ render: (inv) => formatDate(inv.expires_at),+ },+ {+ key: 'actions',+ header: 'Actions',+ sortable: false,+ hideable: false,+ cellClassName: 'actions-cell',+ render: (inv) => (+ inv.status === 'pending' && !inv.is_expired && (+ <>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => copyLink(inv.token)}+ title="Copy invite link"+ >+ {copied === inv.token ? 'Copied!' : 'Copy Link'}+ </Button>+ {inv.email && (+ <Button+ variant="ghost"+ size="sm"+ onClick={() => handleResend(inv.id)}+ title="Resend email"+ >+ Resend+ </Button>+ )}+ <Button+ variant="ghost"+ size="sm"+ onClick={() => handleRevoke(inv.id)}+ title="Revoke invitation"+ className="text-destructive hover:text-destructive"+ >+ Revoke+ </Button>+ </>+ )+ ),+ },+ ];+return (<div className="invitations-section"><div className="tab-header">@@ -100,70 +189,20 @@ const InvitationsTab = () => {<div className="empty-state">No invitations yet</div>) : (<div className="users-table-container">- <table className="users-table">- <thead>- <tr>- <th>Recipient</th>- <th>Role</th>- <th>Status</th>- <th>Created</th>- <th>Expires</th>- <th>Actions</th>- </tr>- </thead>- <tbody>- {invitations.map(inv => (- <tr key={inv.id}>- <td>{inv.email || <span className="text-muted">Link only</span>}</td>- <td>- <Badge variant={getRoleBadgeVariant(inv.role)}>- {inv.role}- </Badge>- </td>- <td>- <Badge variant={getStatusBadgeVariant(inv.status, inv.is_expired)}>- {inv.is_expired && inv.status === 'pending' ? 'expired' : inv.status}- </Badge>- </td>- <td className="date-cell">{formatDate(inv.created_at)}</td>- <td className="date-cell">{formatDate(inv.expires_at)}</td>- <td className="actions-cell">- {inv.status === 'pending' && !inv.is_expired && (- <>- <Button- variant="ghost"- size="sm"- onClick={() => copyLink(inv.token)}- title="Copy invite link"- >- {copied === inv.token ? 'Copied!' : 'Copy Link'}- </Button>- {inv.email && (- <Button- variant="ghost"- size="sm"- onClick={() => handleResend(inv.id)}- title="Resend email"- >- Resend- </Button>- )}- <Button- variant="ghost"- size="sm"- onClick={() => handleRevoke(inv.id)}- title="Revoke invitation"- className="text-destructive hover:text-destructive"- >- Revoke- </Button>- </>- )}- </td>- </tr>- ))}- </tbody>- </table>+ <DataTable+ columns={columns}+ data={invitations}+ keyField="id"+ storageKey="serverkit-table-settings-invitations"+ tableClassName="users-table"+ footer={(+ <DataTableFooter+ shown={invitations.length}+ total={invitations.length}+ noun="invitation"+ />+ )}+ /></div>)}diff --git a/frontend/src/components/settings/MigrationHistoryTab.jsx b/frontend/src/components/settings/MigrationHistoryTab.jsxindex 6b04f12f..54c5d71b 100644--- a/frontend/src/components/settings/MigrationHistoryTab.jsx+++ b/frontend/src/components/settings/MigrationHistoryTab.jsx@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import api from '../../services/api';import { Database, Loader, CheckCircle, ArrowUpCircle, ShieldCheck } from 'lucide-react';import { Badge } from '@/components/ui/badge';+import { DataTable, DataTableFooter } from '@/components/ds';import { useToast } from '../../contexts/ToastContext';import { useConfirm } from '../../hooks/useConfirm';import useSettingFocus from '../../hooks/useSettingFocus';@@ -59,6 +60,46 @@ const MigrationHistoryTab = () => {// re-stamps the version pointer rather than running DDL.const orphaned = Boolean(currentRev) && currentIdx === -1 && revisions.length > 0;+ // Columns for the shared DataTable. Cell markup is identical to the+ // hand-rolled table it replaces, so the .data-table rules keep applying.+ const columns = [+ {+ key: 'revision',+ header: 'Revision',+ sortable: true,+ hideable: false,+ sortValue: (rev) => rev.revision || '',+ render: (rev) => <code>{short(rev.revision)}</code>,+ },+ {+ key: 'description',+ header: 'Description',+ sortable: true,+ sortValue: (rev) => rev.description || 'Schema update',+ render: (rev) => rev.description || 'Schema update',+ },+ {+ key: 'status',+ header: 'Status',+ sortable: true,+ // current -> applied -> pending keeps the lifecycle order sensible.+ sortValue: (rev) => (rev.is_current ? 0 : pendingIds.has(rev.revision) ? 2 : 1),+ render: (rev) => (+ rev.is_current ? (+ <Badge variant="success">+ <CheckCircle size={12} /> Current+ </Badge>+ ) : pendingIds.has(rev.revision) ? (+ <Badge variant="warning">+ <ArrowUpCircle size={12} /> Pending+ </Badge>+ ) : (+ <Badge variant="secondary">Applied</Badge>+ )+ ),+ },+ ];+async function runMigrations() {const ok = await confirm({title: orphaned ? 'Re-sync database version?' : `Apply ${count} migration${plural}?`,@@ -189,38 +230,20 @@ const MigrationHistoryTab = () => {</div>) : (<div {...register('migrations-history', 'table-container')}>- <table className="data-table">- <thead>- <tr>- <th>Revision</th>- <th>Description</th>- <th>Status</th>- </tr>- </thead>- <tbody>- {revisions.map((rev, i) => (- <tr key={i}>- <td>- <code>{short(rev.revision)}</code>- </td>- <td>{rev.description || 'Schema update'}</td>- <td>- {rev.is_current ? (- <Badge variant="success">- <CheckCircle size={12} /> Current- </Badge>- ) : pendingIds.has(rev.revision) ? (- <Badge variant="warning">- <ArrowUpCircle size={12} /> Pending- </Badge>- ) : (- <Badge variant="secondary">Applied</Badge>- )}- </td>- </tr>- ))}- </tbody>- </table>+ <DataTable+ columns={columns}+ data={revisions}+ keyField="revision"+ storageKey="serverkit-table-settings-migrations"+ tableClassName="data-table"+ footer={(+ <DataTableFooter+ shown={revisions.length}+ total={revisions.length}+ noun="migration"+ />+ )}+ /></div>)}</div>diff --git a/frontend/src/components/settings/UsersTab.jsx b/frontend/src/components/settings/UsersTab.jsxindex d2aeb2c8..8e3f93a1 100644--- a/frontend/src/components/settings/UsersTab.jsx+++ b/frontend/src/components/settings/UsersTab.jsx@@ -7,6 +7,7 @@ import LoginLinksSection from './LoginLinksSection';import Modal from '../Modal';import { Button } from '@/components/ui/button';import { Badge } from '@/components/ui/badge';+import { DataTable, DataTableFooter } from '@/components/ds';import useSettingFocus from '../../hooks/useSettingFocus';const UsersTab = () => {@@ -107,6 +108,128 @@ const UsersTab = () => {);}+ // Columns for the shared DataTable. Cell markup and classNames are+ // identical to the hand-rolled table they replace, so _users.scss keeps+ // applying (.user-info, .user-avatar, .status-badge, .date-cell,+ // .actions-cell, tr.inactive).+ const columns = [+ {+ key: 'user',+ header: 'User',+ sortable: true,+ hideable: false,+ sortValue: (user) => user.username || '',+ cellClassName: 'user-info',+ render: (user) => (+ <>+ <div className="user-avatar">+ {user.username.charAt(0).toUpperCase()}+ </div>+ <div className="user-details">+ <span className="username">+ {user.username}+ {user.id === currentUser?.id && (+ <span className="you-badge">You</span>+ )}+ </span>+ <span className="email">{user.email}</span>+ </div>+ </>+ ),+ },+ {+ key: 'role',+ header: 'Role',+ sortable: true,+ sortValue: (user) => user.role || '',+ render: (user) => (+ <Badge variant={getRoleBadgeVariant(user.role)}>+ {user.role}+ </Badge>+ ),+ },+ {+ key: 'status',+ header: 'Status',+ render: (user) => (+ <span className={`status-badge ${user.is_active ? 'active' : 'inactive'}`}>+ {user.is_active ? 'Active' : 'Disabled'}+ </span>+ ),+ },+ {+ key: 'lastLogin',+ header: 'Last Login',+ cellClassName: 'date-cell',+ render: (user) => formatDate(user.last_login_at),+ },+ {+ key: 'created',+ header: 'Created',+ sortable: true,+ sortValue: (user) => (user.created_at ? new Date(user.created_at).getTime() : null),+ cellClassName: 'date-cell',+ render: (user) => formatDate(user.created_at),+ },+ {+ key: 'actions',+ header: 'Actions',+ sortable: false,+ hideable: false,+ cellClassName: 'actions-cell',+ render: (user) => (+ <>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => handleEditUser(user)}+ title="Edit user"+ >+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">+ <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>+ <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>+ </svg>+ </Button>+ {user.id !== currentUser?.id && (+ <>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => handleToggleActive(user)}+ title={user.is_active ? 'Disable user' : 'Enable user'}+ className={user.is_active ? 'text-warning' : 'text-success'}+ >+ {user.is_active ? (+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">+ <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>+ <line x1="1" y1="1" x2="23" y2="23"/>+ </svg>+ ) : (+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>+ <circle cx="12" cy="12" r="3"/>+ </svg>+ )}+ </Button>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => setDeleteConfirm(user)}+ title="Delete user"+ className="text-destructive hover:text-destructive"+ >+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">+ <polyline points="3 6 5 6 21 6"/>+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>+ </svg>+ </Button>+ </>+ )}+ </>+ ),+ },+ ];+return (<div className="users-tab"><div className="tab-header">@@ -126,98 +249,21 @@ const UsersTab = () => {{error && <div className="error-message">{error}</div>}<div {...register('users-management', 'users-table-container')}>- <table className="users-table">- <thead>- <tr>- <th>User</th>- <th>Role</th>- <th>Status</th>- <th>Last Login</th>- <th>Created</th>- <th>Actions</th>- </tr>- </thead>- <tbody>- {users.map(user => (- <tr key={user.id} className={!user.is_active ? 'inactive' : ''}>- <td className="user-info">- <div className="user-avatar">- {user.username.charAt(0).toUpperCase()}- </div>- <div className="user-details">- <span className="username">- {user.username}- {user.id === currentUser?.id && (- <span className="you-badge">You</span>- )}- </span>- <span className="email">{user.email}</span>- </div>- </td>- <td>- <Badge variant={getRoleBadgeVariant(user.role)}>- {user.role}- </Badge>- </td>- <td>- <span className={`status-badge ${user.is_active ? 'active' : 'inactive'}`}>- {user.is_active ? 'Active' : 'Disabled'}- </span>- </td>- <td className="date-cell">{formatDate(user.last_login_at)}</td>- <td className="date-cell">{formatDate(user.created_at)}</td>- <td className="actions-cell">- <Button- variant="ghost"- size="sm"- onClick={() => handleEditUser(user)}- title="Edit user"- >- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>- <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>- </svg>- </Button>- {user.id !== currentUser?.id && (- <>- <Button- variant="ghost"- size="sm"- onClick={() => handleToggleActive(user)}- title={user.is_active ? 'Disable user' : 'Enable user'}- className={user.is_active ? 'text-warning' : 'text-success'}- >- {user.is_active ? (- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>- <line x1="1" y1="1" x2="23" y2="23"/>- </svg>- ) : (- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>- <circle cx="12" cy="12" r="3"/>- </svg>- )}- </Button>- <Button- variant="ghost"- size="sm"- onClick={() => setDeleteConfirm(user)}- title="Delete user"- className="text-destructive hover:text-destructive"- >- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <polyline points="3 6 5 6 21 6"/>- <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>- </svg>- </Button>- </>- )}- </td>- </tr>- ))}- </tbody>- </table>+ <DataTable+ columns={columns}+ data={users}+ keyField="id"+ storageKey="serverkit-table-settings-users"+ rowClassName={(user) => (!user.is_active ? 'inactive' : '')}+ tableClassName="users-table"+ footer={(+ <DataTableFooter+ shown={users.length}+ total={users.length}+ noun="user"+ />+ )}+ /></div>{showModal && (