mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-09 10:58:54 +00:00
50c520e1ff
Complete frontend visual redesign using certctl logo color palette: - Deep teal sidebar (#0c2e25) with prominent centered logo (64px in white pill) - Light content area (#f0f4f8) with white cards and visible borders - Brand colors from logo: teal (#2ea88f), blue (#3b7dd8), orange (#e8873a), green (#4ebe6e) - Inter + JetBrains Mono typography, colored stat card top borders - All 17 pages + 7 components updated (25 files, ~700 lines changed) - 15 new dashboard screenshots replacing old dark theme screenshots - Prometheus metrics e2e test added, integration test mock fixes - Docs updated: architecture.md theme description, testing-guide.md DNS-PERSIST-01 coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
2.2 KiB
TypeScript
74 lines
2.2 KiB
TypeScript
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
import { getTeams, deleteTeam } from '../api/client';
|
|
import PageHeader from '../components/PageHeader';
|
|
import DataTable from '../components/DataTable';
|
|
import type { Column } from '../components/DataTable';
|
|
import ErrorState from '../components/ErrorState';
|
|
import { formatDateTime } from '../api/utils';
|
|
import type { Team } from '../api/types';
|
|
|
|
export default function TeamsPage() {
|
|
const queryClient = useQueryClient();
|
|
|
|
const { data, isLoading, error, refetch } = useQuery({
|
|
queryKey: ['teams'],
|
|
queryFn: () => getTeams(),
|
|
});
|
|
|
|
const deleteMutation = useMutation({
|
|
mutationFn: deleteTeam,
|
|
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['teams'] }),
|
|
onError: (err: Error) => alert(`Delete failed: ${err.message}`),
|
|
});
|
|
|
|
const columns: Column<Team>[] = [
|
|
{
|
|
key: 'name',
|
|
label: 'Team',
|
|
render: (t) => (
|
|
<div>
|
|
<div className="font-medium text-ink">{t.name}</div>
|
|
<div className="text-xs text-ink-faint font-mono">{t.id}</div>
|
|
</div>
|
|
),
|
|
},
|
|
{
|
|
key: 'description',
|
|
label: 'Description',
|
|
render: (t) => (
|
|
<span className="text-ink text-sm max-w-sm truncate block">{t.description || '\u2014'}</span>
|
|
),
|
|
},
|
|
{
|
|
key: 'created',
|
|
label: 'Created',
|
|
render: (t) => <span className="text-xs text-ink-muted">{formatDateTime(t.created_at)}</span>,
|
|
},
|
|
{
|
|
key: 'actions',
|
|
label: '',
|
|
render: (t) => (
|
|
<button
|
|
onClick={(e) => { e.stopPropagation(); if (confirm(`Delete team ${t.name}?`)) deleteMutation.mutate(t.id); }}
|
|
className="text-xs text-red-600 hover:text-red-700 transition-colors"
|
|
>
|
|
Delete
|
|
</button>
|
|
),
|
|
},
|
|
];
|
|
|
|
return (
|
|
<>
|
|
<PageHeader title="Teams" subtitle={data ? `${data.total} teams` : undefined} />
|
|
<div className="flex-1 overflow-y-auto">
|
|
{error ? (
|
|
<ErrorState error={error as Error} onRetry={() => refetch()} />
|
|
) : (
|
|
<DataTable columns={columns} data={data?.data || []} isLoading={isLoading} emptyMessage="No teams configured" />
|
|
)}
|
|
</div>
|
|
</>
|
|
);
|
|
}
|