mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +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
@@ -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