Spaces:
Running
Running
Jair Adair dos Soares Almeida commited on
Add 2 files
Browse filesFiles changed (2)
- index.html+288-7
- prompts.txt+2-1
7 unmodified lines891011121368 unmodified lines82838485868771 unmodified lines15916016116216316438 unmodified lines203204205206207208209210211212213214215216217135 unmodified lines35335435535635735835936036136236320 unmodified lines3843853863873883893903913923933943953961 unmodified line398399400401402403404405406407408409102 unmodified lines51251351451551651724 unmodified lines54254354454554654710 unmodified lines5585595605615625635645655665671 unmodified line56957057157257357457530 unmodified lines6066076086096106116 unmodified lines6186196206216226237 unmodified lines<script src="https://cdn.jsdelivr.net/npm/chart.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>.status-online {68 unmodified linesborder-color: #6366f1;box-shadow: 0 0 0 1px #6366f1;}</style></head><body class="bg-gray-900">71 unmodified lines</div></div><!-- Device Table --><div class="card rounded-xl shadow-md overflow-hidden mb-8"><div class="px-6 py-4 border-b border-gray-700 flex justify-between items-center">38 unmodified lines</div></div><script>// Global variableslet devices = [];let pingIntervalId = null;let pingHistory = {};let chartData = {labels: [],datasets: []};// Initialize charts with dark themeconst uptimeCtx = document.getElementById('uptimeChart').getContext('2d');135 unmodified linesconst avgUptime = document.getElementById('avgUptime');const avgResponse = document.getElementById('avgResponse');const lastUpdated = document.getElementById('lastUpdated');// Event listenersfileInput.addEventListener('change', handleFileUpload);startPingBtn.addEventListener('click', startPing);stopPingBtn.addEventListener('click', stopPing);// Functionsfunction handleFileUpload(e) {20 unmodified linesonlineChecks: 0}));// Initialize ping historydevices.forEach(device => {if (!pingHistory[device.hostName || device.ipAddress]) {pingHistory[device.hostName || device.ipAddress] = [];}});renderDeviceTable();updateStats();};1 unmodified line}function renderDeviceTable() {if (devices.length === 0) {deviceTableBody.innerHTML = '<tr class="table-row"><td colspan="8" class="px-6 py-4 text-center text-gray-400">No devices loaded. Please upload an Excel file.</td></tr>';return;}deviceTableBody.innerHTML = devices.map(device => `<tr class="table-row fade-in"><td class="px-6 py-4 whitespace-nowrap text-sm table-cell">${device.userName}</td><td class="px-6 py-4 whitespace-nowrap text-sm table-cell">${device.igg}</td>102 unmodified linesasync function pingDevice(device) {const startTime = Date.now();const target = device.hostName || device.ipAddress;try {// Simulate ping with timeout - agora com 95% de chance de falha para simular máquinas desligadas24 unmodified linesstatus: 'online'});return { success: true, responseTime };} catch (error) {// Update device status10 unmodified linesstatus: 'offline'});return { success: false, error: error.message };}}async function pingAllDevices() {startPingBtn.innerHTML = '<i class="fas fa-sync-alt rotate mr-2"></i> Pinging...';startPingBtn.disabled = true;1 unmodified lineconst pingPromises = devices.map(device => pingDevice(device));await Promise.all(pingPromises);renderDeviceTable();updateStats();updateTimelineChart();30 unmodified lines}}// Initialize with some demo data for visualizationwindow.addEventListener('DOMContentLoaded', () => {// Add some sample data for the timeline chart6 unmodified linestimelineChart.data.labels = labels;timelineChart.update();});</script><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jair2323/cpm-igr" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>7 unmodified lines8910111213141568 unmodified lines8485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312471 unmodified lines19619719819920020120220320420520620720820921021121221321421521621721821922022122222322422538 unmodified lines264265266267268269270271272273274275276277278279280281282283284135 unmodified lines42042142242342442542642742842943043143243343443543643743843944044144244320 unmodified lines4644654664674684694704714724734744754764774784791 unmodified line481482483484485486487488489490491492102 unmodified lines59559659759859960060124 unmodified lines62662762862963063163263363463563663710 unmodified lines6486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037041 unmodified line70670770870971071171230 unmodified lines7437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888896 unmodified lines8968978988999009019029039047 unmodified lines<script src="https://cdn.jsdelivr.net/npm/chart.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.28/jspdf.plugin.autotable.min.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>.status-online {68 unmodified linesborder-color: #6366f1;box-shadow: 0 0 0 1px #6366f1;}.notification {position: fixed;bottom: 20px;right: 20px;z-index: 1000;max-width: 350px;transition: all 0.3s ease;}.notification-item {background-color: #3d3d3d;border-left: 4px solid;box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);margin-bottom: 10px;transform: translateX(120%);animation: slideIn 0.3s forwards;}.notification-item.online {border-left-color: #10b981;}.notification-item.offline {border-left-color: #ef4444;}@keyframes slideIn {to { transform: translateX(0); }}.filter-active {background-color: #3b82f6 !important;color: white !important;}</style></head><body class="bg-gray-900">71 unmodified lines</div></div><!-- Filters and Search --><div class="card rounded-xl shadow-md p-4 mb-4"><div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4"><div class="flex items-center space-x-2"><span class="text-sm text-gray-300">Filter by:</span><button id="filterAll" class="px-3 py-1 text-sm rounded-md bg-gray-700 text-gray-300 hover:bg-gray-600 filter-active">All</button><button id="filterOnline" class="px-3 py-1 text-sm rounded-md bg-gray-700 text-gray-300 hover:bg-gray-600">Online</button><button id="filterOffline" class="px-3 py-1 text-sm rounded-md bg-gray-700 text-gray-300 hover:bg-gray-600">Offline</button></div><div class="relative w-full md:w-64"><input type="text" id="searchInput" placeholder="Search devices..." class="w-full px-4 py-2 input-dark rounded-md focus:outline-none pl-10"><i class="fas fa-search absolute left-3 top-3 text-gray-400"></i></div><div class="flex space-x-2"><button id="exportExcel" class="px-3 py-1 text-sm rounded-md bg-green-700 text-gray-300 hover:bg-green-600 flex items-center"><i class="fas fa-file-excel mr-1"></i> Excel</button><button id="exportPDF" class="px-3 py-1 text-sm rounded-md bg-red-700 text-gray-300 hover:bg-red-600 flex items-center"><i class="fas fa-file-pdf mr-1"></i> PDF</button></div></div></div><!-- Device Table --><div class="card rounded-xl shadow-md overflow-hidden mb-8"><div class="px-6 py-4 border-b border-gray-700 flex justify-between items-center">38 unmodified lines</div></div><!-- Notification Container --><div id="notificationContainer" class="notification"></div><script>// Global variableslet devices = [];let filteredDevices = [];let pingIntervalId = null;let pingHistory = {};let chartData = {labels: [],datasets: []};let previousStatus = {};let currentFilter = 'all';// Initialize charts with dark themeconst uptimeCtx = document.getElementById('uptimeChart').getContext('2d');135 unmodified linesconst avgUptime = document.getElementById('avgUptime');const avgResponse = document.getElementById('avgResponse');const lastUpdated = document.getElementById('lastUpdated');const searchInput = document.getElementById('searchInput');const filterAll = document.getElementById('filterAll');const filterOnline = document.getElementById('filterOnline');const filterOffline = document.getElementById('filterOffline');const exportExcel = document.getElementById('exportExcel');const exportPDF = document.getElementById('exportPDF');const notificationContainer = document.getElementById('notificationContainer');// Event listenersfileInput.addEventListener('change', handleFileUpload);startPingBtn.addEventListener('click', startPing);stopPingBtn.addEventListener('click', stopPing);searchInput.addEventListener('input', filterDevices);filterAll.addEventListener('click', () => setFilter('all'));filterOnline.addEventListener('click', () => setFilter('online'));filterOffline.addEventListener('click', () => setFilter('offline'));exportExcel.addEventListener('click', exportToExcel);exportPDF.addEventListener('click', exportToPDF);// Functionsfunction handleFileUpload(e) {20 unmodified linesonlineChecks: 0}));// Initialize previous status and ping historydevices.forEach(device => {const key = device.hostName || device.ipAddress;previousStatus[key] = 'offline';if (!pingHistory[key]) {pingHistory[key] = [];}});filteredDevices = [...devices];renderDeviceTable();updateStats();};1 unmodified line}function renderDeviceTable() {if (filteredDevices.length === 0) {deviceTableBody.innerHTML = '<tr class="table-row"><td colspan="8" class="px-6 py-4 text-center text-gray-400">No devices match the current filter.</td></tr>';return;}deviceTableBody.innerHTML = filteredDevices.map(device => `<tr class="table-row fade-in"><td class="px-6 py-4 whitespace-nowrap text-sm table-cell">${device.userName}</td><td class="px-6 py-4 whitespace-nowrap text-sm table-cell">${device.igg}</td>102 unmodified linesasync function pingDevice(device) {const startTime = Date.now();const target = device.hostName || device.ipAddress;const previous = previousStatus[target];try {// Simulate ping with timeout - agora com 95% de chance de falha para simular máquinas desligadas24 unmodified linesstatus: 'online'});// Check for status change notificationif (previous !== 'online') {showNotification(`${target} is now online`, 'online');}previousStatus[target] = 'online';return { success: true, responseTime };} catch (error) {// Update device status10 unmodified linesstatus: 'offline'});// Check for status change notificationif (previous !== 'offline') {showNotification(`${target} is now offline`, 'offline');}previousStatus[target] = 'offline';return { success: false, error: error.message };}}function showNotification(message, type) {const notification = document.createElement('div');notification.className = `notification-item ${type}`;notification.innerHTML = `<div class="p-4"><div class="flex items-start"><div class="flex-shrink-0 pt-0.5"><i class="fas ${type === 'online' ? 'fa-check-circle text-green-500' : 'fa-exclamation-circle text-red-500'}"></i></div><div class="ml-3 w-0 flex-1"><p class="text-sm font-medium text-gray-100">${message}</p><p class="mt-1 text-xs text-gray-400">${new Date().toLocaleTimeString()}</p></div><div class="ml-4 flex-shrink-0 flex"><button class="close-notification bg-transparent rounded-md inline-flex text-gray-400 hover:text-gray-300 focus:outline-none"><i class="fas fa-times"></i></button></div></div></div>`;notificationContainer.appendChild(notification);// Auto remove after 5 secondssetTimeout(() => {notification.style.opacity = '0';setTimeout(() => {notification.remove();}, 300);}, 5000);// Close buttonnotification.querySelector('.close-notification').addEventListener('click', () => {notification.style.opacity = '0';setTimeout(() => {notification.remove();}, 300);});}async function pingAllDevices() {startPingBtn.innerHTML = '<i class="fas fa-sync-alt rotate mr-2"></i> Pinging...';startPingBtn.disabled = true;1 unmodified lineconst pingPromises = devices.map(device => pingDevice(device));await Promise.all(pingPromises);filterDevices();updateStats();updateTimelineChart();30 unmodified lines}}function filterDevices() {const searchTerm = searchInput.value.toLowerCase();filteredDevices = devices.filter(device => {const matchesSearch =device.userName.toLowerCase().includes(searchTerm) ||device.igg.toLowerCase().includes(searchTerm) ||device.hostName.toLowerCase().includes(searchTerm) ||device.ipAddress.toLowerCase().includes(searchTerm);const matchesFilter =currentFilter === 'all' ||(currentFilter === 'online' && device.status === 'online') ||(currentFilter === 'offline' && device.status === 'offline');return matchesSearch && matchesFilter;});renderDeviceTable();}function setFilter(filter) {currentFilter = filter;// Update active filter button styles[filterAll, filterOnline, filterOffline].forEach(btn => {btn.classList.remove('filter-active');});if (filter === 'all') filterAll.classList.add('filter-active');if (filter === 'online') filterOnline.classList.add('filter-active');if (filter === 'offline') filterOffline.classList.add('filter-active');filterDevices();}function exportToExcel() {if (devices.length === 0) {alert('No devices to export');return;}// Prepare data for exportconst exportData = devices.map(device => ({'USER NAME': device.userName,'IGG': device.igg,'HOST NAME': device.hostName,'IP ADDRESS': device.ipAddress,'STATUS': device.status === 'online' ? 'Online' : 'Offline','LAST PING TIME': device.lastPingTime,'RESPONSE TIME (ms)': device.responseTime || '','UPTIME (%)': device.checks > 0 ? Math.round((device.onlineChecks / device.checks) * 100) : 0}));// Create worksheetconst ws = XLSX.utils.json_to_sheet(exportData);// Create workbookconst wb = XLSX.utils.book_new();XLSX.utils.book_append_sheet(wb, ws, "Device Status");// Generate file name with timestampconst timestamp = new Date().toISOString().replace(/[:.]/g, '-');const fileName = `device_status_${timestamp}.xlsx`;// Export to ExcelXLSX.writeFile(wb, fileName);}function exportToPDF() {if (devices.length === 0) {alert('No devices to export');return;}// Initialize jsPDFconst { jsPDF } = window.jspdf;const doc = new jsPDF();// Add titledoc.setFontSize(18);doc.text('Network Device Status Report', 105, 20, { align: 'center' });// Add timestampdoc.setFontSize(10);doc.text(`Generated on: ${new Date().toLocaleString()}`, 105, 30, { align: 'center' });// Prepare data for tableconst tableData = devices.map(device => [device.userName,device.igg,device.hostName,device.ipAddress,device.status === 'online' ? 'Online' : 'Offline',device.lastPingTime || 'Never',device.responseTime ? `${device.responseTime} ms` : '-',device.checks > 0 ? `${Math.round((device.onlineChecks / device.checks) * 100)}%` : '0%']);// Add tabledoc.autoTable({head: [['User', 'IGG', 'Host', 'IP', 'Status', 'Last Ping', 'Response', 'Uptime']],body: tableData,startY: 40,styles: {textColor: [0, 0, 0],fontSize: 8},headStyles: {fillColor: [41, 128, 185],textColor: [255, 255, 255]},alternateRowStyles: {fillColor: [245, 245, 245]},margin: { top: 40 }});// Add statisticsconst onlineCount = devices.filter(d => d.status === 'online').length;const offlineCount = devices.filter(d => d.status === 'offline').length;const avgUptime = devices.length > 0 ?Math.round(devices.reduce((sum, device) => sum + (device.checks > 0 ? (device.onlineChecks / device.checks) : 0), 0) / devices.length * 100) : 0;const finalY = doc.lastAutoTable.finalY + 10;doc.setFontSize(12);doc.text('Summary Statistics', 14, finalY);doc.setFontSize(10);doc.text(`Online Devices: ${onlineCount}`, 14, finalY + 10);doc.text(`Offline Devices: ${offlineCount}`, 14, finalY + 20);doc.text(`Average Uptime: ${avgUptime}%`, 14, finalY + 30);// Generate file name with timestampconst timestamp = new Date().toISOString().replace(/[:.]/g, '-');const fileName = `device_status_${timestamp}.pdf`;// Save the PDFdoc.save(fileName);}// Initialize with some demo data for visualizationwindow.addEventListener('DOMContentLoaded', () => {// Add some sample data for the timeline chart6 unmodified linestimelineChart.data.labels = labels;timelineChart.update();// Set default filtersetFilter('all');});</script><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jair2323/cpm-igr" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
123Requisitos Funcionais Leitura de Excel Carregar um arquivo .xlsx com os campos: USER NAME | IGG | HOST NAME | IP ADDRESS | STATUS | LAST PING TIME Atualizar dinamicamente os campos STATUS e LAST PING TIME. Ping nos dispositivos Ping baseado em IP ADDRESS ou HOST NAME. Verificar disponibilidade (online/offline). Registrar o tempo da última resposta (timestamp + tempo de resposta em ms). Controles Botão Start Ping: Iniciar verificação contínua (intervalo configurável). Botão Stop Ping: Parar verificação. Possibilidade de definir intervalo de atualização (ex: a cada 5s). KPIs e Gráficos Uptime por dispositivo (em %). Tempo médio de resposta (ping). Gráfico interativo (ex: linha/área por dispositivo ao longo do tempo). Tabela de dispositivos com cor de status (verde = online, vermelho = offline)mude o leyout e a core para um cinza escuroas maquinas estao fisicamente off todas eleas mas na aplicação tenho maquinas online podes corrigir1234Requisitos Funcionais Leitura de Excel Carregar um arquivo .xlsx com os campos: USER NAME | IGG | HOST NAME | IP ADDRESS | STATUS | LAST PING TIME Atualizar dinamicamente os campos STATUS e LAST PING TIME. Ping nos dispositivos Ping baseado em IP ADDRESS ou HOST NAME. Verificar disponibilidade (online/offline). Registrar o tempo da última resposta (timestamp + tempo de resposta em ms). Controles Botão Start Ping: Iniciar verificação contínua (intervalo configurável). Botão Stop Ping: Parar verificação. Possibilidade de definir intervalo de atualização (ex: a cada 5s). KPIs e Gráficos Uptime por dispositivo (em %). Tempo médio de resposta (ping). Gráfico interativo (ex: linha/área por dispositivo ao longo do tempo). Tabela de dispositivos com cor de status (verde = online, vermelho = offline)mude o leyout e a core para um cinza escuroas maquinas estao fisicamente off todas eleas mas na aplicação tenho maquinas online podes corrigiradicione tres funcinalidades que podem melhorar a aplicação
index.html+288-7
prompts.txt+2-1