- 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.
63 lines
2.7 KiB
JavaScript
63 lines
2.7 KiB
JavaScript
function renderZeroScale(zeroApps, isAuthed, token) {
|
|
const zeroCont = document.getElementById('zero-container');
|
|
if (!zeroCont || !zeroApps) return;
|
|
|
|
const ph = document.getElementById('placeholder-zero');
|
|
if (ph) ph.remove();
|
|
|
|
zeroApps.forEach(app => {
|
|
const cardId = 'zero-card-' + app.host.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
let card = document.getElementById(cardId);
|
|
const stateCls = app.state === 'active' ? 'active' : 'idle';
|
|
const stateLabel = app.state === 'active' ? '🟢 Active' : '💤 Scaled to Zero';
|
|
const logsUrl = isAuthed && token ? `${app.logs_url}?token=${encodeURIComponent(token)}` : app.logs_url;
|
|
|
|
const resHtml = app.state === 'active'
|
|
? `<span style="color: var(--green); font-weight:600;">⚡ ${formatBytes(app.ram_bytes)} RAM</span> • <span style="color: var(--blue); font-weight:600;">${formatCores(app.cpu_cores)} CPU</span>`
|
|
: `<span style="color: var(--text-muted);">⚡ 0 B RAM • 0 cores (Scaled to 0)</span>`;
|
|
|
|
if (!card) {
|
|
card = document.createElement('div');
|
|
card.className = 'zero-card';
|
|
card.id = cardId;
|
|
card.innerHTML = `
|
|
<div>
|
|
<div class="zero-host">${app.host}</div>
|
|
<div class="zero-status-row">
|
|
<span class="status-badge ${stateCls} zero-badge">${stateLabel}</span>
|
|
</div>
|
|
<div class="zero-resource-row" style="text-align:center; font-size:12px; margin-bottom:8px;">
|
|
${resHtml}
|
|
</div>
|
|
<div class="zero-desc">${app.description || 'Zero-scale dynamic service'}</div>
|
|
</div>
|
|
<div class="zero-actions">
|
|
<a href="${app.url}" target="_blank" onclick="handleOpenApp()" class="btn btn-primary" style="flex:1; justify-content:center;">🌐 Open App</a>
|
|
<a href="${logsUrl}" target="_blank" class="btn btn-logs" style="flex:1; justify-content:center;">🔐 Logs</a>
|
|
</div>
|
|
`;
|
|
zeroCont.appendChild(card);
|
|
} else {
|
|
// In-place update
|
|
const badge = card.querySelector('.zero-badge');
|
|
if (badge && badge.innerText !== stateLabel) {
|
|
badge.className = 'status-badge ' + stateCls + ' zero-badge';
|
|
badge.innerText = stateLabel;
|
|
}
|
|
const resEl = card.querySelector('.zero-resource-row');
|
|
if (resEl && resEl.innerHTML !== resHtml) {
|
|
resEl.innerHTML = resHtml;
|
|
}
|
|
const logsLink = card.querySelector('.btn-logs');
|
|
if (logsLink && logsLink.href !== logsUrl) {
|
|
logsLink.href = logsUrl;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function handleOpenApp() {
|
|
setTimeout(() => { if (typeof loadStatus === 'function') loadStatus(); }, 400);
|
|
setTimeout(() => { if (typeof loadStatus === 'function') loadStatus(); }, 1500);
|
|
}
|