Skip to content
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

Upgrade XbyK 30.0.0 + upgrade UMT 3.0.0 #324

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions KVA/Migration.Tool.Source/Handlers/MigratePagesCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ await MigratePageUrlPaths(ksSite.SiteGUID,
}
}

await ExecDeferredPageBuilderPatch();
await ExecDeferredVisualBuilderPatch();

return new GenericCommandResult();
}
Expand Down Expand Up @@ -636,7 +636,7 @@ private void MigrateFormerUrls(ICmsTree ksNode, WebPageItemInfo targetPage)

#region Deffered patch

private async Task ExecDeferredPageBuilderPatch()
private async Task ExecDeferredVisualBuilderPatch()
{
logger.LogInformation("Executing TreePath patch");

Expand All @@ -646,10 +646,10 @@ private async Task ExecDeferredPageBuilderPatch()
{
var contentItemCommonDataInfo = await ContentItemCommonDataInfo.Provider.GetAsync(uniqueId);

contentItemCommonDataInfo.ContentItemCommonDataPageBuilderWidgets = DeferredPatchPageBuilderWidgets(
contentItemCommonDataInfo.ContentItemCommonDataPageBuilderWidgets, webSiteChannelId, out bool anythingChangedW);
contentItemCommonDataInfo.ContentItemCommonDataPageTemplateConfiguration = DeferredPatchPageTemplateConfiguration(
contentItemCommonDataInfo.ContentItemCommonDataPageTemplateConfiguration, webSiteChannelId, out bool anythingChangedC);
contentItemCommonDataInfo.ContentItemCommonDataVisualBuilderWidgets = DeferredPatchVisualBuilderWidgets(
contentItemCommonDataInfo.ContentItemCommonDataVisualBuilderWidgets, webSiteChannelId, out bool anythingChangedW);
contentItemCommonDataInfo.ContentItemCommonDataVisualBuilderTemplateConfiguration = DeferredPatchVisualTemplateConfiguration(
contentItemCommonDataInfo.ContentItemCommonDataVisualBuilderTemplateConfiguration, webSiteChannelId, out bool anythingChangedC);

if (anythingChangedC || anythingChangedW)
{
Expand All @@ -659,12 +659,12 @@ private async Task ExecDeferredPageBuilderPatch()
else if (className == PageTemplateConfigurationInfo.TYPEINFO.ObjectClassName)
{
var pageTemplateConfigurationInfo = await PageTemplateConfigurationInfo.Provider.GetAsync(uniqueId);
pageTemplateConfigurationInfo.PageTemplateConfigurationWidgets = DeferredPatchPageBuilderWidgets(
pageTemplateConfigurationInfo.PageTemplateConfigurationWidgets = DeferredPatchVisualBuilderWidgets(
pageTemplateConfigurationInfo.PageTemplateConfigurationWidgets,
webSiteChannelId,
out bool anythingChangedW
);
pageTemplateConfigurationInfo.PageTemplateConfigurationTemplate = DeferredPatchPageTemplateConfiguration(
pageTemplateConfigurationInfo.PageTemplateConfigurationTemplate = DeferredPatchVisualTemplateConfiguration(
pageTemplateConfigurationInfo.PageTemplateConfigurationTemplate,
webSiteChannelId,
out bool anythingChangedC
Expand All @@ -677,24 +677,24 @@ out bool anythingChangedC
}
}

private string DeferredPatchPageTemplateConfiguration(string documentPageTemplateConfiguration, int webSiteChannelId, out bool anythingChanged)
private string DeferredPatchVisualTemplateConfiguration(string documentPageTemplateConfiguration, int webSiteChannelId, out bool anythingChanged)
{
if (!string.IsNullOrWhiteSpace(documentPageTemplateConfiguration))
{
var configuration = JObject.Parse(documentPageTemplateConfiguration);
PageBuilderWidgetsPatcher.DeferredPatchProperties(configuration, TreePathConvertor.GetSiteConverter(webSiteChannelId), out anythingChanged);
VisualBuilderWidgetsPatcher.DeferredPatchProperties(configuration, TreePathConvertor.GetSiteConverter(webSiteChannelId), out anythingChanged);
return JsonConvert.SerializeObject(configuration);
}

anythingChanged = false;
return documentPageTemplateConfiguration;
}

private string DeferredPatchPageBuilderWidgets(string documentPageBuilderWidgets, int webSiteChannelId, out bool anythingChanged)
private string DeferredPatchVisualBuilderWidgets(string documentPageBuilderWidgets, int webSiteChannelId, out bool anythingChanged)
{
if (!string.IsNullOrWhiteSpace(documentPageBuilderWidgets))
{
var patched = PageBuilderWidgetsPatcher.DeferredPatchConfiguration(
var patched = VisualBuilderWidgetsPatcher.DeferredPatchConfiguration(
JsonConvert.DeserializeObject<EditableAreasConfiguration>(documentPageBuilderWidgets),
TreePathConvertor.GetSiteConverter(webSiteChannelId),
out anythingChanged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Migration.Tool.Source.Helpers;

public static class PageBuilderWidgetsPatcher
public static class VisualBuilderWidgetsPatcher
{
public static EditableAreasConfiguration DeferredPatchConfiguration(EditableAreasConfiguration configuration, TreePathConvertor convertor, out bool anythingChanged)
{
Expand Down
2 changes: 1 addition & 1 deletion KVA/Migration.Tool.Source/KsCoreDiExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static IServiceCollection UseKsToolCore(this IServiceCollection services,
services.AddSingleton<IAssetFacade, AssetFacade>();
services.AddSingleton<MediaLinkServiceFactory>();
services.AddSingleton<ClassMappingProvider>();
services.AddTransient<PageBuilderPatcher>();
services.AddTransient<VisualBuilderPatcher>();

services.AddTransient<BulkDataCopyService>();
services.AddTransient<CmsRelationshipService>();
Expand Down
30 changes: 15 additions & 15 deletions KVA/Migration.Tool.Source/Mappers/ContentItemMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class ContentItemMapper(
MediaLinkServiceFactory mediaLinkServiceFactory,
ToolConfiguration configuration,
ClassMappingProvider classMappingProvider,
PageBuilderPatcher pageBuilderPatcher,
VisualBuilderPatcher visualBuilderPatcher,
IServiceProvider serviceProvider
) : UmtMapperBase<CmsTreeMapperSource>, IUmtMapper<CustomTableMapperSource>
{
Expand Down Expand Up @@ -174,8 +174,8 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source

DateTime? scheduledPublishWhen = null;
DateTime? scheduleUnpublishWhen = null;
string? contentItemCommonDataPageBuilderWidgets = null;
string? contentItemCommonDataPageTemplateConfiguration = null;
string? contentItemCommonDataVisualBuilderWidgets = null;
string? contentItemCommonDataVisualBuilderTemplateConfiguration = null;

bool ndp = false;
if (!migratedAsContentFolder)
Expand Down Expand Up @@ -214,22 +214,22 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source
}
case CmsDocumentK12 doc:
{
contentItemCommonDataPageBuilderWidgets = doc.DocumentPageBuilderWidgets;
contentItemCommonDataPageTemplateConfiguration = doc.DocumentPageTemplateConfiguration;
contentItemCommonDataVisualBuilderWidgets = doc.DocumentPageBuilderWidgets;
contentItemCommonDataVisualBuilderTemplateConfiguration = doc.DocumentPageTemplateConfiguration;
break;
}
case CmsDocumentK13 doc:
{
contentItemCommonDataPageBuilderWidgets = doc.DocumentPageBuilderWidgets;
contentItemCommonDataPageTemplateConfiguration = doc.DocumentPageTemplateConfiguration;
contentItemCommonDataVisualBuilderWidgets = doc.DocumentPageBuilderWidgets;
contentItemCommonDataVisualBuilderTemplateConfiguration = doc.DocumentPageTemplateConfiguration;
break;
}

default:
break;
}

(contentItemCommonDataPageTemplateConfiguration, contentItemCommonDataPageBuilderWidgets, ndp) = pageBuilderPatcher.PatchJsonDefinitions(source.CmsTree.NodeSiteID, contentItemCommonDataPageTemplateConfiguration, contentItemCommonDataPageBuilderWidgets).GetAwaiter().GetResult();
(contentItemCommonDataVisualBuilderTemplateConfiguration, contentItemCommonDataVisualBuilderWidgets, ndp) = visualBuilderPatcher.PatchJsonDefinitions(source.CmsTree.NodeSiteID, contentItemCommonDataVisualBuilderTemplateConfiguration, contentItemCommonDataVisualBuilderWidgets).GetAwaiter().GetResult();
}

var documentGuid = spoiledGuidContext.EnsureDocumentGuid(
Expand All @@ -246,8 +246,8 @@ protected override IEnumerable<IUmtModel> MapInternal(CmsTreeMapperSource source
ContentItemCommonDataContentLanguageGuid = languageGuid, // DocumentCulture -> language entity needs to be created and its ID used here
ContentItemCommonDataVersionStatus = versionStatus,
ContentItemCommonDataIsLatest = !draftMigrated, // Flag for latest record to know what to retrieve for the UI
ContentItemCommonDataPageBuilderWidgets = contentItemCommonDataPageBuilderWidgets,
ContentItemCommonDataPageTemplateConfiguration = contentItemCommonDataPageTemplateConfiguration,
ContentItemCommonDataVisualBuilderWidgets = contentItemCommonDataVisualBuilderWidgets,
ContentItemCommonDataVisualBuilderTemplateConfiguration = contentItemCommonDataVisualBuilderTemplateConfiguration,
};

if (ndp)
Expand Down Expand Up @@ -405,7 +405,7 @@ private IEnumerable<IUmtModel> MigrateDraft(ICmsVersionHistory checkoutVersion,
{
string? pageTemplateConfiguration = adapter.DocumentPageTemplateConfiguration;
string? pageBuildWidgets = adapter.DocumentPageBuilderWidgets;
(pageTemplateConfiguration, pageBuildWidgets, bool ndp) = pageBuilderPatcher.PatchJsonDefinitions(checkoutVersion.NodeSiteID, pageTemplateConfiguration, pageBuildWidgets).GetAwaiter().GetResult();
(pageTemplateConfiguration, pageBuildWidgets, bool ndp) = visualBuilderPatcher.PatchJsonDefinitions(checkoutVersion.NodeSiteID, pageTemplateConfiguration, pageBuildWidgets).GetAwaiter().GetResult();

#region Find existing guid

Expand Down Expand Up @@ -436,8 +436,8 @@ private IEnumerable<IUmtModel> MigrateDraft(ICmsVersionHistory checkoutVersion,
ContentItemCommonDataContentLanguageGuid = contentLanguageGuid,
ContentItemCommonDataVersionStatus = VersionStatus.Draft,
ContentItemCommonDataIsLatest = true, // Flag for latest record to know what to retrieve for the UI
ContentItemCommonDataPageBuilderWidgets = pageBuildWidgets,
ContentItemCommonDataPageTemplateConfiguration = pageTemplateConfiguration
ContentItemCommonDataVisualBuilderWidgets = pageBuildWidgets,
ContentItemCommonDataVisualBuilderTemplateConfiguration = pageTemplateConfiguration
};

if (ndp)
Expand Down Expand Up @@ -833,8 +833,8 @@ public IEnumerable<IUmtModel> Map(CustomTableMapperSource source)
ContentItemCommonDataContentItemGuid = contentItemGuid,
ContentItemCommonDataContentLanguageGuid = contentLanguageInfo.ContentLanguageGUID,
ContentItemCommonDataVersionStatus = versionStatus,
ContentItemCommonDataPageBuilderWidgets = contentItemCommonDataPageBuilderWidgets,
ContentItemCommonDataPageTemplateConfiguration = contentItemCommonDataPageTemplateConfiguration,
ContentItemCommonDataVisualBuilderWidgets = contentItemCommonDataPageBuilderWidgets,
ContentItemCommonDataVisualBuilderTemplateConfiguration = contentItemCommonDataPageTemplateConfiguration,
};

handler.EnsureContentItemCommonData(commonDataModel, ctms);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class PageTemplateConfigurationMapper(
ILogger<PageTemplateConfigurationMapper> logger,
PrimaryKeyMappingContext pkContext,
IProtocol protocol,
PageBuilderPatcher pageBuilderPatcher
VisualBuilderPatcher visualBuilderPatcher
)
: EntityMapperBase<ICmsPageTemplateConfiguration, PageTemplateConfigurationInfo>(logger, pkContext, protocol)
{
Expand Down Expand Up @@ -44,7 +44,7 @@ protected override PageTemplateConfigurationInfo MapInternal(ICmsPageTemplateCon
string? configurationTemplate = source.PageTemplateConfigurationTemplate;
string? configurationWidgets = source.PageTemplateConfigurationWidgets;

(configurationTemplate, configurationWidgets, bool _) = pageBuilderPatcher.PatchJsonDefinitions(source.PageTemplateConfigurationSiteID, configurationTemplate, configurationWidgets).GetAwaiter().GetResult();
(configurationTemplate, configurationWidgets, bool _) = visualBuilderPatcher.PatchJsonDefinitions(source.PageTemplateConfigurationSiteID, configurationTemplate, configurationWidgets).GetAwaiter().GetResult();

target.PageTemplateConfigurationTemplate = configurationTemplate;
target.PageTemplateConfigurationWidgets = configurationWidgets;
Expand Down
2 changes: 1 addition & 1 deletion KVA/Migration.Tool.Source/Migration.Tool.Source.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Kentico.Xperience.UMT" Version="1.10.2" />
<PackageReference Include="Kentico.Xperience.UMT" Version="3.0.0" />
<PackageReference Include="MediatR" Version="12.4.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace Migration.Tool.Source.Services;

public record PageBuilderPatchResult(string? Configuration, string? Widgets, bool NeedsDeferredPatch);

public class PageBuilderPatcher(
ILogger<PageBuilderPatcher> logger,
public class VisualBuilderPatcher(
ILogger<VisualBuilderPatcher> logger,
SourceInstanceContext sourceInstanceContext,
WidgetMigrationService widgetMigrationService,
ModelFacade modelFacade,
Expand Down
2 changes: 1 addition & 1 deletion Migration.Tool.Common/Migration.Tool.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" />
<PackageReference Include="Kentico.Xperience.UMT" Version="1.10.2" />
<PackageReference Include="Kentico.Xperience.UMT" Version="3.0.0" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
Expand Down
2 changes: 1 addition & 1 deletion Migration.Tool.Core.KX13/Migration.Tool.Core.KX13.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Kentico.Xperience.UMT" Version="1.10.2" />
<PackageReference Include="Kentico.Xperience.UMT" Version="3.0.0" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Migration.Tool.KXP.Api/Migration.Tool.KXP.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Kentico.Xperience.Admin" Version="29.7.0" />
<PackageReference Include="Kentico.Xperience.Core" Version="29.7.0" />
<PackageReference Include="Kentico.Xperience.Admin" Version="30.0.0" />
<PackageReference Include="Kentico.Xperience.Core" Version="30.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Kentico.Xperience.Core" Version="29.7.0" />
<PackageReference Include="Kentico.Xperience.WebApp" Version="29.7.0" />
<PackageReference Include="Kentico.Xperience.Core" Version="30.0.0" />
<PackageReference Include="Kentico.Xperience.WebApp" Version="30.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5"/>
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ View all [project releases](https://github.com/Kentico/xperience-by-kentico-kent

| Xperience Version | Library Version |
|-------------------|-----------------|
| 30.0.0 | 2.0.0 |
| 29.7.0 | 1.6.0 |
| 29.6.0 | 1.4.0 |
| 29.5.2 | 1.3.0 |
Expand Down
Loading