Skip to content

Commit 2642a4d

Browse files
danjoasjvansmnkieferMara Kiefer
authored
Flattened readme (#32)
Co-authored-by: sjvans <[email protected]> Co-authored-by: Mara Kiefer <[email protected]> Co-authored-by: Mara Kiefer <[email protected]>
1 parent 7267362 commit 2642a4d

File tree

2 files changed

+52
-23
lines changed

2 files changed

+52
-23
lines changed

README.md

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,57 @@
1+
# Change Tracking Plugin for SAP Cloud Application Programming Model (CAP)
2+
3+
[![REUSE status](https://api.reuse.software/badge/github.com/cap-js/change-tracking)](https://api.reuse.software/info/github.com/cap-js/change-tracking)
4+
5+
The `@cap-js/change-tracking` package is a [CDS plugin](https://cap.cloud.sap/docs/node.js/cds-plugins#cds-plugin-packages) providing out-of-the box support for automatic capturing, storing, and viewing of the change records of modeled entities as simple as that:
6+
7+
1. [Install the plugin: `npm add @cap-js/change-tracking`](#setup)
8+
2. [Add `@changelog` annotations to your CDS models](#annotations)
9+
3. [Et voilà:](#change-history-view)
10+
11+
<img width="1300" alt="change-history-custom" src="_assets/changes-custom.png">
12+
113

2-
The `@cap-js/change-tracking` package is a [CDS plugin](https://cap.cloud.sap/docs/node.js/cds-plugins#cds-plugin-packages) providing out-of-the box support for automatic capturing, storing, and viewing of the change records of modeled entities.
314

415
### Table of Contents
516

17+
- [Preliminaries](#preliminaries)
618
- [Setup](#setup)
7-
- [Usage](#usage)
8-
- [Add `@changelog` Annotations](#add-changelog-annotations)
9-
- [Human-readable Types and Fields](#human-readable-types-and-fields)
10-
- [Human-readable IDs](#human-readable-ids)
11-
- [Human-readable Values](#human-readable-values)
12-
- [Test-drive locally](#test-drive-locally)
13-
- [Change History View](#change-history-view)
14-
- [Customizations](#customizations)
19+
- [Annotations](#annotations)
20+
- [Human-readable Types and Fields](#human-readable-types-and-fields)
21+
- [Human-readable IDs](#human-readable-ids)
22+
- [Human-readable Values](#human-readable-values)
23+
- [Test-drive locally](#test-drive-locally)
24+
- [Change History View](#change-history-view)
1525
- [Contributing](#contributing)
16-
- [Code of Conduct](#code-of-conduct)
26+
- [Code of Conduct](#code-of-conduct)
1727
- [Licensing](#licensing)
1828

1929

2030

31+
## Preliminaries
32+
33+
In this guide, we use the [Incidents Management reference sample app](https://github.com/cap-js/incidents-app) as the base to add change tracking to. Clone the repository and apply the step-by-step instructions:
34+
35+
```sh
36+
git clone https://github.com/cap-js/incidents-app
37+
cd incidents-app
38+
npm i
39+
```
40+
41+
**Alternatively**, you can clone the incidents app including the prepared enhancements for change-tracking:
42+
43+
```sh
44+
git clone https://github.com/cap-js/calesi --recursive
45+
cd calesi
46+
npm i
47+
```
48+
49+
```sh
50+
cds w samples/change-tracking
51+
```
52+
53+
54+
2155
## Setup
2256

2357
To enable change tracking, simply add this self-configuring plugin package to your project:
@@ -28,11 +62,7 @@ npm add @cap-js/change-tracking
2862

2963

3064

31-
## Usage
32-
33-
In this guide, we use the [Incidents Management reference sample app](https://github.com/cap-js/incidents-app) as the base to add change tracking to.
34-
35-
### Add `@changelog` Annotations
65+
## Annotations
3666

3767
All we need to do is to identify what should be change-tracked by annotating respective entities and elements in our model with the `@changelog` annotation. Following the [best practice of separation of concerns](https://cap.cloud.sap/docs/guides/domain-modeling#separation-of-concerns), we do so in a separate file _srv/change-tracking.cds_:
3868

@@ -55,9 +85,9 @@ The minimal annotation we require for change tracking is `@changelog` on element
5585
Additional identifiers or labels can be added to obtain more *human-readable* change records as described below.
5686

5787

58-
#### Human-readable Types and Fields
88+
### Human-readable Types and Fields
5989

60-
By default the implementation looks up *Object Type* names or *Field* namesfrom respective `@title` or `@Common.Label` annotations, and applies i18n lookups. If no such annotations are given, the technical names of the respective CDS definitions are displayed.
90+
By default the implementation looks up *Object Type* names or *Field* namesfrom respective `@title` or `@Common.Label` annotations, and applies i18n lookups. If no such annotations are given, the technical names of the respective CDS definitions are displayed.
6191

6292
For example, without the `@title` annotation, changes to conversation entries would show up with the technical entity name:
6393

@@ -74,7 +104,7 @@ We get a human-readable display for *Object Type*:
74104
<img width="1300" alt="change-history-type-hr" src="_assets/changes-type-hr-wbox.png">
75105

76106

77-
#### Human-readable IDs
107+
### Human-readable IDs
78108

79109
The changelog annotations for *Object ID* are defined at entity level.
80110

@@ -97,7 +127,7 @@ annotate ProcessorService.Conversations with @changelog: [author, timestamp] {
97127
Expanding the changelog annotation by additional identifiers `[author, timestamp]`, we can now better identify the `message` change events by their respective author and timestamp.
98128

99129

100-
#### Human-readable Values
130+
### Human-readable Values
101131

102132
The changelog annotations for *New Value* and *Old Value* are defined at element level.
103133

@@ -120,7 +150,7 @@ Hence, here it is essential to add a unique identifier to obtain human-readable
120150
<img width="1300" alt="change-history-value-hr" src="_assets/changes-value-hr-wbox.png">
121151

122152

123-
### Test-drive locally
153+
## Test-drive locally
124154

125155
With the steps above, we have successfully set up change tracking for our reference application. Let's see that in action.
126156

@@ -130,7 +160,7 @@ With the steps above, we have successfully set up change tracking for our refere
130160
```
131161
2. **Make a change** on your change-tracked elements. This change will automatically be persisted in the database table (`sap.changelog.ChangeLog`) and made available in a pre-defined view, namely the [Change History view](#change-history-view) for your convenience.
132162

133-
### Change History View
163+
## Change History View
134164

135165
<img width="1300" alt="change-history" src="_assets/changes.png">
136166

@@ -166,7 +196,7 @@ For more information and examples on adding Fiori Annotations, see [Adding SAP F
166196
This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/cap-js/change-tracking/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
167197

168198

169-
### Code of Conduct
199+
## Code of Conduct
170200

171201
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its [Code of Conduct](CODE_OF_CONDUCT.md) at all times.
172202

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"description": "CDS plugin providing out-of-the box support for automatic capturing, storing, and viewing of the change records of modeled entities.",
55
"repository": "cap-js/change-tracking",
66
"author": "SAP SE (https://www.sap.com)",
7-
"homepage": "https://cap.cloud.sap/",
87
"license": "SEE LICENSE IN LICENSE",
98
"main": "cds-plugin.js",
109
"files": [

0 commit comments

Comments
 (0)