Overview
Create resource – overview
The create-resource utilities let you add consistent, DB-driven “new resource” experiences with minimal code.
- Entry points
CreateResourceDialog: a generic dialog that collects fields and inserts the row.CreateResourceButton: a convenience wrapper that looks up the route inresource_routes, renders a brand action button, and opens the dialog.
How configuration is resolved
- When explicit props are provided (
table,required,optional,columns), they are used as-is. - Otherwise, if
resourceNameis provided, components fetchpublic.resource_routes:- First by
resource_name - Fallback by
"table"
- First by
- Relevant fields mapped from
resource_routes:table→ insert targetnew_resource_mandatory_columns→ required fieldsnew_resource_optional_columns→ optional fieldscolumns→ used to derive inputs when explicit fields aren’t providedenable_new_resource_creation,page_label,new_resource_button_text,force_no_cache
Columns and editors
- Each column can be a string or an object with
{ column_name, header|header_label, hidden, data_type, editor }. - Supported editor types:
text(default)number(based ondata_type)boolean(checkbox whendata_typeincludes “bool”)select(viaeditor.type = "select"andeditor.options = [{ label, value }])
Networking
- Fetches and inserts use the standard API format:
POST {APP_CONFIG.api.suitsbooks}/fetch/dataPUT {APP_CONFIG.api.suitsbooks}/data/insert- Headers:
X-Company-Id,X-Organization-Id,X-User-Id,Content-Type: application/json cacheEnabledtogglesCache-Control: no-cacheheader
Notifications and UI
- Notifications use
useNotification. - Dialogs use
ResponsiveDialog. - Buttons follow the brand variant and text/secondary classes conventions.