feat(sessions): add detail page, Notification component, and session API improvements
- add SessionDetailPage with breadcrumbs, DescriptionList, status badge, masked token - add Notification component (info/success/error/warning/note variants) for contextual messages - use Notification for 404 errors on session and environment detail pages - add GET /sessions/:id endpoint; sanitize token (head…tail) and strip cookies/localStorage - change DELETE /sessions/:id to return 204 No Content so client redirect works correctly - add onRowClick prop to Table for clickable rows; stop propagation on actions column - update status badges: open=success (green), closed=error (red) on both list and detail
This commit is contained in:
@@ -21,6 +21,8 @@ export interface TableProps<T> {
|
||||
pageSize?: number;
|
||||
/** Offer a page-size selector when pagination is enabled */
|
||||
pageSizeOptions?: number[];
|
||||
/** Called when a row is clicked */
|
||||
onRowClick?: (row: T) => void;
|
||||
}
|
||||
|
||||
export function Table<T>({
|
||||
@@ -32,6 +34,7 @@ export function Table<T>({
|
||||
className,
|
||||
pageSize: defaultPageSize,
|
||||
pageSizeOptions,
|
||||
onRowClick,
|
||||
}: TableProps<T>) {
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(defaultPageSize ?? 0);
|
||||
@@ -77,12 +80,17 @@ export function Table<T>({
|
||||
</tr>
|
||||
) : (
|
||||
visibleData.map((row) => (
|
||||
<tr key={rowKey(row)} className={styles.tr}>
|
||||
<tr
|
||||
key={rowKey(row)}
|
||||
className={[styles.tr, onRowClick ? styles.clickable : ''].filter(Boolean).join(' ')}
|
||||
onClick={onRowClick ? () => onRowClick(row) : undefined}
|
||||
>
|
||||
{columns.map((col) => (
|
||||
<td
|
||||
key={col.key}
|
||||
className={styles.td}
|
||||
style={{ textAlign: col.align ?? 'left' }}
|
||||
onClick={col.key === 'actions' ? (e) => e.stopPropagation() : undefined}
|
||||
>
|
||||
{col.render(row)}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user