bmc_hub/patch_overview_logic.py
Christian ceb560e2f2 feat: Add bottom bar functionality with real-time updates and manual endpoint tests
- Implemented a new bottom bar feature in `bottom-bar.js` that fetches and displays various notifications and statuses in real-time.
- Added functions for handling visibility, state updates, and user interactions within the bottom bar.
- Introduced WebSocket connection for real-time updates and fallback polling mechanism.
- Created a manual testing script `test_manual.py` to validate API endpoints for the manual module.
- Included tests for various paths to ensure expected responses from the server.
2026-04-12 02:27:01 +02:00

28 lines
1.3 KiB
Python

with open("static/js/bottom-bar.js", "r") as f:
content = f.read()
old_overview = """ if (key === 'overview') {
return [
'Velkommen til dit overblik',
'Her vises det vigtigste på tværs af systemet',
'Næste opgave kl. 14:00'
];
}"""
new_overview = """ if (key === 'overview') {
let out = [];
if (urgent.count > 0) out.push('🚨 Hastesager: ' + urgent.count + ' aktive');
if (mail.unread > 0) out.push('📧 Ubesvarede mails: ' + mail.unread + ' (' + mail.customer_reply_needed + ' kræver svar)');
if (cases.open > 0) out.push('📂 Åbne sager i alt: ' + cases.open);
if (kuma.down > 0) out.push('📉 Uptime Kuma nedetid: ' + kuma.down + ' enheder');
if (eset.incidents > 0) out.push('🔐 ESET incidents: ' + eset.incidents);
if (out.length === 0) {
out.push('🎉 Alt ser grønt ud! Intet kritisk lige nu.');
out.push('👉 Klik på fanerne til venstre for mere info.');
}
return out;
}"""
content = content.replace(old_overview, new_overview)
with open("static/js/bottom-bar.js", "w") as f:
f.write(content)