Main Pages — Overview & Generating a New Page¶
Part of: Main Pages guide See also: Structure & Anatomy | Checklist
A main page is the top-level landing page for an entity (e.g. Active Users, Hosts, DNS Zones). It displays a searchable, paginated table with bulk selection, toolbar actions, and modals for add/delete operations.
Main pages live under src/pages/<EntityName>/ and are named after the entity itself (e.g. Hosts.tsx, DnsZones.tsx). Files with suffixes like Settings, Tabs, Table, or PreSettings are not main pages — they are sub-components consumed by main pages or detail views.
Generating a New Main Page Using This Guide¶
This guide is designed to be used as context in AI-assisted prompts. To generate a complete main page, provide the following input alongside this file.
Required input¶
Input |
Description |
Example |
|---|---|---|
Entity name |
Human-readable name (drives component names, file names, page title) |
|
FreeIPA API object |
The IPA command prefix (determines RPC methods like |
|
Primary key field |
LDAP attribute that uniquely identifies each entry |
|
Table columns |
Fields to display and their labels |
|
Navigation placement |
Sidebar section and sub-group where the page appears |
Policy > Host-based access control |
Route path |
Kebab-case URL segment |
|
RPC service file |
The |
|
Add modal fields |
Fields shown in the Add modal, each with: field name (IPA attribute), label, data type, UI component, and whether it is required. See Add Modal |
|
RPC service file¶
The RPC service file (src/services/rpc<Entity>.ts) must be created manually before or alongside the main page. It is not auto-generated from the prompt because each entity has its own custom queryFn implementations, typed payloads, and entity-specific logic that depend on the FreeIPA API behavior.
Every main page imports hooks from its RPC service file (e.g. useGetDnsZonesFullDataQuery from src/services/rpcDnsZones.ts, useGettingHbacRulesQuery from src/services/rpcHBACRules.ts). The main page component cannot function without them.
To create the RPC service file, follow the template in 09-rpc-service.md. At minimum, you need:
A query for listing entities (paginated, using the two-step
*_find+*_showpattern)A search mutation for explicit search submissions (or use the generic
useSearchEntriesMutationfromrpc.ts)An add mutation and a delete mutation for the modals
Existing RPC service files to use as reference:
src/services/rpcTrusts.ts— newer pattern with domain-specific querysrc/services/rpcHosts.ts— older pattern using the genericuseGettingGenericQuerysrc/services/rpcDnsZones.ts— complex example with many endpoints
Optional input¶
Input |
Description |
Default if omitted |
|---|---|---|
Features |
Enable/Disable buttons, kebab menu, contextual help panel |
Add + Delete only |
Entity fields |
Full list of LDAP attributes with their types. Can be extracted from the IPA command docs (e.g. parameters from |
Stub with |
Data transformation |
Whether API data needs a mapper with |
Simple conversion only |
Conditional rendering |
Whether the page depends on server configuration (e.g. DNS enabled) |
Always visible |
Example prompt¶
Based on the
src/pages/README.mddoc, generate a main page for HBAC Service Groups with:
IPA API object:
hbacsvcgroupPrimary key:
cnTable columns:
cn(“Name”),description(“Description”)Nav placement: Policy > Host-based access control
Route path:
hbac-service-groupsFeatures: Add, Delete (no enable/disable, no kebab)
Entity fields:
cn(string),description(string),dn(string),member_hbacsvc(string[])Add modal fields:
cn→ “Name” (string, InputRequiredText, required)
description→ “Description” (string, TextArea, optional)RPC service file:
src/services/rpcHBACServiceGroups.ts(already exists / to be created manually)
What gets generated¶
A complete prompt with the input above and this guide as context should produce:
File |
Content |
|---|---|
|
Main page component |
|
|
|
|
|
|
|
|
|
Nav group ref + |
|
Add modal |
|
Delete modal |
Not generated (must be created manually):
File |
Why |
|---|---|
|
Contains custom |