updated app start
This commit is contained in:
@@ -129,16 +129,44 @@
|
||||
|
||||
<!-- Modal for Status Updates -->
|
||||
<div class="modal fade" id="statusModal" tabindex="-1" aria-labelledby="statusModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content {{ 'dark-mode' if theme == 'dark' else '' }}">
|
||||
<div class="modal-header {{ 'dark-mode' if theme == 'dark' else '' }}">
|
||||
<h5 class="modal-title" id="statusModalLabel">Processing Files</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="status-message">Uploading and processing your files. Please wait...</p>
|
||||
<div class="progress">
|
||||
<div class="progress mb-3">
|
||||
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
|
||||
<!-- Real-time performance monitoring during upload -->
|
||||
<div class="performance-monitor mt-4">
|
||||
<h6>System Load During Upload:</h6>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<small>CPU Usage</small>
|
||||
<div class="progress mb-1" style="height: 20px;">
|
||||
<div id="modal-cpu-bar" class="progress-bar bg-info" style="width: 0%;">0%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<small>Memory Usage</small>
|
||||
<div class="progress mb-1" style="height: 20px;">
|
||||
<div id="modal-memory-bar" class="progress-bar bg-warning" style="width: 0%;">0%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<small>Disk Usage</small>
|
||||
<div class="progress mb-1" style="height: 20px;">
|
||||
<div id="modal-disk-bar" class="progress-bar bg-danger" style="width: 0%;">0%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<small id="perf-stats" class="text-muted">Waiting for performance data...</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer {{ 'dark-mode' if theme == 'dark' else '' }}">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" disabled>Close</button>
|
||||
@@ -226,6 +254,9 @@
|
||||
statusMessage.textContent = 'Uploading and processing your files. Please wait...';
|
||||
}
|
||||
|
||||
// Start performance monitoring during upload
|
||||
startUploadMonitoring();
|
||||
|
||||
// Simulate progress updates
|
||||
const progressBar = document.getElementById('progress-bar');
|
||||
let progress = 0;
|
||||
@@ -236,6 +267,7 @@
|
||||
|
||||
if (progress >= 100) {
|
||||
clearInterval(interval);
|
||||
stopUploadMonitoring();
|
||||
statusMessage.textContent = 'Files uploaded and processed successfully!';
|
||||
|
||||
// Enable the close button
|
||||
@@ -246,6 +278,82 @@
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// Performance monitoring during upload
|
||||
let uploadMonitoringInterval = null;
|
||||
let startCpu = 0, startMemory = 0;
|
||||
let maxUploadCpu = 0, maxUploadMemory = 0;
|
||||
|
||||
function updateModalPerformance(data) {
|
||||
// Update CPU bar
|
||||
const cpuBar = document.getElementById('modal-cpu-bar');
|
||||
cpuBar.style.width = `${data.cpu_percent}%`;
|
||||
cpuBar.textContent = `${data.cpu_percent.toFixed(1)}%`;
|
||||
if (data.cpu_percent > 75) cpuBar.className = 'progress-bar bg-danger';
|
||||
else if (data.cpu_percent > 50) cpuBar.className = 'progress-bar bg-warning';
|
||||
else cpuBar.className = 'progress-bar bg-info';
|
||||
|
||||
// Update Memory bar
|
||||
const memoryBar = document.getElementById('modal-memory-bar');
|
||||
memoryBar.style.width = `${data.memory_percent}%`;
|
||||
memoryBar.textContent = `${data.memory_percent.toFixed(1)}%`;
|
||||
if (data.memory_percent > 75) memoryBar.className = 'progress-bar bg-danger';
|
||||
else if (data.memory_percent > 50) memoryBar.className = 'progress-bar bg-warning';
|
||||
else memoryBar.className = 'progress-bar bg-warning';
|
||||
|
||||
// Update Disk bar
|
||||
const diskBar = document.getElementById('modal-disk-bar');
|
||||
diskBar.style.width = `${data.disk_percent}%`;
|
||||
diskBar.textContent = `${data.disk_percent.toFixed(1)}%`;
|
||||
if (data.disk_percent > 85) diskBar.className = 'progress-bar bg-danger';
|
||||
else diskBar.className = 'progress-bar bg-danger';
|
||||
|
||||
// Track peaks
|
||||
if (data.cpu_percent > maxUploadCpu) maxUploadCpu = data.cpu_percent;
|
||||
if (data.memory_percent > maxUploadMemory) maxUploadMemory = data.memory_percent;
|
||||
|
||||
// Update stats text
|
||||
const perfStats = document.getElementById('perf-stats');
|
||||
const cpuChange = startCpu ? (data.cpu_percent - startCpu).toFixed(1) : '0.0';
|
||||
const memChange = startMemory ? (data.memory_percent - startMemory).toFixed(1) : '0.0';
|
||||
perfStats.innerHTML = `CPU: ${cpuChange > 0 ? '+' : ''}${cpuChange}% | Memory: ${memChange > 0 ? '+' : ''}${memChange}% | Peak CPU: ${maxUploadCpu.toFixed(1)}%`;
|
||||
}
|
||||
|
||||
function startUploadMonitoring() {
|
||||
// Get baseline performance
|
||||
fetch('/api/performance')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (!data.error) {
|
||||
startCpu = data.cpu_percent;
|
||||
startMemory = data.memory_percent;
|
||||
maxUploadCpu = data.cpu_percent;
|
||||
maxUploadMemory = data.memory_percent;
|
||||
updateModalPerformance(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Start monitoring every 1 second during upload
|
||||
uploadMonitoringInterval = setInterval(() => {
|
||||
fetch('/api/performance')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (!data.error) {
|
||||
updateModalPerformance(data);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('Performance monitoring error:', error);
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function stopUploadMonitoring() {
|
||||
if (uploadMonitoringInterval) {
|
||||
clearInterval(uploadMonitoringInterval);
|
||||
uploadMonitoringInterval = null;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user