Files

2.8 KiB

Business Rules — Unit 3: frontend-cms-page

Table Display (Q1: B+C)

  • BR-FE-01: The CmsInstanceList table displays six columns: Name, URL, Status, Last Contact, DisableMessage, Actions.
  • BR-FE-02: lastContactedAt is formatted as a localised date/time string; displays "—" when null.
  • BR-FE-03: disableMessage displays "—" when null or empty.

Inactive Row Styling (Q2: A)

  • BR-FE-04: A <TableRow> whose instance.status === 'Inactive' receives className="opacity-50". All cells within that row are visually dimmed as a result.

Status Badge Colors

  • BR-FE-05: Available → green badge (secondary or custom green variant).
  • BR-FE-06: NotAvailable → red badge (destructive variant).
  • BR-FE-07: Inactive → muted badge (outline variant).

SetStatusDialog — DisableMessage (Q3 note, existing unit-of-work)

  • BR-FE-08: The DisableMessage field is only rendered when the selected status is NotAvailable.
  • BR-FE-09: DisableMessage is required (non-empty) when status is NotAvailable. Form submit is blocked if it is empty.
  • BR-FE-10: When status changes away from NotAvailable, the DisableMessage field is hidden and its value is reset to "".
  • BR-FE-11: The value sent to the API is null for all statuses except NotAvailable; for NotAvailable it is the trimmed string value.

UpdateStatusResult Toast (Q3: B, "cliënt" terminology)

  • BR-FE-12: On HTTP 200 with slaveContactSuccess === true: show toast "Status updated — cliënt confirmed".
  • BR-FE-13: On HTTP 200 with slaveContactSuccess === false: show toast "Status saved — cliënt unreachable".
  • BR-FE-14: The word "slave" must not appear in any user-visible text. Use "cliënt" in all UI strings.

AddCmsInstanceDialog Error Handling (Q4: A)

  • BR-FE-15: On HTTP 400 from POST /api/v1/CmsInstances: display a FormBannerError at the top of the dialog. The dialog remains open.
  • BR-FE-16: On network error: display a FormBannerError at the top of the dialog. The dialog remains open.
  • BR-FE-17: On success (HTTP 201): close the dialog and show a success toast.

Empty State (Q5: A)

  • BR-FE-18: When useCmsInstances returns an empty array, render a centered placeholder instead of the table. The placeholder contains:
    • A LayoutGrid icon (consistent with the existing CmsPage placeholder).
    • A heading: "No CMS instances yet".
    • A description: "Add your first CMS instance to get started."
    • An "Add CMS" button that opens AddCmsInstanceDialog.
  • BR-FE-19: The "Add CMS" button in the page header is always visible regardless of empty state.

Access Control

  • BR-FE-20: The /cms route is already guarded by RoleGuard allowedRoles={['Owner']}. No additional guard logic is needed inside CmsPage.