@conduction/nextcloud-vue 2.160.0 → 2.161.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue.js +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js +20 -2
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js.map +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue3.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue.js +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js +10 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue.js +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js +3 -2
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue2.js +2 -2
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue3.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +81 -81
- package/dist/esm/utils/auditEntries.js +25 -1
- package/dist/esm/utils/auditEntries.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +60 -8
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +81 -81
- package/package.json +1 -1
- package/src/components/CnAuditTrailCard/CnAuditTrailCard.vue +20 -2
- package/src/components/CnStatWidget/CnStatWidget.vue +10 -1
- package/src/components/CnTabsWidget/CnTabsWidget.vue +3 -2
- package/src/components/CnTimelineWidget/CnTimelineWidget.vue +2 -2
- package/src/utils/auditEntries.js +24 -0
|
@@ -2,7 +2,7 @@ import script from './CnAuditTrailCard.vue2.js';
|
|
|
2
2
|
import { render } from './CnAuditTrailCard.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-3b6d70f7";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -3,7 +3,7 @@ import { NcLoadingIcon } from '@nextcloud/vue';
|
|
|
3
3
|
import { markRaw } from 'vue';
|
|
4
4
|
import History from 'vue-material-design-icons/History.vue';
|
|
5
5
|
import __sfc_main from '../CnDetailCard/CnDetailCard.vue.js';
|
|
6
|
-
import { keepAuditEntries } from '../../utils/auditEntries.js';
|
|
6
|
+
import { keepAuditEntries, auditExclusionParams } from '../../utils/auditEntries.js';
|
|
7
7
|
import { fillAuditLabel, changedValue, changeLabelFor, actionLabelFor } from '../../utils/auditLabels.js';
|
|
8
8
|
import { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js';
|
|
9
9
|
import { leafSourceUrl } from '../../utils/leafSourceUrl.js';
|
|
@@ -270,6 +270,7 @@ var script = {
|
|
|
270
270
|
if (!this.register || !this.schema || !this.objectId) {
|
|
271
271
|
return ''
|
|
272
272
|
}
|
|
273
|
+
this.addExclusions(params);
|
|
273
274
|
return `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails?${params.toString()}`
|
|
274
275
|
},
|
|
275
276
|
},
|
|
@@ -286,6 +287,21 @@ var script = {
|
|
|
286
287
|
},
|
|
287
288
|
|
|
288
289
|
methods: {
|
|
290
|
+
/**
|
|
291
|
+
* Ask an object trail to leave out the excluded actions and actors in
|
|
292
|
+
* the query (`action[notIn]`, `user[notIn]`), so its pages hold what the
|
|
293
|
+
* card shows. `keepAuditEntries` still filters what comes back.
|
|
294
|
+
*
|
|
295
|
+
* @param {URLSearchParams} params The trail query, changed in place.
|
|
296
|
+
* @return {void}
|
|
297
|
+
* @spec openspec/changes/audit-card-exclusions-in-the-query/specs/audit-trail/spec.md#requirement-a-history-card-asks-the-trail-to-leave-out-what-it-hides
|
|
298
|
+
*/
|
|
299
|
+
addExclusions(params) {
|
|
300
|
+
for (const [key, value] of Object.entries(auditExclusionParams({ excludeActions: this.excludeActions, excludeActors: this.excludeActors }))) {
|
|
301
|
+
params.set(key, value);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
|
|
289
305
|
/**
|
|
290
306
|
* Read the entries from `fetchUrl`. The readable feed answers
|
|
291
307
|
* `{ rows, nextCursor }`, the object trail `{ results }`.
|
|
@@ -393,7 +409,9 @@ var script = {
|
|
|
393
409
|
}
|
|
394
410
|
const objects = await read(`${this.apiBase}/objects/${source.register}/${source.schema}?${params.toString()}`);
|
|
395
411
|
const ids = objects.map((object) => object?.id || object?.['@self']?.id || object?.uuid).filter(Boolean);
|
|
396
|
-
const
|
|
412
|
+
const trailParams = new URLSearchParams({ limit: String(limit) });
|
|
413
|
+
this.addExclusions(trailParams);
|
|
414
|
+
const trails = await Promise.all(ids.map((id) => read(`${this.apiBase}/objects/${source.register}/${source.schema}/${id}/audit-trails?${trailParams.toString()}`).catch(() => [])));
|
|
397
415
|
return trails.flat().map((entry) => ({ ...entry, relatedAs: source.as || source.schema }))
|
|
398
416
|
} catch {
|
|
399
417
|
return []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnAuditTrailCard.vue2.js","sources":["../../../../src/components/CnAuditTrailCard/CnAuditTrailCard.vue"],"sourcesContent":["<!--\n CnAuditTrailCard — compact audit-trail widget for the integration\n registry.\n\n Surface-aware shell around the `audit-trail` integration: fetches\n the object's recent audit-trail entries (query-time storage strategy\n per AD-22) and renders them in a CnDetailCard.\n\n Per umbrella change `pluggable-integration-registry` AD-19 (surface\n fallback), one component handles all surfaces — `surface` is\n forwarded so the component can branch internally if desired.\n-->\n<template>\n\t<CnDetailCard\n\t\t:title=\"resolvedTitle\"\n\t\t:icon=\"History\"\n\t\t:collapsible=\"collapsible\"\n\t\t:data-surface=\"surface\">\n\t\t<NcLoadingIcon v-if=\"loading\" />\n\t\t<p v-else-if=\"failed\"\n\t\t\tclass=\"cn-audit-card__empty\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-audit-card-failed\">\n\t\t\t{{ failedLabel }}\n\t\t</p>\n\t\t<div v-else-if=\"shownEntries.length === 0\" class=\"cn-audit-card__empty\">\n\t\t\t{{ noEntriesLabel }}\n\t\t</div>\n\t\t<!-- `dated` (PqJourney \"Geschiedenis\"): the short date beside what\n\t\t happened, one line per entry. -->\n\t\t<dl v-else-if=\"layout === 'dated'\" class=\"cn-audit-card__dated\">\n\t\t\t<template v-for=\"entry in displayedEntries\" :key=\"entry.id\">\n\t\t\t\t<dt class=\"cn-audit-card__date\">\n\t\t\t\t\t{{ shortDate(entry) }}\n\t\t\t\t</dt>\n\t\t\t\t<dd class=\"cn-audit-card__dated-text\">\n\t\t\t\t\t{{ formatAction(entry) }}<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</dd>\n\t\t\t</template>\n\t\t</dl>\n\t\t<ul v-else class=\"cn-audit-card__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"entry in displayedEntries\"\n\t\t\t\t:key=\"entry.id\"\n\t\t\t\tclass=\"cn-audit-card__row\"\n\t\t\t\t:class=\"{ 'cn-audit-card__row--stacked': layout === 'stacked', 'cn-audit-card__row--compact': density === 'compact' }\">\n\t\t\t\t<div class=\"cn-audit-card__row-head\">\n\t\t\t\t\t<strong class=\"cn-audit-card__action\">{{ formatAction(entry) }}</strong>\n\t\t\t\t\t<span v-if=\"layout !== 'stacked'\" class=\"cn-audit-card__when\">{{ formatWhen(entry) }}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cn-audit-card__row-body\">\n\t\t\t\t\t<span v-if=\"layout === 'stacked'\" class=\"cn-audit-card__when\" data-testid=\"cn-audit-card-when-below\">{{ stackedLine(entry) }}</span>\n\t\t\t\t\t<span v-else class=\"cn-audit-card__actor\">{{ formatActor(entry) }}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</div>\n\t\t\t\t<p v-if=\"entry.reason\" class=\"cn-audit-card__reason\">\n\t\t\t\t\t{{ entry.reason }}\n\t\t\t\t</p>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-if=\"footnote\" class=\"cn-audit-card__footnote\" data-testid=\"cn-audit-trail-widget-footnote\">\n\t\t\t{{ footnote }}\n\t\t</p>\n\t\t<template v-if=\"shownEntries.length > maxDisplay\" #footer>\n\t\t\t<button class=\"cn-audit-card__show-all\" @click=\"$emit('show-all')\">\n\t\t\t\t{{ showAllLabel }} ({{ shownEntries.length }})\n\t\t\t</button>\n\t\t</template>\n\t</CnDetailCard>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcLoadingIcon } from '@nextcloud/vue'\nimport { markRaw } from 'vue'\nimport History from 'vue-material-design-icons/History.vue'\nimport CnDetailCard from '../CnDetailCard/CnDetailCard.vue'\nimport { keepAuditEntries } from '../../utils/auditEntries.js'\nimport { actionLabelFor, changedValue, changeLabelFor, fillAuditLabel } from '../../utils/auditLabels.js'\nimport { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { leafSourceUrl } from '../../utils/leafSourceUrl.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\n/**\n * @param {object} entry An audit entry.\n * @return {number} When it happened, in ms; 0 when unreadable.\n */\nfunction entryTime(entry) {\n\tconst time = new Date(entry.creationDateTime || entry.created || entry.timestamp || 0).getTime()\n\treturn Number.isNaN(time) ? 0 : time\n}\n\n/**\n * CnAuditTrailCard — compact audit-trail widget rendered by the\n * integration registry on dashboard and detail surfaces.\n *\n * Basic usage\n * ```vue\n * <CnAuditTrailCard\n * :register=\"registerId\"\n * :schema=\"schemaId\"\n * :object-id=\"objectId\"\n * surface=\"detail-page\" />\n * ```\n */\nexport default {\n\tname: 'CnAuditTrailCard',\n\n\tcomponents: { CnDetailCard, NcLoadingIcon },\n\n\tprops: {\n\t\t/**\n\t\t * A muted line under the trail, inside the card (\"Kenmerk ZT-OMV-REG\").\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-footnote/specs/audit-trail/spec.md#requirement-a-history-card-can-end-in-a-line-about-the-record\n\t\t */\n\t\tfootnote: { type: String, default: '' },\n\t\t/** OpenRegister register id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tschema: { type: String, default: '' },\n\t\t/** Parent object id. Required for `scope: \"object\"` (the default); unused for `scope: \"app\"`. */\n\t\tobjectId: { type: String, default: '' },\n\t\t/**\n\t\t * What the card lists. `object` (the default) is one object's trail\n\t\t * and needs `register`, `schema` and `objectId`. `app` is the\n\t\t * app-wide feed: the entries of every object the caller may read\n\t\t * (OpenRegister's `/audit-trails/readable`), narrowed to `register`\n\t\t * and `schema` when those are set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t */\n\t\tscope: {\n\t\t\ttype: String,\n\t\t\tdefault: 'object',\n\t\t\tvalidator: (value) => ['object', 'app'].includes(value),\n\t\t},\n\n\t\t/** Rendering surface — passed for AD-19 surface fallback consumers. */\n\t\tsurface: {\n\t\t\ttype: String,\n\t\t\tdefault: 'detail-page',\n\t\t\tvalidator: (value) => ['user-dashboard', 'app-dashboard', 'detail-page', 'single-entity'].includes(value),\n\t\t},\n\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\n\t\t/**\n\t\t * Read the trail of something that is not an OpenRegister object:\n\t\t * `{ kind: 'flow-task', id }` reads `${apiBase}/flow-tasks/{id}/audit`,\n\t\t * oldest first. `id` may be left out or written `@objectId`.\n\t\t *\n\t\t * @type {{kind: string, id?: (string|number)}|null}\n\t\t */\n\t\tsource: { type: Object, default: null },\n\n\t\t/** A trail URL that replaces the object's own; `{id}` is filled with the source's id or `objectId`. */\n\t\tendpoint: { type: String, default: '' },\n\n\t\t/** `newest` first (the object trail's order) or `oldest` first; empty takes `oldest` for a source and `newest` otherwise. */\n\t\torder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t\tvalidator: (value) => ['', 'newest', 'oldest'].includes(value),\n\t\t},\n\n\t\t/** Maximum rows to render. */\n\t\tmaxDisplay: { type: Number, default: 5 },\n\t\t/**\n\t\t * `stacked` (DqTaak \"Historie\"): the action, then one muted line under\n\t\t * it with the moment (\"6 okt 09:05\") and who, when the action does not\n\t\t * already name them. Default: the moment beside the action, who under it.\n\t\t * `dated` (PqJourney \"Geschiedenis\"): a two-column list, the short date\n\t\t * (\"2 okt\") beside what happened; who shows only where the action's\n\t\t * label names them (`{actor}`).\n\t\t */\n\t\tlayout: { type: String, default: '' },\n\t\t/**\n\t\t * `compact` draws the rows closer together: in the board look a\n\t\t * stacked row 10px above and below (DqZaaktype \"Historie\") instead of\n\t\t * 12px (DqTaak). Default: the layout's own spacing.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-compact-stacked-rows/specs/audit-trail/spec.md#requirement-a-stacked-audit-card-can-draw-compact-rows\n\t\t */\n\t\tdensity: { type: String, default: '' },\n\t\t/**\n\t\t * Actions the card leaves out (case-insensitive), such as `['read']`\n\t\t * for a history of what changed. It then reads more entries than it\n\t\t * shows, so the rows it leaves out do not crowd the rest away.\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-exclude-actions/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-events-by-action\n\t\t */\n\t\texcludeActions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Actors the card leaves out by user id (case-insensitive), such as\n\t\t * `['System']` for a history of what people did: the bookkeeping a\n\t\t * background job writes is not shown.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-exclude-actors/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-entries-by-actor\n\t\t */\n\t\texcludeActors: { type: Array, default: () => [] },\n\t\t/** Whether the card collapses. */\n\t\tcollapsible: { type: Boolean, default: false },\n\t\t/** Override the card title (defaults to the translated label). */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Pre-translated empty label. */\n\t\tnoEntriesLabel: { type: String, default: () => t('nextcloud-vue', 'No audit entries yet') },\n\t\t/** Pre-translated overflow label. */\n\t\tshowAllLabel: { type: String, default: () => t('nextcloud-vue', 'Show all') },\n\t\t/** Pre-translated fallback action label. */\n\t\tactionLabel: { type: String, default: () => t('nextcloud-vue', 'Change') },\n\t\t/** Shown on an entry the server refused (`authorized: false`). */\n\t\trefusedLabel: { type: String, default: () => t('nextcloud-vue', '(refused)') },\n\t\t/**\n\t\t * What happened, in words, by action (`claim`) or by action and the\n\t\t * state it led to (`complete:completed`, tried first). `{actor}`,\n\t\t * `{state}` and `{changed.<key>}` (a value the entry recorded, a dotted key\n\t\t * reading into it such as `{changed.data.fileName}`, in the\n\t\t * words of `valueLabels`) are filled in; a label that names the actor leaves it off\n\t\t * the line under it. An action without a label shows as written.\n\t\t *\n\t\t * @type {Object<string, string>|null}\n\t\t */\n\t\tactionLabels: { type: Object, default: null },\n\t\t/**\n\t\t * Words for the values an action label quotes as `{changed.<key>}`:\n\t\t * `{ purpose: { handling: 'Handling' } }`. A value without an entry\n\t\t * shows as written.\n\t\t *\n\t\t * @type {{[key: string]: {[value: string]: string}}|null}\n\t\t */\n\t\tvalueLabels: { type: Object, default: null },\n\t\t/**\n\t\t * What happened, in words, by the field an entry changed: rules\n\t\t * `[{ action?, field, to?, label }]`, the first whose `field` the entry\n\t\t * changed (to `to`, when given) wins over `actionLabels`. A label fills\n\t\t * the same tokens, plus `{object.<path>}` from `object`\n\t\t * (\"Version {object.version} published\" for `isDraft` set to false).\n\t\t *\n\t\t * @type {Array<{action?: string, field: string, to?: unknown, label: string}>}\n\t\t */\n\t\tchangeLabels: { type: Array, default: () => [] },\n\t\t/** The audited record, for `{object.<path>}` in a label; null without one. */\n\t\tobject: { type: Object, default: null },\n\t\t/**\n\t\t * Records beside the object whose events belong in its history:\n\t\t * `[{ as, register, schema, filter, limit? }]`. The card lists the\n\t\t * objects matching `filter` (`@objectId` is this object; at most\n\t\t * `limit`, default 5), reads their trails and merges the entries with\n\t\t * the object's own, newest first. A related entry is labelled by\n\t\t * `actionLabels[\"<as>.<action>\"]` first. Object scope only.\n\t\t *\n\t\t * @type {Array<{as: string, register: string, schema: string, filter?: object, limit?: number}>}\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\trelatedSources: { type: Array, default: () => [] },\n\t\t/** Shown when a `source` or `endpoint` read failed. */\n\t\tfailedLabel: { type: String, default: () => t('nextcloud-vue', 'The history could not be loaded') },\n\t},\n\n\temits: ['show-all'],\n\n\tdata() {\n\t\treturn {\n\t\t\tHistory: markRaw(History),\n\t\t\tentries: [],\n\t\t\tloading: false,\n\t\t\t/** A `source` or `endpoint` read failed: said, rather than shown as an empty trail. */\n\t\t\tfailed: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tresolvedTitle() {\n\t\t\treturn this.title || t('nextcloud-vue', 'Audit trail')\n\t\t},\n\n\t\t/**\n\t\t * The entries without the excluded actions and actors, and without an\n\t\t * update that changed nothing: a re-save whose `changed` holds no field\n\t\t * whose old and new value differ (only `@self` bookkeeping) is not\n\t\t * something that happened to the record.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tshownEntries() {\n\t\t\treturn keepAuditEntries(this.entries, { excludeActions: this.excludeActions, excludeActors: this.excludeActors })\n\t\t},\n\n\t\t/** @return {boolean} Whether the card leaves entries out, and so reads more than it shows. */\n\t\tfiltersEntries() {\n\t\t\treturn this.excludeActions.length > 0 || this.excludeActors.length > 0\n\t\t},\n\n\t\tdisplayedEntries() {\n\t\t\tconst entries = this.oldestFirst ? [...this.shownEntries].sort((a, b) => entryTime(a) - entryTime(b)) : this.shownEntries\n\t\t\treturn entries.slice(0, this.maxDisplay)\n\t\t},\n\n\t\t/**\n\t\t * The trail URL a `source` or `endpoint` names, '' while its record id\n\t\t * is unknown, or null when the card reads an object.\n\t\t *\n\t\t * @return {string|null}\n\t\t * @spec openspec/changes/leaf-cards-read-a-source/specs/leaf-cards-read-a-source/spec.md#requirement-a-leaf-card-reads-a-source-or-an-endpoint\n\t\t */\n\t\tsourceUrl() {\n\t\t\treturn leafSourceUrl({ source: this.source, endpoint: this.endpoint, apiBase: this.apiBase, objectId: this.objectId }, 'audit')\n\t\t},\n\n\t\t/** @return {boolean} Whether the entries read oldest first. */\n\t\toldestFirst() {\n\t\t\treturn this.order === 'oldest' || (this.order === '' && this.sourceUrl !== null)\n\t\t},\n\n\t\t/**\n\t\t * The path the card reads (prefixed at fetch time), or '' when it has nothing to read: the\n\t\t * object's own trail, or the app-wide readable feed narrowed to the\n\t\t * register and schema when set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {string}\n\t\t */\n\t\tfetchUrl() {\n\t\t\tif (this.sourceUrl !== null) {\n\t\t\t\treturn this.sourceUrl\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst params = new URLSearchParams({ limit: String(limit) })\n\t\t\tif (this.scope === 'app') {\n\t\t\t\tif (this.register) {\n\t\t\t\t\tparams.set('register', this.register)\n\t\t\t\t}\n\t\t\t\tif (this.schema) {\n\t\t\t\t\tparams.set('schema', this.schema)\n\t\t\t\t}\n\t\t\t\treturn `${this.apiBase}/audit-trails/readable?${params.toString()}`\n\t\t\t}\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails?${params.toString()}`\n\t\t},\n\t},\n\n\twatch: {\n\t\tfetchUrl: {\n\t\t\timmediate: true,\n\t\t\thandler(url) {\n\t\t\t\tif (url) {\n\t\t\t\t\tthis.fetchEntries()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Read the entries from `fetchUrl`. The readable feed answers\n\t\t * `{ rows, nextCursor }`, the object trail `{ results }`.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync fetchEntries() {\n\t\t\tconst url = this.fetchUrl\n\t\t\tif (!url) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.failed = false\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\t\tconst own = await this.withFollowingPages(url, Array.isArray(list) ? list : [])\n\t\t\t\t\tconst related = await this.fetchRelatedEntries()\n\t\t\t\t\tthis.entries = related.length > 0\n\t\t\t\t\t\t? [...own, ...related].sort((a, b) => entryTime(b) - entryTime(a))\n\t\t\t\t\t\t: own\n\t\t\t\t} else {\n\t\t\t\t\tthis.entries = []\n\t\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnAuditTrailCard] failed to fetch audit trail', err)\n\t\t\t\tthis.entries = []\n\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * An object's trail read on until it holds enough entries to show. The\n\t\t * card leaves entries out (reads, actors, empty re-saves) after\n\t\t * reading, and every page view writes a read, so the newest page alone\n\t\t * can be all reads (DqHandhaving Historie: \"no changes yet\"). Reads at\n\t\t * most four more pages.\n\t\t *\n\t\t * @param {string} url The first page's path.\n\t\t * @param {Array<object>} first The first page's entries.\n\t\t * @return {Promise<Array<object>>} The entries read.\n\t\t */\n\t\tasync withFollowingPages(url, first) {\n\t\t\tconst entries = [...first]\n\t\t\tif (!this.filtersEntries || this.scope !== 'object' || this.sourceUrl !== null) {\n\t\t\t\treturn entries\n\t\t\t}\n\t\t\tconst limit = Number(new URLSearchParams(url.split('?')[1] || '').get('limit')) || first.length\n\t\t\tlet page = first\n\t\t\tfor (let more = 0; more < 4 && page.length >= limit && limit > 0; more++) {\n\t\t\t\tthis.entries = [...entries]\n\t\t\t\tif (this.shownEntries.length >= this.maxDisplay) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst next = new URL(url, 'http://x')\n\t\t\t\tnext.searchParams.set('offset', String(entries.length))\n\t\t\t\tconst response = await fetch(prefixUrl(next.pathname + next.search), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\tpage = Array.isArray(list) ? list : []\n\t\t\t\tentries.push(...page)\n\t\t\t}\n\t\t\treturn [...entries]\n\t\t},\n\n\t\t/**\n\t\t * The entries of the records beside the object (`relatedSources`),\n\t\t * each tagged with its source's `as`. A read that fails leaves that\n\t\t * source out.\n\t\t *\n\t\t * @return {Promise<Array<object>>} The entries.\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\tasync fetchRelatedEntries() {\n\t\t\tif (this.scope !== 'object' || this.sourceUrl !== null || !this.objectId || !Array.isArray(this.relatedSources)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst read = async (url) => {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(String(response.status))\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\treturn Array.isArray(list) ? list : []\n\t\t\t}\n\t\t\tconst perSource = await Promise.all(this.relatedSources\n\t\t\t\t.filter((source) => source && source.register && source.schema)\n\t\t\t\t.map(async (source) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst params = new URLSearchParams({ _limit: String(Number(source.limit) > 0 ? Number(source.limit) : 5), _order: JSON.stringify({ '@self.created': 'DESC' }) })\n\t\t\t\t\t\tfor (const [key, value] of Object.entries(source.filter || {})) {\n\t\t\t\t\t\t\tparams.set(key, value === '@objectId' ? this.objectId : String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst objects = await read(`${this.apiBase}/objects/${source.register}/${source.schema}?${params.toString()}`)\n\t\t\t\t\t\tconst ids = objects.map((object) => object?.id || object?.['@self']?.id || object?.uuid).filter(Boolean)\n\t\t\t\t\t\tconst trails = await Promise.all(ids.map((id) => read(`${this.apiBase}/objects/${source.register}/${source.schema}/${id}/audit-trails?limit=${limit}`).catch(() => [])))\n\t\t\t\t\t\treturn trails.flat().map((entry) => ({ ...entry, relatedAs: source.as || source.schema }))\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\treturn perSource.flat()\n\t\t},\n\n\t\t/**\n\t\t * What happened: the action, with the state it led to when the entry\n\t\t * names one (a flow task's `stateAfter`).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatAction(entry) {\n\t\t\tconst label = this.changeLabelFor(entry) ?? this.labelFor(entry)\n\t\t\tif (label !== null) {\n\t\t\t\treturn fillAuditLabel(label, entry, { actor: this.actorName(entry), object: this.object, valueLabels: this.valueLabels })\n\t\t\t}\n\t\t\tconst action = entry.action || entry.event || this.actionLabel\n\t\t\treturn entry.stateAfter ? `${action} (${entry.stateAfter})` : action\n\t\t},\n\n\t\t/**\n\t\t * A value the entry recorded under `changed` (an audit entry's context),\n\t\t * in the words of `valueLabels`; '' when it recorded none.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @param {string} key The recorded key.\n\t\t * @return {string} The value in words.\n\t\t * @spec openspec/changes/audit-label-changed-values/specs/audit-trail/spec.md#requirement-a-trail-label-can-quote-what-the-entry-recorded\n\t\t */\n\t\tchangedValue(entry, key) {\n\t\t\treturn changedValue(entry, key, this.valueLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `changeLabels` rule an entry matches: the first whose field the\n\t\t * entry changed, for its action and to its value when the rule names them.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when no rule matches.\n\t\t */\n\t\tchangeLabelFor(entry) {\n\t\t\treturn changeLabelFor(entry, this.changeLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `actionLabels` entry for an entry: by action and state first,\n\t\t * then by action.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when none is declared.\n\t\t * @spec openspec/changes/audit-trail-action-labels/specs/audit-trail/spec.md#requirement-a-trail-can-say-what-happened-in-words\n\t\t */\n\t\tlabelFor(entry) {\n\t\t\treturn actionLabelFor(entry, this.actionLabels, this.object)\n\t\t},\n\n\t\t/**\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} Who did it, by name where the entry carries one.\n\t\t */\n\t\tactorName(entry) {\n\t\t\tif (entry.actorDisplayName) {\n\t\t\t\treturn entry.actorDisplayName\n\t\t\t}\n\t\t\tconst id = entry.actor || entry.userId || entry.user || ''\n\t\t\t// A person's user id reads as their display name once it is known.\n\t\t\treturn (id && (!entry.performerType || entry.performerType === 'user') && userDisplayName(String(id))) || id\n\t\t},\n\n\t\t/**\n\t\t * The date of a dated list's entry in the board's short form (\"2 okt\").\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The date, or '' without one.\n\t\t * @spec openspec/changes/audit-card-dated-layout/specs/audit-trail/spec.md#requirement-an-audit-list-can-put-the-date-beside-what-happened\n\t\t */\n\t\tshortDate(entry) {\n\t\t\treturn formatBoardDate(entry.creationDateTime || entry.created || entry.timestamp)\n\t\t},\n\n\t\t/**\n\t\t * The muted line of a stacked row: the moment in the board's short\n\t\t * form (\"6 okt 09:05\") and who, unless the action names them already.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t * @spec openspec/changes/audit-card-stacked-rows/specs/audit-trail/spec.md#requirement-an-audit-row-can-put-its-moment-under-the-action\n\t\t */\n\t\tstackedLine(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tconst date = raw ? new Date(raw) : null\n\t\t\tconst when = date && !Number.isNaN(date.getTime()) ? `${formatBoardDate(date)} ${formatTimeOfDay(date)}` : ''\n\t\t\treturn [when, this.formatActor(entry)].filter((part) => part !== '').join(' · ')\n\t\t},\n\n\t\t/**\n\t\t * Who did it: the actor, the kind of performer when it is not a\n\t\t * person (a flow, the system), and on whose behalf.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatActor(entry) {\n\t\t\tconst named = (this.labelFor(entry) || '').includes('{actor}')\n\t\t\tconst parts = [named ? '' : this.actorName(entry)]\n\t\t\tif (entry.performerType && entry.performerType !== 'user') {\n\t\t\t\tparts.push(`(${entry.performerType})`)\n\t\t\t}\n\t\t\tif (entry.onBehalfOf) {\n\t\t\t\tparts.push(t('nextcloud-vue', 'on behalf of {name}', { name: entry.onBehalfOf }))\n\t\t\t}\n\t\t\treturn parts.filter((part) => part !== '').join(' ')\n\t\t},\n\n\t\tformatWhen(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tif (raw === undefined || raw === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst d = new Date(raw)\n\t\t\tif (Number.isNaN(d.getTime()) === true) {\n\t\t\t\treturn String(raw)\n\t\t\t}\n\t\t\treturn d.toLocaleString(userLocale())\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-audit-card__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Nextcloud core pads and aligns `dt` / `dd`; the list resets both. */\n.cn-audit-card__dated {\n\tdisplay: grid;\n\tgrid-template-columns: max-content minmax(0, 1fr);\n\tgap: 8px 16px;\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 14px;\n}\n\n.cn-audit-card__dated .cn-audit-card__date {\n\twidth: auto;\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-audit-card__dated .cn-audit-card__dated-text {\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__row {\n\tpadding: 6px 0;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-audit-card__row:last-child {\n\tborder-bottom: none;\n}\n\n.cn-audit-card__row-head {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-audit-card__action {\n\tcolor: var(--color-main-text);\n}\n\n.cn-audit-card__when {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\twhite-space: nowrap;\n}\n\n.cn-audit-card__row-body {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-audit-card__refused {\n\tmargin-inline-start: 6px;\n\tfont-weight: 700;\n\tcolor: var(--color-error-text, var(--color-main-text));\n}\n\n.cn-audit-card__reason {\n\tmargin: 2px 0 0;\n\tfont-size: 0.9em;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__empty {\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n\tpadding: 12px 0;\n}\n\n.cn-audit-card__footnote {\n\tmargin: 12px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-audit-card__show-all {\n\tbackground: none;\n\tborder: none;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tpadding: 4px 0;\n\tfont: inherit;\n}\n\n.cn-audit-card__show-all:hover {\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["CnDetailCard","t"],"mappings":";;;;;;;;;;;;;AA2FA;AACC;;;AAGD,SAAS,SAAS,CAAC,KAAK,EAAE;AACzB,CAAA,MAAM,IAAG,GAAI,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,KAAK,CAAC,OAAM,IAAK,KAAK,CAAC,SAAQ,IAAK,CAAC,CAAC,CAAC,OAAO,GAAC;AAC/F,CAAA,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE,GAAE,CAAE,GAAE,IAAG;AACpC,CAAA;;AAEA;;;AAGC;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAED,aAAe;CACd,IAAI,EAAE,kBAAkB;;AAExB,CAAA,UAAU,EAAE,gBAAEA,UAAY,EAAE,eAAe;;AAE3C,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;;AAED,EAAA,QAAQ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../../../../src/components/CnAuditTrailCard/CnAuditTrailCard.vue"],"sourcesContent":["<!--\n CnAuditTrailCard — compact audit-trail widget for the integration\n registry.\n\n Surface-aware shell around the `audit-trail` integration: fetches\n the object's recent audit-trail entries (query-time storage strategy\n per AD-22) and renders them in a CnDetailCard.\n\n Per umbrella change `pluggable-integration-registry` AD-19 (surface\n fallback), one component handles all surfaces — `surface` is\n forwarded so the component can branch internally if desired.\n-->\n<template>\n\t<CnDetailCard\n\t\t:title=\"resolvedTitle\"\n\t\t:icon=\"History\"\n\t\t:collapsible=\"collapsible\"\n\t\t:data-surface=\"surface\">\n\t\t<NcLoadingIcon v-if=\"loading\" />\n\t\t<p v-else-if=\"failed\"\n\t\t\tclass=\"cn-audit-card__empty\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-audit-card-failed\">\n\t\t\t{{ failedLabel }}\n\t\t</p>\n\t\t<div v-else-if=\"shownEntries.length === 0\" class=\"cn-audit-card__empty\">\n\t\t\t{{ noEntriesLabel }}\n\t\t</div>\n\t\t<!-- `dated` (PqJourney \"Geschiedenis\"): the short date beside what\n\t\t happened, one line per entry. -->\n\t\t<dl v-else-if=\"layout === 'dated'\" class=\"cn-audit-card__dated\">\n\t\t\t<template v-for=\"entry in displayedEntries\" :key=\"entry.id\">\n\t\t\t\t<dt class=\"cn-audit-card__date\">\n\t\t\t\t\t{{ shortDate(entry) }}\n\t\t\t\t</dt>\n\t\t\t\t<dd class=\"cn-audit-card__dated-text\">\n\t\t\t\t\t{{ formatAction(entry) }}<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</dd>\n\t\t\t</template>\n\t\t</dl>\n\t\t<ul v-else class=\"cn-audit-card__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"entry in displayedEntries\"\n\t\t\t\t:key=\"entry.id\"\n\t\t\t\tclass=\"cn-audit-card__row\"\n\t\t\t\t:class=\"{ 'cn-audit-card__row--stacked': layout === 'stacked', 'cn-audit-card__row--compact': density === 'compact' }\">\n\t\t\t\t<div class=\"cn-audit-card__row-head\">\n\t\t\t\t\t<strong class=\"cn-audit-card__action\">{{ formatAction(entry) }}</strong>\n\t\t\t\t\t<span v-if=\"layout !== 'stacked'\" class=\"cn-audit-card__when\">{{ formatWhen(entry) }}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cn-audit-card__row-body\">\n\t\t\t\t\t<span v-if=\"layout === 'stacked'\" class=\"cn-audit-card__when\" data-testid=\"cn-audit-card-when-below\">{{ stackedLine(entry) }}</span>\n\t\t\t\t\t<span v-else class=\"cn-audit-card__actor\">{{ formatActor(entry) }}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</div>\n\t\t\t\t<p v-if=\"entry.reason\" class=\"cn-audit-card__reason\">\n\t\t\t\t\t{{ entry.reason }}\n\t\t\t\t</p>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-if=\"footnote\" class=\"cn-audit-card__footnote\" data-testid=\"cn-audit-trail-widget-footnote\">\n\t\t\t{{ footnote }}\n\t\t</p>\n\t\t<template v-if=\"shownEntries.length > maxDisplay\" #footer>\n\t\t\t<button class=\"cn-audit-card__show-all\" @click=\"$emit('show-all')\">\n\t\t\t\t{{ showAllLabel }} ({{ shownEntries.length }})\n\t\t\t</button>\n\t\t</template>\n\t</CnDetailCard>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcLoadingIcon } from '@nextcloud/vue'\nimport { markRaw } from 'vue'\nimport History from 'vue-material-design-icons/History.vue'\nimport CnDetailCard from '../CnDetailCard/CnDetailCard.vue'\nimport { auditExclusionParams, keepAuditEntries } from '../../utils/auditEntries.js'\nimport { actionLabelFor, changedValue, changeLabelFor, fillAuditLabel } from '../../utils/auditLabels.js'\nimport { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { leafSourceUrl } from '../../utils/leafSourceUrl.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\n/**\n * @param {object} entry An audit entry.\n * @return {number} When it happened, in ms; 0 when unreadable.\n */\nfunction entryTime(entry) {\n\tconst time = new Date(entry.creationDateTime || entry.created || entry.timestamp || 0).getTime()\n\treturn Number.isNaN(time) ? 0 : time\n}\n\n/**\n * CnAuditTrailCard — compact audit-trail widget rendered by the\n * integration registry on dashboard and detail surfaces.\n *\n * Basic usage\n * ```vue\n * <CnAuditTrailCard\n * :register=\"registerId\"\n * :schema=\"schemaId\"\n * :object-id=\"objectId\"\n * surface=\"detail-page\" />\n * ```\n */\nexport default {\n\tname: 'CnAuditTrailCard',\n\n\tcomponents: { CnDetailCard, NcLoadingIcon },\n\n\tprops: {\n\t\t/**\n\t\t * A muted line under the trail, inside the card (\"Kenmerk ZT-OMV-REG\").\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-footnote/specs/audit-trail/spec.md#requirement-a-history-card-can-end-in-a-line-about-the-record\n\t\t */\n\t\tfootnote: { type: String, default: '' },\n\t\t/** OpenRegister register id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tschema: { type: String, default: '' },\n\t\t/** Parent object id. Required for `scope: \"object\"` (the default); unused for `scope: \"app\"`. */\n\t\tobjectId: { type: String, default: '' },\n\t\t/**\n\t\t * What the card lists. `object` (the default) is one object's trail\n\t\t * and needs `register`, `schema` and `objectId`. `app` is the\n\t\t * app-wide feed: the entries of every object the caller may read\n\t\t * (OpenRegister's `/audit-trails/readable`), narrowed to `register`\n\t\t * and `schema` when those are set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t */\n\t\tscope: {\n\t\t\ttype: String,\n\t\t\tdefault: 'object',\n\t\t\tvalidator: (value) => ['object', 'app'].includes(value),\n\t\t},\n\n\t\t/** Rendering surface — passed for AD-19 surface fallback consumers. */\n\t\tsurface: {\n\t\t\ttype: String,\n\t\t\tdefault: 'detail-page',\n\t\t\tvalidator: (value) => ['user-dashboard', 'app-dashboard', 'detail-page', 'single-entity'].includes(value),\n\t\t},\n\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\n\t\t/**\n\t\t * Read the trail of something that is not an OpenRegister object:\n\t\t * `{ kind: 'flow-task', id }` reads `${apiBase}/flow-tasks/{id}/audit`,\n\t\t * oldest first. `id` may be left out or written `@objectId`.\n\t\t *\n\t\t * @type {{kind: string, id?: (string|number)}|null}\n\t\t */\n\t\tsource: { type: Object, default: null },\n\n\t\t/** A trail URL that replaces the object's own; `{id}` is filled with the source's id or `objectId`. */\n\t\tendpoint: { type: String, default: '' },\n\n\t\t/** `newest` first (the object trail's order) or `oldest` first; empty takes `oldest` for a source and `newest` otherwise. */\n\t\torder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t\tvalidator: (value) => ['', 'newest', 'oldest'].includes(value),\n\t\t},\n\n\t\t/** Maximum rows to render. */\n\t\tmaxDisplay: { type: Number, default: 5 },\n\t\t/**\n\t\t * `stacked` (DqTaak \"Historie\"): the action, then one muted line under\n\t\t * it with the moment (\"6 okt 09:05\") and who, when the action does not\n\t\t * already name them. Default: the moment beside the action, who under it.\n\t\t * `dated` (PqJourney \"Geschiedenis\"): a two-column list, the short date\n\t\t * (\"2 okt\") beside what happened; who shows only where the action's\n\t\t * label names them (`{actor}`).\n\t\t */\n\t\tlayout: { type: String, default: '' },\n\t\t/**\n\t\t * `compact` draws the rows closer together: in the board look a\n\t\t * stacked row 10px above and below (DqZaaktype \"Historie\") instead of\n\t\t * 12px (DqTaak). Default: the layout's own spacing.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-compact-stacked-rows/specs/audit-trail/spec.md#requirement-a-stacked-audit-card-can-draw-compact-rows\n\t\t */\n\t\tdensity: { type: String, default: '' },\n\t\t/**\n\t\t * Actions the card leaves out (case-insensitive), such as `['read']`\n\t\t * for a history of what changed. It then reads more entries than it\n\t\t * shows, so the rows it leaves out do not crowd the rest away.\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-exclude-actions/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-events-by-action\n\t\t */\n\t\texcludeActions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Actors the card leaves out by user id (case-insensitive), such as\n\t\t * `['System']` for a history of what people did: the bookkeeping a\n\t\t * background job writes is not shown.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-exclude-actors/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-entries-by-actor\n\t\t */\n\t\texcludeActors: { type: Array, default: () => [] },\n\t\t/** Whether the card collapses. */\n\t\tcollapsible: { type: Boolean, default: false },\n\t\t/** Override the card title (defaults to the translated label). */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Pre-translated empty label. */\n\t\tnoEntriesLabel: { type: String, default: () => t('nextcloud-vue', 'No audit entries yet') },\n\t\t/** Pre-translated overflow label. */\n\t\tshowAllLabel: { type: String, default: () => t('nextcloud-vue', 'Show all') },\n\t\t/** Pre-translated fallback action label. */\n\t\tactionLabel: { type: String, default: () => t('nextcloud-vue', 'Change') },\n\t\t/** Shown on an entry the server refused (`authorized: false`). */\n\t\trefusedLabel: { type: String, default: () => t('nextcloud-vue', '(refused)') },\n\t\t/**\n\t\t * What happened, in words, by action (`claim`) or by action and the\n\t\t * state it led to (`complete:completed`, tried first). `{actor}`,\n\t\t * `{state}` and `{changed.<key>}` (a value the entry recorded, a dotted key\n\t\t * reading into it such as `{changed.data.fileName}`, in the\n\t\t * words of `valueLabels`) are filled in; a label that names the actor leaves it off\n\t\t * the line under it. An action without a label shows as written.\n\t\t *\n\t\t * @type {Object<string, string>|null}\n\t\t */\n\t\tactionLabels: { type: Object, default: null },\n\t\t/**\n\t\t * Words for the values an action label quotes as `{changed.<key>}`:\n\t\t * `{ purpose: { handling: 'Handling' } }`. A value without an entry\n\t\t * shows as written.\n\t\t *\n\t\t * @type {{[key: string]: {[value: string]: string}}|null}\n\t\t */\n\t\tvalueLabels: { type: Object, default: null },\n\t\t/**\n\t\t * What happened, in words, by the field an entry changed: rules\n\t\t * `[{ action?, field, to?, label }]`, the first whose `field` the entry\n\t\t * changed (to `to`, when given) wins over `actionLabels`. A label fills\n\t\t * the same tokens, plus `{object.<path>}` from `object`\n\t\t * (\"Version {object.version} published\" for `isDraft` set to false).\n\t\t *\n\t\t * @type {Array<{action?: string, field: string, to?: unknown, label: string}>}\n\t\t */\n\t\tchangeLabels: { type: Array, default: () => [] },\n\t\t/** The audited record, for `{object.<path>}` in a label; null without one. */\n\t\tobject: { type: Object, default: null },\n\t\t/**\n\t\t * Records beside the object whose events belong in its history:\n\t\t * `[{ as, register, schema, filter, limit? }]`. The card lists the\n\t\t * objects matching `filter` (`@objectId` is this object; at most\n\t\t * `limit`, default 5), reads their trails and merges the entries with\n\t\t * the object's own, newest first. A related entry is labelled by\n\t\t * `actionLabels[\"<as>.<action>\"]` first. Object scope only.\n\t\t *\n\t\t * @type {Array<{as: string, register: string, schema: string, filter?: object, limit?: number}>}\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\trelatedSources: { type: Array, default: () => [] },\n\t\t/** Shown when a `source` or `endpoint` read failed. */\n\t\tfailedLabel: { type: String, default: () => t('nextcloud-vue', 'The history could not be loaded') },\n\t},\n\n\temits: ['show-all'],\n\n\tdata() {\n\t\treturn {\n\t\t\tHistory: markRaw(History),\n\t\t\tentries: [],\n\t\t\tloading: false,\n\t\t\t/** A `source` or `endpoint` read failed: said, rather than shown as an empty trail. */\n\t\t\tfailed: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tresolvedTitle() {\n\t\t\treturn this.title || t('nextcloud-vue', 'Audit trail')\n\t\t},\n\n\t\t/**\n\t\t * The entries without the excluded actions and actors, and without an\n\t\t * update that changed nothing: a re-save whose `changed` holds no field\n\t\t * whose old and new value differ (only `@self` bookkeeping) is not\n\t\t * something that happened to the record.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tshownEntries() {\n\t\t\treturn keepAuditEntries(this.entries, { excludeActions: this.excludeActions, excludeActors: this.excludeActors })\n\t\t},\n\n\t\t/** @return {boolean} Whether the card leaves entries out, and so reads more than it shows. */\n\t\tfiltersEntries() {\n\t\t\treturn this.excludeActions.length > 0 || this.excludeActors.length > 0\n\t\t},\n\n\t\tdisplayedEntries() {\n\t\t\tconst entries = this.oldestFirst ? [...this.shownEntries].sort((a, b) => entryTime(a) - entryTime(b)) : this.shownEntries\n\t\t\treturn entries.slice(0, this.maxDisplay)\n\t\t},\n\n\t\t/**\n\t\t * The trail URL a `source` or `endpoint` names, '' while its record id\n\t\t * is unknown, or null when the card reads an object.\n\t\t *\n\t\t * @return {string|null}\n\t\t * @spec openspec/changes/leaf-cards-read-a-source/specs/leaf-cards-read-a-source/spec.md#requirement-a-leaf-card-reads-a-source-or-an-endpoint\n\t\t */\n\t\tsourceUrl() {\n\t\t\treturn leafSourceUrl({ source: this.source, endpoint: this.endpoint, apiBase: this.apiBase, objectId: this.objectId }, 'audit')\n\t\t},\n\n\t\t/** @return {boolean} Whether the entries read oldest first. */\n\t\toldestFirst() {\n\t\t\treturn this.order === 'oldest' || (this.order === '' && this.sourceUrl !== null)\n\t\t},\n\n\t\t/**\n\t\t * The path the card reads (prefixed at fetch time), or '' when it has nothing to read: the\n\t\t * object's own trail, or the app-wide readable feed narrowed to the\n\t\t * register and schema when set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {string}\n\t\t */\n\t\tfetchUrl() {\n\t\t\tif (this.sourceUrl !== null) {\n\t\t\t\treturn this.sourceUrl\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst params = new URLSearchParams({ limit: String(limit) })\n\t\t\tif (this.scope === 'app') {\n\t\t\t\tif (this.register) {\n\t\t\t\t\tparams.set('register', this.register)\n\t\t\t\t}\n\t\t\t\tif (this.schema) {\n\t\t\t\t\tparams.set('schema', this.schema)\n\t\t\t\t}\n\t\t\t\treturn `${this.apiBase}/audit-trails/readable?${params.toString()}`\n\t\t\t}\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tthis.addExclusions(params)\n\t\t\treturn `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails?${params.toString()}`\n\t\t},\n\t},\n\n\twatch: {\n\t\tfetchUrl: {\n\t\t\timmediate: true,\n\t\t\thandler(url) {\n\t\t\t\tif (url) {\n\t\t\t\t\tthis.fetchEntries()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Ask an object trail to leave out the excluded actions and actors in\n\t\t * the query (`action[notIn]`, `user[notIn]`), so its pages hold what the\n\t\t * card shows. `keepAuditEntries` still filters what comes back.\n\t\t *\n\t\t * @param {URLSearchParams} params The trail query, changed in place.\n\t\t * @return {void}\n\t\t * @spec openspec/changes/audit-card-exclusions-in-the-query/specs/audit-trail/spec.md#requirement-a-history-card-asks-the-trail-to-leave-out-what-it-hides\n\t\t */\n\t\taddExclusions(params) {\n\t\t\tfor (const [key, value] of Object.entries(auditExclusionParams({ excludeActions: this.excludeActions, excludeActors: this.excludeActors }))) {\n\t\t\t\tparams.set(key, value)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read the entries from `fetchUrl`. The readable feed answers\n\t\t * `{ rows, nextCursor }`, the object trail `{ results }`.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync fetchEntries() {\n\t\t\tconst url = this.fetchUrl\n\t\t\tif (!url) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.failed = false\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\t\tconst own = await this.withFollowingPages(url, Array.isArray(list) ? list : [])\n\t\t\t\t\tconst related = await this.fetchRelatedEntries()\n\t\t\t\t\tthis.entries = related.length > 0\n\t\t\t\t\t\t? [...own, ...related].sort((a, b) => entryTime(b) - entryTime(a))\n\t\t\t\t\t\t: own\n\t\t\t\t} else {\n\t\t\t\t\tthis.entries = []\n\t\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnAuditTrailCard] failed to fetch audit trail', err)\n\t\t\t\tthis.entries = []\n\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * An object's trail read on until it holds enough entries to show. The\n\t\t * card leaves entries out (reads, actors, empty re-saves) after\n\t\t * reading, and every page view writes a read, so the newest page alone\n\t\t * can be all reads (DqHandhaving Historie: \"no changes yet\"). Reads at\n\t\t * most four more pages.\n\t\t *\n\t\t * @param {string} url The first page's path.\n\t\t * @param {Array<object>} first The first page's entries.\n\t\t * @return {Promise<Array<object>>} The entries read.\n\t\t */\n\t\tasync withFollowingPages(url, first) {\n\t\t\tconst entries = [...first]\n\t\t\tif (!this.filtersEntries || this.scope !== 'object' || this.sourceUrl !== null) {\n\t\t\t\treturn entries\n\t\t\t}\n\t\t\tconst limit = Number(new URLSearchParams(url.split('?')[1] || '').get('limit')) || first.length\n\t\t\tlet page = first\n\t\t\tfor (let more = 0; more < 4 && page.length >= limit && limit > 0; more++) {\n\t\t\t\tthis.entries = [...entries]\n\t\t\t\tif (this.shownEntries.length >= this.maxDisplay) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst next = new URL(url, 'http://x')\n\t\t\t\tnext.searchParams.set('offset', String(entries.length))\n\t\t\t\tconst response = await fetch(prefixUrl(next.pathname + next.search), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\tpage = Array.isArray(list) ? list : []\n\t\t\t\tentries.push(...page)\n\t\t\t}\n\t\t\treturn [...entries]\n\t\t},\n\n\t\t/**\n\t\t * The entries of the records beside the object (`relatedSources`),\n\t\t * each tagged with its source's `as`. A read that fails leaves that\n\t\t * source out.\n\t\t *\n\t\t * @return {Promise<Array<object>>} The entries.\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\tasync fetchRelatedEntries() {\n\t\t\tif (this.scope !== 'object' || this.sourceUrl !== null || !this.objectId || !Array.isArray(this.relatedSources)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst read = async (url) => {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(String(response.status))\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\treturn Array.isArray(list) ? list : []\n\t\t\t}\n\t\t\tconst perSource = await Promise.all(this.relatedSources\n\t\t\t\t.filter((source) => source && source.register && source.schema)\n\t\t\t\t.map(async (source) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst params = new URLSearchParams({ _limit: String(Number(source.limit) > 0 ? Number(source.limit) : 5), _order: JSON.stringify({ '@self.created': 'DESC' }) })\n\t\t\t\t\t\tfor (const [key, value] of Object.entries(source.filter || {})) {\n\t\t\t\t\t\t\tparams.set(key, value === '@objectId' ? this.objectId : String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst objects = await read(`${this.apiBase}/objects/${source.register}/${source.schema}?${params.toString()}`)\n\t\t\t\t\t\tconst ids = objects.map((object) => object?.id || object?.['@self']?.id || object?.uuid).filter(Boolean)\n\t\t\t\t\t\tconst trailParams = new URLSearchParams({ limit: String(limit) })\n\t\t\t\t\t\tthis.addExclusions(trailParams)\n\t\t\t\t\t\tconst trails = await Promise.all(ids.map((id) => read(`${this.apiBase}/objects/${source.register}/${source.schema}/${id}/audit-trails?${trailParams.toString()}`).catch(() => [])))\n\t\t\t\t\t\treturn trails.flat().map((entry) => ({ ...entry, relatedAs: source.as || source.schema }))\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\treturn perSource.flat()\n\t\t},\n\n\t\t/**\n\t\t * What happened: the action, with the state it led to when the entry\n\t\t * names one (a flow task's `stateAfter`).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatAction(entry) {\n\t\t\tconst label = this.changeLabelFor(entry) ?? this.labelFor(entry)\n\t\t\tif (label !== null) {\n\t\t\t\treturn fillAuditLabel(label, entry, { actor: this.actorName(entry), object: this.object, valueLabels: this.valueLabels })\n\t\t\t}\n\t\t\tconst action = entry.action || entry.event || this.actionLabel\n\t\t\treturn entry.stateAfter ? `${action} (${entry.stateAfter})` : action\n\t\t},\n\n\t\t/**\n\t\t * A value the entry recorded under `changed` (an audit entry's context),\n\t\t * in the words of `valueLabels`; '' when it recorded none.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @param {string} key The recorded key.\n\t\t * @return {string} The value in words.\n\t\t * @spec openspec/changes/audit-label-changed-values/specs/audit-trail/spec.md#requirement-a-trail-label-can-quote-what-the-entry-recorded\n\t\t */\n\t\tchangedValue(entry, key) {\n\t\t\treturn changedValue(entry, key, this.valueLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `changeLabels` rule an entry matches: the first whose field the\n\t\t * entry changed, for its action and to its value when the rule names them.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when no rule matches.\n\t\t */\n\t\tchangeLabelFor(entry) {\n\t\t\treturn changeLabelFor(entry, this.changeLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `actionLabels` entry for an entry: by action and state first,\n\t\t * then by action.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when none is declared.\n\t\t * @spec openspec/changes/audit-trail-action-labels/specs/audit-trail/spec.md#requirement-a-trail-can-say-what-happened-in-words\n\t\t */\n\t\tlabelFor(entry) {\n\t\t\treturn actionLabelFor(entry, this.actionLabels, this.object)\n\t\t},\n\n\t\t/**\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} Who did it, by name where the entry carries one.\n\t\t */\n\t\tactorName(entry) {\n\t\t\tif (entry.actorDisplayName) {\n\t\t\t\treturn entry.actorDisplayName\n\t\t\t}\n\t\t\tconst id = entry.actor || entry.userId || entry.user || ''\n\t\t\t// A person's user id reads as their display name once it is known.\n\t\t\treturn (id && (!entry.performerType || entry.performerType === 'user') && userDisplayName(String(id))) || id\n\t\t},\n\n\t\t/**\n\t\t * The date of a dated list's entry in the board's short form (\"2 okt\").\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The date, or '' without one.\n\t\t * @spec openspec/changes/audit-card-dated-layout/specs/audit-trail/spec.md#requirement-an-audit-list-can-put-the-date-beside-what-happened\n\t\t */\n\t\tshortDate(entry) {\n\t\t\treturn formatBoardDate(entry.creationDateTime || entry.created || entry.timestamp)\n\t\t},\n\n\t\t/**\n\t\t * The muted line of a stacked row: the moment in the board's short\n\t\t * form (\"6 okt 09:05\") and who, unless the action names them already.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t * @spec openspec/changes/audit-card-stacked-rows/specs/audit-trail/spec.md#requirement-an-audit-row-can-put-its-moment-under-the-action\n\t\t */\n\t\tstackedLine(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tconst date = raw ? new Date(raw) : null\n\t\t\tconst when = date && !Number.isNaN(date.getTime()) ? `${formatBoardDate(date)} ${formatTimeOfDay(date)}` : ''\n\t\t\treturn [when, this.formatActor(entry)].filter((part) => part !== '').join(' · ')\n\t\t},\n\n\t\t/**\n\t\t * Who did it: the actor, the kind of performer when it is not a\n\t\t * person (a flow, the system), and on whose behalf.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatActor(entry) {\n\t\t\tconst named = (this.labelFor(entry) || '').includes('{actor}')\n\t\t\tconst parts = [named ? '' : this.actorName(entry)]\n\t\t\tif (entry.performerType && entry.performerType !== 'user') {\n\t\t\t\tparts.push(`(${entry.performerType})`)\n\t\t\t}\n\t\t\tif (entry.onBehalfOf) {\n\t\t\t\tparts.push(t('nextcloud-vue', 'on behalf of {name}', { name: entry.onBehalfOf }))\n\t\t\t}\n\t\t\treturn parts.filter((part) => part !== '').join(' ')\n\t\t},\n\n\t\tformatWhen(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tif (raw === undefined || raw === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst d = new Date(raw)\n\t\t\tif (Number.isNaN(d.getTime()) === true) {\n\t\t\t\treturn String(raw)\n\t\t\t}\n\t\t\treturn d.toLocaleString(userLocale())\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-audit-card__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Nextcloud core pads and aligns `dt` / `dd`; the list resets both. */\n.cn-audit-card__dated {\n\tdisplay: grid;\n\tgrid-template-columns: max-content minmax(0, 1fr);\n\tgap: 8px 16px;\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 14px;\n}\n\n.cn-audit-card__dated .cn-audit-card__date {\n\twidth: auto;\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-audit-card__dated .cn-audit-card__dated-text {\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__row {\n\tpadding: 6px 0;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-audit-card__row:last-child {\n\tborder-bottom: none;\n}\n\n.cn-audit-card__row-head {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-audit-card__action {\n\tcolor: var(--color-main-text);\n}\n\n.cn-audit-card__when {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\twhite-space: nowrap;\n}\n\n.cn-audit-card__row-body {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-audit-card__refused {\n\tmargin-inline-start: 6px;\n\tfont-weight: 700;\n\tcolor: var(--color-error-text, var(--color-main-text));\n}\n\n.cn-audit-card__reason {\n\tmargin: 2px 0 0;\n\tfont-size: 0.9em;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__empty {\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n\tpadding: 12px 0;\n}\n\n.cn-audit-card__footnote {\n\tmargin: 12px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-audit-card__show-all {\n\tbackground: none;\n\tborder: none;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tpadding: 4px 0;\n\tfont: inherit;\n}\n\n.cn-audit-card__show-all:hover {\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["CnDetailCard","t"],"mappings":";;;;;;;;;;;;;AA2FA;AACC;;;AAGD,SAAS,SAAS,CAAC,KAAK,EAAE;AACzB,CAAA,MAAM,IAAG,GAAI,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,KAAK,CAAC,OAAM,IAAK,KAAK,CAAC,SAAQ,IAAK,CAAC,CAAC,CAAC,OAAO,GAAC;AAC/F,CAAA,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE,GAAE,CAAE,GAAE,IAAG;AACpC,CAAA;;AAEA;;;AAGC;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAED,aAAe;CACd,IAAI,EAAE,kBAAkB;;AAExB,CAAA,UAAU,EAAE,gBAAEA,UAAY,EAAE,eAAe;;AAE3C,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;;AAED,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACvC;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACvC;AACA,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACrC;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACvC;;;;;;AAMC;AACA;;AAED,EAAA,KAAK,EAAE;GACN,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,QAAQ;GACjB,SAAS,EAAE,CAAC,KAAK,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ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C;EACD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnAuditTrailCard.vue3.js","sources":["../../../../src/components/CnAuditTrailCard/CnAuditTrailCard.vue?vue&type=template&id=c8572210&lang.js"],"sourcesContent":["<!--\n CnAuditTrailCard — compact audit-trail widget for the integration\n registry.\n\n Surface-aware shell around the `audit-trail` integration: fetches\n the object's recent audit-trail entries (query-time storage strategy\n per AD-22) and renders them in a CnDetailCard.\n\n Per umbrella change `pluggable-integration-registry` AD-19 (surface\n fallback), one component handles all surfaces — `surface` is\n forwarded so the component can branch internally if desired.\n-->\n<template>\n\t<CnDetailCard\n\t\t:title=\"resolvedTitle\"\n\t\t:icon=\"History\"\n\t\t:collapsible=\"collapsible\"\n\t\t:data-surface=\"surface\">\n\t\t<NcLoadingIcon v-if=\"loading\" />\n\t\t<p v-else-if=\"failed\"\n\t\t\tclass=\"cn-audit-card__empty\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-audit-card-failed\">\n\t\t\t{{ failedLabel }}\n\t\t</p>\n\t\t<div v-else-if=\"shownEntries.length === 0\" class=\"cn-audit-card__empty\">\n\t\t\t{{ noEntriesLabel }}\n\t\t</div>\n\t\t<!-- `dated` (PqJourney \"Geschiedenis\"): the short date beside what\n\t\t happened, one line per entry. -->\n\t\t<dl v-else-if=\"layout === 'dated'\" class=\"cn-audit-card__dated\">\n\t\t\t<template v-for=\"entry in displayedEntries\" :key=\"entry.id\">\n\t\t\t\t<dt class=\"cn-audit-card__date\">\n\t\t\t\t\t{{ shortDate(entry) }}\n\t\t\t\t</dt>\n\t\t\t\t<dd class=\"cn-audit-card__dated-text\">\n\t\t\t\t\t{{ formatAction(entry) }}<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</dd>\n\t\t\t</template>\n\t\t</dl>\n\t\t<ul v-else class=\"cn-audit-card__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"entry in displayedEntries\"\n\t\t\t\t:key=\"entry.id\"\n\t\t\t\tclass=\"cn-audit-card__row\"\n\t\t\t\t:class=\"{ 'cn-audit-card__row--stacked': layout === 'stacked', 'cn-audit-card__row--compact': density === 'compact' }\">\n\t\t\t\t<div class=\"cn-audit-card__row-head\">\n\t\t\t\t\t<strong class=\"cn-audit-card__action\">{{ formatAction(entry) }}</strong>\n\t\t\t\t\t<span v-if=\"layout !== 'stacked'\" class=\"cn-audit-card__when\">{{ formatWhen(entry) }}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cn-audit-card__row-body\">\n\t\t\t\t\t<span v-if=\"layout === 'stacked'\" class=\"cn-audit-card__when\" data-testid=\"cn-audit-card-when-below\">{{ stackedLine(entry) }}</span>\n\t\t\t\t\t<span v-else class=\"cn-audit-card__actor\">{{ formatActor(entry) }}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</div>\n\t\t\t\t<p v-if=\"entry.reason\" class=\"cn-audit-card__reason\">\n\t\t\t\t\t{{ entry.reason }}\n\t\t\t\t</p>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-if=\"footnote\" class=\"cn-audit-card__footnote\" data-testid=\"cn-audit-trail-widget-footnote\">\n\t\t\t{{ footnote }}\n\t\t</p>\n\t\t<template v-if=\"shownEntries.length > maxDisplay\" #footer>\n\t\t\t<button class=\"cn-audit-card__show-all\" @click=\"$emit('show-all')\">\n\t\t\t\t{{ showAllLabel }} ({{ shownEntries.length }})\n\t\t\t</button>\n\t\t</template>\n\t</CnDetailCard>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcLoadingIcon } from '@nextcloud/vue'\nimport { markRaw } from 'vue'\nimport History from 'vue-material-design-icons/History.vue'\nimport CnDetailCard from '../CnDetailCard/CnDetailCard.vue'\nimport { keepAuditEntries } from '../../utils/auditEntries.js'\nimport { actionLabelFor, changedValue, changeLabelFor, fillAuditLabel } from '../../utils/auditLabels.js'\nimport { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { leafSourceUrl } from '../../utils/leafSourceUrl.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\n/**\n * @param {object} entry An audit entry.\n * @return {number} When it happened, in ms; 0 when unreadable.\n */\nfunction entryTime(entry) {\n\tconst time = new Date(entry.creationDateTime || entry.created || entry.timestamp || 0).getTime()\n\treturn Number.isNaN(time) ? 0 : time\n}\n\n/**\n * CnAuditTrailCard — compact audit-trail widget rendered by the\n * integration registry on dashboard and detail surfaces.\n *\n * Basic usage\n * ```vue\n * <CnAuditTrailCard\n * :register=\"registerId\"\n * :schema=\"schemaId\"\n * :object-id=\"objectId\"\n * surface=\"detail-page\" />\n * ```\n */\nexport default {\n\tname: 'CnAuditTrailCard',\n\n\tcomponents: { CnDetailCard, NcLoadingIcon },\n\n\tprops: {\n\t\t/**\n\t\t * A muted line under the trail, inside the card (\"Kenmerk ZT-OMV-REG\").\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-footnote/specs/audit-trail/spec.md#requirement-a-history-card-can-end-in-a-line-about-the-record\n\t\t */\n\t\tfootnote: { type: String, default: '' },\n\t\t/** OpenRegister register id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tschema: { type: String, default: '' },\n\t\t/** Parent object id. Required for `scope: \"object\"` (the default); unused for `scope: \"app\"`. */\n\t\tobjectId: { type: String, default: '' },\n\t\t/**\n\t\t * What the card lists. `object` (the default) is one object's trail\n\t\t * and needs `register`, `schema` and `objectId`. `app` is the\n\t\t * app-wide feed: the entries of every object the caller may read\n\t\t * (OpenRegister's `/audit-trails/readable`), narrowed to `register`\n\t\t * and `schema` when those are set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t */\n\t\tscope: {\n\t\t\ttype: String,\n\t\t\tdefault: 'object',\n\t\t\tvalidator: (value) => ['object', 'app'].includes(value),\n\t\t},\n\n\t\t/** Rendering surface — passed for AD-19 surface fallback consumers. */\n\t\tsurface: {\n\t\t\ttype: String,\n\t\t\tdefault: 'detail-page',\n\t\t\tvalidator: (value) => ['user-dashboard', 'app-dashboard', 'detail-page', 'single-entity'].includes(value),\n\t\t},\n\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\n\t\t/**\n\t\t * Read the trail of something that is not an OpenRegister object:\n\t\t * `{ kind: 'flow-task', id }` reads `${apiBase}/flow-tasks/{id}/audit`,\n\t\t * oldest first. `id` may be left out or written `@objectId`.\n\t\t *\n\t\t * @type {{kind: string, id?: (string|number)}|null}\n\t\t */\n\t\tsource: { type: Object, default: null },\n\n\t\t/** A trail URL that replaces the object's own; `{id}` is filled with the source's id or `objectId`. */\n\t\tendpoint: { type: String, default: '' },\n\n\t\t/** `newest` first (the object trail's order) or `oldest` first; empty takes `oldest` for a source and `newest` otherwise. */\n\t\torder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t\tvalidator: (value) => ['', 'newest', 'oldest'].includes(value),\n\t\t},\n\n\t\t/** Maximum rows to render. */\n\t\tmaxDisplay: { type: Number, default: 5 },\n\t\t/**\n\t\t * `stacked` (DqTaak \"Historie\"): the action, then one muted line under\n\t\t * it with the moment (\"6 okt 09:05\") and who, when the action does not\n\t\t * already name them. Default: the moment beside the action, who under it.\n\t\t * `dated` (PqJourney \"Geschiedenis\"): a two-column list, the short date\n\t\t * (\"2 okt\") beside what happened; who shows only where the action's\n\t\t * label names them (`{actor}`).\n\t\t */\n\t\tlayout: { type: String, default: '' },\n\t\t/**\n\t\t * `compact` draws the rows closer together: in the board look a\n\t\t * stacked row 10px above and below (DqZaaktype \"Historie\") instead of\n\t\t * 12px (DqTaak). Default: the layout's own spacing.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-compact-stacked-rows/specs/audit-trail/spec.md#requirement-a-stacked-audit-card-can-draw-compact-rows\n\t\t */\n\t\tdensity: { type: String, default: '' },\n\t\t/**\n\t\t * Actions the card leaves out (case-insensitive), such as `['read']`\n\t\t * for a history of what changed. It then reads more entries than it\n\t\t * shows, so the rows it leaves out do not crowd the rest away.\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-exclude-actions/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-events-by-action\n\t\t */\n\t\texcludeActions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Actors the card leaves out by user id (case-insensitive), such as\n\t\t * `['System']` for a history of what people did: the bookkeeping a\n\t\t * background job writes is not shown.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-exclude-actors/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-entries-by-actor\n\t\t */\n\t\texcludeActors: { type: Array, default: () => [] },\n\t\t/** Whether the card collapses. */\n\t\tcollapsible: { type: Boolean, default: false },\n\t\t/** Override the card title (defaults to the translated label). */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Pre-translated empty label. */\n\t\tnoEntriesLabel: { type: String, default: () => t('nextcloud-vue', 'No audit entries yet') },\n\t\t/** Pre-translated overflow label. */\n\t\tshowAllLabel: { type: String, default: () => t('nextcloud-vue', 'Show all') },\n\t\t/** Pre-translated fallback action label. */\n\t\tactionLabel: { type: String, default: () => t('nextcloud-vue', 'Change') },\n\t\t/** Shown on an entry the server refused (`authorized: false`). */\n\t\trefusedLabel: { type: String, default: () => t('nextcloud-vue', '(refused)') },\n\t\t/**\n\t\t * What happened, in words, by action (`claim`) or by action and the\n\t\t * state it led to (`complete:completed`, tried first). `{actor}`,\n\t\t * `{state}` and `{changed.<key>}` (a value the entry recorded, a dotted key\n\t\t * reading into it such as `{changed.data.fileName}`, in the\n\t\t * words of `valueLabels`) are filled in; a label that names the actor leaves it off\n\t\t * the line under it. An action without a label shows as written.\n\t\t *\n\t\t * @type {Object<string, string>|null}\n\t\t */\n\t\tactionLabels: { type: Object, default: null },\n\t\t/**\n\t\t * Words for the values an action label quotes as `{changed.<key>}`:\n\t\t * `{ purpose: { handling: 'Handling' } }`. A value without an entry\n\t\t * shows as written.\n\t\t *\n\t\t * @type {{[key: string]: {[value: string]: string}}|null}\n\t\t */\n\t\tvalueLabels: { type: Object, default: null },\n\t\t/**\n\t\t * What happened, in words, by the field an entry changed: rules\n\t\t * `[{ action?, field, to?, label }]`, the first whose `field` the entry\n\t\t * changed (to `to`, when given) wins over `actionLabels`. A label fills\n\t\t * the same tokens, plus `{object.<path>}` from `object`\n\t\t * (\"Version {object.version} published\" for `isDraft` set to false).\n\t\t *\n\t\t * @type {Array<{action?: string, field: string, to?: unknown, label: string}>}\n\t\t */\n\t\tchangeLabels: { type: Array, default: () => [] },\n\t\t/** The audited record, for `{object.<path>}` in a label; null without one. */\n\t\tobject: { type: Object, default: null },\n\t\t/**\n\t\t * Records beside the object whose events belong in its history:\n\t\t * `[{ as, register, schema, filter, limit? }]`. The card lists the\n\t\t * objects matching `filter` (`@objectId` is this object; at most\n\t\t * `limit`, default 5), reads their trails and merges the entries with\n\t\t * the object's own, newest first. A related entry is labelled by\n\t\t * `actionLabels[\"<as>.<action>\"]` first. Object scope only.\n\t\t *\n\t\t * @type {Array<{as: string, register: string, schema: string, filter?: object, limit?: number}>}\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\trelatedSources: { type: Array, default: () => [] },\n\t\t/** Shown when a `source` or `endpoint` read failed. */\n\t\tfailedLabel: { type: String, default: () => t('nextcloud-vue', 'The history could not be loaded') },\n\t},\n\n\temits: ['show-all'],\n\n\tdata() {\n\t\treturn {\n\t\t\tHistory: markRaw(History),\n\t\t\tentries: [],\n\t\t\tloading: false,\n\t\t\t/** A `source` or `endpoint` read failed: said, rather than shown as an empty trail. */\n\t\t\tfailed: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tresolvedTitle() {\n\t\t\treturn this.title || t('nextcloud-vue', 'Audit trail')\n\t\t},\n\n\t\t/**\n\t\t * The entries without the excluded actions and actors, and without an\n\t\t * update that changed nothing: a re-save whose `changed` holds no field\n\t\t * whose old and new value differ (only `@self` bookkeeping) is not\n\t\t * something that happened to the record.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tshownEntries() {\n\t\t\treturn keepAuditEntries(this.entries, { excludeActions: this.excludeActions, excludeActors: this.excludeActors })\n\t\t},\n\n\t\t/** @return {boolean} Whether the card leaves entries out, and so reads more than it shows. */\n\t\tfiltersEntries() {\n\t\t\treturn this.excludeActions.length > 0 || this.excludeActors.length > 0\n\t\t},\n\n\t\tdisplayedEntries() {\n\t\t\tconst entries = this.oldestFirst ? [...this.shownEntries].sort((a, b) => entryTime(a) - entryTime(b)) : this.shownEntries\n\t\t\treturn entries.slice(0, this.maxDisplay)\n\t\t},\n\n\t\t/**\n\t\t * The trail URL a `source` or `endpoint` names, '' while its record id\n\t\t * is unknown, or null when the card reads an object.\n\t\t *\n\t\t * @return {string|null}\n\t\t * @spec openspec/changes/leaf-cards-read-a-source/specs/leaf-cards-read-a-source/spec.md#requirement-a-leaf-card-reads-a-source-or-an-endpoint\n\t\t */\n\t\tsourceUrl() {\n\t\t\treturn leafSourceUrl({ source: this.source, endpoint: this.endpoint, apiBase: this.apiBase, objectId: this.objectId }, 'audit')\n\t\t},\n\n\t\t/** @return {boolean} Whether the entries read oldest first. */\n\t\toldestFirst() {\n\t\t\treturn this.order === 'oldest' || (this.order === '' && this.sourceUrl !== null)\n\t\t},\n\n\t\t/**\n\t\t * The path the card reads (prefixed at fetch time), or '' when it has nothing to read: the\n\t\t * object's own trail, or the app-wide readable feed narrowed to the\n\t\t * register and schema when set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {string}\n\t\t */\n\t\tfetchUrl() {\n\t\t\tif (this.sourceUrl !== null) {\n\t\t\t\treturn this.sourceUrl\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst params = new URLSearchParams({ limit: String(limit) })\n\t\t\tif (this.scope === 'app') {\n\t\t\t\tif (this.register) {\n\t\t\t\t\tparams.set('register', this.register)\n\t\t\t\t}\n\t\t\t\tif (this.schema) {\n\t\t\t\t\tparams.set('schema', this.schema)\n\t\t\t\t}\n\t\t\t\treturn `${this.apiBase}/audit-trails/readable?${params.toString()}`\n\t\t\t}\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails?${params.toString()}`\n\t\t},\n\t},\n\n\twatch: {\n\t\tfetchUrl: {\n\t\t\timmediate: true,\n\t\t\thandler(url) {\n\t\t\t\tif (url) {\n\t\t\t\t\tthis.fetchEntries()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Read the entries from `fetchUrl`. The readable feed answers\n\t\t * `{ rows, nextCursor }`, the object trail `{ results }`.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync fetchEntries() {\n\t\t\tconst url = this.fetchUrl\n\t\t\tif (!url) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.failed = false\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\t\tconst own = await this.withFollowingPages(url, Array.isArray(list) ? list : [])\n\t\t\t\t\tconst related = await this.fetchRelatedEntries()\n\t\t\t\t\tthis.entries = related.length > 0\n\t\t\t\t\t\t? [...own, ...related].sort((a, b) => entryTime(b) - entryTime(a))\n\t\t\t\t\t\t: own\n\t\t\t\t} else {\n\t\t\t\t\tthis.entries = []\n\t\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnAuditTrailCard] failed to fetch audit trail', err)\n\t\t\t\tthis.entries = []\n\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * An object's trail read on until it holds enough entries to show. The\n\t\t * card leaves entries out (reads, actors, empty re-saves) after\n\t\t * reading, and every page view writes a read, so the newest page alone\n\t\t * can be all reads (DqHandhaving Historie: \"no changes yet\"). Reads at\n\t\t * most four more pages.\n\t\t *\n\t\t * @param {string} url The first page's path.\n\t\t * @param {Array<object>} first The first page's entries.\n\t\t * @return {Promise<Array<object>>} The entries read.\n\t\t */\n\t\tasync withFollowingPages(url, first) {\n\t\t\tconst entries = [...first]\n\t\t\tif (!this.filtersEntries || this.scope !== 'object' || this.sourceUrl !== null) {\n\t\t\t\treturn entries\n\t\t\t}\n\t\t\tconst limit = Number(new URLSearchParams(url.split('?')[1] || '').get('limit')) || first.length\n\t\t\tlet page = first\n\t\t\tfor (let more = 0; more < 4 && page.length >= limit && limit > 0; more++) {\n\t\t\t\tthis.entries = [...entries]\n\t\t\t\tif (this.shownEntries.length >= this.maxDisplay) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst next = new URL(url, 'http://x')\n\t\t\t\tnext.searchParams.set('offset', String(entries.length))\n\t\t\t\tconst response = await fetch(prefixUrl(next.pathname + next.search), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\tpage = Array.isArray(list) ? list : []\n\t\t\t\tentries.push(...page)\n\t\t\t}\n\t\t\treturn [...entries]\n\t\t},\n\n\t\t/**\n\t\t * The entries of the records beside the object (`relatedSources`),\n\t\t * each tagged with its source's `as`. A read that fails leaves that\n\t\t * source out.\n\t\t *\n\t\t * @return {Promise<Array<object>>} The entries.\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\tasync fetchRelatedEntries() {\n\t\t\tif (this.scope !== 'object' || this.sourceUrl !== null || !this.objectId || !Array.isArray(this.relatedSources)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst read = async (url) => {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(String(response.status))\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\treturn Array.isArray(list) ? list : []\n\t\t\t}\n\t\t\tconst perSource = await Promise.all(this.relatedSources\n\t\t\t\t.filter((source) => source && source.register && source.schema)\n\t\t\t\t.map(async (source) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst params = new URLSearchParams({ _limit: String(Number(source.limit) > 0 ? Number(source.limit) : 5), _order: JSON.stringify({ '@self.created': 'DESC' }) })\n\t\t\t\t\t\tfor (const [key, value] of Object.entries(source.filter || {})) {\n\t\t\t\t\t\t\tparams.set(key, value === '@objectId' ? this.objectId : String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst objects = await read(`${this.apiBase}/objects/${source.register}/${source.schema}?${params.toString()}`)\n\t\t\t\t\t\tconst ids = objects.map((object) => object?.id || object?.['@self']?.id || object?.uuid).filter(Boolean)\n\t\t\t\t\t\tconst trails = await Promise.all(ids.map((id) => read(`${this.apiBase}/objects/${source.register}/${source.schema}/${id}/audit-trails?limit=${limit}`).catch(() => [])))\n\t\t\t\t\t\treturn trails.flat().map((entry) => ({ ...entry, relatedAs: source.as || source.schema }))\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\treturn perSource.flat()\n\t\t},\n\n\t\t/**\n\t\t * What happened: the action, with the state it led to when the entry\n\t\t * names one (a flow task's `stateAfter`).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatAction(entry) {\n\t\t\tconst label = this.changeLabelFor(entry) ?? this.labelFor(entry)\n\t\t\tif (label !== null) {\n\t\t\t\treturn fillAuditLabel(label, entry, { actor: this.actorName(entry), object: this.object, valueLabels: this.valueLabels })\n\t\t\t}\n\t\t\tconst action = entry.action || entry.event || this.actionLabel\n\t\t\treturn entry.stateAfter ? `${action} (${entry.stateAfter})` : action\n\t\t},\n\n\t\t/**\n\t\t * A value the entry recorded under `changed` (an audit entry's context),\n\t\t * in the words of `valueLabels`; '' when it recorded none.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @param {string} key The recorded key.\n\t\t * @return {string} The value in words.\n\t\t * @spec openspec/changes/audit-label-changed-values/specs/audit-trail/spec.md#requirement-a-trail-label-can-quote-what-the-entry-recorded\n\t\t */\n\t\tchangedValue(entry, key) {\n\t\t\treturn changedValue(entry, key, this.valueLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `changeLabels` rule an entry matches: the first whose field the\n\t\t * entry changed, for its action and to its value when the rule names them.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when no rule matches.\n\t\t */\n\t\tchangeLabelFor(entry) {\n\t\t\treturn changeLabelFor(entry, this.changeLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `actionLabels` entry for an entry: by action and state first,\n\t\t * then by action.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when none is declared.\n\t\t * @spec openspec/changes/audit-trail-action-labels/specs/audit-trail/spec.md#requirement-a-trail-can-say-what-happened-in-words\n\t\t */\n\t\tlabelFor(entry) {\n\t\t\treturn actionLabelFor(entry, this.actionLabels, this.object)\n\t\t},\n\n\t\t/**\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} Who did it, by name where the entry carries one.\n\t\t */\n\t\tactorName(entry) {\n\t\t\tif (entry.actorDisplayName) {\n\t\t\t\treturn entry.actorDisplayName\n\t\t\t}\n\t\t\tconst id = entry.actor || entry.userId || entry.user || ''\n\t\t\t// A person's user id reads as their display name once it is known.\n\t\t\treturn (id && (!entry.performerType || entry.performerType === 'user') && userDisplayName(String(id))) || id\n\t\t},\n\n\t\t/**\n\t\t * The date of a dated list's entry in the board's short form (\"2 okt\").\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The date, or '' without one.\n\t\t * @spec openspec/changes/audit-card-dated-layout/specs/audit-trail/spec.md#requirement-an-audit-list-can-put-the-date-beside-what-happened\n\t\t */\n\t\tshortDate(entry) {\n\t\t\treturn formatBoardDate(entry.creationDateTime || entry.created || entry.timestamp)\n\t\t},\n\n\t\t/**\n\t\t * The muted line of a stacked row: the moment in the board's short\n\t\t * form (\"6 okt 09:05\") and who, unless the action names them already.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t * @spec openspec/changes/audit-card-stacked-rows/specs/audit-trail/spec.md#requirement-an-audit-row-can-put-its-moment-under-the-action\n\t\t */\n\t\tstackedLine(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tconst date = raw ? new Date(raw) : null\n\t\t\tconst when = date && !Number.isNaN(date.getTime()) ? `${formatBoardDate(date)} ${formatTimeOfDay(date)}` : ''\n\t\t\treturn [when, this.formatActor(entry)].filter((part) => part !== '').join(' · ')\n\t\t},\n\n\t\t/**\n\t\t * Who did it: the actor, the kind of performer when it is not a\n\t\t * person (a flow, the system), and on whose behalf.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatActor(entry) {\n\t\t\tconst named = (this.labelFor(entry) || '').includes('{actor}')\n\t\t\tconst parts = [named ? '' : this.actorName(entry)]\n\t\t\tif (entry.performerType && entry.performerType !== 'user') {\n\t\t\t\tparts.push(`(${entry.performerType})`)\n\t\t\t}\n\t\t\tif (entry.onBehalfOf) {\n\t\t\t\tparts.push(t('nextcloud-vue', 'on behalf of {name}', { name: entry.onBehalfOf }))\n\t\t\t}\n\t\t\treturn parts.filter((part) => part !== '').join(' ')\n\t\t},\n\n\t\tformatWhen(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tif (raw === undefined || raw === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst d = new Date(raw)\n\t\t\tif (Number.isNaN(d.getTime()) === true) {\n\t\t\t\treturn String(raw)\n\t\t\t}\n\t\t\treturn d.toLocaleString(userLocale())\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-audit-card__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Nextcloud core pads and aligns `dt` / `dd`; the list resets both. */\n.cn-audit-card__dated {\n\tdisplay: grid;\n\tgrid-template-columns: max-content minmax(0, 1fr);\n\tgap: 8px 16px;\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 14px;\n}\n\n.cn-audit-card__dated .cn-audit-card__date {\n\twidth: auto;\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-audit-card__dated .cn-audit-card__dated-text {\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__row {\n\tpadding: 6px 0;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-audit-card__row:last-child {\n\tborder-bottom: none;\n}\n\n.cn-audit-card__row-head {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-audit-card__action {\n\tcolor: var(--color-main-text);\n}\n\n.cn-audit-card__when {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\twhite-space: nowrap;\n}\n\n.cn-audit-card__row-body {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-audit-card__refused {\n\tmargin-inline-start: 6px;\n\tfont-weight: 700;\n\tcolor: var(--color-error-text, var(--color-main-text));\n}\n\n.cn-audit-card__reason {\n\tmargin: 2px 0 0;\n\tfont-size: 0.9em;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__empty {\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n\tpadding: 12px 0;\n}\n\n.cn-audit-card__footnote {\n\tmargin: 12px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-audit-card__show-all {\n\tbackground: none;\n\tborder: none;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tpadding: 4px 0;\n\tfont: inherit;\n}\n\n.cn-audit-card__show-all:hover {\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["_createBlock","_toDisplayString","_createElementBlock","_openBlock","_Fragment","_renderList","_createElementVNode","_createTextVNode","_normalizeClass"],"mappings":";;;;AAgCI,EAAA,KAAI,EAAC,sBAAsB;AAC1B,EAAA,MAAG,OAAO;eACP,EAAA,sBAAA;;;;AAG8B,EAAA,KAAA,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,CAAA,QAAA,CAAA,UAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;AAEH,sBAAAK,kBAAA,CAOM,OAPN,WAOM,EAAA;yBANO,MAAM,CAAA,MAAA,KAAA,SAAA;AAAlB,6BAAAH,SAAA,EAAA,EAAAD,kBAAA,CAA4F,MAA5F,EAAA,WAA4F,EAAAD,eAAA,CAAA,QAAA,CAAA,WAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,YAAA;AAC7F,6BAAAE,SAAA,EAAA,EAAAD,kBAAA,CAAY,MAAZ,EAAA,WAAY,EAAAD,eAAA,CAAA,QAAA,CAAA,WAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;AAEJ,wBAAA,CAAA,KAAK,CAAC,UAAU,KAAA,KAAA;0CADvBC,kBAG4C,CAAA,MAAA,EAH5C,WAG4C,EAAAD,eAAA,CAAJ,MAAI,CAAA,YAAA,CAAA,EAAA,CAAA,YAAA;;;AAErC,sBAAA,CAAA,KAAA,CAAA,MAAA;AAAR,2BAAAE,SAAA,EAAA,EAAAD,kBAAA,IAAA,EAAA,aACID,eAAA,CAAA,KAAK,CAAC,MAAC,CAAA,EAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnAuditTrailCard.vue3.js","sources":["../../../../src/components/CnAuditTrailCard/CnAuditTrailCard.vue?vue&type=template&id=3b6d70f7&lang.js"],"sourcesContent":["<!--\n CnAuditTrailCard — compact audit-trail widget for the integration\n registry.\n\n Surface-aware shell around the `audit-trail` integration: fetches\n the object's recent audit-trail entries (query-time storage strategy\n per AD-22) and renders them in a CnDetailCard.\n\n Per umbrella change `pluggable-integration-registry` AD-19 (surface\n fallback), one component handles all surfaces — `surface` is\n forwarded so the component can branch internally if desired.\n-->\n<template>\n\t<CnDetailCard\n\t\t:title=\"resolvedTitle\"\n\t\t:icon=\"History\"\n\t\t:collapsible=\"collapsible\"\n\t\t:data-surface=\"surface\">\n\t\t<NcLoadingIcon v-if=\"loading\" />\n\t\t<p v-else-if=\"failed\"\n\t\t\tclass=\"cn-audit-card__empty\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-audit-card-failed\">\n\t\t\t{{ failedLabel }}\n\t\t</p>\n\t\t<div v-else-if=\"shownEntries.length === 0\" class=\"cn-audit-card__empty\">\n\t\t\t{{ noEntriesLabel }}\n\t\t</div>\n\t\t<!-- `dated` (PqJourney \"Geschiedenis\"): the short date beside what\n\t\t happened, one line per entry. -->\n\t\t<dl v-else-if=\"layout === 'dated'\" class=\"cn-audit-card__dated\">\n\t\t\t<template v-for=\"entry in displayedEntries\" :key=\"entry.id\">\n\t\t\t\t<dt class=\"cn-audit-card__date\">\n\t\t\t\t\t{{ shortDate(entry) }}\n\t\t\t\t</dt>\n\t\t\t\t<dd class=\"cn-audit-card__dated-text\">\n\t\t\t\t\t{{ formatAction(entry) }}<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</dd>\n\t\t\t</template>\n\t\t</dl>\n\t\t<ul v-else class=\"cn-audit-card__list\">\n\t\t\t<li\n\t\t\t\tv-for=\"entry in displayedEntries\"\n\t\t\t\t:key=\"entry.id\"\n\t\t\t\tclass=\"cn-audit-card__row\"\n\t\t\t\t:class=\"{ 'cn-audit-card__row--stacked': layout === 'stacked', 'cn-audit-card__row--compact': density === 'compact' }\">\n\t\t\t\t<div class=\"cn-audit-card__row-head\">\n\t\t\t\t\t<strong class=\"cn-audit-card__action\">{{ formatAction(entry) }}</strong>\n\t\t\t\t\t<span v-if=\"layout !== 'stacked'\" class=\"cn-audit-card__when\">{{ formatWhen(entry) }}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"cn-audit-card__row-body\">\n\t\t\t\t\t<span v-if=\"layout === 'stacked'\" class=\"cn-audit-card__when\" data-testid=\"cn-audit-card-when-below\">{{ stackedLine(entry) }}</span>\n\t\t\t\t\t<span v-else class=\"cn-audit-card__actor\">{{ formatActor(entry) }}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tv-if=\"entry.authorized === false\"\n\t\t\t\t\t\tclass=\"cn-audit-card__refused\"\n\t\t\t\t\t\tdata-testid=\"cn-audit-card-refused\">{{ refusedLabel }}</span>\n\t\t\t\t</div>\n\t\t\t\t<p v-if=\"entry.reason\" class=\"cn-audit-card__reason\">\n\t\t\t\t\t{{ entry.reason }}\n\t\t\t\t</p>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-if=\"footnote\" class=\"cn-audit-card__footnote\" data-testid=\"cn-audit-trail-widget-footnote\">\n\t\t\t{{ footnote }}\n\t\t</p>\n\t\t<template v-if=\"shownEntries.length > maxDisplay\" #footer>\n\t\t\t<button class=\"cn-audit-card__show-all\" @click=\"$emit('show-all')\">\n\t\t\t\t{{ showAllLabel }} ({{ shownEntries.length }})\n\t\t\t</button>\n\t\t</template>\n\t</CnDetailCard>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcLoadingIcon } from '@nextcloud/vue'\nimport { markRaw } from 'vue'\nimport History from 'vue-material-design-icons/History.vue'\nimport CnDetailCard from '../CnDetailCard/CnDetailCard.vue'\nimport { auditExclusionParams, keepAuditEntries } from '../../utils/auditEntries.js'\nimport { actionLabelFor, changedValue, changeLabelFor, fillAuditLabel } from '../../utils/auditLabels.js'\nimport { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { leafSourceUrl } from '../../utils/leafSourceUrl.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\n/**\n * @param {object} entry An audit entry.\n * @return {number} When it happened, in ms; 0 when unreadable.\n */\nfunction entryTime(entry) {\n\tconst time = new Date(entry.creationDateTime || entry.created || entry.timestamp || 0).getTime()\n\treturn Number.isNaN(time) ? 0 : time\n}\n\n/**\n * CnAuditTrailCard — compact audit-trail widget rendered by the\n * integration registry on dashboard and detail surfaces.\n *\n * Basic usage\n * ```vue\n * <CnAuditTrailCard\n * :register=\"registerId\"\n * :schema=\"schemaId\"\n * :object-id=\"objectId\"\n * surface=\"detail-page\" />\n * ```\n */\nexport default {\n\tname: 'CnAuditTrailCard',\n\n\tcomponents: { CnDetailCard, NcLoadingIcon },\n\n\tprops: {\n\t\t/**\n\t\t * A muted line under the trail, inside the card (\"Kenmerk ZT-OMV-REG\").\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-footnote/specs/audit-trail/spec.md#requirement-a-history-card-can-end-in-a-line-about-the-record\n\t\t */\n\t\tfootnote: { type: String, default: '' },\n\t\t/** OpenRegister register id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tregister: { type: String, default: '' },\n\t\t/** OpenRegister schema id (slug or uuid). Optional for `scope: \"app\"`. */\n\t\tschema: { type: String, default: '' },\n\t\t/** Parent object id. Required for `scope: \"object\"` (the default); unused for `scope: \"app\"`. */\n\t\tobjectId: { type: String, default: '' },\n\t\t/**\n\t\t * What the card lists. `object` (the default) is one object's trail\n\t\t * and needs `register`, `schema` and `objectId`. `app` is the\n\t\t * app-wide feed: the entries of every object the caller may read\n\t\t * (OpenRegister's `/audit-trails/readable`), narrowed to `register`\n\t\t * and `schema` when those are set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t */\n\t\tscope: {\n\t\t\ttype: String,\n\t\t\tdefault: 'object',\n\t\t\tvalidator: (value) => ['object', 'app'].includes(value),\n\t\t},\n\n\t\t/** Rendering surface — passed for AD-19 surface fallback consumers. */\n\t\tsurface: {\n\t\t\ttype: String,\n\t\t\tdefault: 'detail-page',\n\t\t\tvalidator: (value) => ['user-dashboard', 'app-dashboard', 'detail-page', 'single-entity'].includes(value),\n\t\t},\n\n\t\t/** Base API URL. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\n\t\t/**\n\t\t * Read the trail of something that is not an OpenRegister object:\n\t\t * `{ kind: 'flow-task', id }` reads `${apiBase}/flow-tasks/{id}/audit`,\n\t\t * oldest first. `id` may be left out or written `@objectId`.\n\t\t *\n\t\t * @type {{kind: string, id?: (string|number)}|null}\n\t\t */\n\t\tsource: { type: Object, default: null },\n\n\t\t/** A trail URL that replaces the object's own; `{id}` is filled with the source's id or `objectId`. */\n\t\tendpoint: { type: String, default: '' },\n\n\t\t/** `newest` first (the object trail's order) or `oldest` first; empty takes `oldest` for a source and `newest` otherwise. */\n\t\torder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t\tvalidator: (value) => ['', 'newest', 'oldest'].includes(value),\n\t\t},\n\n\t\t/** Maximum rows to render. */\n\t\tmaxDisplay: { type: Number, default: 5 },\n\t\t/**\n\t\t * `stacked` (DqTaak \"Historie\"): the action, then one muted line under\n\t\t * it with the moment (\"6 okt 09:05\") and who, when the action does not\n\t\t * already name them. Default: the moment beside the action, who under it.\n\t\t * `dated` (PqJourney \"Geschiedenis\"): a two-column list, the short date\n\t\t * (\"2 okt\") beside what happened; who shows only where the action's\n\t\t * label names them (`{actor}`).\n\t\t */\n\t\tlayout: { type: String, default: '' },\n\t\t/**\n\t\t * `compact` draws the rows closer together: in the board look a\n\t\t * stacked row 10px above and below (DqZaaktype \"Historie\") instead of\n\t\t * 12px (DqTaak). Default: the layout's own spacing.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-compact-stacked-rows/specs/audit-trail/spec.md#requirement-a-stacked-audit-card-can-draw-compact-rows\n\t\t */\n\t\tdensity: { type: String, default: '' },\n\t\t/**\n\t\t * Actions the card leaves out (case-insensitive), such as `['read']`\n\t\t * for a history of what changed. It then reads more entries than it\n\t\t * shows, so the rows it leaves out do not crowd the rest away.\n\t\t *\n\t\t * @spec openspec/changes/audit-trail-exclude-actions/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-events-by-action\n\t\t */\n\t\texcludeActions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Actors the card leaves out by user id (case-insensitive), such as\n\t\t * `['System']` for a history of what people did: the bookkeeping a\n\t\t * background job writes is not shown.\n\t\t *\n\t\t * @spec openspec/changes/audit-card-exclude-actors/specs/audit-trail/spec.md#requirement-a-history-card-can-leave-out-entries-by-actor\n\t\t */\n\t\texcludeActors: { type: Array, default: () => [] },\n\t\t/** Whether the card collapses. */\n\t\tcollapsible: { type: Boolean, default: false },\n\t\t/** Override the card title (defaults to the translated label). */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Pre-translated empty label. */\n\t\tnoEntriesLabel: { type: String, default: () => t('nextcloud-vue', 'No audit entries yet') },\n\t\t/** Pre-translated overflow label. */\n\t\tshowAllLabel: { type: String, default: () => t('nextcloud-vue', 'Show all') },\n\t\t/** Pre-translated fallback action label. */\n\t\tactionLabel: { type: String, default: () => t('nextcloud-vue', 'Change') },\n\t\t/** Shown on an entry the server refused (`authorized: false`). */\n\t\trefusedLabel: { type: String, default: () => t('nextcloud-vue', '(refused)') },\n\t\t/**\n\t\t * What happened, in words, by action (`claim`) or by action and the\n\t\t * state it led to (`complete:completed`, tried first). `{actor}`,\n\t\t * `{state}` and `{changed.<key>}` (a value the entry recorded, a dotted key\n\t\t * reading into it such as `{changed.data.fileName}`, in the\n\t\t * words of `valueLabels`) are filled in; a label that names the actor leaves it off\n\t\t * the line under it. An action without a label shows as written.\n\t\t *\n\t\t * @type {Object<string, string>|null}\n\t\t */\n\t\tactionLabels: { type: Object, default: null },\n\t\t/**\n\t\t * Words for the values an action label quotes as `{changed.<key>}`:\n\t\t * `{ purpose: { handling: 'Handling' } }`. A value without an entry\n\t\t * shows as written.\n\t\t *\n\t\t * @type {{[key: string]: {[value: string]: string}}|null}\n\t\t */\n\t\tvalueLabels: { type: Object, default: null },\n\t\t/**\n\t\t * What happened, in words, by the field an entry changed: rules\n\t\t * `[{ action?, field, to?, label }]`, the first whose `field` the entry\n\t\t * changed (to `to`, when given) wins over `actionLabels`. A label fills\n\t\t * the same tokens, plus `{object.<path>}` from `object`\n\t\t * (\"Version {object.version} published\" for `isDraft` set to false).\n\t\t *\n\t\t * @type {Array<{action?: string, field: string, to?: unknown, label: string}>}\n\t\t */\n\t\tchangeLabels: { type: Array, default: () => [] },\n\t\t/** The audited record, for `{object.<path>}` in a label; null without one. */\n\t\tobject: { type: Object, default: null },\n\t\t/**\n\t\t * Records beside the object whose events belong in its history:\n\t\t * `[{ as, register, schema, filter, limit? }]`. The card lists the\n\t\t * objects matching `filter` (`@objectId` is this object; at most\n\t\t * `limit`, default 5), reads their trails and merges the entries with\n\t\t * the object's own, newest first. A related entry is labelled by\n\t\t * `actionLabels[\"<as>.<action>\"]` first. Object scope only.\n\t\t *\n\t\t * @type {Array<{as: string, register: string, schema: string, filter?: object, limit?: number}>}\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\trelatedSources: { type: Array, default: () => [] },\n\t\t/** Shown when a `source` or `endpoint` read failed. */\n\t\tfailedLabel: { type: String, default: () => t('nextcloud-vue', 'The history could not be loaded') },\n\t},\n\n\temits: ['show-all'],\n\n\tdata() {\n\t\treturn {\n\t\t\tHistory: markRaw(History),\n\t\t\tentries: [],\n\t\t\tloading: false,\n\t\t\t/** A `source` or `endpoint` read failed: said, rather than shown as an empty trail. */\n\t\t\tfailed: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tresolvedTitle() {\n\t\t\treturn this.title || t('nextcloud-vue', 'Audit trail')\n\t\t},\n\n\t\t/**\n\t\t * The entries without the excluded actions and actors, and without an\n\t\t * update that changed nothing: a re-save whose `changed` holds no field\n\t\t * whose old and new value differ (only `@self` bookkeeping) is not\n\t\t * something that happened to the record.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tshownEntries() {\n\t\t\treturn keepAuditEntries(this.entries, { excludeActions: this.excludeActions, excludeActors: this.excludeActors })\n\t\t},\n\n\t\t/** @return {boolean} Whether the card leaves entries out, and so reads more than it shows. */\n\t\tfiltersEntries() {\n\t\t\treturn this.excludeActions.length > 0 || this.excludeActors.length > 0\n\t\t},\n\n\t\tdisplayedEntries() {\n\t\t\tconst entries = this.oldestFirst ? [...this.shownEntries].sort((a, b) => entryTime(a) - entryTime(b)) : this.shownEntries\n\t\t\treturn entries.slice(0, this.maxDisplay)\n\t\t},\n\n\t\t/**\n\t\t * The trail URL a `source` or `endpoint` names, '' while its record id\n\t\t * is unknown, or null when the card reads an object.\n\t\t *\n\t\t * @return {string|null}\n\t\t * @spec openspec/changes/leaf-cards-read-a-source/specs/leaf-cards-read-a-source/spec.md#requirement-a-leaf-card-reads-a-source-or-an-endpoint\n\t\t */\n\t\tsourceUrl() {\n\t\t\treturn leafSourceUrl({ source: this.source, endpoint: this.endpoint, apiBase: this.apiBase, objectId: this.objectId }, 'audit')\n\t\t},\n\n\t\t/** @return {boolean} Whether the entries read oldest first. */\n\t\toldestFirst() {\n\t\t\treturn this.order === 'oldest' || (this.order === '' && this.sourceUrl !== null)\n\t\t},\n\n\t\t/**\n\t\t * The path the card reads (prefixed at fetch time), or '' when it has nothing to read: the\n\t\t * object's own trail, or the app-wide readable feed narrowed to the\n\t\t * register and schema when set.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {string}\n\t\t */\n\t\tfetchUrl() {\n\t\t\tif (this.sourceUrl !== null) {\n\t\t\t\treturn this.sourceUrl\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst params = new URLSearchParams({ limit: String(limit) })\n\t\t\tif (this.scope === 'app') {\n\t\t\t\tif (this.register) {\n\t\t\t\t\tparams.set('register', this.register)\n\t\t\t\t}\n\t\t\t\tif (this.schema) {\n\t\t\t\t\tparams.set('schema', this.schema)\n\t\t\t\t}\n\t\t\t\treturn `${this.apiBase}/audit-trails/readable?${params.toString()}`\n\t\t\t}\n\t\t\tif (!this.register || !this.schema || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tthis.addExclusions(params)\n\t\t\treturn `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails?${params.toString()}`\n\t\t},\n\t},\n\n\twatch: {\n\t\tfetchUrl: {\n\t\t\timmediate: true,\n\t\t\thandler(url) {\n\t\t\t\tif (url) {\n\t\t\t\t\tthis.fetchEntries()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Ask an object trail to leave out the excluded actions and actors in\n\t\t * the query (`action[notIn]`, `user[notIn]`), so its pages hold what the\n\t\t * card shows. `keepAuditEntries` still filters what comes back.\n\t\t *\n\t\t * @param {URLSearchParams} params The trail query, changed in place.\n\t\t * @return {void}\n\t\t * @spec openspec/changes/audit-card-exclusions-in-the-query/specs/audit-trail/spec.md#requirement-a-history-card-asks-the-trail-to-leave-out-what-it-hides\n\t\t */\n\t\taddExclusions(params) {\n\t\t\tfor (const [key, value] of Object.entries(auditExclusionParams({ excludeActions: this.excludeActions, excludeActors: this.excludeActors }))) {\n\t\t\t\tparams.set(key, value)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read the entries from `fetchUrl`. The readable feed answers\n\t\t * `{ rows, nextCursor }`, the object trail `{ results }`.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-the-audit-trail-widget-reads-the-app-wide-feed\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync fetchEntries() {\n\t\t\tconst url = this.fetchUrl\n\t\t\tif (!url) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.failed = false\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\t\tconst own = await this.withFollowingPages(url, Array.isArray(list) ? list : [])\n\t\t\t\t\tconst related = await this.fetchRelatedEntries()\n\t\t\t\t\tthis.entries = related.length > 0\n\t\t\t\t\t\t? [...own, ...related].sort((a, b) => entryTime(b) - entryTime(a))\n\t\t\t\t\t\t: own\n\t\t\t\t} else {\n\t\t\t\t\tthis.entries = []\n\t\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[CnAuditTrailCard] failed to fetch audit trail', err)\n\t\t\t\tthis.entries = []\n\t\t\t\tthis.failed = this.sourceUrl !== null\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * An object's trail read on until it holds enough entries to show. The\n\t\t * card leaves entries out (reads, actors, empty re-saves) after\n\t\t * reading, and every page view writes a read, so the newest page alone\n\t\t * can be all reads (DqHandhaving Historie: \"no changes yet\"). Reads at\n\t\t * most four more pages.\n\t\t *\n\t\t * @param {string} url The first page's path.\n\t\t * @param {Array<object>} first The first page's entries.\n\t\t * @return {Promise<Array<object>>} The entries read.\n\t\t */\n\t\tasync withFollowingPages(url, first) {\n\t\t\tconst entries = [...first]\n\t\t\tif (!this.filtersEntries || this.scope !== 'object' || this.sourceUrl !== null) {\n\t\t\t\treturn entries\n\t\t\t}\n\t\t\tconst limit = Number(new URLSearchParams(url.split('?')[1] || '').get('limit')) || first.length\n\t\t\tlet page = first\n\t\t\tfor (let more = 0; more < 4 && page.length >= limit && limit > 0; more++) {\n\t\t\t\tthis.entries = [...entries]\n\t\t\t\tif (this.shownEntries.length >= this.maxDisplay) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst next = new URL(url, 'http://x')\n\t\t\t\tnext.searchParams.set('offset', String(entries.length))\n\t\t\t\tconst response = await fetch(prefixUrl(next.pathname + next.search), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\tpage = Array.isArray(list) ? list : []\n\t\t\t\tentries.push(...page)\n\t\t\t}\n\t\t\treturn [...entries]\n\t\t},\n\n\t\t/**\n\t\t * The entries of the records beside the object (`relatedSources`),\n\t\t * each tagged with its source's `as`. A read that fails leaves that\n\t\t * source out.\n\t\t *\n\t\t * @return {Promise<Array<object>>} The entries.\n\t\t * @spec openspec/changes/audit-trail-related-sources/specs/audit-trail/spec.md#requirement-an-objects-history-can-include-the-events-of-records-beside-it\n\t\t */\n\t\tasync fetchRelatedEntries() {\n\t\t\tif (this.scope !== 'object' || this.sourceUrl !== null || !this.objectId || !Array.isArray(this.relatedSources)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst limit = this.filtersEntries ? Math.min(100, this.maxDisplay * 10) : this.maxDisplay\n\t\t\tconst read = async (url) => {\n\t\t\t\tconst response = await fetch(prefixUrl(url), { headers: buildHeaders() })\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(String(response.status))\n\t\t\t\t}\n\t\t\t\tconst data = await response.json()\n\t\t\t\tconst list = data.results || data.rows || data\n\t\t\t\treturn Array.isArray(list) ? list : []\n\t\t\t}\n\t\t\tconst perSource = await Promise.all(this.relatedSources\n\t\t\t\t.filter((source) => source && source.register && source.schema)\n\t\t\t\t.map(async (source) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst params = new URLSearchParams({ _limit: String(Number(source.limit) > 0 ? Number(source.limit) : 5), _order: JSON.stringify({ '@self.created': 'DESC' }) })\n\t\t\t\t\t\tfor (const [key, value] of Object.entries(source.filter || {})) {\n\t\t\t\t\t\t\tparams.set(key, value === '@objectId' ? this.objectId : String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst objects = await read(`${this.apiBase}/objects/${source.register}/${source.schema}?${params.toString()}`)\n\t\t\t\t\t\tconst ids = objects.map((object) => object?.id || object?.['@self']?.id || object?.uuid).filter(Boolean)\n\t\t\t\t\t\tconst trailParams = new URLSearchParams({ limit: String(limit) })\n\t\t\t\t\t\tthis.addExclusions(trailParams)\n\t\t\t\t\t\tconst trails = await Promise.all(ids.map((id) => read(`${this.apiBase}/objects/${source.register}/${source.schema}/${id}/audit-trails?${trailParams.toString()}`).catch(() => [])))\n\t\t\t\t\t\treturn trails.flat().map((entry) => ({ ...entry, relatedAs: source.as || source.schema }))\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t\treturn perSource.flat()\n\t\t},\n\n\t\t/**\n\t\t * What happened: the action, with the state it led to when the entry\n\t\t * names one (a flow task's `stateAfter`).\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatAction(entry) {\n\t\t\tconst label = this.changeLabelFor(entry) ?? this.labelFor(entry)\n\t\t\tif (label !== null) {\n\t\t\t\treturn fillAuditLabel(label, entry, { actor: this.actorName(entry), object: this.object, valueLabels: this.valueLabels })\n\t\t\t}\n\t\t\tconst action = entry.action || entry.event || this.actionLabel\n\t\t\treturn entry.stateAfter ? `${action} (${entry.stateAfter})` : action\n\t\t},\n\n\t\t/**\n\t\t * A value the entry recorded under `changed` (an audit entry's context),\n\t\t * in the words of `valueLabels`; '' when it recorded none.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @param {string} key The recorded key.\n\t\t * @return {string} The value in words.\n\t\t * @spec openspec/changes/audit-label-changed-values/specs/audit-trail/spec.md#requirement-a-trail-label-can-quote-what-the-entry-recorded\n\t\t */\n\t\tchangedValue(entry, key) {\n\t\t\treturn changedValue(entry, key, this.valueLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `changeLabels` rule an entry matches: the first whose field the\n\t\t * entry changed, for its action and to its value when the rule names them.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when no rule matches.\n\t\t */\n\t\tchangeLabelFor(entry) {\n\t\t\treturn changeLabelFor(entry, this.changeLabels)\n\t\t},\n\n\t\t/**\n\t\t * The `actionLabels` entry for an entry: by action and state first,\n\t\t * then by action.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string|null} The label, or null when none is declared.\n\t\t * @spec openspec/changes/audit-trail-action-labels/specs/audit-trail/spec.md#requirement-a-trail-can-say-what-happened-in-words\n\t\t */\n\t\tlabelFor(entry) {\n\t\t\treturn actionLabelFor(entry, this.actionLabels, this.object)\n\t\t},\n\n\t\t/**\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} Who did it, by name where the entry carries one.\n\t\t */\n\t\tactorName(entry) {\n\t\t\tif (entry.actorDisplayName) {\n\t\t\t\treturn entry.actorDisplayName\n\t\t\t}\n\t\t\tconst id = entry.actor || entry.userId || entry.user || ''\n\t\t\t// A person's user id reads as their display name once it is known.\n\t\t\treturn (id && (!entry.performerType || entry.performerType === 'user') && userDisplayName(String(id))) || id\n\t\t},\n\n\t\t/**\n\t\t * The date of a dated list's entry in the board's short form (\"2 okt\").\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The date, or '' without one.\n\t\t * @spec openspec/changes/audit-card-dated-layout/specs/audit-trail/spec.md#requirement-an-audit-list-can-put-the-date-beside-what-happened\n\t\t */\n\t\tshortDate(entry) {\n\t\t\treturn formatBoardDate(entry.creationDateTime || entry.created || entry.timestamp)\n\t\t},\n\n\t\t/**\n\t\t * The muted line of a stacked row: the moment in the board's short\n\t\t * form (\"6 okt 09:05\") and who, unless the action names them already.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t * @spec openspec/changes/audit-card-stacked-rows/specs/audit-trail/spec.md#requirement-an-audit-row-can-put-its-moment-under-the-action\n\t\t */\n\t\tstackedLine(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tconst date = raw ? new Date(raw) : null\n\t\t\tconst when = date && !Number.isNaN(date.getTime()) ? `${formatBoardDate(date)} ${formatTimeOfDay(date)}` : ''\n\t\t\treturn [when, this.formatActor(entry)].filter((part) => part !== '').join(' · ')\n\t\t},\n\n\t\t/**\n\t\t * Who did it: the actor, the kind of performer when it is not a\n\t\t * person (a flow, the system), and on whose behalf.\n\t\t *\n\t\t * @param {object} entry The entry.\n\t\t * @return {string} The line.\n\t\t */\n\t\tformatActor(entry) {\n\t\t\tconst named = (this.labelFor(entry) || '').includes('{actor}')\n\t\t\tconst parts = [named ? '' : this.actorName(entry)]\n\t\t\tif (entry.performerType && entry.performerType !== 'user') {\n\t\t\t\tparts.push(`(${entry.performerType})`)\n\t\t\t}\n\t\t\tif (entry.onBehalfOf) {\n\t\t\t\tparts.push(t('nextcloud-vue', 'on behalf of {name}', { name: entry.onBehalfOf }))\n\t\t\t}\n\t\t\treturn parts.filter((part) => part !== '').join(' ')\n\t\t},\n\n\t\tformatWhen(entry) {\n\t\t\tconst raw = entry.creationDateTime || entry.created || entry.timestamp\n\t\t\tif (raw === undefined || raw === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst d = new Date(raw)\n\t\t\tif (Number.isNaN(d.getTime()) === true) {\n\t\t\t\treturn String(raw)\n\t\t\t}\n\t\t\treturn d.toLocaleString(userLocale())\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-audit-card__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Nextcloud core pads and aligns `dt` / `dd`; the list resets both. */\n.cn-audit-card__dated {\n\tdisplay: grid;\n\tgrid-template-columns: max-content minmax(0, 1fr);\n\tgap: 8px 16px;\n\tmargin: 0;\n\tpadding: 0;\n\tfont-size: 14px;\n}\n\n.cn-audit-card__dated .cn-audit-card__date {\n\twidth: auto;\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\twhite-space: nowrap;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-audit-card__dated .cn-audit-card__dated-text {\n\tmargin: 0;\n\tpadding: 0;\n\ttext-align: start;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__row {\n\tpadding: 6px 0;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-audit-card__row:last-child {\n\tborder-bottom: none;\n}\n\n.cn-audit-card__row-head {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-audit-card__action {\n\tcolor: var(--color-main-text);\n}\n\n.cn-audit-card__when {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\twhite-space: nowrap;\n}\n\n.cn-audit-card__row-body {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-audit-card__refused {\n\tmargin-inline-start: 6px;\n\tfont-weight: 700;\n\tcolor: var(--color-error-text, var(--color-main-text));\n}\n\n.cn-audit-card__reason {\n\tmargin: 2px 0 0;\n\tfont-size: 0.9em;\n\toverflow-wrap: anywhere;\n}\n\n.cn-audit-card__empty {\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n\tpadding: 12px 0;\n}\n\n.cn-audit-card__footnote {\n\tmargin: 12px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-audit-card__show-all {\n\tbackground: none;\n\tborder: none;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tpadding: 4px 0;\n\tfont: inherit;\n}\n\n.cn-audit-card__show-all:hover {\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["_createBlock","_toDisplayString","_createElementBlock","_openBlock","_Fragment","_renderList","_createElementVNode","_createTextVNode","_normalizeClass"],"mappings":";;;;AAgCI,EAAA,KAAI,EAAC,sBAA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BAAAE,SAAA,EAAA,EAAAD,kBAAA,CAAE,MAAF,EAAA,WAAE,EAAAD,eAAA,CAAA,QAAA,CAAA,UAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;AAEH,sBAAAK,kBAAA,CAOM,OAPN,WAOM,EAAA;yBANO,MAAM,CAAA,MAAA,KAAA,SAAA;AAAlB,6BAAAH,SAAA,EAAA,EAAAD,kBAAA,CAA4F,MAA5F,EAAA,WAA4F,EAAAD,eAAA,CAAA,QAAA,CAAA,WAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,YAAA;AAC7F,6BAAAE,SAAA,EAAA,EAAAD,kBAAA,CAAY,MAAZ,EAAA,WAAY,EAAAD,eAAA,CAAA,QAAA,CAAA,WAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;AAEJ,wBAAA,CAAA,KAAK,CAAC,UAAU,KAAA,KAAA;0CADvBC,kBAG4C,CAAA,MAAA,EAH5C,WAG4C,EAAAD,eAAA,CAAJ,MAAI,CAAA,YAAA,CAAA,EAAA,CAAA,YAAA;;;AAErC,sBAAA,CAAA,KAAA,CAAA,MAAA;AAAR,2BAAAE,SAAA,EAAA,EAAAD,kBAAA,IAAA,EAAA,aACID,eAAA,CAAA,KAAK,CAAC,MAAC,CAAA,EAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnStatWidget.vue2.js';
|
|
|
2
2
|
import { render } from './CnStatWidget.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-4c29c40f";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -521,12 +521,17 @@ var script = {
|
|
|
521
521
|
* placeholder in the source string and can move it within the sentence —
|
|
522
522
|
* the same contract as Nextcloud's own `t()` parameters.
|
|
523
523
|
*
|
|
524
|
+
* `@object.<field>`, `@objectId`, `@workspace.<key>` and `@config.<key>`
|
|
525
|
+
* read the page's contexts as a source's tokens do, so a register-counted
|
|
526
|
+
* tile can name its record's own figure ("of @object.capacity places").
|
|
527
|
+
*
|
|
524
528
|
* A token with no matching field resolves to the empty string rather
|
|
525
529
|
* than being left as `{levelName}` on screen: a caption is decoration,
|
|
526
530
|
* and showing a reader a raw token is worse than showing them less.
|
|
527
531
|
*
|
|
528
532
|
* @return {string}
|
|
529
533
|
* @spec openspec/changes/stat-caption-formats/specs/stat-widget/spec.md#requirement-a-stat-caption-token-can-carry-a-format
|
|
534
|
+
* @spec openspec/changes/stat-caption-object-token/specs/stat-caption-object-token/spec.md#requirement-a-stat-caption-can-name-a-field-of-the-pages-record
|
|
530
535
|
*/
|
|
531
536
|
resolvedCaption() {
|
|
532
537
|
const override = this.activeOverride;
|
|
@@ -545,7 +550,11 @@ var script = {
|
|
|
545
550
|
const zero = count !== null && this.content.captionSource.zeroText;
|
|
546
551
|
return typeof zero === 'string' && zero !== '' ? this.effectiveTranslate(zero) : ''
|
|
547
552
|
}
|
|
548
|
-
|
|
553
|
+
// `@object.<field>` names a field of the page's record (PqEvenement
|
|
554
|
+
// "van @object.capacity plaatsen" on a register-counted tile).
|
|
555
|
+
const translated = caption.indexOf('@') === -1
|
|
556
|
+
? this.effectiveTranslate(caption)
|
|
557
|
+
: this.interpolateTokens(this.effectiveTranslate(caption)).replace(/\s{2,}/g, ' ').trim();
|
|
549
558
|
if (translated.indexOf('{') === -1) {
|
|
550
559
|
return translated
|
|
551
560
|
}
|