diff --git a/projects/msp-tools/bug-tracker/dashboard.html b/projects/msp-tools/bug-tracker/dashboard.html index 7ece16a7..955f18e9 100644 --- a/projects/msp-tools/bug-tracker/dashboard.html +++ b/projects/msp-tools/bug-tracker/dashboard.html @@ -570,7 +570,19 @@ async function showDetail(repo, num) { Updated ${new Date(issue.updated_at).toLocaleString()} · Open in Gitea -
+
+ + ${issue.state==='open' ? ` @@ -613,6 +625,35 @@ async function toggleLabel(repo,num,name) { showDetail(repo,num); loadIssues(); } +async function changePriority(repo, num, newPrio) { + const lc = labelCache[repo] || {}; + const prioLabels = ['P1-critical','P2-high','P3-normal','P4-low']; + // Remove all existing priority labels + for (const p of prioLabels) { + const id = lc[p]; + if (id) await fetch(`${API}/repos/${OWNER}/${repo}/issues/${num}/labels/${id}`, {method:'DELETE', headers:headers()}); + } + // Add new one + const newId = lc[newPrio]; + if (newId) await fetch(`${API}/repos/${OWNER}/${repo}/issues/${num}/labels`, {method:'POST', headers:{...headers(),'Content-Type':'application/json'}, body:JSON.stringify({labels:[newId]})}); + showDetail(repo, num); loadIssues(); +} + +async function changeAssignee(repo, num, newAssign) { + const lc = labelCache[repo] || {}; + // Remove existing assigned: labels + for (const a of ['assigned:howard','assigned:mike']) { + const id = lc[a]; + if (id) await fetch(`${API}/repos/${OWNER}/${repo}/issues/${num}/labels/${id}`, {method:'DELETE', headers:headers()}); + } + // Add new one (if not empty) + if (newAssign) { + const newId = lc[newAssign]; + if (newId) await fetch(`${API}/repos/${OWNER}/${repo}/issues/${num}/labels`, {method:'POST', headers:{...headers(),'Content-Type':'application/json'}, body:JSON.stringify({labels:[newId]})}); + } + showDetail(repo, num); loadIssues(); +} + // --- New issue --- function showNewIssue() { const m = document.getElementById('new-modal');