XYLEX Group
DevelopmentResource FrameworkCreate Resource

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 in resource_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 resourceName is provided, components fetch public.resource_routes:
    1. First by resource_name
    2. Fallback by "table"
  • Relevant fields mapped from resource_routes:
    • table → insert target
    • new_resource_mandatory_columns → required fields
    • new_resource_optional_columns → optional fields
    • columns → used to derive inputs when explicit fields aren’t provided
    • enable_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 on data_type)
    • boolean (checkbox when data_type includes “bool”)
    • select (via editor.type = "select" and editor.options = [{ label, value }])

Networking

  • Fetches and inserts use the standard API format:
    • POST {APP_CONFIG.api.suitsbooks}/fetch/data
    • PUT {APP_CONFIG.api.suitsbooks}/data/insert
    • Headers: X-Company-Id, X-Organization-Id, X-User-Id, Content-Type: application/json
    • cacheEnabled toggles Cache-Control: no-cache header

Notifications and UI

  • Notifications use useNotification.
  • Dialogs use ResponsiveDialog.
  • Buttons follow the brand variant and text/secondary classes conventions.