MediaWiki:Common.css: mudanças entre as edições

De WIKI Netnews
Ir para navegação Ir para pesquisar
Sem resumo de edição
Sem resumo de edição
Linha 1: Linha 1:
/* ======================================================
function atualizarStatus(host, elementId) {
  WIKI NETNEWS 3.1 - NOC Interativo
  ====================================================== */


body {
     fetch('/noc/status.php?host=' + host)
     font-family: 'Segoe UI', Arial, sans-serif;
        .then(function(response) {
}
            return response.json();
 
        })
/* HERO */
        .then(function(data) {
.hero {
    background: linear-gradient(90deg, #1e3c72, #2a5298);
    padding: 70px 40px;
    color: white;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 50px;
}


.hero h1 {
            var el = document.getElementById(elementId);
    font-size: 40px;
            if (!el) return;
    margin-bottom: 10px;
    font-weight: 600;
}


.hero p {
            var html = '';
    font-size: 18px;
    opacity: 0.9;
}


/* GRID */
            if (data.status === "online") {
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}


/* CARDS */
                html = "🟢 Operacional<br>" +
.card {
                      "<small>Uptime: " + formatUptime(data.uptime) + "</small><br>" +
    padding: 35px;
                      "<small>Último check: " + (data.lastcheck ? data.lastcheck : '-') + "</small>";
    border-radius: 22px;
    color: white;
    transition: all 0.35s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
}


.card h3 {
                el.classList.remove("blink");
    margin-top: 0;
    font-size: 22px;
    font-weight: 600;
}


.card p {
            } else if (data.status === "offline") {
    font-size: 15px;
    opacity: 0.9;
}


.card a {
                html = "🔴 Offline<br>" +
    color: white !important;
                      "<small>Último check: " + (data.lastcheck ? data.lastcheck : '-') + "</small>";
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
    display: inline-block;
}


.card:hover {
                el.classList.add("blink");
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}


/* CORES */
            } else {
.blue { background: linear-gradient(135deg, #2980b9, #3498db); }
.green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.yellow { background: linear-gradient(135deg, #f39c12, #f1c40f); color: #000; }
.red { background: linear-gradient(135deg, #c0392b, #e74c3c); }


/* ========================= */
                html = "🟡 Indefinido";
/* PAINEL NOC */
            }
/* ========================= */


.noc-panel {
            el.innerHTML = html;
    background: #0f172a;
    padding: 40px;
    border-radius: 22px;
    color: white;
    margin-bottom: 60px;
}


.noc-title {
        })
    font-size: 24px;
        .catch(function() {
    margin-bottom: 30px;
            var el = document.getElementById(elementId);
    font-weight: 600;
            if (el) {
                el.innerHTML = "🟡 Erro";
            }
        });
}
}


.noc-grid {
function formatUptime(seconds) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}


.server-box {
     if (!seconds || seconds <= 0) return '-';
     background: #1e293b;
    padding: 22px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white !important;
}


.server-box:hover {
    var days = Math.floor(seconds / 86400);
     background: #334155;
     var hours = Math.floor((seconds % 86400) / 3600);
     transform: translateY(-4px);
     var minutes = Math.floor((seconds % 3600) / 60);
}


.server-name {
     return days + "d " + hours + "h " + minutes + "m";
     font-weight: 600;
}
}


/* STATUS DOT */
function atualizarTodos() {
.status-dot {
    atualizarStatus("web01", "web01-status");
     width: 14px;
     atualizarStatus("web02", "web02-status");
     height: 14px;
     atualizarStatus("web03", "web03-status");
     border-radius: 50%;
     atualizarStatus("web04", "web04-status");
     display: inline-block;
     atualizarStatus("ns1", "ns1-status");
     margin-right: 8px;
     atualizarStatus("ns2", "ns2-status");
}
}


/* STATUS COLORS */
document.addEventListener("DOMContentLoaded", function () {
.status-green {
     atualizarTodos();
    background: #22c55e;
     setInterval(atualizarTodos, 30000);
}
});
 
.status-yellow {
    background: #facc15;
}
 
.status-red {
    background: #ef4444;
}
 
/* ALERTA PISCANDO */
@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
     100% { opacity: 1; }
}
 
.status-blink {
     animation: blink 1s infinite;
}
 
.btn-green {
    background: #2ecc71;
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
}
 
.btn-green:hover {
    background: #27ae60;
}
.blink {
    animation: piscar 1s infinite;
}
 
@keyframes piscar {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}

Edição das 17h20min de 18 de fevereiro de 2026

function atualizarStatus(host, elementId) {

    fetch('/noc/status.php?host=' + host)
        .then(function(response) {
            return response.json();
        })
        .then(function(data) {

            var el = document.getElementById(elementId);
            if (!el) return;

            var html = '';

            if (data.status === "online") {

                html = "🟢 Operacional<br>" +
                       "<small>Uptime: " + formatUptime(data.uptime) + "</small><br>" +
                       "<small>Último check: " + (data.lastcheck ? data.lastcheck : '-') + "</small>";

                el.classList.remove("blink");

            } else if (data.status === "offline") {

                html = "🔴 Offline<br>" +
                       "<small>Último check: " + (data.lastcheck ? data.lastcheck : '-') + "</small>";

                el.classList.add("blink");

            } else {

                html = "🟡 Indefinido";
            }

            el.innerHTML = html;

        })
        .catch(function() {
            var el = document.getElementById(elementId);
            if (el) {
                el.innerHTML = "🟡 Erro";
            }
        });
}

function formatUptime(seconds) {

    if (!seconds || seconds <= 0) return '-';

    var days = Math.floor(seconds / 86400);
    var hours = Math.floor((seconds % 86400) / 3600);
    var minutes = Math.floor((seconds % 3600) / 60);

    return days + "d " + hours + "h " + minutes + "m";
}

function atualizarTodos() {
    atualizarStatus("web01", "web01-status");
    atualizarStatus("web02", "web02-status");
    atualizarStatus("web03", "web03-status");
    atualizarStatus("web04", "web04-status");
    atualizarStatus("ns1", "ns1-status");
    atualizarStatus("ns2", "ns2-status");
}

document.addEventListener("DOMContentLoaded", function () {
    atualizarTodos();
    setInterval(atualizarTodos, 30000);
});