Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

entityTypeHistoryModal #6741


User avatar
0
BobIngham created

angular, dotnetcore, 6.8.0 Somewhere between 5.4.1 and 6.8.0 (I know, I know, I really shouldn't leave it so long between updates) entity type history was introduced. The component entityTypeHistoryModal was introduced in many pages. The option to view this modal seems to revolve around the setting entityHistoryEnabled and this value seems to be set through:

let customSettings = (abp as any).custom;

Could someone please show me where this setting is made and how it works. Just use something simple for the time being such as "how is set for roles in roles.component.ts". It looks useful and I would like to use it but I'm not sure how it works.


2 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, the custom settings for entity history are configured here. (See EntityHistoryUiSetting)

    https://github.com/aspnetzero/aspnet-zero-core/blob/7eb8a38d46bc704dbc6250b49e240c149900caf7/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/EntityHistory/EntityHistoryConfigProvider.cs

    Basically, role component reads the custom settings for entity history of the entity Role and show EntityHistoryModal accordingly.

    The modal then fetch the EntityTypeChanges for the given entity type from AuditLogAppService

  • User Avatar
    0
    BobIngham created

    Hi @ryancyq, thanks for your help. I finally managed to get this working with the following settings: Core/EntityHistory/EntityHistoryConfigProvider.cs

                if (!_abpStartupConfiguration.EntityHistory.IsEnabled)
                {
                    return new Dictionary<string, object>
                    {
                        {
                            EntityHistoryHelper.EntityHistoryConfigurationName,
                            new EntityHistoryUiSetting{
                                IsEnabled = true
                            }
                        }
                    };
                }
    

    EntityFrameworkCore\EntityFrameworkCore[ProjectName]EntityFrameworkCoreModule.cs:

                Configuration.EntityHistory.Selectors.Add(
                    new NamedTypeSelector(
                        "Abp.FullAuditedEntities",
                        type => typeof(IFullAudited).IsAssignableFrom(type)
                     ));
    
                // Uncomment below line to write change logs for the entities below:
                Configuration.EntityHistory.Selectors.Add("NuagecareEntities", EntityHistoryHelper.TrackedTypes);
                Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));