Rack Planner
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Rack Planner is a visual design and documentation tool within the IT Management System used to plan the physical elevation and placement of IT assets within server racks. Unlike the IDFs module, which manages live infrastructure and active port synchronization, the Rack Planner serves as a layout tool for data center physical layer management. It allows users to simulate the placement of patch panels, switches, and servers using a drag-and-drop interface.
The module is strictly scoped by company_id to ensure multi-tenant data isolation and integrates with existing equipment inventory and catalog items to provide accurate physical dimensions (Rack Units) and cost estimations for planned deployments.
Sources: [modules/rack_planner/AGENT_NOTES.md:1-12], [wiki/Modules.md:73-77], [README.md:113-113]
Architecture and Data Flow
The Rack Planner follows a standard CRUD pattern but utilizes a specialized visualization layer for the rack elevation. The core logic resides in a JSON-based layout state that tracks the position, size, and metadata of every component within a specific plan.
Visual Elevation Logic
The system renders a vertical grid representing Rack Units (U). Each unit in the grid is an interactive container that can either be empty or occupied by a device. Devices are anchored to a specific starting unit and can span multiple units (e.g., a 2U server).
This diagram shows the flow of data from user interaction through the local state object into the persistent MySQL database.
Sources: [modules/rack_planner/includes/partials/render.php:670-800], [modules/rack_planner/AGENT_NOTES.md:15-20]
Component Types
The planner supports three primary ways to populate a rack:
- Standard Components: Preset items like patch panels and standard switches defined in the
componentCatalog. - Catalog Items: Custom models imported from the global Catalogs module.
- Equipment Inventory: Existing IT assets already registered in the system's equipment table.
Sources: [modules/rack_planner/includes/partials/render.php:280-340]
Detailed Functionality
Component Placement and Modals
When a user clicks an empty unit, the system triggers a modal (rackUnitModal) allowing selection from the categorized component list. The logic handles collision detection, ensuring a 2U device cannot be placed where it would overlap an existing component or exceed the rack's total capacity.
The sequence above illustrates the validation and rendering process for adding new components to the rack elevation.
Sources: [modules/rack_planner/includes/partials/render.php:1100-1150], [modules/rack_planner/includes/partials/render.php:1270-1300]
Export Capabilities
The Rack Planner provides multiple export formats to facilitate physical installation and procurement:
- Image (PNG): Uses
html2canvasto capture the visual elevation. - PDF: Generates a landscape A4 report using
jsPDF, including the visual layout and total cost. - Excel (XLS): Generates a tabular report of all rack units, sizes, labels, and prices.
Sources: [modules/rack_planner/includes/partials/render.php:440-580], [README.md:113-113]
Data Model
The primary data for the module is stored in the rack_planner table, which includes metadata and a serialized JSON object for the layout.
| Field | Type | Description |
|---|---|---|
id | INT | Primary key |
company_id | INT | Multi-tenant identifier |
name | VARCHAR | Name of the rack plan |
rack_units | INT | Total height of the rack (max 100) |
notes | TEXT | Description or planning notes |
layout_json | LONGTEXT | Serialized state of placed components |
active | TINYINT | Status flag (Active/Inactive) |
Sources: [modules/rack_planner/includes/partials/render.php:218-245], [modules/rack_planner/AGENT_NOTES.md:5-10]
JSON Layout Structure
The layout_json field contains a structured object that allows the UI to rebuild the rack state without complex relational queries for every unit.
{
"version": 1,
"units": 42,
"devices": [
{
"code": "sw48",
"label": "Core Switch 01",
"start_u": 40,
"size": 1,
"price": 1200.00
}
]
}
Sources: [modules/rack_planner/includes/partials/render.php:870-930]
AJAX and API Operations
The module uses asynchronous updates to ensure the visual state is saved without full page reloads.
| Action | Endpoint | Purpose |
|---|---|---|
ajax_update_layout | modules/rack_planner/index.php | Persists the layout_json and calculates total cost on-the-fly. |
get_available_equipment | modules/rack_planner/index.php | Fetches filtered equipment list for the picker. |
save_item | modules/rack_planner/index.php | Handles specific component updates. |
Sources: [scripts/api.php:107-107], [modules/rack_planner/includes/partials/render.php:1030-1075]
Comparison: Rack Planner vs. IDFs
It is critical to distinguish between these two modules:
| Feature | Rack Planner | IDFs |
|---|---|---|
| Primary Goal | Physical Layer Planning | Live Infrastructure Management |
| State Storage | layout_json blob | Relational tables (idf_ports, idf_links) |
| Connectivity | Visual only | Active port-to-port links |
| Synchronization | None | Real-time equipment and switch_ports parity |
Sources: [wiki/Modules.md:73-77], [wiki/IDF-Synchronization.md:1-20]
Conclusion
The Rack Planner is a powerful visual utility for IT architects, providing a bridge between high-level planning and physical implementation. By centralizing rack elevations and component costs into a company-scoped module, it enables standardized documentation and procurement processes across the organization.