Ga naar hoofdinhoud

CnAuditTrailCard

Compact audit-trail widget for the pluggable integration registry. Fetches the most recent audit-trail entries for an OpenRegister object (query-time storage strategy) and renders them inside a CnDetailCard. Surface-aware shell around the audit-trail integration: handles user-dashboard, app-dashboard, detail-page, and single-entity from a single component.

Wraps: CnDetailCard

Try it​

Loading CnAuditTrailCard playground…

Usage​

<CnAuditTrailCard
:register="registerId"
:schema="schemaId"
:object-id="objectId"
surface="detail-page"
@show-all="openAuditTrailTab" />

Pass pre-translated labels when your app handles i18n:

<CnAuditTrailCard
:register="reg"
:schema="schema"
:object-id="id"
:no-entries-label="t('myapp', 'No audit entries yet')"
:show-all-label="t('myapp', 'Show all')" />

Display props​

PropTypeDefaultNotes
titleString''Override the card title (defaults to the translated label).
maxDisplay (max-display)Number5Maximum rows to render.
layoutString''stacked (DqTaak "Historie"): the action, then one muted line under it with the moment ("6 okt 09:05") and who, when the action does not already name them. Empty: the moment beside the action, who under it.
densityString''compact (DqZaaktype "Historie"): the rows closer together, a stacked row 10px above and below in the board look instead of 12px. The audit-trail widget reads it from content.density.
excludeActions (exclude-actions)Array[]Actions left out, case-insensitive (['read'] for a history of what changed). The card then reads up to ten times maxDisplay entries (at most 100), so the rows it leaves out do not crowd the rest away.
excludeActors (exclude-actors)Array[]Actors left out by user id, case-insensitive (['System'] for a history of what people did): the bookkeeping a background job writes is not shown.
collapsibleBooleanfalseWhether the card collapses.
actionLabel (action-label)Stringt('nextcloud-vue', 'Change')Pre-translated fallback action label.
apiBase (api-base)String'/apps/openregister/api'Base API URL.
refusedLabel (refused-label)Stringt('nextcloud-vue', '(refused)')Shown on an entry the server refused (authorized: false).
failedLabel (failed-label)Stringt('nextcloud-vue', 'The history could not be loaded')Shown when a source or endpoint read failed.
footnoteString''A muted line under the trail, inside the card ("Kenmerk ZT-OMV-REG").

A flow task, or another source​

PropTypeDefaultDescription
sourceObjectnull{ kind: 'flow-task', id } reads {apiBase}/flow-tasks/{id}/audit, the task engine's own trail. id may be left out or written @objectId.
actionLabelsObjectnullWhat happened, in words: by action (claim) or by action and the state it led to (complete:completed, tried first). {actor}, {state} and {changed.<key>} (a value the entry recorded, in the words of valueLabels) are filled in, and a label that names the actor leaves it off the line under it. An action without a label shows as written, with its state in brackets. DqTaak: { "claim": "Task picked up by {actor}" }.
changeLabelsArray[]Words for an entry by what it changed: [{ action?, field, to?, label }], the first whose field the entry changed (to to, when given) wins over actionLabels. A label fills the same tokens, plus {object.<path>} from object ("Version {object.version} published" for isDraft set to false).
valueLabelsObjectnullWords for the values a label quotes as {changed.<key>}: { "purpose": { "handling": "Handling" } }. A value without words shows as written.
relatedSourcesArray[]Records beside the object whose events join its history: [{ as, register, schema, filter, limit? }]. The card lists the objects matching filter (@objectId is this object, at most limit, default 5), reads their trails and merges the entries with the object's own, newest first; a related entry is labelled by actionLabels["<as>.<action>"] first. A related read that fails leaves only its entries out. DqSociaalDomein: { as: "consent", schema: "toestemming", filter: { caseId: "@objectId" } }.
endpointString''A trail URL of its own; {id} is filled with the source's id or objectId.
orderString''newest or oldest first. Empty reads a source oldest first and an object newest first.

A row shows the action with the state it led to (stateAfter), the actor, the kind of performer when it is not a person (performerType), on whose behalf (onBehalfOf), "(refused)" for authorized: false, and the entry's reason. A failed read says so instead of showing an empty trail.

Reference​

OpenRegister reliance​

medium: this component relies on OpenRegister for part of what it does. 1 direct reference, 8 files reached through imports.

See the reliance overview for the filterable list.

Props​

NameTypeRequiredDefaultDescription
footnotestring''A muted line under the trail, inside the card ("Kenmerk ZT-OMV-REG").
registerstring''OpenRegister register id (slug or uuid). Optional for scope: "app".
schemastring''OpenRegister schema id (slug or uuid). Optional for scope: "app".
objectIdstring''Parent object id. Required for scope: "object" (the default); unused for scope: "app".
scopestring'object'What the card lists. object (the default) is one object's trail and needs register, schema and objectId. app is the app-wide feed: the entries of every object the caller may read (OpenRegister's /audit-trails/readable), narrowed to register and schema when those are set.
surfacestring'detail-page'Rendering surface — passed for AD-19 surface fallback consumers.
apiBasestring'/apps/openregister/api'Base API URL.
sourceunionnullRead the trail of something that is not an OpenRegister object: { kind: 'flow-task', id } reads \$\{apiBase}/flow-tasks/{id}/audit, oldest first. id may be left out or written @objectId.
endpointstring''A trail URL that replaces the object's own; {id} is filled with the source's id or objectId.
orderstring''newest first (the object trail's order) or oldest first; empty takes oldest for a source and newest otherwise.
maxDisplaynumber5Maximum rows to render.
layoutstring''stacked (DqTaak "Historie"): the action, then one muted line under it with the moment ("6 okt 09:05") and who, when the action does not already name them. Default: the moment beside the action, who under it. dated (PqJourney "Geschiedenis"): a two-column list, the short date ("2 okt") beside what happened; who shows only where the action's label names them ({actor}).
densitystring''compact draws the rows closer together: in the board look a stacked row 10px above and below (DqZaaktype "Historie") instead of 12px (DqTaak). Default: the layout's own spacing.
excludeActionsarray[]Actions the card leaves out (case-insensitive), such as ['read'] for a history of what changed. It then reads more entries than it shows, so the rows it leaves out do not crowd the rest away.
excludeActorsarray[]Actors the card leaves out by user id (case-insensitive), such as ['System'] for a history of what people did: the bookkeeping a background job writes is not shown.
collapsiblebooleanfalseWhether the card collapses.
titlestring''Override the card title (defaults to the translated label).
noEntriesLabelstring() =&gt; t('nextcloud-vue', 'No audit entries yet')Pre-translated empty label.
showAllLabelstring() =&gt; t('nextcloud-vue', 'Show all')Pre-translated overflow label.
actionLabelstring() =&gt; t('nextcloud-vue', 'Change')Pre-translated fallback action label.
refusedLabelstring() =&gt; t('nextcloud-vue', '(refused)')Shown on an entry the server refused (authorized: false).
actionLabelsObject<string, string>&#124;nullnullWhat happened, in words, by action (claim) or by action and the state it led to (complete:completed, tried first). {actor}, {state} and {changed.&lt;key&gt;} (a value the entry recorded, a dotted key reading into it such as {changed.data.fileName}, in the words of valueLabels) are filled in; a label that names the actor leaves it off the line under it. An action without a label shows as written.
valueLabels{[key: string]: {[value: string]: string}}&#124;nullnullWords for the values an action label quotes as {changed.&lt;key&gt;}: { purpose: { handling: 'Handling' } }. A value without an entry shows as written.
changeLabelsArray<{action?: string, field: string, to?: unknown, label: string}>[]What happened, in words, by the field an entry changed: rules [{ action?, field, to?, label }], the first whose field the entry changed (to to, when given) wins over actionLabels. A label fills the same tokens, plus {object.&lt;path&gt;} from object ("Version {object.version} published" for isDraft set to false).
objectobjectnullThe audited record, for {object.&lt;path&gt;} in a label; null without one.
relatedSourcesArray<{as: string, register: string, schema: string, filter?: object, limit?: number}>[]Records beside the object whose events belong in its history: [{ as, register, schema, filter, limit? }]. The card lists the objects matching filter (@objectId is this object; at most limit, default 5), reads their trails and merges the entries with the object's own, newest first. A related entry is labelled by actionLabels["&lt;as&gt;.&lt;action&gt;"] first. Object scope only.
failedLabelstring() =&gt; t('nextcloud-vue', 'The history could not be loaded')Shown when a source or endpoint read failed.

Events​

NamePayloadDescription
show-all—

The app-wide feed (scope: "app")​

PropTypeDefaultDescription
scopeString'object'object lists one object's trail and needs register, schema and objectId. app lists the reader's whole feed: the entries of every object the caller may read (OpenRegister's /audit-trails/readable), narrowed to register and schema when set, with no object.

The built-in audit-trail widget (CnAuditTrailWidget) takes the same scope as a prop or as content.scope, so a dashboard can declare { "widgetKey": "audit-trail", "props": { "content": { "scope": "app", "title": "Recent activity", "register": "dossiq" } } }.