diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/app.js | 10 | ||||
| -rw-r--r-- | web/index.html | 2 | ||||
| -rw-r--r-- | web/test/deployment-badge.test.mjs | 24 |
3 files changed, 15 insertions, 21 deletions
@@ -107,8 +107,7 @@ export function renderDeploymentBadge(status, doc = (typeof document !== 'undefi span.className = 'deployment-badge deployment-badge--deployed'; span.textContent = '✓ Deployed'; } else { - span.className = 'deployment-badge deployment-badge--pending'; - span.textContent = '⚠ Not deployed'; + return null; } if (status.deployed_commit) { span.title = `Deployed commit: ${status.deployed_commit.slice(0, 8)}`; @@ -179,8 +178,9 @@ function createTaskCard(task) { if (csBadge) card.appendChild(csBadge); } - // Deployment status badge for READY tasks - if (task.state === 'READY' && task.deployment_status != null) { + // Deployment status badge for READY tasks — only when there are tracked commits to check. + if (task.state === 'READY' && task.deployment_status != null && + task.deployment_status.fix_commits && task.deployment_status.fix_commits.length > 0) { const depBadge = renderDeploymentBadge(task.deployment_status); if (depBadge) card.appendChild(depBadge); } @@ -2660,7 +2660,7 @@ async function enableNotifications(btn) { if (!res.ok) throw new Error(`Subscribe failed: HTTP ${res.status}`); if (btn) { - btn.textContent = '🔔 On'; + btn.textContent = '🔔'; btn.disabled = true; } } catch (err) { diff --git a/web/index.html b/web/index.html index 64dd486..c17601b 100644 --- a/web/index.html +++ b/web/index.html @@ -17,7 +17,7 @@ <option value="claude">Claude</option> <option value="gemini">Gemini</option> </select> - <button id="btn-notifications" class="btn-secondary" title="Enable push notifications">🔔 Notifications</button> + <button id="btn-notifications" class="btn-secondary" title="Enable push notifications">🔔</button> <button id="btn-start-next" class="btn-secondary">Start Next</button> <button id="btn-new-task" class="btn-primary">New Task</button> </div> diff --git a/web/test/deployment-badge.test.mjs b/web/test/deployment-badge.test.mjs index afb4a59..438fb27 100644 --- a/web/test/deployment-badge.test.mjs +++ b/web/test/deployment-badge.test.mjs @@ -33,8 +33,14 @@ describe('renderDeploymentBadge', () => { assert.equal(el, null); }); - it('returns element with deployment-badge class for valid status', () => { - const status = { deployed_commit: 'abc123', fix_commits: [], includes_fix: false }; + it('returns null when includes_fix is false', () => { + const status = { deployed_commit: 'abc123', fix_commits: [{ hash: 'aabbcc', message: 'fix' }], includes_fix: false }; + const el = renderDeploymentBadge(status, makeDoc()); + assert.equal(el, null); + }); + + it('returns element with deployment-badge class when includes_fix is true', () => { + const status = { deployed_commit: 'abc123', fix_commits: [{ hash: 'aabbcc', message: 'fix' }], includes_fix: true }; const el = renderDeploymentBadge(status, makeDoc()); assert.ok(el, 'element should not be null'); assert.ok(el.className.includes('deployment-badge'), `className should include deployment-badge, got: ${el.className}`); @@ -46,26 +52,14 @@ describe('renderDeploymentBadge', () => { assert.ok(el.textContent.includes('Deployed'), `expected "Deployed" in "${el.textContent}"`); }); - it('shows "Not deployed" text when includes_fix is false', () => { - const status = { deployed_commit: 'abc123', fix_commits: [{ hash: 'aabbcc', message: 'fix' }], includes_fix: false }; - const el = renderDeploymentBadge(status, makeDoc()); - assert.ok(el.textContent.includes('Not deployed'), `expected "Not deployed" in "${el.textContent}"`); - }); - it('applies deployed class when includes_fix is true', () => { const status = { deployed_commit: 'abc123', fix_commits: [{ hash: 'aabbcc', message: 'fix' }], includes_fix: true }; const el = renderDeploymentBadge(status, makeDoc()); assert.ok(el.className.includes('deployment-badge--deployed'), `className: ${el.className}`); }); - it('applies pending class when includes_fix is false', () => { - const status = { deployed_commit: 'abc123', fix_commits: [{ hash: 'aabbcc', message: 'fix' }], includes_fix: false }; - const el = renderDeploymentBadge(status, makeDoc()); - assert.ok(el.className.includes('deployment-badge--pending'), `className: ${el.className}`); - }); - it('returns null for doc=null', () => { - const status = { deployed_commit: 'abc', fix_commits: [], includes_fix: false }; + const status = { deployed_commit: 'abc', fix_commits: [], includes_fix: true }; const el = renderDeploymentBadge(status, null); assert.equal(el, null); }); |
