- Add SystemAlert.vue component with health check polling - Poll /api/system/health every 30 seconds - Display warning banner when migrations pending - Display error banner when versions incompatible - Auto-hide when system compatible - Add smooth slide-down animation - Fixed position at top (z-index 9999) Features: - Non-intrusive design (doesn't block UI) - Displays version info (backend & database) - i18n support (German/English translations) - Automatic cleanup on component unmount - No authentication required (uses public endpoint) Visual states: - Warning (yellow): Database migration required - Error (red): Incompatible versions - Hidden: All systems compatible Integration: - Added to App.vue (always visible) - Uses axios for API calls - Minimal dependencies - Follows KISS principle Ready for Phase 6: Testing & Documentation
6.4 KiB
Phase 5: Frontend Warning Banner - COMPLETE
Date: 16. Januar 2026
Status: ✅ COMPLETE
Approach: KISS (Keep It Simple, Stupid) - Minimal, non-intrusive design
Summary
Phase 5 has been successfully completed. The frontend now displays a warning banner when database migrations are pending or versions are incompatible.
Implemented Features
1. SystemAlert Component
- Location:
frontend/src/components/SystemAlert.vue - Pattern: Vue 3 Options API (consistent with project)
- Features:
- Polls
/api/system/healthevery 30 seconds - Shows warning banner when
migrations_pending = true - Shows error banner when versions incompatible
- Auto-hides when system compatible
- Displays version information (backend & database)
- Smooth slide-down animation
- Fixed position at top (z-index 9999)
- Polls
2. Component Design
Visual States
Warning State (migrations pending):
⚠️ Datenbank-Migration erforderlich. Bitte kontaktieren Sie den Administrator.
Backend: 0.5.0 | Datenbank: 0.4.0
- Yellow background (#fff3cd)
- Amber border (#ffc107)
Error State (incompatible versions):
✖ Inkompatible Versionen. Backend-Update erforderlich.
Backend: 0.4.0 | Datenbank: 0.5.0
- Red background (#f8d7da)
- Red border (#dc3545)
Hidden (all compatible):
- Banner not shown
- Continues polling in background
3. Internationalization
German (locales/de)
system: {
migrationRequired: 'Datenbank-Migration erforderlich. Bitte kontaktieren Sie den Administrator.',
incompatibleVersions: 'Inkompatible Versionen. Backend-Update erforderlich.',
backendVersion: 'Backend',
databaseVersion: 'Datenbank'
}
English (locales/en)
system: {
migrationRequired: 'Database migration required. Please contact the administrator.',
incompatibleVersions: 'Incompatible versions. Backend update required.',
backendVersion: 'Backend',
databaseVersion: 'Database'
}
4. Integration
App.vue Integration:
<template>
<div id="app">
<SystemAlert /> <!-- Always visible, manages own display -->
<Menu v-if="isLoggedIn" />
<main class="main-content">
<router-view />
</main>
</div>
</template>
Placement: Top of the page, above menu and main content
Technical Implementation
Polling Mechanism
mounted() {
await this.checkSystemHealth() // Initial check
this.startPolling() // Start 30s interval
}
startPolling() {
this.pollInterval = setInterval(() => {
this.checkSystemHealth()
}, 30000) // 30 seconds
}
API Communication
- Uses axios directly (no authentication required for
/api/system/health) - Falls back to
http://localhost:8180if env variable not set - Handles errors gracefully (logs to console, doesn't break UI)
- No authentication headers needed (public endpoint)
Lifecycle Management
beforeUnmount() {
this.stopPolling() // Cleanup interval on component destroy
}
Design Decisions
1. Public Endpoint Access
- No authentication required for health check
- Allows banner to work even before login
- Follows "system status is public" principle
2. Non-Intrusive Design
- Fixed position at top (doesn't push content down)
- Subtle animation (slide down)
- Auto-hides when not needed
- Low priority (doesn't block user interaction)
3. Simple Logic
- Only shows warning when necessary
- No complex state management
- No user dismissal (auto-manages based on system state)
- Minimal dependencies (only axios)
4. Performance
- 30-second polling interval (not aggressive)
- Lightweight component
- No watchers or computed properties overhead
- Cleans up interval on unmount
Files Created/Modified
Created
frontend/src/components/SystemAlert.vue(163 lines)
Modified
frontend/src/App.vue- Added SystemAlert component import and usagefrontend/src/locales/de- Added system translations (4 keys)frontend/src/locales/en- Added system translations (4 keys)
Testing Results
Live Testing
- ✅ Frontend container running (port 5173)
- ✅ No errors in frontend logs
- ✅ Component compiles successfully
- ✅ Vite HMR working
Expected Behavior
Scenario 1: Compatible versions
- GET
/api/system/healthreturnscompatible: true, migrations_pending: false - Banner: Hidden ✅
Scenario 2: Migration pending
- GET
/api/system/healthreturnscompatible: false, migrations_pending: true - Banner: Yellow warning with version info ⚠️
Scenario 3: Incompatible (DB too new)
- GET
/api/system/healthreturnscompatible: false, migrations_pending: false - Banner: Red error with version info ✖
Browser Compatibility
- Modern browsers with ES6 support
- Fixed positioning support
- CSS animations support
- All major browsers: Chrome, Firefox, Safari, Edge
Future Enhancements (Low Priority)
Potential improvements if needed:
- Click to dismiss temporarily
- Countdown timer until next check
- Admin-only "run migration" button (requires auth integration)
- Websocket for real-time updates (instead of polling)
- Progress indicator during migration
- More detailed migration info in tooltip
Notes
- Component follows KISS principle - minimal code, maximum clarity
- No external dependencies beyond axios (already in project)
- Follows project conventions (Options API, template-style-script order)
- Translations follow existing pattern (nested objects)
- Component is self-contained and doesn't affect other parts of the app
- Z-index 9999 ensures banner is always on top
Integration with Backend
The component relies on Phase 4 endpoints:
GET /api/system/health- Primary endpoint for status checks- Returns all necessary data in single call
- No additional endpoints needed
Complete System Flow
Frontend Loads
↓
SystemAlert.mounted()
↓
Initial health check via axios
↓
Start 30s polling interval
↓
Every 30s: GET /api/system/health
↓
Parse response
↓
Update banner state (show/hide/type)
↓
User sees banner if needed
↓
Backend migration completed
↓
Next poll detects compatible state
↓
Banner auto-hides
Phase 5 Complete!
The frontend warning banner is now functional and integrated. Users will be notified when database migrations are pending or when there are version incompatibilities.
Next: Phase 6 - Testing & Documentation