feat: global Docker health indicator and graceful degradation

- GET /api/health endpoint returning Docker connectivity status
- Sidebar shows Docker connection dot (green=connected, red=disconnected)
- Stale scanner returns store-only results when Docker is unavailable
- Polls health every 30s
This commit is contained in:
2026-03-30 13:43:33 +03:00
parent b57b164be0
commit 37cfa090ac
15 changed files with 317 additions and 277 deletions
+30
View File
@@ -0,0 +1,30 @@
/** Shared auth helpers for token management. */
const TOKEN_KEY = 'auth_token';
/** Returns the stored JWT token, or null if not authenticated. */
export function getAuthToken(): string | null {
if (typeof localStorage !== 'undefined') {
return localStorage.getItem(TOKEN_KEY);
}
return null;
}
/** Returns true if the user has a stored auth token. */
export function isAuthenticated(): boolean {
return getAuthToken() !== null;
}
/** Stores the JWT token after successful login. */
export function setAuthToken(token: string): void {
if (typeof localStorage !== 'undefined') {
localStorage.setItem(TOKEN_KEY, token);
}
}
/** Removes the stored token and redirects to login. */
export function clearAuth(): void {
if (typeof localStorage !== 'undefined') {
localStorage.removeItem(TOKEN_KEY);
}
}