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:
1 parent
097c747993
commit
d342637eb6
14 files changed
+290
-11
No files matched your search
@@ -1,5 +1,7 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Trash2 } from 'lucide-react';
|
||||
import { sessions } from '../api';
|
||||
import type { Session } from '../api';
|
||||
import { Badge, Breadcrumbs, Button, Table, type TableColumn, Timestamp } from '../ui';
|
||||
@@ -7,6 +9,7 @@ import styles from './Page.module.css';
|
||||
|
||||
export function SessionsPage() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const [items, setItems] = useState<Session[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -37,7 +40,7 @@ export function SessionsPage() {
|
||||
header: t('sessions.col_status'),
|
||||
width: 100,
|
||||
render: (s) => (
|
||||
<Badge variant={s.status === 'open' ? 'success' : 'neutral'}>{s.status}</Badge>
|
||||
<Badge variant={s.status === 'open' ? 'success' : 'error'}>{s.status}</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -49,11 +52,16 @@ export function SessionsPage() {
|
||||
{
|
||||
key: 'actions',
|
||||
header: '',
|
||||
width: 80,
|
||||
width: 48,
|
||||
align: 'right',
|
||||
render: (s) => (
|
||||
<Button variant="secondary" size="sm" onClick={() => handleDelete(s.id)}>
|
||||
{t('sessions.action_delete')}
|
||||
<Button
|
||||
variant="danger"
|
||||
size="sm"
|
||||
title={t('sessions.action_delete')}
|
||||
onClick={() => handleDelete(s.id)}
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
@@ -71,6 +79,7 @@ export function SessionsPage() {
|
||||
emptyMessage={t('sessions.empty')}
|
||||
pageSize={10}
|
||||
pageSizeOptions={[10, 25, 50]}
|
||||
onRowClick={(s) => navigate(`/sessions/${s.id}`)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user