Update ashboard, tools (~2)
This commit is contained in:
@@ -1604,10 +1604,26 @@
|
||||
const msg = status.anaf.ok !== false ? 'Nicio modificare' : (status.anaf.message || 'Modificări!');
|
||||
subtitle.textContent = `${msg} · ${lastCheck}`;
|
||||
|
||||
if (status.anaf.lastCheck) {
|
||||
document.getElementById('anafLastCheck').textContent =
|
||||
'Ultima verificare: ' + status.anaf.lastCheck;
|
||||
// Construiește detaliile
|
||||
const detailsDiv = document.getElementById('anafDetails');
|
||||
let html = '<div class="status-detail-item"><i data-lucide="clock"></i><span>Ultima verificare: ' +
|
||||
(status.anaf.lastCheck || '-') + '</span></div>';
|
||||
|
||||
// Adaugă modificările dacă există
|
||||
if (status.anaf.details && status.anaf.details.length > 0) {
|
||||
status.anaf.details.forEach(detail => {
|
||||
html += '<div class="status-detail-item" style="flex-direction: column; align-items: flex-start; padding: 12px 16px; background: rgba(234, 179, 8, 0.1); border-radius: 8px; margin-top: 8px;">';
|
||||
html += '<div style="font-weight: 600; color: var(--text-primary); margin-bottom: 4px;">' + detail.name + '</div>';
|
||||
detail.changes.forEach(change => {
|
||||
html += '<div style="font-size: 13px; color: var(--text-secondary); margin-left: 16px;">• ' + change + '</div>';
|
||||
});
|
||||
html += '<a href="' + detail.url + '" target="_blank" style="font-size: 12px; color: #3b82f6; margin-top: 4px; text-decoration: none;">Vezi pagina →</a>';
|
||||
html += '</div>';
|
||||
});
|
||||
}
|
||||
|
||||
detailsDiv.innerHTML = html;
|
||||
lucide.createIcons(); // Reinitializează icon-urile
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -313,17 +313,29 @@ def check_page(page, saved_versions, saved_hashes):
|
||||
log(f"OK: {page_id}")
|
||||
return None
|
||||
|
||||
def update_dashboard_status(has_changes, changes_count):
|
||||
def update_dashboard_status(has_changes, changes_count, all_changes):
|
||||
"""Actualizează status.json pentru dashboard"""
|
||||
try:
|
||||
status = load_json(DASHBOARD_STATUS, {})
|
||||
status['anaf'] = {
|
||||
anaf_status = {
|
||||
'ok': not has_changes,
|
||||
'status': 'MODIFICĂRI' if has_changes else 'OK',
|
||||
'message': f'{changes_count} modificări detectate' if has_changes else 'Nicio modificare detectată',
|
||||
'lastCheck': datetime.now().strftime('%d %b %Y, %H:%M'),
|
||||
'changesCount': changes_count
|
||||
}
|
||||
|
||||
# Adaugă lista de modificări pentru dashboard
|
||||
if has_changes and all_changes:
|
||||
anaf_status['details'] = []
|
||||
for change in all_changes:
|
||||
anaf_status['details'].append({
|
||||
'name': change['name'],
|
||||
'changes': change['changes'],
|
||||
'url': change['url']
|
||||
})
|
||||
|
||||
status['anaf'] = anaf_status
|
||||
save_json(DASHBOARD_STATUS, status)
|
||||
except Exception as e:
|
||||
log(f"ERROR updating dashboard status: {e}")
|
||||
@@ -345,7 +357,7 @@ def main():
|
||||
save_json(HASHES_FILE, saved_hashes)
|
||||
|
||||
# Update dashboard status
|
||||
update_dashboard_status(len(all_changes) > 0, len(all_changes))
|
||||
update_dashboard_status(len(all_changes) > 0, len(all_changes), all_changes)
|
||||
|
||||
log("=== Monitor complete ===")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user