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(wordpress): selective-push — specific-table selectors in PromoteModal (#31)

Juan Denis6949ceac06cd
diff --git a/docs/WORDPRESS_ROADMAP.md b/docs/WORDPRESS_ROADMAP.md
index 361ab820..bdaafefc 100644
--- a/docs/WORDPRESS_ROADMAP.md
+++ b/docs/WORDPRESS_ROADMAP.md
@@ -274,11 +274,12 @@ Highest-effort, broadest surface — but by now the `WordPressSite` is a first-c
- **Reuse:** `security_service` (Fail2ban jails), `wp_cli`, `cron_service`, `nginx_service` WP template.
- **Done when:** A site can be scanned, checksum-verified, brute-force-protected, and debug-toggled.
-### #31 — Selective push UI `[S]` 🟡
+### #31 — Selective push UI `[S]` 🟡 — ✅ Done (specific-tables selectors added; files-only/db-only/specific-folders already existed)
- **Today:** The dump layer already supports table filters / files-only / db-only; `PromoteModal` exposes only coarse code/db/full.
- **Do:** Expose files-only / db-only / specific-folders / specific-tables selectors in `PromoteModal`.
- **Reuse:** `db_sync_service` `_transform_dump` filters, `environment_pipeline` promote.
- **Done when:** A promote can move just selected files/tables.
+- **Landed:** `PromoteModal` already had **files-only** (`code` type), **db-only** (`database` type), and **specific-folders** (the `include_plugins`/`themes`/`mu_plugins`/`uploads` checkboxes); the only missing piece was **specific-tables**, now added as two comma-separated inputs in the database section — **Exclude tables** (omitted entirely) and **Truncate tables** (structure promoted, rows dropped) — split into arrays on submit. The full backend chain already honored them (`POST …/promote` documents+forwards `config.exclude_tables`/`truncate_tables` → `promote_database`/`promote_full` → `clone_options` → `_transform_dump`), so this is pure UI wiring with no backend change. Verified: frontend lint-clean + production build.
### #32 — Per-site SFTP `[M]` ❌
- **Today:** FTP is host-global (`ftp_service`); no per-site SFTP.
diff --git a/frontend/src/components/wordpress/PromoteModal.jsx b/frontend/src/components/wordpress/PromoteModal.jsx
index 229975af..57d79f5f 100644
--- a/frontend/src/components/wordpress/PromoteModal.jsx
+++ b/frontend/src/components/wordpress/PromoteModal.jsx
@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import { Checkbox } from '@/components/ui/checkbox';
import { Label } from '@/components/ui/label';
+import { Input } from '@/components/ui/input';
const PromoteModal = ({ sourceEnv, targetEnv, onClose, onPromote }) => {
const [promotionType, setPromotionType] = useState('code');
@@ -17,7 +18,9 @@ const PromoteModal = ({ sourceEnv, targetEnv, onClose, onPromote }) => {
include_uploads: false,
backup_target_first: true,
sanitize: false,
- sanitization_profile_id: ''
+ sanitization_profile_id: '',
+ exclude_tables: '',
+ truncate_tables: ''
});
const [loading, setLoading] = useState(false);
const [profiles, setProfiles] = useState([]);
@@ -49,6 +52,9 @@ const PromoteModal = ({ sourceEnv, targetEnv, onClose, onPromote }) => {
} else {
delete submitConfig.sanitization_profile_id;
}
+ const toList = (s) => (s || '').split(',').map(t => t.trim()).filter(Boolean);
+ submitConfig.exclude_tables = toList(config.exclude_tables);
+ submitConfig.truncate_tables = toList(config.truncate_tables);
await onPromote({
source_env_id: sourceEnv.id,
target_env_id: targetEnv.id,
@@ -204,6 +210,25 @@ const PromoteModal = ({ sourceEnv, targetEnv, onClose, onPromote }) => {
)}
</div>
)}
+
+ <div className="form-group">
+ <Label>Exclude tables (optional)</Label>
+ <Input
+ value={config.exclude_tables}
+ onChange={e => handleConfigChange('exclude_tables', e.target.value)}
+ placeholder="e.g. wp_statistics, wp_actionscheduler_logs"
+ />
+ <span className="form-hint">Comma-separated table names to omit from the promotion entirely.</span>
+ </div>
+ <div className="form-group">
+ <Label>Truncate tables (optional)</Label>
+ <Input
+ value={config.truncate_tables}
+ onChange={e => handleConfigChange('truncate_tables', e.target.value)}
+ placeholder="e.g. wp_sessions, wp_woocommerce_log"
+ />
+ <span className="form-hint">Comma-separated tables to keep but empty (structure promoted, rows dropped).</span>
+ </div>
</>
)}