diff --git a/src/static/js/app.js b/src/static/js/app.js index c7d03ad..40460ef 100644 --- a/src/static/js/app.js +++ b/src/static/js/app.js @@ -2085,6 +2085,8 @@ async handleRefresh() { this._refreshingIncidents.delete(msg.incident_id); this._updateSidebarDot(msg.incident_id); UI._removeSidebarRefreshStatus(msg.incident_id); + delete UI._progressState[msg.incident_id]; + UI._reindexQueuePositions(); this.renderSidebar(); if (msg.incident_id === this.currentIncidentId) { @@ -2191,6 +2193,7 @@ async handleRefresh() { this._updateSidebarDot(msg.incident_id, 'error'); UI._removeSidebarRefreshStatus(msg.incident_id); delete UI._progressState[msg.incident_id]; + UI._reindexQueuePositions(); this.renderSidebar(); if (msg.incident_id === this.currentIncidentId) { this._updateRefreshButton(false); @@ -2210,6 +2213,7 @@ async handleRefresh() { this._updateSidebarDot(msg.incident_id); UI._removeSidebarRefreshStatus(msg.incident_id); delete UI._progressState[msg.incident_id]; + UI._reindexQueuePositions(); this.renderSidebar(); if (msg.incident_id === this.currentIncidentId) { this._updateRefreshButton(false); diff --git a/src/static/js/components.js b/src/static/js/components.js index 2da4125..580736d 100644 --- a/src/static/js/components.js +++ b/src/static/js/components.js @@ -650,6 +650,22 @@ const UI = { if (item) item.classList.remove('refreshing-item', 'queued-item'); }, + _reindexQueuePositions() { + // Collect all queued incidents and renumber sequentially + const queued = []; + for (const [id, state] of Object.entries(this._progressState)) { + if (state && state.step === 'queued') queued.push({ id: Number(id), pos: state._queuePos || 999 }); + } + queued.sort((a, b) => a.pos - b.pos); + queued.forEach((item, idx) => { + const newPos = idx + 1; + const state = this._progressState[item.id]; + if (state) state._queuePos = newPos; + const statusEl = document.getElementById('sidebar-refresh-' + item.id); + if (statusEl) statusEl.innerHTML = 'Warteschlange (#' + newPos + ')'; + }); + }, + // === Click-outside to auto-minimize popup === _initClickOutside() {