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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Complete Phase 13: Environment Switching UI
Juan Denis5194bce2235c
diff --git a/.planning/ROADMAP.md b/.planning/ROADMAP.mdindex 8445048d..9b8d4238 100644--- a/.planning/ROADMAP.md+++ b/.planning/ROADMAP.md@@ -24,7 +24,7 @@ Completed 2026-01-19 | 9 phases | 109 commits | +14,667/-2,836 lines|-------|------|--------|------|| 11 | Shared Database WordPress Template | **completed** | Create WordPress template with external DB support || 12 | Multi-Environment App Linking | **completed** | Link prod/dev apps to share database |-| 13 | Environment Switching UI | pending | UI to manage prod/dev environments |+| 13 | Environment Switching UI | **completed** | UI to manage prod/dev environments || 14 | GitHub & Community Links | **completed** | Add GitHub link, community resources to app || 15 | WordPress Dev Workflow Testing | pending | End-to-end testing of the dev workflow |@@ -71,34 +71,25 @@ Completed 2026-01-19 | 9 phases | 109 commits | +14,667/-2,836 lines----## Phase 13: Environment Switching UI+## Phase 13: Environment Switching UI ✓**Goal**: UI to manage and switch between prod/dev environments-### Tasks-1. **Environment badge in app list**- - Show "PROD" / "DEV" / "STAGING" badge- - Color coding (green=prod, blue=dev, yellow=staging)- - Filter apps by environment type--2. **Linked apps section in app detail**- - Show linked apps with quick navigation- - Environment comparison (running status, version, etc.)- - Quick action: "Copy theme from dev to prod"--3. **Environment configuration panel**- - Set environment type for existing apps- - Link/unlink apps UI- - Shared resource visualization--4. **Theme sync feature (WordPress-specific)**- - Copy theme files from dev to prod- - Preview changes before sync- - Rollback capability+**Status**: Completed 2026-01-19++### What Was Built+- Environment badges (PROD/DEV/STAGING) in app list with color coding+- Environment filter dropdown in apps toolbar with URL param persistence+- LinkedAppsSection component showing linked apps with navigation/unlink buttons+- LinkAppModal for linking apps with environment selection and DB credential options+- Environment settings in Settings tab with change/unlink functionality+- Comprehensive LESS styles for all new components### Success Criteria-- [ ] Environment type visible in UI-- [ ] Easy navigation between linked apps-- [ ] Theme sync works for WordPress apps+- [x] Environment type visible in UI+- [x] Easy navigation between linked apps+- [ ] Theme sync works for WordPress apps (deferred to Phase 15)++[Full Summary](./phases/13-environment-switching-ui/SUMMARY.md)---diff --git a/.planning/STATE.md b/.planning/STATE.mdindex 51e7d605..c33fb538 100644--- a/.planning/STATE.md+++ b/.planning/STATE.md@@ -2,7 +2,7 @@## Current Status- **Milestone**: 2 - Multi-Environment WordPress & Community Features-- **Current Phase**: 13 - Environment Switching UI+- **Current Phase**: 15 - WordPress Dev Workflow Testing- **Phase Status**: Pending- **Last Updated**: 2026-01-19@@ -12,10 +12,19 @@|-------|--------|---------|-----------|| 11 | completed | 2026-01-19 | 2026-01-19 || 12 | completed | 2026-01-19 | 2026-01-19 |-| 13 | pending | - | - |+| 13 | completed | 2026-01-19 | 2026-01-19 || 14 | completed | 2026-01-19 | 2026-01-19 || 15 | pending | - | - |+## Phase 13 Summary+Environment Switching UI implemented:+- Added environment badges (PROD/DEV/STAGING) to app list with color coding+- Added environment filter dropdown to apps toolbar with URL param persistence+- Created LinkedAppsSection component showing linked apps with navigation/unlink+- Created LinkAppModal for linking apps with environment selection and DB credential options+- Integrated linked apps into ApplicationDetail Overview tab+- Added environment settings to Settings tab with change/unlink functionality+## Phase 12 SummaryMulti-Environment App Linking implemented:- Added `environment_type`, `linked_app_id`, `shared_config` fields to Application model@@ -55,8 +64,8 @@ None currently identified.## Notes- Milestone 1 (v1.0) completed 2026-01-19- Phase numbering continues from Milestone 1 (11-15)-- Phases 11, 12, and 14 completed - template, linking API, and community features done-- Next: Phase 13 (Environment Switching UI) to add UI for managing linked apps+- Phases 11, 12, 13, and 14 completed - all core features done+- Next: Phase 15 (WordPress Dev Workflow Testing) for end-to-end validation## Quick Links- [ROADMAP.md](./ROADMAP.md)@@ -64,4 +73,5 @@ None currently identified.- [Milestone 1 Archive](./milestones/v1.0-ROADMAP.md)- [Phase 11 Summary](./phases/11-shared-database-wordpress-template/SUMMARY.md)- [Phase 12 Summary](./phases/12-multi-environment-app-linking/SUMMARY.md)+- [Phase 13 Summary](./phases/13-environment-switching-ui/SUMMARY.md)- [Phase 14 Summary](./phases/14-github-community-links/SUMMARY.md)diff --git a/.planning/phases/13-environment-switching-ui/SUMMARY.md b/.planning/phases/13-environment-switching-ui/SUMMARY.mdnew file mode 100644index 00000000..64d5d8a6--- /dev/null+++ b/.planning/phases/13-environment-switching-ui/SUMMARY.md@@ -0,0 +1,118 @@+# Phase 13: Environment Switching UI - Summary++## Overview+Implemented the frontend UI for managing multi-environment app linking, including environment badges, linked apps section, link app modal, and environment settings.++## Completed: 2026-01-19++## What Was Built++### 1. Environment Badges in App List+**File**: `frontend/src/pages/Applications.jsx`++- Added `EnvironmentBadge` helper component showing PROD/DEV/STAGING badges+- Color coding: green (production), blue (development), yellow (staging)+- Shows linked icon when app is linked to another+- Added environment filter dropdown to toolbar+- Filter state persisted via URL params (`?envFilter=production`)+- Added 'environment' as sort option++### 2. LinkedAppsSection Component+**File**: `frontend/src/components/LinkedAppsSection.jsx`++- Displays current environment type with colored badge+- Shows linked apps list with:+ - App name and environment type+ - Running status badge+ - Port number+ - Quick navigation button+ - Unlink button+- Shows shared database info when credentials propagated+- Empty state messaging for standalone/unlinked apps++### 3. LinkAppModal Component+**File**: `frontend/src/components/LinkAppModal.jsx`++- Modal for linking apps together+- Filters compatible apps (same type, not already linked, standalone)+- Environment selection (dev/prod/staging) via radio buttons+- Visual preview diagram showing link relationship+- Docker-specific options:+ - Propagate database credentials checkbox+ - Table prefix configuration+- Loading and empty states++### 4. Linked Apps Integration in ApplicationDetail+**File**: `frontend/src/pages/ApplicationDetail.jsx`++- Added environment badge to app header+- Integrated LinkedAppsSection in OverviewTab+- Added LinkAppModal with show/hide state+- Added handlers for link, unlink, and navigate actions+- Loads linked apps data on mount and after link/unlink++### 5. Environment Settings in Settings Tab+**File**: `frontend/src/pages/ApplicationDetail.jsx`++- Environment Configuration section in SettingsTab+- Current environment type display+- Dropdown to change environment (standalone apps only)+- Disabled state with badge for linked apps+- Unlink Application button for linked apps+- Warning styling for linked app section++### 6. Styles+**Files**:+- `frontend/src/styles/components/_linked-apps.less` (new)+- `frontend/src/styles/components/_badges.less` (modified)+- `frontend/src/styles/pages/_settings.less` (modified)+- `frontend/src/styles/main.less` (modified)++Styles include:+- `.env-badge` variants for production/development/staging+- `.linked-apps-section` with header, list, items+- `.linked-app-item` with info, icon, details, actions+- `.link-app-modal` with form, preview diagram+- `.env-radio-group` and `.env-radio-option`+- `.settings-row`, `.settings-label`, `.settings-control`+- `.status-badge-sm` for compact status display++## Files Changed++| File | Change Type |+|------|-------------|+| `frontend/src/pages/Applications.jsx` | Modified |+| `frontend/src/pages/ApplicationDetail.jsx` | Modified |+| `frontend/src/components/LinkedAppsSection.jsx` | Created |+| `frontend/src/components/LinkAppModal.jsx` | Created |+| `frontend/src/styles/components/_badges.less` | Modified |+| `frontend/src/styles/components/_linked-apps.less` | Created |+| `frontend/src/styles/pages/_settings.less` | Modified |+| `frontend/src/styles/main.less` | Modified |++## Commits++1. `f2fc1c4` - Add environment badges to application list+2. `60ba896` - Add environment filter dropdown to apps toolbar+3. `92df579` - Create LinkedAppsSection component for app detail+4. `d61628e` - Create LinkAppModal component for linking apps+5. `9dbcfea` - Integrate linked apps section into ApplicationDetail+6. `99bc859` - Add environment settings to Settings tab++## API Methods Used (from Phase 12)+- `api.getLinkedApps(appId)` - Get linked apps+- `api.linkApp(appId, targetId, environment, options)` - Link apps+- `api.unlinkApp(appId)` - Unlink apps+- `api.updateAppEnvironment(appId, environmentType)` - Change environment++## Success Criteria++- [x] Environment type visible in UI (badges in list and detail)+- [x] Easy navigation between linked apps (LinkedAppsSection with buttons)+- [ ] Theme sync works for WordPress apps (deferred - Phase 15)++## Notes++- Theme sync feature deferred to Phase 15 (testing phase)+- All environment management now accessible through both Overview and Settings tabs+- Filter dropdown integrates with existing URL param pattern used for other filters