Spaces:
Running

server-status / index.html
murillodutt's picture
Add 3 files
599ac91 verified
Raw History Blame Contribute Delete
54.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teste de Uso de Recursos - WordPress Plugin</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gauge.js/dist/gauge.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.gauge-container {
width: 100%;
max-width: 250px;
margin: 0 auto;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.alert-banner {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.log-entry:hover {
background-color: #f3f4f6;
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltip-text {
visibility: hidden;
width: 200px;
background-color: #374151;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -100px;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:hover .tooltip-text {
visibility: visible;
opacity: 1;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="container mx-auto px-4 py-8">
<!-- Warning Banner -->
<div class="alert-banner bg-red-500 text-white px-4 py-3 rounded-lg mb-6 flex items-center justify-between">
<div class="flex items-center">
<i class="fas fa-exclamation-triangle mr-3 text-xl"></i>
<span class="font-bold">AVISO:</span>
<span class="ml-2">Use apenas em ambiente controlado (desenvolvimento/teste)!</span>
</div>
<button class="text-white hover:text-gray-200">
<i class="fas fa-times"></i>
</button>
</div>
<!-- Plugin Header -->
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl font-bold text-gray-800">
<i class="fas fa-tachometer-alt text-blue-500 mr-2"></i>
Teste de Uso de Recursos
</h1>
<p class="text-gray-600 mt-1">Monitoramento e simulação de consumo de recursos do servidor</p>
</div>
<div class="flex items-center">
<span class="bg-green-100 text-green-800 text-xs font-semibold px-2.5 py-0.5 rounded-full mr-3">
<i class="fas fa-circle text-green-500 mr-1"></i> Ativo
</span>
<button class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-question-circle mr-2"></i> Ajuda
</button>
</div>
</div>
</div>
<!-- Navigation Tabs -->
<div class="bg-white rounded-lg shadow-md mb-6">
<div class="flex border-b">
<button class="tab-btn px-6 py-3 font-medium text-gray-600 hover:text-blue-500 border-b-2 border-transparent hover:border-blue-300 active" data-tab="dashboard">
<i class="fas fa-chart-line mr-2"></i> Dashboard
</button>
<button class="tab-btn px-6 py-3 font-medium text-gray-600 hover:text-blue-500 border-b-2 border-transparent hover:border-blue-300" data-tab="server-info">
<i class="fas fa-server mr-2"></i> Informações do Servidor
</button>
<button class="tab-btn px-6 py-3 font-medium text-gray-600 hover:text-blue-500 border-b-2 border-transparent hover:border-blue-300" data-tab="settings">
<i class="fas fa-cog mr-2"></i> Configurações
</button>
<button class="tab-btn px-6 py-3 font-medium text-gray-600 hover:text-blue-500 border-b-2 border-transparent hover:border-blue-300" data-tab="logs">
<i class="fas fa-clipboard-list mr-2"></i> Logs
</button>
</div>
</div>
<!-- Dashboard Tab Content -->
<div id="dashboard" class="tab-content active">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-6">
<!-- CPU Usage Gauge -->
<div class="bg-white rounded-lg shadow-md p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800">
<i class="fas fa-microchip text-blue-500 mr-2"></i> Uso de CPU
</h3>
<span class="text-sm font-medium px-2.5 py-0.5 rounded-full" id="cpu-status">
<i class="fas fa-circle text-green-500 mr-1"></i> Normal
</span>
</div>
<div class="gauge-container" id="cpu-gauge"></div>
<div class="mt-4 text-center">
<p class="text-gray-600">Uso atual: <span id="cpu-percentage" class="font-bold">45%</span></p>
<p class="text-sm text-gray-500 mt-1">Limite: 80%</p>
</div>
</div>
<!-- Memory Usage Gauge -->
<div class="bg-white rounded-lg shadow-md p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800">
<i class="fas fa-memory text-purple-500 mr-2"></i> Uso de Memória
</h3>
<span class="text-sm font-medium px-2.5 py-0.5 rounded-full" id="memory-status">
<i class="fas fa-circle text-yellow-500 mr-1"></i> Moderado
</span>
</div>
<div class="gauge-container" id="memory-gauge"></div>
<div class="mt-4 text-center">
<p class="text-gray-600">Uso atual: <span id="memory-percentage" class="font-bold">65%</span></p>
<p class="text-sm text-gray-500 mt-1">512MB / 1024MB</p>
</div>
</div>
<!-- Server Health -->
<div class="bg-white rounded-lg shadow-md p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800">
<i class="fas fa-heartbeat text-red-500 mr-2"></i> Saúde do Servidor
</h3>
<span class="text-sm font-medium px-2.5 py-0.5 rounded-full bg-green-100 text-green-800">
<i class="fas fa-check-circle mr-1"></i> Estável
</span>
</div>
<div class="space-y-3">
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-600">Tempo de resposta:</span>
<span class="font-medium">28ms</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full" style="width: 25%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-600">Processos ativos:</span>
<span class="font-medium">12/50</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-500 h-2 rounded-full" style="width: 24%"></div>
</div>
</div>
<div>
<div class="flex justify-between text-sm mb-1">
<span class="text-gray-600">Uso de disco:</span>
<span class="font-medium">35%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-yellow-500 h-2 rounded-full" style="width: 35%"></div>
</div>
</div>
</div>
<button class="w-full mt-4 bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center justify-center">
<i class="fas fa-magic mr-2"></i> Wizard de Correção
</button>
</div>
</div>
<!-- CPU Usage Chart -->
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800">
<i class="fas fa-chart-area text-blue-500 mr-2"></i> Histórico de Uso de CPU
</h3>
<div class="flex space-x-2">
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-3 py-1 rounded text-sm">
1H
</button>
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-3 py-1 rounded text-sm">
24H
</button>
<button class="bg-blue-100 text-blue-800 px-3 py-1 rounded text-sm">
7D
</button>
</div>
</div>
<canvas id="cpuChart" height="120"></canvas>
</div>
<!-- Memory Usage Chart -->
<div class="bg-white rounded-lg shadow-md p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-gray-800">
<i class="fas fa-chart-bar text-purple-500 mr-2"></i> Histórico de Uso de Memória
</h3>
<div class="flex space-x-2">
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-3 py-1 rounded text-sm">
1H
</button>
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-3 py-1 rounded text-sm">
24H
</button>
<button class="bg-blue-100 text-blue-800 px-3 py-1 rounded text-sm">
7D
</button>
</div>
</div>
<canvas id="memoryChart" height="120"></canvas>
</div>
</div>
<!-- Server Info Tab Content -->
<div id="server-info" class="tab-content">
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
<h3 class="text-lg font-semibold text-gray-800 mb-4">
<i class="fas fa-info-circle text-blue-500 mr-2"></i> Detalhes do Servidor
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-medium text-gray-700 mb-2 flex items-center">
<i class="fas fa-code mr-2 text-blue-500"></i> Informações do PHP
</h4>
<div class="space-y-2">
<div class="flex justify-between">
<span class="text-gray-600">Versão:</span>
<span class="font-medium">8.1.12</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Limite de Memória:</span>
<span class="font-medium">256M</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Tempo Máx. Execução:</span>
<span class="font-medium">30s</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Upload Máx. Arquivo:</span>
<span class="font-medium">64M</span>
</div>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="font-medium text-gray-700 mb-2 flex items-center">
<i class="fas fa-server mr-2 text-blue-500"></i> Informações do Servidor
</h4>
<div class="space-y-2">
<div class="flex justify-between">
<span class="text-gray-600">Software:</span>
<span class="font-medium">Apache/2.4.54</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Sistema Operacional:</span>
<span class="font-medium">Linux</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Tempo de Resposta:</span>
<span class="font-medium">28ms</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Protocolo:</span>
<span class="font-medium">HTTP/1.1</span>
</div>
</div>
</div>
</div>
<h3 class="text-lg font-semibold text-gray-800 mb-4">
<i class="fas fa-network-wired text-blue-500 mr-2"></i> Teste de Conexão
</h3>
<div class="bg-gray-50 p-4 rounded-lg mb-4">
<div class="flex items-center justify-between mb-3">
<div>
<h4 class="font-medium text-gray-700">Ping para o Servidor</h4>
<p class="text-sm text-gray-500">Teste a latência da conexão com o servidor</p>
</div>
<button id="run-ping" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-play mr-2"></i> Executar Teste
</button>
</div>
<div id="ping-results" class="hidden">
<div class="flex items-center justify-between mb-2">
<span class="text-gray-600">Tempo médio:</span>
<span class="font-medium" id="ping-average">28ms</span>
</div>
<div class="flex items-center justify-between mb-2">
<span class="text-gray-600">Pacotes perdidos:</span>
<span class="font-medium" id="ping-lost">0%</span>
</div>
<div class="bg-white p-3 rounded border">
<pre class="text-sm text-gray-800" id="ping-output">Executando teste de ping...</pre>
</div>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<div class="flex items-center justify-between mb-3">
<div>
<h4 class="font-medium text-gray-700">Teste de Velocidade</h4>
<p class="text-sm text-gray-500">Mede a velocidade de download/upload</p>
</div>
<button id="run-speedtest" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-tachometer-alt mr-2"></i> Executar Teste
</button>
</div>
<div id="speedtest-results" class="hidden">
<div class="grid grid-cols-2 gap-4 mb-4">
<div class="bg-white p-3 rounded border text-center">
<div class="text-gray-600 mb-1">Download</div>
<div class="text-xl font-bold text-blue-600" id="download-speed">0 Mbps</div>
</div>
<div class="bg-white p-3 rounded border text-center">
<div class="text-gray-600 mb-1">Upload</div>
<div class="text-xl font-bold text-purple-600" id="upload-speed">0 Mbps</div>
</div>
</div>
<div class="bg-white p-3 rounded border">
<pre class="text-sm text-gray-800" id="speedtest-output">Executando teste de velocidade...</pre>
</div>
</div>
</div>
</div>
</div>
<!-- Settings Tab Content -->
<div id="settings" class="tab-content">
<div class="bg-white rounded-lg shadow-md p-6 mb-6">
<h3 class="text-lg font-semibold text-gray-800 mb-6">
<i class="fas fa-sliders-h text-blue-500 mr-2"></i> Configurações de Consumo
</h3>
<form id="resource-settings-form">
<div class="mb-6">
<div class="flex items-center justify-between mb-2">
<label class="block text-gray-700 font-medium">Modo de Operação</label>
<div class="tooltip">
<i class="fas fa-info-circle text-gray-400"></i>
<span class="tooltip-text">Ative para simular consumo de recursos conforme as configurações abaixo</span>
</div>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
<span class="ml-3 text-gray-700">Ativar consumo de recursos</span>
</label>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<label for="cpu-usage" class="block text-gray-700 font-medium mb-2">
<i class="fas fa-microchip text-blue-500 mr-2"></i> Uso de CPU (segundos)
</label>
<input type="number" id="cpu-usage" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" value="10" min="1" max="60">
<p class="text-sm text-gray-500 mt-1">Duração máxima do consumo de CPU por ciclo</p>
</div>
<div>
<label for="memory-usage" class="block text-gray-700 font-medium mb-2">
<i class="fas fa-memory text-purple-500 mr-2"></i> Uso de Memória (MB)
</label>
<input type="number" id="memory-usage" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" value="256" min="1" max="1024">
<p class="text-sm text-gray-500 mt-1">Quantidade de memória a ser alocada</p>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<label for="active-cycle" class="block text-gray-700 font-medium mb-2">
<i class="fas fa-play-circle text-green-500 mr-2"></i> Ciclo de Atividade (segundos)
</label>
<input type="number" id="active-cycle" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" value="10" min="1" max="300">
<p class="text-sm text-gray-500 mt-1">Tempo de atividade do consumo</p>
</div>
<div>
<label for="pause-cycle" class="block text-gray-700 font-medium mb-2">
<i class="fas fa-pause-circle text-yellow-500 mr-2"></i> Ciclo de Pausa (segundos)
</label>
<input type="number" id="pause-cycle" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" value="20" min="1" max="300">
<p class="text-sm text-gray-500 mt-1">Tempo de pausa entre ciclos</p>
</div>
</div>
<div class="mb-6">
<label for="max-cpu" class="block text-gray-700 font-medium mb-2">
<i class="fas fa-exclamation-triangle text-red-500 mr-2"></i> Limite Máximo de CPU (%)
</label>
<input type="number" id="max-cpu" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" value="80" min="10" max="95">
<p class="text-sm text-gray-500 mt-1">O plugin não excederá este limite para evitar travamentos</p>
</div>
<div class="flex justify-end space-x-4">
<button type="button" class="px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-100">
<i class="fas fa-undo mr-2"></i> Redefinir
</button>
<button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-lg flex items-center">
<i class="fas fa-save mr-2"></i> Salvar Configurações
</button>
</div>
</form>
</div>
<div class="bg-white rounded-lg shadow-md p-6">
<h3 class="text-lg font-semibold text-gray-800 mb-6">
<i class="fas fa-shield-alt text-blue-500 mr-2"></i> Configurações de Segurança
</h3>
<div class="mb-6">
<div class="flex items-center justify-between mb-2">
<label class="block text-gray-700 font-medium">Registro de Logs</label>
<div class="tooltip">
<i class="fas fa-info-circle text-gray-400"></i>
<span class="tooltip-text">Registra todas as ações do plugin para auditoria</span>
</div>
</div>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
<span class="ml-3 text-gray-700">Ativar registro de logs</span>
</label>
</div>
<div class="mb-6">
<label for="log-retention" class="block text-gray-700 font-medium mb-2">
<i class="fas fa-history text-blue-500 mr-2"></i> Retenção de Logs (dias)
</label>
<select id="log-retention" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
<option value="7">7 dias</option>
<option value="14">14 dias</option>
<option value="30" selected>30 dias</option>
<option value="60">60 dias</option>
<option value="90">90 dias</option>
</select>
<p class="text-sm text-gray-500 mt-1">Os logs mais antigos serão excluídos automaticamente</p>
</div>
<div class="mb-6">
<label class="block text-gray-700 font-medium mb-2">
<i class="fas fa-file-export text-blue-500 mr-2"></i> Exportar Logs
</label>
<div class="flex space-x-3">
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-file-csv mr-2"></i> CSV
</button>
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-file-code mr-2"></i> JSON
</button>
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-file-alt mr-2"></i> TXT
</button>
</div>
</div>
<div class="flex justify-end">
<button class="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-lg flex items-center">
<i class="fas fa-save mr-2"></i> Salvar Configurações
</button>
</div>
</div>
</div>
<!-- Logs Tab Content -->
<div id="logs" class="tab-content">
<div class="bg-white rounded-lg shadow-md p-6">
<div class="flex justify-between items-center mb-6">
<h3 class="text-lg font-semibold text-gray-800">
<i class="fas fa-clipboard-list text-blue-500 mr-2"></i> Logs de Atividade
</h3>
<div class="flex space-x-3">
<div class="relative">
<input type="text" placeholder="Filtrar logs..." class="pl-10 pr-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<button class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg flex items-center">
<i class="fas fa-filter mr-2"></i> Filtros
</button>
</div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Data/Hora
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Tipo
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Mensagem
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Status
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Ações
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr class="log-entry hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2023-07-15 14:32:45
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">
CPU
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
Ciclo de consumo de CPU iniciado (10s)
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
Sucesso
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr class="log-entry hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2023-07-15 14:32:30
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800">
Memória
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
Alocada 256MB de memória
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
Sucesso
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr class="log-entry hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2023-07-15 14:32:15
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
Configuração
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
Configurações atualizadas pelo usuário admin
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
Sucesso
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr class="log-entry hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2023-07-15 14:30:22
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">
Erro
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
Falha ao alocar 512MB de memória - limite excedido
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">
Erro
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr class="log-entry hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
2023-07-15 14:28:10
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">
CPU
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
Ciclo de consumo de CPU finalizado
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
Sucesso
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex items-center justify-between border-t border-gray-200 mt-4 pt-4">
<div>
<p class="text-sm text-gray-700">
Mostrando <span class="font-medium">1</span> a <span class="font-medium">5</span> de <span class="font-medium">124</span> registros
</p>
</div>
<div class="flex space-x-2">
<button class="px-3 py-1 border rounded text-gray-700 bg-gray-100">
<i class="fas fa-angle-left"></i>
</button>
<button class="px-3 py-1 border rounded bg-blue-500 text-white">1</button>
<button class="px-3 py-1 border rounded text-gray-700 hover:bg-gray-100">2</button>
<button class="px-3 py-1 border rounded text-gray-700 hover:bg-gray-100">3</button>
<button class="px-3 py-1 border rounded text-gray-700 hover:bg-gray-100">...</button>
<button class="px-3 py-1 border rounded text-gray-700 hover:bg-gray-100">8</button>
<button class="px-3 py-1 border rounded text-gray-700 hover:bg-gray-100">
<i class="fas fa-angle-right"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<script>
// Tab switching functionality
document.querySelectorAll('.tab-btn').forEach(button => {
button.addEventListener('click', () => {
// Remove active class from all buttons and contents
document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active', 'border-blue-500', 'text-blue-500'));
document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
// Add active class to clicked button and corresponding content
button.classList.add('active', 'border-blue-500', 'text-blue-500');
const tabId = button.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
});
});
// Initialize CPU Gauge
const cpuGauge = new Gauge(document.getElementById('cpu-gauge')).setOptions({
angle: 0,
lineWidth: 0.2,
radiusScale: 1,
pointer: {
length: 0.6,
strokeWidth: 0.035,
color: '#000000'
},
limitMax: false,
limitMin: false,
colorStart: '#6AD2F3',
colorStop: '#3863F2',
strokeColor: '#E0E0E0',
generateGradient: true,
highDpiSupport: true,
percentColors: [[0.0, "#a9d70b" ], [0.50, "#f9c802"], [0.8, "#ff0000"]]
});
cpuGauge.maxValue = 100;
cpuGauge.set(45);
// Initialize Memory Gauge
const memoryGauge = new Gauge(document.getElementById('memory-gauge')).setOptions({
angle: 0,
lineWidth: 0.2,
radiusScale: 1,
pointer: {
length: 0.6,
strokeWidth: 0.035,
color: '#000000'
},
limitMax: false,
limitMin: false,
colorStart: '#D2B3F3',
colorStop: '#8A63F2',
strokeColor: '#E0E0E0',
generateGradient: true,
highDpiSupport: true,
percentColors: [[0.0, "#a9d70b" ], [0.50, "#f9c802"], [0.8, "#ff0000"]]
});
memoryGauge.maxValue = 100;
memoryGauge.set(65);
// Update status indicators based on values
function updateStatusIndicators() {
const cpuPercentage = 45;
const memoryPercentage = 65;
const cpuStatus = document.getElementById('cpu-status');
const memoryStatus = document.getElementById('memory-status');
if (cpuPercentage > 80) {
cpuStatus.innerHTML = '<i class="fas fa-circle text-red-500 mr-1"></i> Crítico';
cpuStatus.className = 'text-sm font-medium px-2.5 py-0.5 rounded-full bg-red-100 text-red-800';
} else if (cpuPercentage > 60) {
cpuStatus.innerHTML = '<i class="fas fa-circle text-yellow-500 mr-1"></i> Alto';
cpuStatus.className = 'text-sm font-medium px-2.5 py-0.5 rounded-full bg-yellow-100 text-yellow-800';
} else {
cpuStatus.innerHTML = '<i class="fas fa-circle text-green-500 mr-1"></i> Normal';
cpuStatus.className = 'text-sm font-medium px-2.5 py-0.5 rounded-full bg-green-100 text-green-800';
}
if (memoryPercentage > 80) {
memoryStatus.innerHTML = '<i class="fas fa-circle text-red-500 mr-1"></i> Crítico';
memoryStatus.className = 'text-sm font-medium px-2.5 py-0.5 rounded-full bg-red-100 text-red-800';
} else if (memoryPercentage > 60) {
memoryStatus.innerHTML = '<i class="fas fa-circle text-yellow-500 mr-1"></i> Moderado';
memoryStatus.className = 'text-sm font-medium px-2.5 py-0.5 rounded-full bg-yellow-100 text-yellow-800';
} else {
memoryStatus.innerHTML = '<i class="fas fa-circle text-green-500 mr-1"></i> Normal';
memoryStatus.className = 'text-sm font-medium px-2.5 py-0.5 rounded-full bg-green-100 text-green-800';
}
}
updateStatusIndicators();
// Initialize CPU Chart
const cpuCtx = document.getElementById('cpuChart').getContext('2d');
const cpuChart = new Chart(cpuCtx, {
type: 'line',
data: {
labels: Array.from({length: 24}, (_, i) => `${i}:00`),
datasets: [{
label: 'Uso de CPU (%)',
data: [30, 35, 40, 45, 50, 55, 60, 65, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 25, 30, 35, 40, 45],
borderColor: '#3B82F6',
backgroundColor: 'rgba(59, 130, 246, 0.1)',
borderWidth: 2,
tension: 0.4,
fill: true
}]
},
options: {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Initialize Memory Chart
const memoryCtx = document.getElementById('memoryChart').getContext('2d');
const memoryChart = new Chart(memoryCtx, {
type: 'line',
data: {
labels: Array.from({length: 24}, (_, i) => `${i}:00`),
datasets: [{
label: 'Uso de Memória (%)',
data: [40, 45, 50, 55, 60, 65, 70, 75, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 35, 40, 45, 50, 65],
borderColor: '#8B5CF6',
backgroundColor: 'rgba(139, 92, 246, 0.1)',
borderWidth: 2,
tension: 0.4,
fill: true
}]
},
options: {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Simulate real-time updates
function simulateUpdates() {
// Randomly update CPU and memory values
const newCpuValue = Math.min(100, Math.max(0, cpuGauge.value + (Math.random() * 10 - 5)));
const newMemoryValue = Math.min(100, Math.max(0, memoryGauge.value + (Math.random() * 10 - 5)));
cpuGauge.set(newCpuValue);
memoryGauge.set(newMemoryValue);
document.getElementById('cpu-percentage').textContent = Math.round(newCpuValue) + '%';
document.getElementById('memory-percentage').textContent = Math.round(newMemoryValue) + '%';
updateStatusIndicators();
// Update charts with new data point
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
const timeLabel = `${hours}:${minutes < 10 ? '0' + minutes : minutes}`;
// Shift all data left and add new point at the end
cpuChart.data.labels.shift();
cpuChart.data.labels.push(timeLabel);
cpuChart.data.datasets[0].data.shift();
cpuChart.data.datasets[0].data.push(newCpuValue);
cpuChart.update();
memoryChart.data.labels.shift();
memoryChart.data.labels.push(timeLabel);
memoryChart.data.datasets[0].data.shift();
memoryChart.data.datasets[0].data.push(newMemoryValue);
memoryChart.update();
}
// Update every 5 seconds
setInterval(simulateUpdates, 5000);
// Ping test functionality
document.getElementById('run-ping').addEventListener('click', function() {
const pingResults = document.getElementById('ping-results');
const pingOutput = document.getElementById('ping-output');
pingResults.classList.remove('hidden');
pingOutput.textContent = 'Executando teste de ping...';
// Simulate ping test
setTimeout(() => {
const average = Math.floor(Math.random() * 30) + 10;
const lost = Math.random() > 0.9 ? '10%' : '0%';
document.getElementById('ping-average').textContent = average + 'ms';
document.getElementById('ping-lost').textContent = lost;
pingOutput.textContent = `PING example.com (93.184.216.34) 56(84) bytes of data.
64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=${average} ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=${average + 2} ms
64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=${average - 3} ms
64 bytes from 93.184.216.34: icmp_seq=4 ttl=56 time=${average + 1} ms
--- example.com ping statistics ---
4 packets transmitted, 4 received, ${lost} packet loss, time 3002ms
rtt min/avg/max/mdev = ${average - 3}.123/${average}.456/${average + 2}.789/1.234 ms`;
}, 1500);
});
// Speed test functionality
document.getElementById('run-speedtest').addEventListener('click', function() {
const speedtestResults = document.getElementById('speedtest-results');
const speedtestOutput = document.getElementById('speedtest-output');
speedtestResults.classList.remove('hidden');
speedtestOutput.textContent = 'Executando teste de velocidade...';
// Simulate speed test with progress
let downloadSpeed = 0;
let uploadSpeed = 0;
const downloadInterval = setInterval(() => {
downloadSpeed += Math.random() * 10;
if (downloadSpeed >= 85) {
downloadSpeed = 85 + Math.random() * 5;
clearInterval(downloadInterval);
// Start upload test
const uploadInterval = setInterval(() => {
uploadSpeed += Math.random() * 5;
if (uploadSpeed >= 35) {
uploadSpeed = 35 + Math.random() * 5;
clearInterval(uploadInterval);
// Final results
speedtestOutput.textContent = `Teste de velocidade concluído!
Download: ${downloadSpeed.toFixed(2)} Mbps
Upload: ${uploadSpeed.toFixed(2)} Mbps
Ping: ${Math.floor(Math.random() * 30) + 10} ms
Provedor: Example Network
Servidor: São Paulo, BR`;
}
document.getElementById('upload-speed').textContent = uploadSpeed.toFixed(2) + ' Mbps';
}, 200);
}
document.getElementById('download-speed').textContent = downloadSpeed.toFixed(2) + ' Mbps';
}, 100);
});
// Form validation
document.getElementById('resource-settings-form').addEventListener('submit', function(e) {
e.preventDefault();
// Validate inputs
const cpuUsage = document.getElementById('cpu-usage').value;
const memoryUsage = document.getElementById('memory-usage').value;
const activeCycle = document.getElementById('active-cycle').value;
const pauseCycle = document.getElementById('pause-cycle').value;
const maxCpu = document.getElementById('max-cpu').value;
if (cpuUsage < 1 || cpuUsage > 60) {
alert('O uso de CPU deve estar entre 1 e 60 segundos');
return;
}
if (memoryUsage < 1 || memoryUsage > 1024) {
alert('O uso de memória deve estar entre 1 e 1024 MB');
return;
}
if (activeCycle < 1 || activeCycle > 300) {
alert('O ciclo de atividade deve estar entre 1 e 300 segundos');
return;
}
if (pauseCycle < 1 || pauseCycle > 300) {
alert('O ciclo de pausa deve estar entre 1 e 300 segundos');
return;
}
if (maxCpu < 10 || maxCpu > 95) {
alert('O limite máximo de CPU deve estar entre 10% e 95%');
return;
}
// If all valid, show success message
alert('Configurações salvas com sucesso!');
});
</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=murillodutt/server-status" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>