Ga naar hoofdinhoud

CnLogsPage

A read-only audit-trail / activity-log page. Wraps CnDataTable with sensible default columns (timestamp, actor, action, target, details) and supports two data-source modes selected via pages[].config:

  • OpenRegister-backed — set register + schema. The component fetches via useObjectStore().
  • Custom URL — set source to a HTTP endpoint. The component fetches via axios.get(source).

Mounted automatically by CnPageRenderer when a manifest page declares type: "logs". Honours headerComponent, actionsComponent, and the generic slots map alongside the other built-in page types.

Wraps: CnDataTable, CnPageHeader, NcEmptyContent, NcLoadingIcon.

Props

PropTypeDefaultDescription
titleString'Activity log'Page title (used by the optional inline header)
descriptionString''Subtitle shown under the title when showTitle is set
showTitleBooleanfalseWhether to render the inline CnPageHeader
iconString''MDI icon name
registerString''OpenRegister register slug (paired with schema)
schemaString''OpenRegister schema slug (paired with register)
sourceString''Custom log-source URL — used when register+schema is not set
columnsArray[]Column definitions (strings → {key, label}; or full objects). Defaults to [timestamp, actor, action, target, details]
rowKeyString'id'Property used as the unique row identifier
emptyTextString'No log entries to show'Text rendered when there are no entries
errorTextString'Could not load log entries'Text rendered when fetch fails
storeObjectnullOverride the default useObjectStore() (e.g. when the consumer uses createObjectStore with a custom ID)

Slots

SlotScopeDescription
header{ title, description, icon }Replaces the default CnPageHeader
actionsRight-aligned actions (refresh, export). Filled by pages[].actionsComponent when set
emptyReplaces the empty-state
error{ error }Replaces the error block
row-actions{ row }Per-row action menu inside the table
column-<key>{ row, value }Custom cell renderer for a specific column

Events

The component emits no events directly; consumer interactions go through the slots (header buttons, row actions). A refresh() method is exposed for actionsComponent implementations to call.

Manifest configuration

{
"id": "audit-logs",
"route": "/logs",
"type": "logs",
"title": "myapp.logs.title",
"config": {
"register": "audit-trail-immutable",
"schema": "audit-event"
// OR a custom source URL:
// "source": "/index.php/apps/myapp/api/logs"
}
}

Usage (standalone)

<template>
<CnLogsPage
register="audit-trail-immutable"
schema="audit-event"
:columns="['timestamp', 'actor', 'action']"
show-title
title="Activity" />
</template>

<script>
import { CnLogsPage } from '@conduction/nextcloud-vue'
export default { components: { CnLogsPage } }
</script>

Custom-fallback notes

  • The component does NOT bundle filters, time-range pickers, or actor autocomplete — those live in the consumer's actionsComponent (or as row-actions slot fills). If your log surface needs richer filtering, drop in a custom action area.
  • The default columns assume an OR audit-event-shape (timestamp, actor, action, target, details). Logs that don't match this shape should pass an explicit columns array.
  • When neither register+schema nor source is set, the component renders the empty-state and emits a single console.warn. This is deliberate — a misconfigured manifest does not break the app shell.