Spaces:
Running
Running
File size: 54,236 Bytes
599ac91 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | <!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> |