mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Add system-fragment.php — a thin authenticated endpoint that returns only the tab-panel HTML (toolbar + meta + log/nginx-config output) for a given ?tab=&n= combination. No page shell, no status section, no DB queries. system.php changes: - Tab <a> elements gain data-tab= attributes used by JS to identify the target without parsing hrefs. - Tab panel content wrapped in <div id=sys-tab-panel data-tab= data-n=> which JS uses as both the swap target and its own state store. - JS rewritten: tab clicks and lines-select changes call loadPanel() which fetch()es system-fragment.php, swaps innerHTML, updates active tab ARIA attributes, and pushes state via history.pushState. - Browser back/forward handled via popstate listener. - bindPanelControls() re-wires the lines-select and copy-to-clipboard button after every innerHTML swap (event delegation not feasible here because log-output is replaced wholesale). - fetch() failure falls back to window.location.href (full page load). - Tabs without JS still work: <a href> links go to system.php?tab=… as before. system-fragment.php: - Requires AdminAuth::isAuthenticated(); returns 403 on failure. - Validates tab and n params against the same whitelist as system.php. - All helper functions namespaced with frag_ prefix to avoid redeclaration if PHP ever includes both files in the same process. - Renders identical HTML to the corresponding section in system.php. system.css: - #sys-tab-panel gets min-height:8rem and position:relative to prevent layout jump during fetch. - .sys-panel-loading: opacity 0.4 + pointer-events:none + subtle diagonal-stripe ::after overlay with shimmer animation.
384 lines
10 KiB
CSS
384 lines
10 KiB
CSS
/* ============================================================
|
|
SYSTEM PAGE
|
|
============================================================ */
|
|
|
|
@import url("./variables.css");
|
|
|
|
/* ── System page tabs ──────────────────────────────────────────────────── */
|
|
.sys-tabs {
|
|
display: flex;
|
|
gap: 0;
|
|
border-bottom: 1px solid #555;
|
|
margin-bottom: 1.75rem;
|
|
}
|
|
.sys-tab {
|
|
display: inline-block;
|
|
padding: .55rem 1.1rem;
|
|
font-size: .84rem;
|
|
font-weight: 500;
|
|
color: #969696;
|
|
text-decoration: none;
|
|
border-bottom: 2px solid transparent;
|
|
margin-bottom: -1px;
|
|
transition: color .15s, border-color .15s;
|
|
}
|
|
.sys-tab:hover {
|
|
color: #e8e8e8;
|
|
}
|
|
.sys-tab.active {
|
|
color: var(--accent-primary);
|
|
border-bottom-color: var(--accent-primary);
|
|
}
|
|
|
|
/* ── Status section (always-visible panel above tabs) ─────────────────── */
|
|
.sys-status-section {
|
|
background: #1a1a1a;
|
|
border: 1px solid #555;
|
|
border-radius: 6px;
|
|
padding: 1rem 1.25rem 1.25rem;
|
|
margin-bottom: 1.75rem;
|
|
}
|
|
.sys-status-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.sys-status-toggle {
|
|
background: none;
|
|
border: 1px solid #555;
|
|
color: #969696;
|
|
border-radius: 3px;
|
|
font-size: .72rem;
|
|
font-family: inherit;
|
|
padding: .2rem .55rem;
|
|
cursor: pointer;
|
|
white-space: nowrap;
|
|
transition: color .15s, border-color .15s;
|
|
}
|
|
.sys-status-toggle:hover {
|
|
color: #e8e8e8;
|
|
border-color: #888;
|
|
}
|
|
.sys-status-meta {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 1.5rem 2rem;
|
|
margin-top: 1.5rem;
|
|
padding-top: 1.25rem;
|
|
border-top: 1px solid #333;
|
|
}
|
|
@media (max-width: 700px) {
|
|
.sys-status-meta { grid-template-columns: 1fr; }
|
|
}
|
|
|
|
/* ── Status cards ──────────────────────────────────────────────────────── */
|
|
.srv-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 2.5rem;
|
|
}
|
|
.srv-card {
|
|
background: #242424;
|
|
border: 1px solid #555;
|
|
border-radius: 5px;
|
|
padding: 1rem 1.25rem;
|
|
}
|
|
.srv-card__header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: .4rem;
|
|
}
|
|
.srv-card__name {
|
|
font-size: .82rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: .07em;
|
|
color: #969696;
|
|
font-weight: 500;
|
|
}
|
|
.srv-card__detail {
|
|
font-size: .8rem;
|
|
color: #969696;
|
|
margin-top: .25rem;
|
|
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
}
|
|
.status-ok { color: var(--accent-green); font-weight: 600; font-size: .85rem; }
|
|
.status-warn { color: var(--warning); font-weight: 600; font-size: .85rem; }
|
|
.status-err { color: var(--error); font-weight: 600; font-size: .85rem; }
|
|
.status-unknown { color: var(--text-tertiary); font-weight: 600; font-size: .85rem; }
|
|
|
|
.srv-section-title {
|
|
font-size: .82rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: .1em;
|
|
color: #969696;
|
|
border-bottom: 1px solid #555;
|
|
padding-bottom: .4rem;
|
|
margin: 0 0 1rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
/* ── PHP info grid ─────────────────────────────────────────────────────── */
|
|
.php-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
gap: .5rem .75rem;
|
|
margin-bottom: 2.5rem;
|
|
}
|
|
.php-item {
|
|
background: #242424;
|
|
border: 1px solid #555;
|
|
border-radius: 4px;
|
|
padding: .5rem .75rem;
|
|
}
|
|
.php-item__key {
|
|
font-size: .75rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: .06em;
|
|
color: #969696;
|
|
}
|
|
.php-item__val {
|
|
font-size: .92rem;
|
|
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
color: #e8e8e8;
|
|
margin-top: .15rem;
|
|
}
|
|
|
|
/* ── Disk bar ──────────────────────────────────────────────────────────── */
|
|
.disk-bar-wrap {
|
|
background: #555;
|
|
border-radius: 3px;
|
|
height: 6px;
|
|
margin-top: .5rem;
|
|
overflow: hidden;
|
|
}
|
|
.disk-bar {
|
|
height: 100%;
|
|
border-radius: 3px;
|
|
/* width and background-color are set via inline style using --disk-pct and --disk-color */
|
|
width: var(--disk-pct, 0%);
|
|
background: var(--disk-color, #4caf50);
|
|
transition: width .3s;
|
|
}
|
|
.disk-stats {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: .78rem;
|
|
color: #969696;
|
|
margin-top: .25rem;
|
|
}
|
|
|
|
/* ── Tab panel loading state ──────────────────────────────────────────────── */
|
|
#sys-tab-panel {
|
|
min-height: 8rem; /* prevent layout jump while fetching */
|
|
position: relative;
|
|
}
|
|
#sys-tab-panel.sys-panel-loading {
|
|
opacity: 0.4;
|
|
pointer-events: none;
|
|
transition: opacity 0.1s;
|
|
}
|
|
#sys-tab-panel.sys-panel-loading::after {
|
|
content: '';
|
|
position: absolute;
|
|
inset: 0;
|
|
background: repeating-linear-gradient(
|
|
-45deg,
|
|
transparent,
|
|
transparent 6px,
|
|
rgba(255,255,255,.03) 6px,
|
|
rgba(255,255,255,.03) 12px
|
|
);
|
|
border-radius: 4px;
|
|
animation: sys-panel-shimmer 1s linear infinite;
|
|
background-size: 200% 200%;
|
|
}
|
|
@keyframes sys-panel-shimmer {
|
|
0% { background-position: 0 0; }
|
|
100% { background-position: 100% 100%; }
|
|
}
|
|
|
|
/* ── Log viewer ────────────────────────────────────────────────────────── */
|
|
.log-toolbar {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
gap: .6rem;
|
|
margin-bottom: 1.25rem;
|
|
}
|
|
.log-toolbar select {
|
|
background: #242424;
|
|
border: 1px solid #555;
|
|
color: #e8e8e8;
|
|
border-radius: 4px;
|
|
padding: .4rem .7rem;
|
|
font-size: .85rem;
|
|
font-family: inherit;
|
|
}
|
|
.log-toolbar select:focus { outline: 2px solid var(--accent-primary); }
|
|
|
|
.log-meta {
|
|
font-size: .78rem;
|
|
color: #969696;
|
|
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
margin-bottom: .75rem;
|
|
display: flex;
|
|
gap: 1.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
.log-meta span::before { content: attr(data-label) ": "; opacity: .6; }
|
|
|
|
.log-unavailable {
|
|
background: #242424;
|
|
border: 1px solid #555;
|
|
border-radius: 4px;
|
|
padding: 1.5rem;
|
|
color: #969696;
|
|
font-size: .88rem;
|
|
}
|
|
.log-unavail-path {
|
|
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
font-size: .8rem;
|
|
margin-top: .4rem;
|
|
opacity: .7;
|
|
}
|
|
.log-unavail-dev {
|
|
margin-top: .6rem;
|
|
font-size: .8rem;
|
|
opacity: .7;
|
|
}
|
|
.log-empty {
|
|
color: #969696;
|
|
font-size: .88rem;
|
|
padding: 1rem 0;
|
|
}
|
|
.log-output {
|
|
background: #0d0d0d;
|
|
border: 1px solid var(--admin-border);
|
|
border-radius: 4px;
|
|
padding: 1rem;
|
|
overflow-x: auto;
|
|
font-family: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
|
|
font-size: .76rem;
|
|
line-height: 1.55;
|
|
max-height: 62vh;
|
|
overflow-y: auto;
|
|
position: relative;
|
|
}
|
|
.log-line {
|
|
display: block;
|
|
white-space: pre;
|
|
padding: .05rem .1rem;
|
|
border-radius: 2px;
|
|
color: #bbb;
|
|
}
|
|
.log-line + .log-line { border-top: 1px solid rgba(255,255,255,.03); }
|
|
.log-crit { color: #ff7070; background: rgba(242, 90, 90, 0.12); }
|
|
.log-error { color: #f08080; }
|
|
.log-warn { color: var(--warning); }
|
|
.log-notice { color: #a0c8ff; }
|
|
.log-line::before {
|
|
content: attr(data-n);
|
|
display: inline-block;
|
|
min-width: 4ch;
|
|
margin-right: .75rem;
|
|
opacity: .3;
|
|
text-align: right;
|
|
user-select: none;
|
|
}
|
|
.log-count-badge {
|
|
background: #242424;
|
|
border: 1px solid #555;
|
|
border-radius: 3px;
|
|
font-size: .76rem;
|
|
padding: .15rem .5rem;
|
|
color: #969696;
|
|
font-family: ui-monospace, monospace;
|
|
}
|
|
.log-copy-btn {
|
|
position: absolute;
|
|
top: .6rem;
|
|
right: .6rem;
|
|
background: #242424;
|
|
border: 1px solid #555;
|
|
color: #969696;
|
|
border-radius: 4px;
|
|
font-size: .76rem;
|
|
padding: .25rem .6rem;
|
|
cursor: pointer;
|
|
font-family: inherit;
|
|
transition: color .15s, border-color .15s;
|
|
z-index: 2;
|
|
}
|
|
.log-copy-btn:hover {
|
|
color: #e8e8e8;
|
|
border-color: var(--accent-primary);
|
|
}
|
|
.log-copy-btn.copied {
|
|
color: var(--accent-green);
|
|
border-color: var(--accent-green);
|
|
}
|
|
|
|
.sys-refresh-note {
|
|
font-size: .78rem;
|
|
color: #969696;
|
|
margin-bottom: 1.25rem;
|
|
}
|
|
.sys-refresh-note a {
|
|
color: var(--accent-primary);
|
|
text-decoration: none;
|
|
}
|
|
.sys-refresh-note a:hover { text-decoration: underline; }
|
|
|
|
/* ── Cache freshness badges ──────────────────────────────────────────────── */
|
|
.sys-cache-badge {
|
|
display: inline-block;
|
|
font-size: .68rem;
|
|
font-weight: 400;
|
|
font-family: ui-monospace, monospace;
|
|
padding: .1rem .45rem;
|
|
border-radius: 3px;
|
|
margin-left: .7rem;
|
|
vertical-align: middle;
|
|
line-height: 1.6;
|
|
}
|
|
.sys-cache-badge--hit {
|
|
background: rgba(251, 202, 81, 0.12);
|
|
color: var(--warning);
|
|
border: 1px solid rgba(251, 202, 81, 0.35);
|
|
}
|
|
.sys-cache-badge--miss {
|
|
background: rgba(92, 214, 157, 0.12);
|
|
color: var(--success);
|
|
border: 1px solid rgba(92, 214, 157, 0.35);
|
|
}
|
|
|
|
/* ── Nginx config viewer ───────────────────────────────────────────────── */
|
|
.nginx-source-badge {
|
|
display: inline-block;
|
|
font-size: .72rem;
|
|
font-family: ui-monospace, monospace;
|
|
padding: .15rem .55rem;
|
|
border-radius: 3px;
|
|
margin-left: .6rem;
|
|
vertical-align: middle;
|
|
}
|
|
.nginx-source-badge--live {
|
|
background: rgba(92, 214, 157, 0.15);
|
|
color: var(--success);
|
|
border: 1px solid rgba(92, 214, 157, 0.35);
|
|
}
|
|
.nginx-source-badge--local {
|
|
background: rgba(251, 202, 81, 0.12);
|
|
color: var(--warning);
|
|
border: 1px solid rgba(251, 202, 81, 0.35);
|
|
}
|
|
/* Nginx syntax highlight layers inside .log-output */
|
|
.nginx-comment { color: #666; font-style: italic; }
|
|
.nginx-directive { color: #7eb8f7; }
|
|
.nginx-block { color: #d4a0ff; font-weight: 600; }
|
|
.nginx-value { color: #e2c08d; }
|
|
.nginx-location { color: #79dac8; }
|