refactor(auth): remove keys auth module and align tests
- remove server auth module and client keys page/routes/api to simplify flow - update mcp and scenario tests to match uuid routes and step schema
This commit is contained in:
+1
-4
@@ -1,6 +1,6 @@
|
||||
import { NavLink, Navigate, Route, Routes } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Globe, KeyRound, Monitor, ClipboardList, Activity, KeySquare, Braces } from 'lucide-react';
|
||||
import { Globe, Monitor, ClipboardList, Activity, KeySquare, Braces } from 'lucide-react';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import styles from './App.module.css';
|
||||
import { SidePanel, ThemeSwitcher } from './ui';
|
||||
@@ -9,7 +9,6 @@ import { EnvironmentsPage } from './pages/environment/EnvironmentsPage';
|
||||
import { EnvironmentDetailPage } from './pages/environment/EnvironmentDetailPage';
|
||||
import { CreateEnvironmentPage } from './pages/environment/CreateEnvironmentPage';
|
||||
import { EditEnvironmentPage } from './pages/environment/EditEnvironmentPage';
|
||||
import { KeysPage } from './pages/KeysPage';
|
||||
import { SessionsPage } from './pages/session/SessionsPage';
|
||||
import { SessionDetailPage } from './pages/session/SessionDetailPage';
|
||||
import { ScenariosPage } from './pages/scenario/ScenariosPage';
|
||||
@@ -34,7 +33,6 @@ const NAV: { path: string; labelKey: string; Icon: LucideIcon }[] = [
|
||||
{ path: '/environments', labelKey: 'nav.environments', Icon: Globe },
|
||||
{ path: '/credentials', labelKey: 'nav.credentials', Icon: KeySquare },
|
||||
{ path: '/snippets', labelKey: 'nav.snippets', Icon: Braces },
|
||||
{ path: '/keys', labelKey: 'nav.keys', Icon: KeyRound },
|
||||
{ path: '/sessions', labelKey: 'nav.sessions', Icon: Monitor },
|
||||
{ path: '/scenarios', labelKey: 'nav.scenarios', Icon: ClipboardList },
|
||||
{ path: '/runs', labelKey: 'nav.runs', Icon: Activity },
|
||||
@@ -77,7 +75,6 @@ export default function App() {
|
||||
<Route path="/environments/new" element={<CreateEnvironmentPage />} />
|
||||
<Route path="/environments/:id/edit" element={<EditEnvironmentPage />} />
|
||||
<Route path="/environments/:id" element={<EnvironmentDetailPage />} />
|
||||
<Route path="/keys" element={<KeysPage />} />
|
||||
<Route path="/sessions" element={<SessionsPage />} />
|
||||
<Route path="/sessions/:id" element={<SessionDetailPage />} />
|
||||
<Route path="/scenarios" element={<ScenariosPage />} />
|
||||
|
||||
@@ -2,7 +2,6 @@ import type {
|
||||
PaginatedResponse,
|
||||
Credential,
|
||||
Environment,
|
||||
KeysResponse,
|
||||
ScenarioCredential,
|
||||
Session,
|
||||
Scenario,
|
||||
@@ -13,7 +12,7 @@ import type {
|
||||
Snippet,
|
||||
} from './types';
|
||||
|
||||
// In dev, Vite proxies /environments /sessions /scenarios /keys to localhost:3000.
|
||||
// In dev, Vite proxies /environments /sessions /scenarios to localhost:3000.
|
||||
// In production (or when VITE_API_URL is set) we hit the configured origin directly.
|
||||
const BASE_URL: string = (import.meta.env.VITE_API_URL as string | undefined) ?? '';
|
||||
|
||||
@@ -132,14 +131,6 @@ export const environments = {
|
||||
},
|
||||
};
|
||||
|
||||
// ── Keys ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
export const keys = {
|
||||
list(): Promise<KeysResponse> {
|
||||
return request('/keys');
|
||||
},
|
||||
};
|
||||
|
||||
// ── Sessions ──────────────────────────────────────────────────────────────────
|
||||
|
||||
export const sessions = {
|
||||
|
||||
@@ -46,12 +46,6 @@ export interface Snippet {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
// ── Keys ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface KeysResponse {
|
||||
keys: string[];
|
||||
}
|
||||
|
||||
// ── Sessions ──────────────────────────────────────────────────────────────────
|
||||
|
||||
export type SessionStatus = 'open' | 'closed';
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { keys } from '../api';
|
||||
import { Breadcrumbs, Table, type TableColumn } from '../ui';
|
||||
import styles from './Page.module.css';
|
||||
|
||||
interface KeyRow {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function KeysPage() {
|
||||
const { t } = useTranslation();
|
||||
const [items, setItems] = useState<KeyRow[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const columns: TableColumn<KeyRow>[] = [
|
||||
{ key: 'name', header: t('keys.col_name'), render: (k) => k.name },
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
keys
|
||||
.list()
|
||||
.then((res) => setItems(res.keys.map((name) => ({ name }))))
|
||||
.catch((err: Error) => setError(err.message))
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Breadcrumbs items={[{ label: t('keys.title') }]} className={styles.breadcrumbs} />
|
||||
{error && <p className={styles.error}>{error}</p>}
|
||||
<Table
|
||||
columns={columns}
|
||||
data={items}
|
||||
rowKey={(k) => k.name}
|
||||
loading={loading}
|
||||
emptyMessage={t('keys.empty')}
|
||||
pageSize={10}
|
||||
pageSizeOptions={[10, 25, 50]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -17,8 +17,6 @@ export default defineConfig({
|
||||
'/snippets': 'http://localhost:13000',
|
||||
'/sessions': 'http://localhost:13000',
|
||||
'/scenarios': 'http://localhost:13000',
|
||||
'/keys': 'http://localhost:13000',
|
||||
'/login': 'http://localhost:13000',
|
||||
},
|
||||
},
|
||||
test: {
|
||||
|
||||
Reference in New Issue
Block a user