V10.530 暫停 recover-stale 主操作入口
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
This commit is contained in:
@@ -288,13 +288,11 @@ let priceChartInstance = null;
|
||||
card,
|
||||
trigger: document.querySelector('[data-pchome-backfill-trigger]'),
|
||||
refreshStaleTrigger: document.querySelector('[data-pchome-refresh-stale-trigger]'),
|
||||
recoverStaleTrigger: document.querySelector('[data-pchome-recover-stale-trigger]'),
|
||||
status: document.querySelector('[data-pchome-backfill-status]'),
|
||||
result: document.querySelector('[data-pchome-backfill-result]'),
|
||||
progress: document.querySelector('[data-pchome-backfill-progress]'),
|
||||
backfillEndpoint: card ? card.dataset.backfillEndpoint : '/api/ai/pchome-match/backfill',
|
||||
refreshStaleEndpoint: card ? card.dataset.refreshStaleEndpoint : '/api/ai/pchome-match/refresh-stale',
|
||||
recoverStaleEndpoint: card ? card.dataset.recoverStaleEndpoint : '/api/ai/pchome-match/recover-stale',
|
||||
statusEndpoint: card ? card.dataset.statusEndpoint : '/api/ai/pchome-match/backfill/status'
|
||||
};
|
||||
}
|
||||
@@ -401,13 +399,6 @@ let priceChartInstance = null;
|
||||
? '<i class="fas fa-spinner fa-spin"></i> 執行中'
|
||||
: '<i class="fas fa-rotate"></i> 刷新過期 120 筆';
|
||||
}
|
||||
if (elements.recoverStaleTrigger) {
|
||||
elements.recoverStaleTrigger.disabled = running;
|
||||
elements.recoverStaleTrigger.classList.toggle('is-loading', running);
|
||||
elements.recoverStaleTrigger.innerHTML = running
|
||||
? '<i class="fas fa-spinner fa-spin"></i> 執行中'
|
||||
: '<i class="fas fa-life-ring"></i> 救援過期 40 筆';
|
||||
}
|
||||
|
||||
if (running) {
|
||||
schedulePchomeBackfillPoll();
|
||||
@@ -505,54 +496,14 @@ let priceChartInstance = null;
|
||||
});
|
||||
}
|
||||
|
||||
function recoverStalePchomeMatches() {
|
||||
const elements = getPchomeBackfillElements();
|
||||
if (!elements.card || !elements.recoverStaleTrigger) return;
|
||||
const limit = Number(elements.recoverStaleTrigger.dataset.limit || 40);
|
||||
if (!confirm(`啟動 PChome 過期 identity 搜尋救援 ${limit} 筆?`)) return;
|
||||
|
||||
elements.recoverStaleTrigger.disabled = true;
|
||||
if (elements.status) {
|
||||
elements.status.textContent = '正在送出過期 identity 搜尋救援任務';
|
||||
}
|
||||
fetch(elements.recoverStaleEndpoint, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': getCSRFToken()
|
||||
},
|
||||
body: JSON.stringify({ limit })
|
||||
})
|
||||
.then(response => response.json().then(data => ({ ok: response.ok, status: response.status, data })))
|
||||
.then(({ ok, status, data }) => {
|
||||
renderPchomeBackfillStatus(data);
|
||||
if (!ok && status !== 409) {
|
||||
throw new Error(data.message || data.error || 'PChome 過期 identity 搜尋救援啟動失敗');
|
||||
}
|
||||
schedulePchomeBackfillPoll();
|
||||
})
|
||||
.catch(error => {
|
||||
if (elements.status) {
|
||||
elements.status.textContent = error.message || 'PChome 過期 identity 搜尋救援啟動失敗';
|
||||
}
|
||||
if (elements.recoverStaleTrigger) {
|
||||
elements.recoverStaleTrigger.disabled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.backfillPchomeMatches = backfillPchomeMatches;
|
||||
window.refreshStalePchomeMatches = refreshStalePchomeMatches;
|
||||
window.recoverStalePchomeMatches = recoverStalePchomeMatches;
|
||||
document.querySelectorAll('[data-pchome-backfill-trigger]').forEach(button => {
|
||||
button.addEventListener('click', backfillPchomeMatches);
|
||||
});
|
||||
document.querySelectorAll('[data-pchome-refresh-stale-trigger]').forEach(button => {
|
||||
button.addEventListener('click', refreshStalePchomeMatches);
|
||||
});
|
||||
document.querySelectorAll('[data-pchome-recover-stale-trigger]').forEach(button => {
|
||||
button.addEventListener('click', recoverStalePchomeMatches);
|
||||
});
|
||||
loadPchomeBackfillStatus();
|
||||
|
||||
function runPchomeReviewDecision(button) {
|
||||
|
||||
Reference in New Issue
Block a user