mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-27 18:57:09 +00:00
feat: sortable resource tables and richer dashboard stack-health columns (#1498)
Make the Resources Images, Volumes, and Networks tables sortable with a shared useTableSort hook and SortableTableHead, move the Images scan-history control into the Images tab header, and keep the network List/Topology toggle anchored with Create Network visible in both modes. Rework the dashboard Stack health table: drop the redundant Host column, add sortable Stack/Up/CPU/Mem headers, and add Source (local/git) and Port columns. The status endpoint now labels each stack with its git/local source, computed outside the cache so linking changes show immediately. Extract a reusable CreateNetworkDialog and add a create-network action to the stack-detail Networking tab.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { ArrowUp, ArrowDown } from 'lucide-react';
|
||||
import { TableHead } from '@/components/ui/table';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { SortDir } from '@/hooks/useTableSort';
|
||||
|
||||
/** Clickable, sort-aware `<TableHead>`. Pairs with the `useTableSort` hook. */
|
||||
export function SortableTableHead<K extends string>({
|
||||
label, columnKey, activeKey, dir, onSort, className,
|
||||
}: {
|
||||
label: string;
|
||||
columnKey: K;
|
||||
activeKey: K;
|
||||
dir: SortDir;
|
||||
onSort: (k: K) => void;
|
||||
className?: string;
|
||||
}) {
|
||||
const active = activeKey === columnKey;
|
||||
return (
|
||||
<TableHead className={cn('text-[11px] cursor-pointer select-none', className)}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onSort(columnKey)}
|
||||
className="inline-flex items-center gap-1 hover:text-foreground"
|
||||
>
|
||||
{label}
|
||||
{active && (dir === 'asc' ? <ArrowUp className="w-3 h-3" /> : <ArrowDown className="w-3 h-3" />)}
|
||||
</button>
|
||||
</TableHead>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user