Actualizar automatizaciones.html
This commit is contained in:
@@ -110,25 +110,32 @@
|
||||
setInterval(loadAutomations, 20000);
|
||||
});
|
||||
|
||||
async function loadAutomations() {
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/providers/scraped`, {
|
||||
headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` }
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.ok) {
|
||||
scrapedData = data.services || [];
|
||||
activeIntervals.forEach(clearInterval);
|
||||
activeIntervals = [];
|
||||
async function loadAutomations() {
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/providers/scraped`, {
|
||||
headers: { "Authorization": `Bearer ${localStorage.getItem("token")}` }
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.ok) {
|
||||
scrapedData = data.services || [];
|
||||
activeIntervals.forEach(clearInterval);
|
||||
activeIntervals = [];
|
||||
|
||||
const inQueue = scrapedData.filter(s => s.automation_status === 'in_progress' && s.current_worker_name !== null);
|
||||
const failed = scrapedData.filter(s => s.automation_status === 'failed' || (s.automation_status === 'in_progress' && s.current_worker_name === null));
|
||||
// Filtrado estricto: Solo mostramos lo que NO es 'manual'
|
||||
const inQueue = scrapedData.filter(s =>
|
||||
s.automation_status === 'in_progress' && s.current_worker_name !== null
|
||||
);
|
||||
|
||||
renderCards(inQueue);
|
||||
renderFailedTable(failed);
|
||||
}
|
||||
} catch (e) { console.error(e); }
|
||||
const failed = scrapedData.filter(s =>
|
||||
s.automation_status === 'failed' ||
|
||||
(s.automation_status === 'in_progress' && s.current_worker_name === null)
|
||||
);
|
||||
|
||||
renderCards(inQueue);
|
||||
renderFailedTable(failed);
|
||||
}
|
||||
} catch (e) { console.error(e); }
|
||||
}
|
||||
|
||||
function renderCards(activeServices) {
|
||||
const container = document.getElementById('automation-list');
|
||||
|
||||
Reference in New Issue
Block a user