Files
zero-scale-platform/cmd/zero-scale-dashboard/static/js/efficiency.js
Stephen Schuresko 7659c711ac feat: enhance zero-scale dashboard with resource display and update functionality
- Added RAM and CPU resource display in the zero-scale dashboard for active applications.
- Implemented dynamic updates for resource display based on application state.

feat: expand zero-scale control script with new commands and options

- Introduced `apply`, `upload-binary`, and `provision-db` commands to the zero-scale control script.
- Added options for specifying configuration files, binary uploads, and database provisioning parameters.

feat: implement temporal JWKS aggregator service

- Created a new service to aggregate JWKS from Gitea and Kubernetes API.
- Implemented caching and refresh logic for JWKS keys.

feat: deploy shared MySQL and Redis services

- Added Kubernetes manifests for shared MySQL and Redis services, including StatefulSet and ConfigMap definitions.
- Configured persistent storage and resource limits for MySQL and Redis deployments.

feat: add temporal OAuth secret example and values configuration

- Created example secret manifest for OAuth credentials required by Temporal.
- Added a values file for configuring Temporal server with JWKS integration and resource limits.

feat: implement Kubernetes token provider for Temporal client

- Developed a K8sTokenHeadersProvider to supply Kubernetes service account tokens to Temporal.
- Added tests for token retrieval and environment variable fallback.
2026-10-11 17:43:21 -04:00

89 lines
4.6 KiB
JavaScript

function renderEfficiency(eff, stack) {
if (!eff) return;
const effPct = Math.round(eff.saved_memory_percent || 0);
const savedGB = (eff.saved_memory_mb / 1024).toFixed(2);
const tradGB = (eff.traditional_baseline_mb / 1024).toFixed(2);
const actGB = (eff.current_actual_mb / 1024).toFixed(2);
const badgeEff = document.getElementById('badge-efficiency-saved');
if (badgeEff) badgeEff.innerText = `${effPct}% Memory Saved`;
// Card 1: Zero-Scale Serverless
const serverlessSavedMB = eff.serverless_savings_mb;
const serverlessSavedGB = (serverlessSavedMB / 1024).toFixed(2);
const elZeroSaved = document.getElementById('eff-zero-saved');
if (elZeroSaved) elZeroSaved.innerText = `${serverlessSavedGB} GB`;
const elZeroDesc = document.getElementById('eff-zero-desc');
if (elZeroDesc) elZeroDesc.innerText = `${eff.idle_zero_apps} of ${eff.total_apps_count} services idle at 0 MB RAM`;
const zeroSavedPct = eff.total_apps_count > 0 ? Math.round((eff.idle_zero_apps / eff.total_apps_count) * 100) : 100;
const elZeroPct = document.getElementById('eff-zero-pct');
if (elZeroPct) elZeroPct.innerText = `${zeroSavedPct}% Idle (0 MB)`;
const elZeroFill = document.getElementById('fill-zero-saved');
if (elZeroFill) elZeroFill.style.width = `${zeroSavedPct}%`;
// Total Zero-Scale Cluster Footprint & Stack Total Badge
const badgeFootprint = document.getElementById('badge-zero-footprint');
const elZeroFootVal = document.getElementById('eff-zero-footprint-val');
if (stack) {
if (badgeFootprint) {
badgeFootprint.innerText = `⚡ Stack Total: ${formatBytes(stack.total_ram_bytes)} RAM • ${formatCores(stack.total_cpu_cores)} CPU (${stack.cluster_ram_percent.toFixed(1)}% Cluster RAM)`;
}
if (elZeroFootVal) {
elZeroFootVal.innerText = `${formatBytes(stack.zero_scale_ram_bytes)} RAM • ${formatCores(stack.zero_scale_cpu_cores)} CPU`;
}
} else {
const zeroFootMB = eff.total_zero_scale_footprint_mb || 0;
const zeroClusterPct = eff.zero_scale_cluster_percent || 0;
if (badgeFootprint) {
badgeFootprint.innerText = `⚡ Total Zero-Scale: ${zeroFootMB.toFixed(1)} MB (${zeroClusterPct.toFixed(2)}% of Cluster)`;
}
if (elZeroFootVal) {
elZeroFootVal.innerText = `${zeroFootMB.toFixed(1)} MB (${zeroClusterPct.toFixed(2)}% of cluster)`;
}
}
// Card 2: CloudNativePG DB Pooling (Explicitly Clarifying Savings vs Consumption)
const dbSavedMB = eff.database_savings_mb || 620;
const dbBaselineMB = eff.database_baseline_mb || 900;
const elDbSaved = document.getElementById('eff-db-saved');
if (elDbSaved) elDbSaved.innerText = `~${dbSavedMB} MB Saved`;
const elDbDesc = document.getElementById('eff-db-desc');
if (elDbDesc) elDbDesc.innerText = `Saves ~${dbSavedMB} MB net by pooling databases into 1 shared HA cluster vs 3+ separate 24/7 DB pods`;
const elDbActualVal = document.getElementById('eff-db-actual-val');
if (elDbActualVal) {
if (stack && stack.postgres_ram_bytes > 0) {
elDbActualVal.innerText = `${formatBytes(stack.postgres_ram_bytes)} RAM • ${formatCores(stack.postgres_cpu_cores)} CPU`;
} else {
elDbActualVal.innerText = `~${eff.database_actual_mb || 280} MB`;
}
}
const dbSavedPct = dbBaselineMB > 0 ? Math.round((dbSavedMB / dbBaselineMB) * 100) : 69;
const elDbPct = document.getElementById('eff-db-pct');
if (elDbPct) elDbPct.innerText = `~${dbSavedPct}% Saved`;
const elDbFill = document.getElementById('fill-db-saved');
if (elDbFill) elDbFill.style.width = `${Math.min(dbSavedPct, 100)}%`;
// Card 3: Unified Longhorn Storage
const elStorageVols = document.getElementById('eff-storage-vols');
if (elStorageVols && stack && stack.longhorn_ram_bytes > 0) {
elStorageVols.innerText = `12 Volumes (${formatBytes(stack.longhorn_ram_bytes)} RAM)`;
}
// Card 4: Total Net Cluster Memory Saved
const elTotalSaved = document.getElementById('eff-total-saved');
if (elTotalSaved) elTotalSaved.innerText = `${savedGB} GB`;
const elTotalBreakdown = document.getElementById('eff-total-breakdown');
if (elTotalBreakdown) {
if (stack && stack.total_ram_bytes > 0) {
elTotalBreakdown.innerText = `Stack Live: ${formatBytes(stack.total_ram_bytes)} vs 24/7 Baseline: ${tradGB} GB`;
} else {
elTotalBreakdown.innerText = `Live: ${actGB} GB vs 24/7 Baseline: ${tradGB} GB`;
}
}
const elTotalPct = document.getElementById('eff-total-pct');
if (elTotalPct) elTotalPct.innerText = `${effPct}% Reduction`;
const elTotalFill = document.getElementById('fill-total-saved');
if (elTotalFill) elTotalFill.style.width = `${Math.min(effPct, 100)}%`;
}