- Scaffold Vite + React + TypeScript frontend in ui/ with full design system (dark/light themes) matching the HTML mockups - Implement Execution Explorer page: search filters, results table with expandable processor tree and exchange detail sidebar, pagination - Add UI authentication: UiAuthController (login/refresh endpoints), JWT filter handles ui: subject prefix, CORS configuration - Shared components: StatusPill, DurationBar, StatCard, AppBadge, FilterChip, Pagination — all using CSS Modules with design tokens - API client layer: openapi-fetch with auth middleware, TanStack Query hooks for search/detail/snapshot queries, Zustand for state - Standalone deployment: Nginx Dockerfile, K8s Deployment + ConfigMap + NodePort (30080), runtime config.js for API base URL - Embedded mode: maven-resources-plugin copies ui/dist into JAR static resources, SPA forward controller for client-side routing - CI/CD: UI build step, Docker build/push for server-ui image, K8s deploy step for UI, UI credential secrets Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { type FormEvent, useState } from 'react';
|
|
import { Navigate } from 'react-router';
|
|
import { useAuthStore } from './auth-store';
|
|
import styles from './LoginPage.module.css';
|
|
|
|
export function LoginPage() {
|
|
const { isAuthenticated, login, loading, error } = useAuthStore();
|
|
const [username, setUsername] = useState('');
|
|
const [password, setPassword] = useState('');
|
|
|
|
if (isAuthenticated) return <Navigate to="/" replace />;
|
|
|
|
const handleSubmit = (e: FormEvent) => {
|
|
e.preventDefault();
|
|
login(username, password);
|
|
};
|
|
|
|
return (
|
|
<div className={styles.page}>
|
|
<form className={styles.card} onSubmit={handleSubmit}>
|
|
<div className={styles.logo}>
|
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2" />
|
|
<path d="M12 6v6l4 2" />
|
|
</svg>
|
|
cameleer3
|
|
</div>
|
|
<div className={styles.subtitle}>Sign in to access the observability dashboard</div>
|
|
|
|
<div className={styles.field}>
|
|
<label className={styles.label}>Username</label>
|
|
<input
|
|
className={styles.input}
|
|
type="text"
|
|
value={username}
|
|
onChange={(e) => setUsername(e.target.value)}
|
|
autoFocus
|
|
autoComplete="username"
|
|
/>
|
|
</div>
|
|
|
|
<div className={styles.field}>
|
|
<label className={styles.label}>Password</label>
|
|
<input
|
|
className={styles.input}
|
|
type="password"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
autoComplete="current-password"
|
|
/>
|
|
</div>
|
|
|
|
<button className={styles.submit} type="submit" disabled={loading || !username || !password}>
|
|
{loading ? 'Signing in...' : 'Sign In'}
|
|
</button>
|
|
|
|
{error && <div className={styles.error}>{error}</div>}
|
|
</form>
|
|
</div>
|
|
);
|
|
}
|