- Removed `COMMON_ERRORS.md` file to streamline documentation. - Added `Flask-Limiter` for rate limiting and `redis` for session management in `requirements.txt`. - Expanded `ROADMAP.md` to include completed security features and planned enhancements for version 2.2. - Enhanced `setup_myp.sh` for ultra-secure kiosk installation, including system hardening and security configurations. - Updated `app.py` to integrate CSRF protection and improved logging setup. - Refactored user model to include username and active status for better user management. - Improved job scheduler with uptime tracking and task management features. - Updated various templates for a more cohesive user interface and experience.
64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
/**
|
|
* Admin Dashboard JavaScript
|
|
*/
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Initialize progress bars
|
|
initProgressBars();
|
|
|
|
// Initialize confirmation dialogs for delete buttons
|
|
initConfirmDialogs();
|
|
|
|
// Add automatic fade-out for flash messages after 5 seconds
|
|
initFlashMessages();
|
|
});
|
|
|
|
/**
|
|
* Initialize progress bars by setting the width based on data-width attribute
|
|
*/
|
|
function initProgressBars() {
|
|
const progressBars = document.querySelectorAll('.progress-bar-fill');
|
|
|
|
progressBars.forEach(bar => {
|
|
const width = bar.getAttribute('data-width');
|
|
if (width) {
|
|
// Use setTimeout to allow for a smooth animation
|
|
setTimeout(() => {
|
|
bar.style.width = `${width}%`;
|
|
}, 100);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Initialize confirmation dialogs for delete buttons
|
|
*/
|
|
function initConfirmDialogs() {
|
|
const confirmForms = document.querySelectorAll('form[onsubmit*="confirm"]');
|
|
|
|
confirmForms.forEach(form => {
|
|
form.onsubmit = function() {
|
|
const message = this.getAttribute('onsubmit').match(/confirm\('([^']+)'\)/)[1];
|
|
return confirm(message);
|
|
};
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Initialize auto-hide for flash messages
|
|
*/
|
|
function initFlashMessages() {
|
|
const flashMessages = document.querySelectorAll('.flash-messages .alert');
|
|
|
|
flashMessages.forEach(message => {
|
|
// Auto-hide messages after 5 seconds
|
|
setTimeout(() => {
|
|
message.style.opacity = '0';
|
|
message.style.transition = 'opacity 0.5s ease';
|
|
|
|
// Remove from DOM after fade out
|
|
setTimeout(() => {
|
|
message.remove();
|
|
}, 500);
|
|
}, 5000);
|
|
});
|
|
}
|