|
2 | 2 |
|
3 | 3 | In change logs under audit logs menu, we can see all change logs (entity history) in the application:
|
4 | 4 |
|
5 |
| -<img src="images/entity-history-logs.png" alt="Change Logs" class="img-thumbnail" /> |
| 5 | +<img src="D:/Github/documents/docs/en/images/change-logs-core.png" alt="Change Logs" class="img-thumbnail" /> |
6 | 6 |
|
7 |
| -When we click the magnifier icon, we can see all details a change log. We can see which properties are changed. |
| 7 | +When we click the magnifier icon, we can see all the details about a change log: |
8 | 8 |
|
9 |
| -<img src="images/entity-history-log-detail.png" alt="Change Log Detail" class="img-thumbnail" /> |
| 9 | +<img src="D:/Github/documents/docs/en/images/entity-history-log-detail.png" alt="Change Log Detail" class="img-thumbnail" /> |
10 | 10 |
|
11 |
| -You should add entity type that you want to track to `*.Core\EntityHistory\EntityHistoryHelper.TrackedTypes`. And make sure you uncomment following line in `*.EntityFrameworkCore\EntityFrameworkCore\YourProjectNameEntityFrameworkCoreModule.cs` |
| 11 | +You should add entity type that you want to track to ***.Core\EntityHistory\EntityHistoryHelper.TrackedTypes**. Make sure you uncomment following lines in ***.EntityFrameworkCore\EntityFrameworkCore\{YourProjectName}EntityFrameworkCoreModule.cs** and set **Configuration.EntityHistory.IsEnabled** to **true**. |
12 | 12 |
|
13 | 13 | ```csharp
|
14 |
| -//Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes); |
| 14 | +// Set this setting to true for enabling entity history. |
| 15 | +Configuration.EntityHistory.IsEnabled = false; |
| 16 | + |
| 17 | +// Uncomment below line to write change logs for the entities below: |
| 18 | +// Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes); |
| 19 | +// Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration)); |
| 20 | +``` |
| 21 | + |
| 22 | +The first commented line here adds entity types defined in `EntityHistoryHelper.TrackedTypes` to entity history config, so changes on those entities will be recorded. The second commented line adds a custom config provider to `CustomConfigProviders` list. ASP.NET Zero executes `GetConfig` method of each `CustomConfigProvider` and returns the result of `GetConfig` to Angular client app. |
| 23 | + |
| 24 | +So, in this particular case, `EntityHistoryConfigProvider` returns if entity history feature is enabled or not and if enabled, it returns list of entities enabled for entity history. Angular client app uses those information to show entity history related buttons on each entity page. |
| 25 | + |
| 26 | +For example, when entity history is enabled for an Entity, Angular client shows history dropdown menu item for each entity record on the related page. Here is a sample screenshot for role list: |
| 27 | + |
| 28 | +<img src="D:/Github/documents/docs/en/images/change-logs-history-action-item.png" alt="Entity History Action" class="img-thumbnail" /> |
| 29 | + |
| 30 | +In this way, history of an entity can be retrieved both on change logs tab in audit logs page or on the list page of the entity itself. |
| 31 | + |
| 32 | +The entity history config can be accessed on the Angular app like below: |
| 33 | + |
| 34 | +```javascript |
| 35 | +abp.custom.EntityHistory |
15 | 36 | ```
|
16 | 37 |
|
| 38 | +The abp.custom.EntityHistory object contains properties below: |
| 39 | + |
| 40 | +- **isEnabled**: Boolean field represents if entity history is enabled or not. |
| 41 | +- **enabledEntities**: Array of string contains full name of entity types entity history is enabled for. |
| 42 | + |
| 43 | +Here is a sample screenshot which show the value of **abp.custom.EntityHistory**: |
| 44 | + |
| 45 | +<img src="D:/Github/documents/docs/en/images/change-logs-custom-config-result-core.png" alt="Entity history custom config" class="img-thumbnail" /> |
| 46 | + |
| 47 | + |
17 | 48 | ## Next
|
18 | 49 |
|
19 | 50 | - [Subscription](Features-Mvc-Core-Subscription)
|
0 commit comments