System Administration
Manage system settings, monitor health, and configure services
20
Total Companies
1.0 MB6
Total Contacts
0 emails sent0
Active Tasks
0 queued8
Integrations
0 activeSystem Health Monitor
Database Connection
Connected
API Services
Operational
Background Tasks
Running
Last check: 2026-01-09 02:11:07
Integrations
Apollo
Last used: 2026-01-07 17:41:27
Groq
Last used: 2026-01-07 17:41:27
Powerlead
Last used: 2026-01-07 17:41:27
Sendgrid
Last used: 2026-01-07 17:41:28
Zoho
Last used: 2026-01-07 17:41:30
Million_Verifier
Last used: 2026-01-07 17:41:30
Hunter
Last used: 2026-01-06 17:30:02
Automation_Monitoring
Last used: 2026-01-07 09:57:05
Background Tasks
0
Active
0
Queued
0
Failed
0
Completed
Worker Status
Healthy
System Configuration
try {
const response = await fetch('/automation/settings/auto-send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ enabled: enabled })
});
const result = await response.json();
if (result.success) {
showAlert('success', `Auto send ${enabled ? 'enabled' : 'disabled'}`);
} else {
showAlert('error', result.error || 'Failed to toggle auto send');
toggle.checked = !enabled; // Revert toggle
}
} catch (error) {
showAlert('error', 'Network error: ' + error.message);
toggle.checked = !enabled; // Revert toggle
}
}
// Admin functions
async function runHealthCheck() {
try {
const response = await fetch('/admin/api/health-status', { method: 'GET' });
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const result = await response.json();
// Show health status results
let message = `Health check completed!\nOverall status:
${result.overall_status.toUpperCase()}\n\n`;
for (const [service, data] of Object.entries(result.services)) {
message += `${service}: ${data.status.toUpperCase()}\n`;
}
showAlert('success', 'Health check completed - see console for details');
console.log('Health Check Results:', result);
// Optionally reload to refresh the display
setTimeout(() => location.reload(), 2000);
} catch (error) {
console.error('Health check error:', error);
showAlert('error', 'Network error: ' + error.message);
}
}
function testIntegration(integration) {
fetch(`/admin/test-integration/${integration}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
alert(`${integration} test: ${data.message}`);
} else {
alert(`${integration} test failed: ${data.error}`);
}
})
.catch(error => {
alert(`Error testing ${integration}: ${error.message}`);
});
}
function testAllIntegrations() {
// Show loading state
const buttons = document.querySelectorAll('button[onclick="testAllIntegrations()"]');
buttons.forEach(btn => {
btn.disabled = true;
btn.innerHTML = ' Testing...';
});
fetch('/admin/api/test-integrations', {
method: 'GET'
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return response.json();
})
.then(data => {
// Reset button state
buttons.forEach(btn => {
btn.disabled = false;
btn.innerHTML = ' Test All';
});
if (data.success) {
// Create HTML content for the modal
let html = `
`;
for (const [service, result] of Object.entries(data.test_results)) {
const statusClass = result.status === 'success' ? 'success' : result.status === 'warning' ?
'warning' : 'danger';
const icon = result.status === 'success' ? 'check-circle-fill' : result.status === 'warning' ?
'exclamation-triangle-fill' : 'x-circle-fill';
html += `
`;
}
document.getElementById('testResultsContent').innerHTML = html;
const modal = new bootstrap.Modal(document.getElementById('testResultsModal'));
modal.show();
} else {
alert('Error testing integrations: ' + data.error);
}
})
.catch(error => {
// Reset button state
buttons.forEach(btn => {
btn.disabled = false;
btn.innerHTML = ' Test All';
});
console.error('Integration test error:', error);
alert('Error testing integrations: ' + error.message);
});
}
function clearCache() {
if (confirm('Clear all system cache?')) {
const button = event.target;
const originalText = button.innerHTML;
button.disabled = true;
button.innerHTML = 'Clearing...';
fetch('/admin/clear-cache', { method: 'POST' })
.then(response => response.json())
.then(data => {
button.disabled = false;
button.innerHTML = originalText;
if (data.success) {
showAlert('success', data.message);
} else {
showAlert('error', data.error);
}
})
.catch(error => {
button.disabled = false;
button.innerHTML = originalText;
showAlert('error', 'Error: ' + error.message);
});
}
}
function restartWorkers() {
if (confirm('Restart all background workers?')) {
const button = event.target;
const originalText = button.innerHTML;
button.disabled = true;
button.innerHTML = 'Restarting...';
fetch('/admin/restart-workers', { method: 'POST' })
.then(response => response.json())
.then(data => {
button.disabled = false;
button.innerHTML = originalText;
if (data.success) {
showAlert('success', data.message);
} else {
showAlert('error', data.error || data.message);
}
})
.catch(error => {
button.disabled = false;
button.innerHTML = originalText;
showAlert('error', 'Error: ' + error.message);
});
}
}
function backupDatabase() {
if (confirm('Create database backup?')) {
const button = event.target;
const originalText = button.innerHTML;
button.disabled = true;
button.innerHTML = 'Backing up...';
fetch('/admin/backup-database', { method: 'POST' })
.then(response => response.json())
.then(data => {
button.disabled = false;
button.innerHTML = originalText;
if (data.success) {
showAlert('success', data.message);
} else {
showAlert('error', data.error);
}
})
.catch(error => {
button.disabled = false;
button.innerHTML = originalText;
showAlert('error', 'Error: ' + error.message);
});
}
}
function viewAuditLogs() {
fetch('/admin/audit-logs')
.then(response => response.json())
.then(data => {
if (data.success) {
document.getElementById('auditContent').innerHTML = data.html;
const modal = new bootstrap.Modal(document.getElementById('auditModal'));
modal.show();
} else {
showAlert('error', data.error);
}
})
.catch(error => {
showAlert('error', 'Error loading audit logs: ' + error.message);
});
}
function exportLogs() {
fetch('/admin/export-logs')
.then(response => response.json())
.then(data => {
if (data.success) {
showAlert('success', data.message);
if (data.download_url) {
// Optionally trigger download
window.open(data.download_url, '_blank');
}
} else {
showAlert('error', data.error);
}
})
.catch(error => {
showAlert('error', 'Error exporting logs: ' + error.message);
});
}
function refreshActivity() {
location.reload();
}
function refreshDashboard() {
location.reload();
}
function showAuditModal() {
viewAuditLogs();
}
function showAlert(type, message) {
// Map types to dialog system
const typeMap = {
'success': 'success',
'warning': 'warning',
'error': 'error',
'danger': 'error',
'info': 'info'
};
const dialogType = typeMap[type] || 'info';
return showDialog.alert(message, dialogType);
}
Overall Status: ${data.overall_status.toUpperCase()}
Tested at: ${data.timestamp}
${service.charAt(0).toUpperCase() + service.slice(1).replace('_', ' ')}
${result.message}
${result.message}