mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-05 22:51:51 +09:00
feat(extensions): Phase 5 — WordPress UI contributed by serverkit-wordpress
Completes #38: the WordPress frontend now belongs to the extension too, not just the backend. The tab-group constraint (contributed routes are flat — there's no way to contribute a shared TabGroupLayout parent inside the dashboard) is solved by contributing a SINGLE splat route `wordpress/*` whose component (WordPressExtension) self-renders the whole WordPress sub-router — reproducing the exact structure core App.jsx used to own: - TabGroupLayout + WORDPRESS_TABS over the 3 list pages (sites / plugin library / pipelines), - full-bleed site + pipeline detail routes as siblings, - the legacy /wordpress/projects → /wordpress/pipelines deprecation redirects. The 5 page components stay in core pages/ and are re-used (Pattern A, same as serverkit-git/email/workflows); only the routing + nav/palette/title ownership moves into the manifest. - builtin-extensions/serverkit-wordpress/frontend/index.jsx (source) → synced to frontend/src/plugins/serverkit-wordpress/ (pre-bundled, D5) via scripts/sync-builtin-frontends.mjs (drift check green). - plugin.json contributions: nav (WordPress), routes ([{path:"wordpress/*", component:"WordPressExtension"}]), page_titles, command_palette. - Core App.jsx: removed the WordPress imports, the TabGroupLayout WORDPRESS_TABS route block, the detail routes, LegacyWpPipelineRedirect, and the now-unused ModuleRoute + WORDPRESS_TABS imports (kept the dynamic /wordpress/ title fallbacks). Removed the sidebar nav item and the two command-palette entries. WordPress now disappears cleanly (nav+routes+API) when the extension is uninstalled. Verified: npm run lint (0 errors) + npm run build clean; the screenshots skill renders /wordpress/42 correctly (visually confirmed — full detail page, Overview tab, sidebar item active); backend flagship still seeds/loads (has_frontend now true) with tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a55e50bc16
commit
39d21f7a46
9 files changed
+240
-55
No files matched your search
+7
-36
@@ -40,16 +40,10 @@ import { SERVICE_TABS } from './components/services/serviceTabs';
|
||||
import { FILE_TABS } from './components/files/fileTabs';
|
||||
import { MONITOR_TABS } from './components/monitoring/monitorTabs';
|
||||
import { MARKET_TABS } from './components/marketplace/marketTabs';
|
||||
import { WORDPRESS_TABS } from './components/wordpress/wordpressTabs';
|
||||
import { BACKUP_TABS } from './components/backups/backupTabs';
|
||||
import { SECURITY_TABS } from './components/security/securityTabs';
|
||||
import { ORG_TABS } from './components/organization/organizationTabs';
|
||||
import Downloads from './pages/Downloads';
|
||||
import WordPress from './pages/WordPress';
|
||||
import WordPressDetail from './pages/WordPressDetail';
|
||||
import WordPressProjects from './pages/WordPressProjects';
|
||||
import WordPressPluginLibrary from './pages/WordPressPluginLibrary';
|
||||
import WordPressProject from './pages/WordPressProject';
|
||||
import SSLCertificates from './pages/SSLCertificates';
|
||||
import SSOCallback from './pages/SSOCallback';
|
||||
import SourceConnectionCallback from './pages/SourceConnectionCallback';
|
||||
@@ -81,7 +75,6 @@ import Telemetry from './pages/Telemetry';
|
||||
import Jobs from './pages/Jobs';
|
||||
import useExtensionRoutes from './plugins/ExtensionRoutes';
|
||||
import { useContributions } from './plugins/contributions';
|
||||
import ModuleRoute from './components/ModuleRoute';
|
||||
|
||||
// Page title mapping
|
||||
const PAGE_TITLES = {
|
||||
@@ -94,9 +87,8 @@ const PAGE_TITLES = {
|
||||
'/projects': 'Projects',
|
||||
'/shared-variables': 'Shared Variables',
|
||||
'/fleet-proxy': 'Fleet Proxy',
|
||||
'/wordpress': 'WordPress Sites',
|
||||
'/wordpress/plugins/library': 'WordPress Plugin Library',
|
||||
'/wordpress/pipelines': 'WordPress Pipelines',
|
||||
// WordPress list-page titles come from the serverkit-wordpress manifest
|
||||
// (page_titles) now; the dynamic detail-page fallbacks below stay in core.
|
||||
'/templates': 'Templates',
|
||||
'/deployments': 'Deployment Activity',
|
||||
'/domains': 'Domains',
|
||||
@@ -156,14 +148,6 @@ function LegacyAppRedirect() {
|
||||
return <Navigate to={`/services/${suffix}`} replace />;
|
||||
}
|
||||
|
||||
// "WordPress Projects" was renamed to "Pipelines" (§2 unification) to end the
|
||||
// collision with generic /projects. Forward old deep links to the new space.
|
||||
function LegacyWpPipelineRedirect() {
|
||||
const { id, tab } = useParams();
|
||||
const suffix = [id, tab].filter(Boolean).join('/');
|
||||
return <Navigate to={`/wordpress/pipelines/${suffix}`} replace />;
|
||||
}
|
||||
|
||||
function PageTitleUpdater() {
|
||||
const location = useLocation();
|
||||
const { page_titles: pluginTitles } = useContributions();
|
||||
@@ -336,24 +320,11 @@ function AppRoutes() {
|
||||
<Route path="apps" element={<Navigate to="/services" replace />} />
|
||||
<Route path="apps/:id" element={<LegacyAppRedirect />} />
|
||||
<Route path="apps/:id/:tab" element={<LegacyAppRedirect />} />
|
||||
{/* WordPress routes are gated by the WordPress module toggle
|
||||
(Settings → Modules); disabled ⇒ redirect to the dashboard. */}
|
||||
<Route element={<TabGroupLayout tabs={WORDPRESS_TABS} />}>
|
||||
<Route path="wordpress" element={<ModuleRoute name="wordpress"><WordPress /></ModuleRoute>} />
|
||||
<Route path="wordpress/plugins/library" element={<ModuleRoute name="wordpress"><WordPressPluginLibrary /></ModuleRoute>} />
|
||||
<Route path="wordpress/pipelines" element={<ModuleRoute name="wordpress"><WordPressProjects /></ModuleRoute>} />
|
||||
</Route>
|
||||
<Route path="wordpress/pipelines/:id" element={<ModuleRoute name="wordpress"><WordPressProject /></ModuleRoute>} />
|
||||
<Route path="wordpress/pipelines/:id/:tab" element={<ModuleRoute name="wordpress"><WordPressProject /></ModuleRoute>} />
|
||||
{/* Legacy "WordPress Projects" URLs → Pipelines (§2). */}
|
||||
<Route path="wordpress/projects" element={<Navigate to="/wordpress/pipelines" replace />} />
|
||||
<Route path="wordpress/projects/:id" element={<LegacyWpPipelineRedirect />} />
|
||||
<Route path="wordpress/projects/:id/:tab" element={<LegacyWpPipelineRedirect />} />
|
||||
<Route path="wordpress/:id" element={<ModuleRoute name="wordpress"><WordPressDetail /></ModuleRoute>} />
|
||||
<Route path="wordpress/:id/:tab" element={<ModuleRoute name="wordpress"><WordPressDetail /></ModuleRoute>} />
|
||||
{/* Settings sub-section in the URL (e.g. .../settings/git) so the
|
||||
Settings left-nav is shareable and survives a refresh. */}
|
||||
<Route path="wordpress/:id/:tab/:section" element={<ModuleRoute name="wordpress"><WordPressDetail /></ModuleRoute>} />
|
||||
{/* WordPress moved into the serverkit-wordpress builtin extension
|
||||
(Phase 5 #38). It contributes a single splat route wordpress/*
|
||||
via its manifest and self-renders the whole sub-router (tab
|
||||
group + full-bleed detail + legacy /projects redirects), so all
|
||||
the WordPress routing now lives in the extension. */}
|
||||
{/* /workflow is now the serverkit-workflows builtin extension
|
||||
(contributes the route via its manifest, full layout). */}
|
||||
<Route element={<TabGroupLayout tabs={DOMAIN_TABS} />}>
|
||||
|
||||
@@ -19,8 +19,7 @@ const STATIC_PAGES = [
|
||||
{ label: 'SSL Certificates', path: '/ssl', category: 'Pages', keywords: 'https tls' },
|
||||
{ label: 'Templates', path: '/templates', category: 'Pages', keywords: 'deploy one-click' },
|
||||
{ label: 'Deployments', path: '/deployments', category: 'Pages', keywords: 'deploy jobs status logs' },
|
||||
{ label: 'WordPress', path: '/wordpress', category: 'Pages', keywords: 'wp sites' },
|
||||
{ label: 'WordPress Pipelines', path: '/wordpress/pipelines', category: 'Pages', keywords: 'wp environments projects pipeline' },
|
||||
// WordPress palette entries are contributed by the serverkit-wordpress extension.
|
||||
{ label: 'Files', path: '/files', category: 'Pages', keywords: 'file manager explorer' },
|
||||
{ label: 'FTP Server', path: '/ftp', category: 'Pages', keywords: 'sftp upload' },
|
||||
{ label: 'Observability', path: '/monitoring', category: 'Pages', keywords: 'metrics uptime monitoring alerts' },
|
||||
|
||||
@@ -86,19 +86,9 @@ export const SIDEBAR_ITEMS = [
|
||||
category: 'infrastructure',
|
||||
icon: '<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>'
|
||||
},
|
||||
{
|
||||
// Redesign: WordPress uses the top-bar layout (REDESIGN_MAP §6 dec. 3).
|
||||
// Pipeline now lives in the page's top bar (PageTopbar WORDPRESS_TABS),
|
||||
// not as a sidebar sub-item. The pipeline list is at /wordpress/pipelines
|
||||
// (renamed from /wordpress/projects in §2; old URLs redirect).
|
||||
id: 'wordpress',
|
||||
label: 'WordPress',
|
||||
route: '/wordpress',
|
||||
category: 'infrastructure',
|
||||
// Hidden when an admin disables the WordPress module (Settings → Modules).
|
||||
requiresCondition: 'wordpressEnabled',
|
||||
icon: '<circle cx="12" cy="12" r="10"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/><path d="M3.5 9h17M3.5 15h17"/>'
|
||||
},
|
||||
// WordPress is now the serverkit-wordpress builtin extension (Phase 5 #38);
|
||||
// its sidebar item is contributed by the extension manifest (nav), so it
|
||||
// disappears cleanly when the extension is uninstalled.
|
||||
// Workflow Builder is now the serverkit-workflows builtin extension; its
|
||||
// sidebar item is contributed by the extension manifest.
|
||||
{
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// WordPress UI, contributed through the extension system. The full WordPress
|
||||
// backend (the /api/v1/wordpress* blueprints + services) lives in this
|
||||
// extension's backend/; the page components stay in the host pages/ dir and are
|
||||
// re-used here (same re-export pattern as serverkit-git/email/workflows) so
|
||||
// their many relative imports keep resolving.
|
||||
//
|
||||
// After sync this file lives at frontend/src/plugins/serverkit-wordpress/ so the
|
||||
// relative imports resolve against the host's src/ tree.
|
||||
//
|
||||
// The WordPress surface is a tab group + full-bleed detail pages. Contributed
|
||||
// routes are flat (there's no way to contribute a shared TabGroupLayout parent
|
||||
// inside the dashboard), so we contribute ONE splat route (`wordpress/*`) and
|
||||
// this component self-renders the whole WordPress sub-router — reproducing the
|
||||
// exact structure the core App.jsx used to own (TabGroupLayout + WORDPRESS_TABS
|
||||
// over the three list pages; full-bleed detail/pipeline routes as siblings;
|
||||
// the legacy /wordpress/projects → /wordpress/pipelines deprecation redirects).
|
||||
import { Routes, Route, Navigate, useParams } from 'react-router-dom';
|
||||
|
||||
import TabGroupLayout from '../../layouts/TabGroupLayout';
|
||||
import { WORDPRESS_TABS } from '../../components/wordpress/wordpressTabs';
|
||||
import WordPress from '../../pages/WordPress';
|
||||
import WordPressPluginLibrary from '../../pages/WordPressPluginLibrary';
|
||||
import WordPressProjects from '../../pages/WordPressProjects';
|
||||
import WordPressProject from '../../pages/WordPressProject';
|
||||
import WordPressDetail from '../../pages/WordPressDetail';
|
||||
|
||||
// "WordPress Projects" was renamed to "Pipelines" (§2 unification). Forward old
|
||||
// deep links to the new space.
|
||||
function LegacyWpPipelineRedirect() {
|
||||
const { id, tab } = useParams();
|
||||
const suffix = [id, tab].filter(Boolean).join('/');
|
||||
return <Navigate to={`/wordpress/pipelines/${suffix}`} replace />;
|
||||
}
|
||||
|
||||
export function WordPressExtension() {
|
||||
return (
|
||||
<Routes>
|
||||
{/* Tab group — list surfaces share one PageTopbar + WORDPRESS_TABS. */}
|
||||
<Route element={<TabGroupLayout tabs={WORDPRESS_TABS} />}>
|
||||
<Route index element={<WordPress />} />
|
||||
<Route path="plugins/library" element={<WordPressPluginLibrary />} />
|
||||
<Route path="pipelines" element={<WordPressProjects />} />
|
||||
</Route>
|
||||
{/* Full-bleed pipeline detail (own chrome, outside the tab group). */}
|
||||
<Route path="pipelines/:id" element={<WordPressProject />} />
|
||||
<Route path="pipelines/:id/:tab" element={<WordPressProject />} />
|
||||
{/* Legacy "WordPress Projects" URLs → Pipelines (§2). */}
|
||||
<Route path="projects" element={<Navigate to="/wordpress/pipelines" replace />} />
|
||||
<Route path="projects/:id" element={<LegacyWpPipelineRedirect />} />
|
||||
<Route path="projects/:id/:tab" element={<LegacyWpPipelineRedirect />} />
|
||||
{/* Full-bleed site detail (own chrome, outside the tab group). The
|
||||
:tab/:section depth keeps the Settings sub-nav shareable. */}
|
||||
<Route path=":id" element={<WordPressDetail />} />
|
||||
<Route path=":id/:tab" element={<WordPressDetail />} />
|
||||
<Route path=":id/:tab/:section" element={<WordPressDetail />} />
|
||||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
export default WordPressExtension;
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"name": "serverkit-wordpress",
|
||||
"display_name": "WordPress",
|
||||
"version": "1.0.0",
|
||||
"description": "The full WordPress suite — site provisioning, plugin library, environments/pipelines, updates, security hardening, vulnerability scanning, analytics and reports. Ships bundled and installed by default (a flagship), and can be uninstalled to slim the core.",
|
||||
"author": "ServerKit",
|
||||
"license": "MIT",
|
||||
"category": "integration",
|
||||
"homepage": "https://github.com/jhd3197/ServerKit",
|
||||
"permissions": [
|
||||
"shell",
|
||||
"filesystem",
|
||||
"network",
|
||||
"docker",
|
||||
"database"
|
||||
],
|
||||
"min_panel_version": "1.7.0",
|
||||
"entry_point": "wordpress:wordpress_bp",
|
||||
"url_prefix": "/api/v1/wordpress",
|
||||
"extra_blueprints": [
|
||||
{
|
||||
"module": "wordpress_sites",
|
||||
"attr": "wordpress_sites_bp",
|
||||
"url_prefix": "/api/v1/wordpress"
|
||||
},
|
||||
{
|
||||
"module": "environment_pipeline",
|
||||
"attr": "environment_pipeline_bp",
|
||||
"url_prefix": "/api/v1/wordpress/projects"
|
||||
},
|
||||
{
|
||||
"module": "environment_pipeline",
|
||||
"attr": "environment_pipeline_bp",
|
||||
"url_prefix": "/api/v1/wordpress/pipelines",
|
||||
"name": "environment_pipeline_pipelines"
|
||||
}
|
||||
],
|
||||
"icon": "<path d=\"M12 2a10 10 0 100 20 10 10 0 000-20zm-8 10a8 8 0 011.4-4.5l4.7 12.9A8 8 0 014 12zm8 8c-.8 0-1.6-.1-2.3-.3l2.4-7 2.5 6.8.1.1A8 8 0 0112 20zm1.1-11.8c.5 0 .9-.1.9-.1.4 0 .4-.6-.1-.6 0 0-1.4.1-2.3.1-.8 0-2.2-.1-2.2-.1-.5 0-.6.6-.1.6 0 0 .4.1.9.1l1.3 3.6-1.9 5.6L6.6 8.2c.5 0 .9-.1.9-.1.4 0 .4-.6-.1-.6 0 0-1.4.1-2.3.1h-.4A8 8 0 0112 4a8 8 0 016.5 3.3h-.3c-.8 0-1.4.7-1.4 1.5 0 .7.4 1.3.8 2 .3.6.7 1.3.7 2.3 0 .7-.3 1.6-.6 2.7l-.8 2.7-2.9-8.8z\"/>",
|
||||
"contributions": {
|
||||
"nav": [
|
||||
{
|
||||
"id": "wordpress",
|
||||
"label": "WordPress",
|
||||
"route": "/wordpress",
|
||||
"category": "infrastructure",
|
||||
"icon": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\"/><path d=\"M3.5 9h17M3.5 15h17\"/>"
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"path": "wordpress/*",
|
||||
"component": "WordPressExtension"
|
||||
}
|
||||
],
|
||||
"page_titles": {
|
||||
"/wordpress": "WordPress Sites",
|
||||
"/wordpress/plugins/library": "WordPress Plugin Library",
|
||||
"/wordpress/pipelines": "WordPress Pipelines"
|
||||
},
|
||||
"command_palette": [
|
||||
{
|
||||
"label": "WordPress",
|
||||
"path": "/wordpress",
|
||||
"category": "Pages",
|
||||
"keywords": "wp sites"
|
||||
},
|
||||
{
|
||||
"label": "WordPress Pipelines",
|
||||
"path": "/wordpress/pipelines",
|
||||
"category": "Pages",
|
||||
"keywords": "wp environments projects pipeline"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user