Skip to content

Commit 3e933f0

Browse files
committedDec 19, 2019
updated entity history documents
1 parent 0a3bb82 commit 3e933f0

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed
 

‎docs/en/Features-Angular-Entity-History.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ When we click the magnifier icon, we can see all the details about a change log:
88

99
<img src="images/entity-history-log-detail.png" alt="Change Log Detail" class="img-thumbnail" />
1010

11-
You should add entity type that you want to track to ***.Core\EntityHistory\EntityHistoryHelper.TrackedTypes**. And make sure you uncomment following lines in ***.EntityFrameworkCore\EntityFrameworkCore\{YourProjectName}EntityFrameworkCoreModule.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**.
1212

1313
```csharp
14-
//Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes);
15-
//Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
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));
1620
```
1721

18-
The first line here adds entity types defined in `EntityHistoryHelper.TrackedTypes` to entity history config, so changes on those entities will be recorded. The second 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.
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.
1923

2024
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.
2125

‎docs/en/Features-Mvc-Core-Entity-History.md

+36-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,49 @@
22

33
In change logs under audit logs menu, we can see all change logs (entity history) in the application:
44

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" />
66

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:
88

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" />
1010

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**.
1212

1313
```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
1536
```
1637

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+
1748
## Next
1849

1950
- [Subscription](Features-Mvc-Core-Subscription)

0 commit comments

Comments
 (0)