Skip to content

Java: Adds examples on how to customise change tracking UI #1966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions java/change-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,44 @@ must be read-only and shouldn't be writable via OData requests.
The change log is extended with the texts coming from your entities' `@title` annotation and the element. Otherwise, the change log contains only the technical names of the entities and the elements.
Titles are translated, if they're annotated as translatable. See [Externalizing Texts Bundles](../guides/i18n#localization-i18n) for more information.

You can customize the standard UI on the entity itself:

```cds
annotate Bookshop.Books.changes with @(UI: {
PresentationVariant: {
Visualizations: ['@UI.LineItem'],
RequestAtLeast: [change.targetEntity],
SortOrder: [{
Property: change.createdAt,
Descending: true
}]
},
LineItem: [...],
});
```

Or on the `ChangeLink` entity so that it changed for all entities:

```cds
annotate sap.changelog.ChangeLink with @(UI: {
PresentationVariant: {
Visualizations: ['@UI.LineItem'],
RequestAtLeast: [change.targetEntity],
SortOrder: [{
Property: change.createdAt,
Descending: true
}]
},
LineItem: [...],
});
```

You can also customize individual fields by annotating them directly, as follows:

```cds
annotate Bookshop.Books.changes:up_ with @UI.Hidden;
```

## How Changes are Stored

The namespace `sap.changelog` defines an entity `Changes` that reflects each change, so the changes are stored in a flat table for all entities together.
Expand Down