Sub-Pages — Entity Data Types¶
Part of: Sub-Pages guide See also: Settings Tab | Data Hook
How to use TypeScript interfaces and API metadata when generating sub-pages.
Using Entity Data Types¶
Always check the entity’s TypeScript interface in src/utils/datatypes/globalDataTypes.ts.
The interface provides:
Field types — Use the correct form component
Type constraints — Comments specify defaults, min/max, allowed values
Optional vs required — Fields without
?are typically required
Example: The OtpToken interface:
export interface OtpToken {
ipatokenuniqueid: string;
ipatokentotpclockoffset: number; // Default: 0 | Minimum value: -2147483648 | Maximum value: 2147483647
ipatokentotptimestep: number; // Default: 30 | Minimum value: 5 | Maximum value: 2147483647
ipatokenotpdigits: OtpTokenDigits; // Default: 6
}
Apply constraints to form components:
<IpaNumberInput
name="ipatokentotptimestep"
minValue={5}
maxValue={2147483647}
numCharsShown={10} // max(String(5).length, String(2147483647).length)
/>
For plain string fields, IpaTextInput needs no extra constraint props — required is inferred automatically from metadata. Add rules only when custom validation is needed:
<IpaTextInput
name="cn"
dataCy="entity-tab-settings-textbox-cn"
ipaObject={ipaObject}
onChange={recordOnChange}
rules={[
{
id: "maxLength",
message: "Must be at most 255 characters",
validate: (value: string) => value.length <= 255,
},
]}
/>
Each rule provides live feedback: indeterminate when empty, success/error as the user types.
Type-to-Component Mappings¶
TypeScript Type |
Comment Hints |
Form Component |
Extra Props |
|---|---|---|---|
|
— |
|
— |
|
(multi-line) |
|
— |
|
|
|
|
|
— |
|
— |
|
datetime |
|
— |
|
— |
|
|
Custom type |
— |
|
|
Calculating numCharsShown¶
For IpaNumberInput, set width based on the longest possible value:
numCharsShown = max(String(minValue).length, String(maxValue).length)
Field |
Min |
Max |
numCharsShown |
|---|---|---|---|
|
-2147483648 |
2147483647 |
11 (includes |
|
5 |
2147483647 |
10 |
|
6 |
8 |
1 |
Tab Shorthand Reference¶
Use these shorthand codes in prompts to specify membership tabs:
Shorthand |
Tab Type |
Uses Component |
|---|---|---|
|
Member of User groups |
|
|
Member of Host groups |
|
|
Member of Netgroups |
|
|
Member of Roles |
|
|
Member of HBAC rules |
|
|
Member of Sudo rules |
|
|
User members |
|
|
Group members |
|
|
Host members |
|
|
Managed by hosts |
|
|
Managed by users |
|
|
Member managers (users) |
|
|
Member managers (groups) |
|
|
Custom table |
Custom implementation |
Quick Reference¶
See also:
01-overview.md — Full input reference, example prompts
04-settings-tab.md — Form components, field constraints
06-membership-tabs.md — Available membership components