Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRunfola committed Feb 24, 2025
1 parent 473b36e commit f1d2a14
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions geoBoundaryBuilder/monitor/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,28 +280,14 @@ <h2>Worker Status Grid</h2>
}

function getStatusColor(status, timestamp) {
const ageInDays = (new Date() - new Date(timestamp)) / (1000 * 60 * 60 * 24);
const ageInHours = (new Date() - new Date(timestamp)) / (1000 * 60 * 60);
const baseColor = status.includes('COMPLETE') ? [46, 204, 113] : // Green
status.includes('ERROR') ? [231, 76, 60] : // Red
[241, 196, 15]; // Yellow

if (status.includes('ERROR')) {
// Red colors for ERROR: Brighter red for older (up to 1 month), darker red for newer
const brightness = Math.min(ageInDays / 30, 1); // Scale over 30 days
const red = 200 + Math.round(55 * brightness); // 200-255
const other = 30 + Math.round(30 * brightness); // 30-60
return `rgb(${red},${other},${other})`;
} else if (status.includes('COMPLETE')) {
// Green colors: Dark green for older (1+ month), bright green for newer
const brightness = Math.max(0, 1 - (ageInDays / 30)); // Scale over 30 days
const green = 100 + Math.round(155 * brightness); // 100-255
const other = 30 + Math.round(40 * brightness); // 30-70
return `rgb(${other},${green},${other})`;
} else {
// Yellow turning to bright red if more than 1 day old
if (ageInDays > 1) {
return 'rgb(255,50,50)'; // Bright red
}
return 'rgb(241,196,15)'; // Yellow
}
}
// Darken based on age (up to 72 hours)
const darkening = Math.min(ageInHours / 72, 1) * 0.7; // Max 70% darker
return `rgb(${baseColor.map(c => Math.round(c * (1 - darkening))).join(',')})`;
}

function updateWorkerGrid() {
Expand Down

0 comments on commit f1d2a14

Please sign in to comment.