- Updated .dockerignore and .gitignore for better file management. - Introduced .env.example for environment variable configuration. - Added docker-compose.dev.yml for development with mock data and live reload. - Enhanced Dockerfile to include necessary dependencies and entrypoint script. - Created mock_data.py to provide sample data for testing without OpenStack/Prometheus. - Added unit tests for template filters in dashboard. - Cleaned up various files for consistency and improved readability.
26 lines
943 B
JavaScript
26 lines
943 B
JavaScript
// Color utilities
|
|
const getCSSVar = (varName) => {
|
|
return getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
}
|
|
function getColorWithOpacity(className) {
|
|
const element = document.createElement('div');
|
|
element.className = className;
|
|
element.style.opacity = '1'; // Force opacity
|
|
element.textContent = '.';
|
|
|
|
document.body.appendChild(element);
|
|
const computedColor = window.getComputedStyle(element).color;
|
|
document.body.removeChild(element);
|
|
|
|
return computedColor;
|
|
}
|
|
// Utility function to calculate mean and standard deviation
|
|
function calculateStats(data) {
|
|
if (!data || data.length === 0) return { mean: 0, std: 0 };
|
|
|
|
const mean = data.reduce((a, b) => a + b, 0) / data.length;
|
|
const variance = data.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / data.length;
|
|
const std = Math.sqrt(variance);
|
|
|
|
return { mean, std };
|
|
} |