MongocampRoles
Full CRUD table for managing roles — create, edit (admin flag, collection grants), and delete. Includes a server-side debounced search input and sortable column headers. The key icon on each row links to the grant management page.
Usage
vue
<template>
<MongocampRoles grants-path="/secured/admin/roles" />
</template>Props
| Prop | Type | Default | Description |
|---|---|---|---|
grantsPath | string | /secured/admin/roles | Base path the key icon links to: <grantsPath>/<roleName> |
Behavior
- List — fetched via
useMongocampAdmin().listRoles(filter), debounced 300ms on the search input. - Details — the info icon opens a read-only side drawer with the role's Admin/Standard badge and its grants (
MongocampGrantList), rendered from the list row (getRolereturns exactly the same object, so there is no extra request) on a copy. Editing keeps going through the edit dialog andMongocampRoleGrants. - Clone — the copy icon opens a dialog asking for the new role name; the new role gets the source role's admin flag and a copy of all its grants (created with a single
addRolecall). A refused clone (e.g. name already taken) keeps the dialog open with the reason. - Add / Edit — name,
isAdminflag. - Delete — confirmation modal before calling
deleteRole. If the server refuses, the dialog stays open and shows why so you can try again or cancel; the list is only reloaded after a successful delete. - Bulk delete — a checkbox column (with select-all) and a selection bar; confirming deletes the selected roles a few at a time (
MongocampBulkDelete). The selection is cleared on every reload; failures are reported and stay selected. - Errors / empty — a failed load shows
MongocampErrorAlertwith retry; no rows shows an empty state. - Grant management itself lives in
MongocampRoleGrants, reached via the key icon.