<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tenant Harmony | Per-Tenant Fairness Dashboard</title>
<!-- Tailwind CSS (CDN) -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Three.js (CDN) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<!-- Google Fonts: Playfair Display (Serif) & Lora (Body) -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;1,400&family=Playfair+Display:wght@400;600;700&display=swap" rel="stylesheet">
<!-- Tailwind Configuration -->
<script>
tailwind.config = {
theme: {
extend: {
colors: {
// Earthy Palette: No pure black/white
paper: '#f4f1ea', // Creamy base
stone: '#e6e2d8', // Lighter stone
ink: '#2c2c2c', // Soft charcoal
sage: '#8da399', // Muted green
terracotta: '#c96c48', // Burnt orange
clay: '#c7b198', // Beige-brown
moss: '#556b2f', // Dark olive
accent: '#bc6c25' // Warm earth highlight
},
fontFamily: {
serif: ['"Playfair Display"', 'serif'],
body: ['"Lora"', 'serif'],
},
boxShadow: {
'soft': '0 10px 40px -10px rgba(44, 44, 44, 0.08)',
'inner-soft': 'inset 0 2px 4px 0 rgba(44, 44, 44, 0.03)',
},
animation: {
'float': 'float 6s ease-in-out infinite',
},
keyframes: {
float: {
'0%, 100%': { transform: 'translateY(0)' },
'50%': { transform: 'translateY(-5px)' },
}
}
}
}
}
</script>
<style>
/* --- Global Textures & Wabi-Sabi Styling --- */
/* 1. Noise Overlay: Simulates paper/grain texture */
.noise-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none;
z-index: 50;
opacity: 0.07;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
/* 2. Organic Shapes: Asymmetric border radii */
.organic-radius {
border-radius: 2.5rem 1.5rem 3.5rem 1.5rem / 1.5rem 2.5rem 2rem 3.5rem;
}
.organic-radius-sm {
border-radius: 1rem 0.75rem 1.5rem 0.5rem;
}
/* 3. Blob Backgrounds */
.blob-saturation-0 { border-radius: 1.5rem 4rem 3rem 1rem; }
.blob-saturation-1 { border-radius: 3rem 1.5rem 1.5rem 4rem; }
.blob-saturation-2 { border-radius: 2rem 2rem 4rem 1.5rem; }
/* 4. Smooth Scroll & Font Rendering */
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* 5. Glassmorphism (Frosted Paper) */
.glass-panel {
background: rgba(244, 241, 234, 0.65); /* Paper color with opacity */
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.6);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}
/* 6. Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7b198; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #bc6c25; }
/* 7. Progress Bar Organic Shape */
.saturation-track {
border-radius: 999px;
background: rgba(44, 44, 44, 0.06);
overflow: hidden;
height: 0.75rem;
}
.saturation-fill {
transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1); /* Ultra smooth natural ease */
border-radius: 999px;
}
/* 8. Status Pills */
.status-pill {
font-variant-numeric: tabular-nums;
letter-spacing: 0.05em;
text-transform: uppercase;
font-size: 0.75rem;
padding: 0.25rem 0.75rem;
border-radius: 999px;
background: rgba(255, 255, 255, 0.5);
border: 1px solid rgba(0,0,0,0.05);
transition: all 0.5s ease;
}
</style>
</head>
<body class="bg-paper text-ink font-body overflow-x-hidden relative">
<!-- Three.js Background Canvas -->
<canvas id="bg-canvas" class="fixed top-0 left-0 w-full h-full -z-10"></canvas>
<!-- Noise Texture Overlay -->
<div class="noise-overlay"></div>
<!-- Main Content -->
<main class="relative z-10 w-full max-w-7xl mx-auto px-6 py-12 md:py-20">
<!-- Header Section -->
<header class="mb-16 md:mb-24 flex flex-col md:flex-row justify-between items-end md:items-center gap-6 animate-fade-in-up">
<div class="text-center md:text-left">
<h1 class="font-serif text-4xl md:text-6xl font-bold tracking-tight mb-2" style="text-shadow: 0 2px 10px rgba(0,0,0,0.03);">
Tenant <span class="italic text-terracotta">Harmony</span>
</h1>
<p class="text-lg md:text-xl text-ink/70 max-w-md">
Monitoring quotas, throttles, and system saturation with organic intuition.
</p>
</div>
<!-- Date / Context -->
<div class="text-right">
<div class="text-sm font-serif italic opacity-60 uppercase tracking-widest">System Status</div>
<div id="clock" class="text-2xl font-serif font-medium text-moss">--:--</div>
</div>
</header>
<!-- Global Aggregates (The "Sun" of the Dashboard) -->
<section class="grid grid-cols-1 md:grid-cols-3 gap-8 mb-16">
<!-- Aggregate Card 1 -->
<div class="glass-panel organic-radius p-8 hover:translate-y-[-2px] transition-transform duration-700 ease-out group">
<div class="flex justify-between items-start">
<div>
<div class="text-xs uppercase tracking-wider opacity-60 mb-1">Total Tenants</div>
<div class="text-4xl font-serif font-medium" id="total-tenants">0</div>
</div>
<div class="text-2xl opacity-20 group-hover:opacity-40 transition-opacity">☾</div>
</div>
<div class="mt-4 text-sm opacity-60">Active namespaces in cluster</div>
</div>
<!-- Aggregate Card 2 -->
<div class="glass-panel organic-radius p-8 hover:translate-y-[-2px] transition-transform duration-700 ease-out group relative overflow-hidden">
<!-- Decorative organic blob behind -->
<div class="absolute -right-4 -bottom-4 w-24 h-24 bg-sage/10 rounded-full blur-2xl"></div>
<div class="flex justify-between items-start">
<div>
<div class="text-xs uppercase tracking-wider opacity-60 mb-1">Avg Saturation</div>
<div class="text-4xl font-serif font-medium" id="avg-saturation">0%</div>
</div>
<div class="text-2xl opacity-20 group-hover:opacity-40 transition-opacity">◉</div>
</div>
<div class="mt-4 text-sm opacity-60">Resource utilization across all tiers</div>
<!-- Mini visual gauge -->
<div class="w-full h-1.5 bg-stone-300/50 mt-4 rounded-full overflow-hidden">
<div id="avg-bar" class="h-full bg-sage transition-all duration-1000 ease-out" style="width: 0%"></div>
</div>
</div>
<!-- Aggregate Card 3 -->
<div class="glass-panel organic-radius p-8 hover:translate-y-[-2px] transition-transform duration-700 ease-out group">
<div class="flex justify-between items-start">
<div>
<div class="text-xs uppercase tracking-wider opacity-60 mb-1">Throttled</div>
<div class="text-4xl font-serif font-medium text-terracotta" id="throttled-count">0</div>
</div>
<div class="text-2xl opacity-20 group-hover:opacity-40 transition-opacity">!</div>
</div>
<div class="mt-4 text-sm opacity-60">Tenants hitting limits</div>
</div>
</section>
<!-- Tenant Grid -->
<section>
<div class="flex items-center justify-between mb-8">
<h2 class="font-serif text-2xl font-medium">Tenant Overview</h2>
<div class="flex gap-2">
<button class="status-pill border-sage/30 text-sage hover:bg-sage hover:text-white transition-colors">All</button>
<button class="status-pill opacity-50 hover:opacity-100">High Load</button>
<button class="status-pill opacity-50 hover:opacity-100">Throttled</button>
</div>
</div>
<!-- Grid Container -->
<div id="tenant-grid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Tenant Cards Injected via JS -->
</div>
</section>
<!-- Footer -->
<footer class="mt-24 text-center text-ink/40 text-sm font-body pb-8">
<p>Designed with Biophilic principles • Wabi-Sabi interface</p>
</footer>
</main>
<!-- Noise Overlay (Specific to text readability) -->
<div class="fixed inset-0 pointer-events-none z-50 mix-blend-multiply opacity-[0.03]" style="background-image: url('data:image/svg+xml,%3Csvg viewBox=%220 0 200 200%22 xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cfilter id=%22noise%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.8%22 numOctaves=%223%22 stitchTiles=%22stitch%22/%3E%3C/filter%3E%3Crect width=%22100%25%22 height=%22100%25%22 filter=%22url(%23noise)%22 opacity=%221%22/%3E%3C/svg%3E');"></div>
<script>
// ==========================================
// 1. THE THREE.JS BACKGROUND (ORGANIC FOG)
// ==========================================
const initThreeJS = () => {
const canvas = document.getElementById('bg-canvas');
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); // Performance friendly
canvas.appendChild(renderer.domElement);
const scene = new THREE.Scene();
// Camera setup: Orthographic for a 2D-flat texture feel, yet 3D distortion
const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
// Simple plane covering the whole view
const geometry = new THREE.PlaneGeometry(2, 2);
// Custom Shader Material: Slow-moving noise/gradient
const vertexShader = `
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position, 1.0);
}
`;
const fragmentShader = `
uniform float uTime;
uniform vec2 uResolution;
uniform vec2 uMouse;
varying vec2 vUv;
// Simple pseudo-random noise
float random (in vec2 _st) {
return fract(sin(dot(_st.xy, vec2(12.9898,78.233))) * 43758.5453123);
}
// 2D Noise based on Morgan McGuire @morgan3d
float noise (in vec2 _st) {
vec2 i = floor(_st);
vec2 f = fract(_st);
float a = random(i);
float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0));
float d = random(i + vec2(1.0, 1.0));
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(a, b, u.x) + (c - a)* u.y * (1.0 - u.x) + (d - b) * u.x * u.y;
}
// Fractal Brownian Motion
float fbm (in vec2 _st) {
float v = 0.0;
float a = 0.5;
vec2 shift = vec2(100.0);
// Rotate to reduce axial bias
mat2 rot = mat2(cos(0.5), sin(0.5), -sin(0.5), cos(0.50));
for (int i = 0; i < 5; ++i) {
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
}
return v;
}
void main() {
vec2 st = vUv * 2.0 - 1.0; // -1 to 1
// Aspect ratio correction for noise
st.x *= uResolution.x / uResolution.y;
// Mouse influence: gently shift the noise coordinates
vec2 mouseOffset = uMouse * 0.2;
float n = fbm(st * 1.5 + uTime * 0.1 + mouseOffset);
// Define colors (Earth palette in linear space logic)
// We want light cream to faint sage/stone
vec3 color1 = vec3(0.957, 0.945, 0.918); // Paper (#f4f1ea)
vec3 color2 = vec3(0.553, 0.639, 0.6); // Sage (#8da399) - desaturated
vec3 color3 = vec3(0.788, 0.694, 0.596); // Clay (#c7b198)
// Mix colors based on noise
vec3 color = mix(color1, color2, n);
color = mix(color, color3, n * n * 0.6); // Add depth with third color
// Vignette to darken edges slightly (Dappled effect)
float dist = distance(vUv, vec2(0.5));
color *= 1.0 - dist * 0.5;
gl_FragColor = vec4(color, 1.0);
}
`;
const uniforms = {
uTime: { value: 0 },
uResolution: { value: new THREE.Vector2(window.innerWidth, window.innerHeight) },
uMouse: { value: new THREE.Vector2(0, 0) }
};
const material = new THREE.ShaderMaterial({
uniforms: uniforms,
vertexShader: vertexShader,
fragmentShader: fragmentShader
});
const plane = new THREE.Mesh(geometry, material);
scene.add(plane);
// Animation Loop
const animate = (time) => {
requestAnimationFrame(animate);
uniforms.uTime.value = time * 0.0005; // Slow seconds
renderer.render(scene, camera);
};
animate();
// Handle Mouse Move
window.addEventListener('mousemove', (e) => {
const x = (e.clientX / window.innerWidth) * 2 - 1; // -1 to 1
const y = -(e.clientY / window.innerHeight) * 2 + 1; // -1 to 1
// Smooth interpolation could be added, but direct is fine for subtlety
uniforms.uMouse.value.set(x * 0.5, y * 0.5);
});
// Resize
window.addEventListener('resize', () => {
renderer.setSize(window.innerWidth, window.innerHeight);
uniforms.uResolution.value.set(window.innerWidth, window.innerHeight);
});
};
// ==========================================
// 2. DATA MODEL (TENANT SIMULATION)
// ==========================================
const TENANT_COUNT = 12;
const NAMES = ["Aether", "Boreas", "Cryos", "Dynamo", "Eos", "Flux", "Glacier", "Helix", "Ions", "Jupiter", "Kappa", "Lumen"];
const generateTenants = (count) => {
return Array.from({ length: count }, (_, i) => {
const quota = Math.floor(Math.random() * 800) + 200; // 200-1000 units
const usage = Math.floor(Math.random() * quota); // 0-100% usage
// 20% chance of being throttled
const isThrottled = usage > quota * 0.85 ? true : (Math.random() > 0.8);
// Throttle intensity depth if active
const throttleDepth = isThrottled ? (usage - (quota * 0.85)) / (quota * 0.15) : 0;
return {
id: i + 1,
name: NAMES[i] || `Tenant-${i+1}`,
quota: quota,
usage: usage,
isThrottled: isThrottled,
throttleDepth: throttleDepth, // 0 to 1
region: ['us-east', 'eu-west', 'ap-south'][Math.floor(Math.random() * 3)]
};
});
};
// ==========================================
// 3. UI RENDERING & UPDATES
// ==========================================
const tenantGrid = document.getElementById('tenant-grid');
// Function to determine color based on saturation
const getSaturationColor = (ratio) => {
if (ratio < 0.5) return 'bg-sage'; // Healthy
if (ratio < 0.85) return 'bg-clay'; // Warning
return 'bg-terracotta'; // Critical/Throttled
};
// Create Tenant Card Element
const createTenantCard = (tenant) => {
const ratio = tenant.usage / tenant.quota;
const pct = Math.round(ratio * 100);
const colorClass = getSaturationColor(ratio);
// Organic random radii for visual variety
const radiusClass = [
'organic-radius-sm',
'rounded-3xl',
'rounded-[2.5rem_1.5rem_3.5rem_1.5rem]',
'rounded-[1.5rem_3rem_2rem_2.5rem]'
][Math.floor(Math.random() * 4)];
const card = document.createElement('div');
card.className = `glass-panel ${radiusClass} p-6 flex flex-col justify-between transition-transform duration-700 hover:scale-[1.02] hover:shadow-soft relative overflow-hidden group`;
card.dataset.id = tenant.id;
// Subtle noise/grain specific to card (optional, using global noise is enough, but adds depth)
// card.style.background = `rgba(255,255,255,${0.1 + Math.random()*0.2})`; // Variation
card.innerHTML = `
<div class="relative z-10">
<div class="flex justify-between items-start mb-2">
<div>
<h3 class="font-serif text-xl font-bold text-ink">${tenant.name}</h3>
<div class="text-xs uppercase tracking-widest opacity-50 text-ink/60">${tenant.region} • ID: ${tenant.id}</div>
</div>
<div class="status-pill ${tenant.isThrottled ? 'bg-terracotta/10 text-terracotta border-terracotta/20' : 'bg-sage/10 text-sage border-sage/20'}">
${tenant.isThrottled ? 'Throttled' : 'Normal'}
</div>
</div>
<div class="grid grid-cols-2 gap-4 mb-6">
<div>
<div class="text-xs uppercase tracking-wider opacity-50 mb-1">Quota</div>
<div class="font-serif text-lg">${tenant.quota.toLocaleString()} <span class="text-xs opacity-40">GB</span></div>
</div>
<div class="text-right">
<div class="text-xs uppercase tracking-wider opacity-50 mb-1">Saturation</div>
<div class="font-serif text-lg">${pct}%</div>
</div>
</div>
<!-- Organic Progress Bar -->
<div class="saturation-track">
<div class="saturation-fill ${colorClass} ${tenant.isThrottled ? 'opacity-80' : ''}"
data-width="${pct}%"
style="width: 0%">
</div>
</div>
</div>
<!-- Decorative Background Blob (Watercolor style) -->
<div class="absolute -right-4 -bottom-4 w-32 h-32 rounded-full bg-terracotta/5 blur-2xl group-hover:bg-terracotta/10 transition-colors duration-700"></div>
`;
return card;
};
const updateDashboard = () => {
const tenants = generateTenants(TENANT_COUNT);
tenantGrid.innerHTML = '';
let totalUsage = 0;
let totalQuota = 0;
let throttleCount = 0;
tenants.forEach(tenant => {
totalUsage += tenant.usage;
totalQuota += tenant.quota;
if(tenant.isThrottled) throttleCount++;
// Append card
tenantGrid.appendChild(createTenantCard(tenant));
// Animate bar fill after a brief delay to allow CSS transition to catch initial 0 width
setTimeout(() => {
const card = tenantGrid.lastElementChild;
const fill = card.querySelector('.saturation-fill');
const targetWidth = (tenant.usage / tenant.quota) * 100;
fill.style.width = `${targetWidth}%`;
}, 100 + (Math.random() * 800)); // Staggered animation
});
// Update Aggregate Stats
document.getElementById('total-tenants').textContent = TENANT_COUNT;
document.getElementById('throttled-count').textContent = throttleCount;
const avgSaturation = Math.round((totalUsage / totalQuota) * 100);
document.getElementById('avg-saturation').textContent = `${avgSaturation}%`;
const avgBar = document.getElementById('avg-bar');
// Color coding for global average
let avgColor = 'bg-sage';
if (avgSaturation > 50) avgColor = 'bg-clay';
if (avgSaturation > 85) avgColor = 'bg-terracotta';
avgBar.className = `h-full ${avgColor} transition-all duration-1000 ease-out`;
// Trigger width transition
requestAnimationFrame(() => {
avgBar.style.width = `0%`; // reset
setTimeout(() => avgBar.style.width = `${avgSaturation}%`, 50);
});
};
// ==========================================
// 4. LIVE SIMULATION CYCLE
// ==========================================
// Simulate "live" updates: Every few seconds, pick a random card and update its metrics
const liveUpdate = () => {
const cards = Array.from(tenantGrid.children);
if (cards.length === 0) return;
// Pick 1-3 random tenants to update
const count = Math.floor(Math.random() * 3) + 1;
for(let i=0; i<count; i++) {
const randomCard = cards[Math.floor(Math.random() * cards.length)];
const id = parseInt(randomCard.dataset.id);
// Re-generate data for this specific ID logic (simplified here by just modifying DOM)
// In a real app, we would fetch new data from an API.
// Find current values within DOM (or keep data state separate, but for demo we approximate)
// Let's just randomize the bar width slightly to simulate "flux"
const fill = randomCard.querySelector('.saturation-fill');
const statusPill = randomCard.querySelector('.status-pill');
const satDisplay = randomCard.querySelector('.grid-cols-2 .font-serif.text-lg:last-child'); // last of the two stats
let currentWidth = parseFloat(fill.style.width);
// Fluctuate +/- 5%
let fluctuation = (Math.random() * 10) - 5;
let newWidth = Math.max(0, Math.min(100, currentWidth + fluctuation));
// Update bar
fill.style.width = `${newWidth}%`;
// Update percentage text
if(satDisplay) satDisplay.textContent = `${Math.round(newWidth)}%`;
// Color check
const pct = newWidth;
const colorClass = getSaturationColor(pct/100);
fill.className = fill.className.replace(/bg-\w+/g, colorClass); // replace color class
// Check throttle status
const isThrottled = pct > 85;
if (isThrottled) {
fill.classList.add('opacity-80');
statusPill.className = 'status-pill bg-terracotta/10 text-terracotta border-terracotta/20';
statusPill.textContent = 'Throttled';
} else {
fill.classList.remove('opacity-80');
statusPill.className = 'status-pill bg-sage/10 text-sage border-sage/20';
statusPill.textContent = 'Normal';
}
}
// Recalculate aggregates occasionally (throttled)
// For performance we skip re-calc aggregates every live tick,
// instead we rely on the weekly full refresh.
};
// ==========================================
// 5. CLOCK & INIT
// ==========================================
const updateClock = () => {
const now = new Date();
document.getElementById('clock').textContent = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
};
// Main Execution
window.addEventListener('DOMContentLoaded', () => {
initThreeJS();
// Initial Render
updateDashboard();
// Clock
setInterval(updateClock, 1000);
updateClock();
// Live updates every 2.5 seconds (slow, calming rhythm)
setInterval(liveUpdate, 2500);
});
</script>
</body>
</html>