Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(ui): WP list bulk-select + detail posture gauge & PHP version (S8.4)

Juan Denis8ac61a7f1e90
diff --git a/docs/REDESIGN_MAP.md b/docs/REDESIGN_MAP.md
index 40c5c6bf..d9f3fd2c 100644
--- a/docs/REDESIGN_MAP.md
+++ b/docs/REDESIGN_MAP.md
@@ -280,12 +280,17 @@ modal TargetPicker and **no terminal shell at all** on this page. Pass-1 restyle
shape of the page is not the demo's. Needs the §5 unified-targets endpoint to be fully real; an interim
win: host the existing SSH/xterm console (RemoteTerminal is built but unmounted) as a Terminal tab.
-### 8.4 WordPress — detail is close; list is thin
-- List: no bulk-select (demo: tri-state ckbox + bulk Start/Restart/Stop/Update/Backup bar) — JSX now,
- fan-out or bulk route later; missing Plugins/Visits/Uptime/Server/Env columns = §5 `get_sites` enrichment.
-- Detail (mostly §5 data gaps, structure is right): security posture **ScoreGauge** (compute from existing
- check rows — JSX-only), largest-tables **gauge bars**, PHP version in header subtitle, response-time chart,
- referrers/devices bars, FilesDrawer w/ code viewer.
+### 8.4 WordPress — ✅ **JSX-only parts done 2026-06-11**
+- List: **bulk-select shipped** — header + per-row checkboxes, accent `is-selected` rows, bulkbar with
+ Start/Stop/Update-core/Backup/Clear-cache fanned out per site over the real APIs (unarchive/archive/
+ updateCore/createSnapshot/flushCache), each scoped by an `applies` filter (e.g. Stop only hits running
+ sites). Restart/bulk-Delete skipped (no site-level restart API; delete too destructive for bulk).
+- Detail: **posture ScoreGauge shipped** in the Security tab — score computed client-side from 3 real signals
+ (integrity clean, WP_DEBUG off, no critical/high vulns) with a checklist; unrun checks stay out of the
+ score. **PHP version added to the header subtitle** (`site.application.php_version`).
+- Still §5 (data missing): Plugins/Visits/Uptime/Server/Env list columns (`get_sites` enrichment),
+ largest-tables + gauge bars (no table-size endpoint), response-time chart, referrers/devices bars,
+ FilesDrawer w/ code viewer.
### 8.5 Files — high parity; 3 visible gaps
Syntax-highlighted preview (`PreviewDrawer.jsx:113` plain textarea vs `.pv-code` tokens — the planned
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index 38240cd7..ac9182fd 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -12,6 +12,7 @@ import { WORDPRESS_TABS } from '../components/wordpress/wordpressTabs';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
+import { Checkbox } from '@/components/ui/checkbox';
function WordPress() {
const [sites, setSites] = useState([]);
@@ -28,6 +29,8 @@ function WordPress() {
const [importLoading, setImportLoading] = useState(false);
const [importForm, setImportForm] = useState({ name: '', adminEmail: '', oldUrl: '' });
const [importFile, setImportFile] = useState(null);
+ const [selectedIds, setSelectedIds] = useState(new Set());
+ const [bulkLoading, setBulkLoading] = useState(false);
const navigate = useNavigate();
const toast = useToast();
@@ -81,6 +84,27 @@ function WordPress() {
}
};
+ // Bulk ops fan out per-site (no bulk route yet — §5); `applies` filters the
+ // selection to sites the action makes sense for.
+ const bulkRun = async (label, fn, applies = () => true) => {
+ const targets = sites.filter(s => selectedIds.has(s.id) && applies(s));
+ if (targets.length === 0) {
+ toast.info(`No selected sites need "${label}"`);
+ return;
+ }
+ setBulkLoading(true);
+ try {
+ const results = await Promise.allSettled(targets.map(s => fn(s)));
+ const failed = results.filter(r => r.status === 'rejected').length;
+ if (failed) toast.error(`${label}: ${failed} of ${targets.length} failed`);
+ else toast.success(`${label} sent to ${targets.length} site${targets.length === 1 ? '' : 's'}`);
+ setSelectedIds(new Set());
+ await loadSites();
+ } finally {
+ setBulkLoading(false);
+ }
+ };
+
const handleImport = async () => {
if (!importForm.name) { toast.error('Site name is required'); return; }
if (!importForm.oldUrl) { toast.error('Original site URL is required'); return; }
@@ -236,10 +260,50 @@ function WordPress() {
)}
</div>
+ {selectedIds.size > 0 && (
+ <div className="wp-list__bulkbar">
+ <span className="wp-list__bulkcount">{selectedIds.size} selected</span>
+ <div className="wp-list__bulkactions">
+ <Button variant="outline" size="sm" disabled={bulkLoading}
+ onClick={() => bulkRun('Start', s => wordpressApi.unarchiveSite(s.id), s => s.status !== 'running')}>
+ Start
+ </Button>
+ <Button variant="outline" size="sm" disabled={bulkLoading}
+ onClick={() => bulkRun('Stop', s => wordpressApi.archiveSite(s.id), s => s.status === 'running')}>
+ Stop
+ </Button>
+ <Button variant="outline" size="sm" disabled={bulkLoading}
+ onClick={() => bulkRun('Update core', s => wordpressApi.updateCore(s.id), s => s.status === 'running')}>
+ Update
+ </Button>
+ <Button variant="outline" size="sm" disabled={bulkLoading}
+ onClick={() => bulkRun('Backup', s => wordpressApi.createSnapshot(s.id, { name: 'bulk-backup' }), s => s.status === 'running')}>
+ Backup
+ </Button>
+ <Button variant="outline" size="sm" disabled={bulkLoading}
+ onClick={() => bulkRun('Clear cache', s => wordpressApi.flushCache(s.id), s => s.status === 'running')}>
+ Clear cache
+ </Button>
+ <Button variant="ghost" size="sm" onClick={() => setSelectedIds(new Set())}>
+ Clear
+ </Button>
+ </div>
+ </div>
+ )}
+
<div className="wp-list__card">
<table className="sk-dtable">
<thead>
<tr>
+ <th className="wp-list__ck">
+ <Checkbox
+ checked={shownSites.length > 0 && shownSites.every(s => selectedIds.has(s.id))}
+ onCheckedChange={(checked) => {
+ setSelectedIds(checked ? new Set(shownSites.map(s => s.id)) : new Set());
+ }}
+ aria-label="Select all sites"
+ />
+ </th>
<th>Site</th>
<th>Environments</th>
<th>Version</th>
@@ -250,7 +314,25 @@ function WordPress() {
</thead>
<tbody>
{shownSites.map(site => (
- <tr key={site.id} className="is-clickable" onClick={() => navigate(`/wordpress/${site.id}`)}>
+ <tr
+ key={site.id}
+ className={`is-clickable ${selectedIds.has(site.id) ? 'is-selected' : ''}`}
+ onClick={() => navigate(`/wordpress/${site.id}`)}
+ >
+ <td className="wp-list__ck" onClick={e => e.stopPropagation()}>
+ <Checkbox
+ checked={selectedIds.has(site.id)}
+ onCheckedChange={(checked) => {
+ setSelectedIds(prev => {
+ const next = new Set(prev);
+ if (checked) next.add(site.id);
+ else next.delete(site.id);
+ return next;
+ });
+ }}
+ aria-label={`Select ${site.name || `site ${site.id}`}`}
+ />
+ </td>
<td>
<div className="sk-cell-name">
<span className="wp-list__tile" aria-hidden="true">
diff --git a/frontend/src/pages/WordPressDetail.jsx b/frontend/src/pages/WordPressDetail.jsx
index 7718a472..7fdfda12 100644
--- a/frontend/src/pages/WordPressDetail.jsx
+++ b/frontend/src/pages/WordPressDetail.jsx
@@ -9,7 +9,7 @@ import { useToast } from '../contexts/ToastContext';
import { useLogsDrawer } from '../contexts/LogsDrawerContext';
import { EnvironmentCard, SnapshotTable, GitConnectForm, CommitList, DiskUsageBar } from '../components/wordpress';
import { HealthDot } from '../components/wordpress/HealthStatusPanel';
-import { Pill, EnvTag, MetricCard, SegControl } from '../components/ds';
+import { Pill, EnvTag, MetricCard, SegControl, ScoreGauge } from '../components/ds';
import { ErrorBoundary, ErrorState } from '../components/ErrorBoundary';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
@@ -376,6 +376,12 @@ const WordPressDetail = () => {
</h1>
<div className="app-detail-subtitle">
<span>WordPress {site.wp_version || '—'}</span>
+ {site.application?.php_version && (
+ <>
+ <span className="separator">·</span>
+ <span>PHP {site.application.php_version}</span>
+ </>
+ )}
{site.url && (
<>
<span className="separator">·</span>
@@ -898,17 +904,19 @@ const SecurityTab = ({ siteId }) => {
const [integrity, setIntegrity] = useState(null);
const [debug, setDebug] = useState(null);
const [cron, setCron] = useState(null);
+ const [vulns, setVulns] = useState(null);
const [loading, setLoading] = useState(true);
const [busy, setBusy] = useState(false);
const loadAll = React.useCallback(async () => {
try {
- const [i, d, c] = await Promise.all([
+ const [i, d, c, v] = await Promise.all([
wordpressApi.getIntegrity(siteId).catch(() => null),
wordpressApi.getDebug(siteId).catch(() => null),
wordpressApi.getCron(siteId).catch(() => null),
+ wordpressApi.getVulnerabilities(siteId).catch(() => null),
]);
- setIntegrity(i); setDebug(d); setCron(c);
+ setIntegrity(i); setDebug(d); setCron(c); setVulns(v);
} finally {
setLoading(false);
}
@@ -960,9 +968,58 @@ const SecurityTab = ({ siteId }) => {
const intRunning = integrity?.status === 'running';
const issues = integrity?.issues || [];
+ // Posture checks — real signals only; checks that haven't run yet stay out
+ // of the score (demo's posture ring, computed client-side).
+ const vsum = vulns?.summary || {};
+ const checks = [
+ {
+ label: 'Core & plugin files verified',
+ state: integrity?.status === 'completed' ? (issues.length === 0 ? 'pass' : 'fail') : 'unknown',
+ detail: integrity?.status === 'completed'
+ ? (issues.length === 0 ? 'checksums clean' : `${issues.length} issue${issues.length === 1 ? '' : 's'}`)
+ : 'not checked yet',
+ },
+ {
+ label: 'WP_DEBUG disabled',
+ state: debug ? (debug.debug?.WP_DEBUG ? 'fail' : 'pass') : 'unknown',
+ detail: debug ? (debug.debug?.WP_DEBUG ? 'debug is on' : 'off') : 'unavailable',
+ },
+ {
+ label: 'No critical / high vulnerabilities',
+ state: vulns?.scanned_at ? (((vsum.critical ?? 0) + (vsum.high ?? 0)) === 0 ? 'pass' : 'fail') : 'unknown',
+ detail: vulns?.scanned_at
+ ? `${(vsum.critical ?? 0) + (vsum.high ?? 0)} found`
+ : 'no scan yet',
+ },
+ ];
+ const scored = checks.filter(c => c.state !== 'unknown');
+ const score = scored.length ? Math.round(scored.filter(c => c.state === 'pass').length / scored.length * 100) : null;
+ const scoreColor = score >= 80 ? 'var(--green)' : score >= 50 ? 'var(--amber)' : 'var(--red)';
+ const CHECK_PILL = { pass: 'green', fail: 'red', unknown: 'gray' };
+
return (
<div className="app-overview-grid">
<div className="app-overview-left">
+ <div className="app-panel">
+ <div className="app-panel-header">Security posture</div>
+ <div className="app-panel-body wp-posture">
+ {score !== null ? (
+ <ScoreGauge value={score} size={110} stroke={9} color={scoreColor} label="posture" />
+ ) : (
+ <p className="hint">Run the checks below to compute a posture score.</p>
+ )}
+ <div className="wp-posture__checks">
+ {checks.map(c => (
+ <div key={c.label} className="wp-posture__check">
+ <span className="wp-posture__label">{c.label}</span>
+ <span className="wp-posture__detail">{c.detail}</span>
+ <Pill kind={CHECK_PILL[c.state]}>{c.state === 'unknown' ? 'pending' : c.state}</Pill>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+
<div className="app-panel">
<div className="app-panel-header">File integrity</div>
<div className="app-panel-body">
diff --git a/frontend/src/styles/pages/_wordpress.scss b/frontend/src/styles/pages/_wordpress.scss
index 0e8280bd..479358ca 100644
--- a/frontend/src/styles/pages/_wordpress.scss
+++ b/frontend/src/styles/pages/_wordpress.scss
@@ -165,6 +165,39 @@
.wp-tag-filter { margin: 0; }
}
+ // bulk-select bar (demo's bulkbar) — appears once any row is checked
+ &__bulkbar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-3;
+ flex-wrap: wrap;
+ padding: $space-2 $space-4;
+ margin-bottom: $space-3;
+ background: var(--accent-bg-soft);
+ border: 1px solid var(--accent-dim);
+ border-radius: var(--radius);
+ }
+
+ &__bulkcount {
+ font-family: var(--mono);
+ font-size: 12px;
+ font-weight: $font-weight-medium;
+ color: var(--accent-bright);
+ }
+
+ &__bulkactions {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ flex-wrap: wrap;
+ }
+
+ &__ck {
+ width: 36px;
+ padding-right: 0;
+ }
+
&__card {
background: var(--surface);
border: 1px solid var(--border-soft);
@@ -876,6 +909,49 @@
margin-bottom: $space-4;
}
+ // ---- Security posture (ScoreGauge ring + checklist, demo Posture panel) ----
+ .wp-posture {
+ display: flex;
+ align-items: center;
+ gap: $space-6;
+
+ &__checks {
+ flex: 1;
+ min-width: 0;
+ }
+
+ &__check {
+ display: flex;
+ align-items: center;
+ gap: $space-3;
+ padding: 10px 0;
+ border-top: 1px solid var(--border-soft);
+ font-size: 13px;
+
+ &:first-child { border-top: none; }
+ }
+
+ &__label {
+ flex: 1;
+ min-width: 0;
+ color: var(--text);
+ }
+
+ &__detail {
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+ white-space: nowrap;
+ }
+
+ @media (max-width: $breakpoint-md) {
+ flex-direction: column;
+ align-items: flex-start;
+
+ &__checks { width: 100%; }
+ }
+ }
+
// ---- Mono code well (integrity issue lines) ----
.wp-code-list {
margin-top: $space-3;