153 lines
4.1 KiB
Markdown
153 lines
4.1 KiB
Markdown
# Phase 2 Module Activation Guide
|
|
|
|
> Reference document for activating disabled modules (Linker, Optimizer, SiteBuilder)
|
|
|
|
## Current Status (as of December 2025)
|
|
|
|
| Module | Status | Backend Flag | Migration |
|
|
|--------|--------|--------------|-----------|
|
|
| **SiteBuilder** | ❌ DEPRECATED | `site_builder_enabled` | Disabled via 0011 |
|
|
| **Linker** | ⏸️ Phase 2 | `linker_enabled` | Disabled via 0011 |
|
|
| **Optimizer** | ⏸️ Phase 2 | `optimizer_enabled` | Disabled via 0011 |
|
|
|
|
---
|
|
|
|
## How Module Disabling Works
|
|
|
|
### 1. Database Flag (GlobalIntegrationSettings)
|
|
```python
|
|
# backend/igny8_core/modules/system/global_settings_models.py
|
|
site_builder_enabled = models.BooleanField(default=False)
|
|
linker_enabled = models.BooleanField(default=False)
|
|
optimizer_enabled = models.BooleanField(default=False)
|
|
```
|
|
|
|
### 2. Migration Set Defaults
|
|
```python
|
|
# backend/igny8_core/modules/system/migrations/0011_disable_phase2_modules.py
|
|
# Sets all three modules to disabled for existing records
|
|
```
|
|
|
|
### 3. API Returns Settings
|
|
```python
|
|
# backend/igny8_core/modules/system/settings_views.py
|
|
# GET /api/module-settings/ returns enabled/disabled status
|
|
```
|
|
|
|
### 4. Frontend Checks Settings
|
|
```typescript
|
|
// frontend/src/store/moduleStore.ts
|
|
// useModuleStore.isModuleEnabled('linker') → checks API response
|
|
```
|
|
|
|
### 5. Sidebar Hides Menu Items
|
|
```tsx
|
|
// frontend/src/layout/AppSidebar.tsx
|
|
if (isModuleEnabled('linker')) {
|
|
// Add menu item
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Activation Steps for Phase 2
|
|
|
|
### Option A: Via Django Admin (Recommended)
|
|
|
|
1. Log into Django Admin (`/admin/`)
|
|
2. Navigate to **System → Global Integration Settings**
|
|
3. Edit the singleton record
|
|
4. Set `linker_enabled` or `optimizer_enabled` to `True`
|
|
5. Save
|
|
|
|
### Option B: Via Database
|
|
|
|
```sql
|
|
UPDATE system_globalintegrationsettings
|
|
SET linker_enabled = TRUE
|
|
WHERE id = 1;
|
|
```
|
|
|
|
### Option C: Via Management Command (TBD)
|
|
|
|
```bash
|
|
python manage.py enable_module linker
|
|
python manage.py enable_module optimizer
|
|
```
|
|
|
|
---
|
|
|
|
## Pre-Activation Checklist
|
|
|
|
Before enabling a Phase 2 module:
|
|
|
|
### Linker Module
|
|
- [ ] Verify `modules/linker/views.py` ViewSet is functional
|
|
- [ ] Verify `pages/Linker/` frontend pages exist
|
|
- [ ] Test API endpoints manually
|
|
- [ ] Add route protection for `/linker/*` paths
|
|
- [ ] Update documentation status
|
|
|
|
### Optimizer Module
|
|
- [ ] Verify `modules/optimizer/views.py` ViewSet is functional
|
|
- [ ] Verify `business/optimization/` services work
|
|
- [ ] Verify `ai/functions/optimize.py` AI function
|
|
- [ ] Verify `pages/Optimizer/` frontend pages exist
|
|
- [ ] Test API endpoints manually
|
|
- [ ] Add route protection for `/optimizer/*` paths
|
|
- [ ] Update documentation status
|
|
|
|
---
|
|
|
|
## Route Protection (TODO for Phase 2)
|
|
|
|
Currently, direct URL access (e.g., `/linker`) still works even when module is disabled.
|
|
|
|
### Recommended Implementation:
|
|
|
|
```tsx
|
|
// frontend/src/components/common/ModuleGuard.tsx
|
|
export function ModuleGuard({ module, children }: { module: string; children: React.ReactNode }) {
|
|
const { isModuleEnabled } = useModuleStore();
|
|
|
|
if (!isModuleEnabled(module)) {
|
|
return <Navigate to="/" replace />;
|
|
}
|
|
|
|
return <>{children}</>;
|
|
}
|
|
|
|
// In routes:
|
|
<Route path="/linker/*" element={
|
|
<ModuleGuard module="linker">
|
|
<LinkerPage />
|
|
</ModuleGuard>
|
|
} />
|
|
```
|
|
|
|
---
|
|
|
|
## SiteBuilder (DEPRECATED)
|
|
|
|
**Do NOT activate SiteBuilder.** This module is deprecated and code is being removed.
|
|
|
|
### Removed Items (Task 5.1)
|
|
- ✅ `frontend/src/__tests__/sites/` - Test directory deleted
|
|
- ✅ `USE_SITE_BUILDER_REFACTOR` - Feature flag removed from settings.py
|
|
- ✅ Feature flag checks - Removed from clustering_service.py, validation_service.py, serializers.py
|
|
- ✅ Tasks.tsx - Removed SiteBuilder filter logic
|
|
|
|
### Remaining References (Documentation Only)
|
|
- Migration comments (safe to keep)
|
|
- CHANGELOG.md entries (historical)
|
|
- IGNY8-APP.md (documents deprecated status)
|
|
- Database field (kept for backward compatibility)
|
|
|
|
---
|
|
|
|
## Related Documentation
|
|
|
|
- [LINKER.md](../10-MODULES/LINKER.md) - Full Linker module docs
|
|
- [OPTIMIZER.md](../10-MODULES/OPTIMIZER.md) - Full Optimizer module docs
|
|
- [SYSTEM-SETTINGS.md](../10-MODULES/SYSTEM-SETTINGS.md) - Settings model reference
|