Skip to content

Commit

Permalink
feat(sln): remove obsolete api references (#30)
Browse files Browse the repository at this point in the history
* feat(sln): remove obsolete api references

* fix(npm): update versions

* fix(admin ui): incorrect index alias page link
  • Loading branch information
bkapustik authored Oct 16, 2024
1 parent 4120c9e commit cb853b4
Show file tree
Hide file tree
Showing 190 changed files with 6,458 additions and 2,639 deletions.
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Azure.Search.Documents" Version="11.6.0-beta.2" />
<PackageVersion Include="Kentico.Xperience.Admin" Version="29.5.0" />
<PackageVersion Include="Kentico.Xperience.WebApp" Version="29.5.0" />
<PackageVersion Include="kentico.xperience.azurestorage" Version="29.5.0" />
<PackageVersion Include="kentico.xperience.imageprocessing" Version="29.5.0" />
<PackageVersion Include="Kentico.Xperience.Core.Tests" Version="29.5.0" />
<PackageVersion Include="Kentico.Xperience.Admin" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.WebApp" Version="29.5.3" />
<PackageVersion Include="kentico.xperience.azurestorage" Version="29.5.3" />
<PackageVersion Include="kentico.xperience.imageprocessing" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Core.Tests" Version="29.5.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.20.0.85982" />

Expand Down
2 changes: 1 addition & 1 deletion examples/DancingGoat/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"kentico.xperience.dbmanager": {
"version": "28.1.0",
"version": "29.5.3",
"commands": [
"kentico-xperience-dbmanager"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using CMS.Base;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

using CMS.Base;
using CMS.ContactManagement;
using CMS.Core;
using CMS.DataEngine;
Expand Down Expand Up @@ -39,7 +43,7 @@ public class SampleDataGeneratorApplication : OverviewPageBase
private readonly IInfoProvider<ConsentInfo> consentInfoProvider;
private readonly IInfoProvider<BizFormInfo> bizFormInfoProvider;
private readonly IInfoProvider<ContactGroupInfo> contactGroupInfoProvider;
private readonly ISettingsKeyInfoProvider settingsKeyInfoProvider;
private readonly IInfoProvider<SettingsKeyInfo> settingsKeyInfoProvider;
private readonly IInfoProvider<WebsiteChannelInfo> websiteChannelInfoProvider;


Expand All @@ -59,7 +63,7 @@ public SampleDataGeneratorApplication(
IInfoProvider<ConsentInfo> consentInfoProvider,
IInfoProvider<BizFormInfo> bizFormInfoProvider,
IInfoProvider<ContactGroupInfo> contactGroupInfoProvider,
ISettingsKeyInfoProvider settingsKeyInfoProvider,
IInfoProvider<SettingsKeyInfo> settingsKeyInfoProvider,
IInfoProvider<WebsiteChannelInfo> websiteChannelInfoProvider)
{
this.formBuilderConfigurationSerializer = formBuilderConfigurationSerializer;
Expand Down Expand Up @@ -127,10 +131,12 @@ private void EnableDataProtectionSamples()
}


private OverviewCard GetGdprCard() => new()
private OverviewCard GetGdprCard()
{
Headline = "Set up data protection (GDPR) demo",
Actions = new[]
return new OverviewCard
{
Headline = "Set up data protection (GDPR) demo",
Actions = new[]
{
new Kentico.Xperience.Admin.Base.Action(ActionType.Command)
{
Expand All @@ -139,15 +145,16 @@ private void EnableDataProtectionSamples()
ButtonColor = ButtonColor.Secondary
}
},
Components = new List<IOverviewCardComponent>()
Components = new List<IOverviewCardComponent>()
{
new StringContentCardComponent
{
Content = @"Generates data and enables demonstration of giving consents, personal data portability, right to access, and right to be forgotten features.
Once enabled, the demo functionality cannot be disabled. Use on demo instances only."
}
}
};
};
}


private async Task SetChannelDefaultCookieLevelToEssential(int websiteChannelId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DancingGoat;
using DancingGoat;
using DancingGoat.Models;
using DancingGoat.PageTemplates;
using DancingGoat.Sections;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using CMS.ContactManagement;
using System.Collections.Generic;
using System.Linq;

using CMS.ContactManagement;
using CMS.DataEngine;

using DancingGoat.Personalization;
Expand Down
10 changes: 8 additions & 2 deletions examples/DancingGoat/Components/Sections/ZoneRestrictions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using DancingGoat.Widgets;
using System.Collections.Generic;
using System.Linq;

using Kentico.PageBuilder.Web.Mvc;

using DancingGoat.Widgets;

namespace DancingGoat.Sections
{
/// <summary>
Expand Down Expand Up @@ -48,8 +51,11 @@ public static IEnumerable<string> GetWideZoneRestrictions()
}


private static IEnumerable<string> GetWidgetsIdentifiers() => new ComponentDefinitionProvider<WidgetDefinition>()
private static IEnumerable<string> GetWidgetsIdentifiers()
{
return new ComponentDefinitionProvider<WidgetDefinition>()
.GetAll()
.Select(definition => definition.Identifier);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using CMS.Websites;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using CMS.Websites;

using DancingGoat.Models;

Expand Down Expand Up @@ -37,12 +41,12 @@ public ArticlesViewComponent(

public async Task<ViewViewComponentResult> InvokeAsync(WebPageRelatedItem articlesSectionItem)
{
string languageName = currentLanguageRetriever.Get();
var languageName = currentLanguageRetriever.Get();

var articlesSection = await articlesSectionRepository.GetArticlesSection(articlesSectionItem.WebPageGuid, languageName);
var articlesSection = await articlesSectionRepository.GetArticlesSection(articlesSectionItem.WebPageGuid, languageName, HttpContext.RequestAborted);
if (articlesSection == null)
{
return View("~/Components/ViewComponents/Articles/Default.cshtml", ArticlesSectionViewModel.GetViewModel(Enumerable.Empty<ArticleViewModel>(), string.Empty));
return View("~/Components/ViewComponents/Articles/Default.cshtml", ArticlesSectionViewModel.GetViewModel(null, Enumerable.Empty<ArticleViewModel>(), string.Empty));
}

var articlePages = await articlePageRepository.GetArticles(articlesSection.SystemFields.WebPageItemTreePath,
Expand All @@ -51,13 +55,13 @@ public async Task<ViewViewComponentResult> InvokeAsync(WebPageRelatedItem articl
var models = new List<ArticleViewModel>();
foreach (var article in articlePages)
{
var model = await ArticleViewModel.GetViewModel(article, urlRetriever, languageName);
var model = await ArticleViewModel.GetViewModel(article, urlRetriever, languageName, HttpContext.RequestAborted);
models.Add(model);
}

string url = (await urlRetriever.Retrieve(articlesSection, languageName)).RelativePath;
var url = (await urlRetriever.Retrieve(articlesSection, languageName, HttpContext.RequestAborted)).RelativePath;

var viewModel = ArticlesSectionViewModel.GetViewModel(models, url);
var viewModel = ArticlesSectionViewModel.GetViewModel(articlesSection, models, url);

return View("~/Components/ViewComponents/Articles/Default.cshtml", viewModel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace DancingGoat.ViewComponents
/// </summary>
public class BannerViewComponent : ViewComponent
{
public ViewViewComponentResult Invoke(BannerViewModel banner) => View("~/Components/ViewComponents/Banner/Default.cshtml", banner);
public ViewViewComponentResult Invoke(BannerViewModel banner)
{
return View("~/Components/ViewComponents/Banner/Default.cshtml", banner);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace DancingGoat.ViewComponents
/// </summary>
public class CafeViewComponent : ViewComponent
{
public ViewViewComponentResult Invoke(CafeViewModel cafe) => View("~/Components/ViewComponents/Cafe/Default.cshtml", cafe);
public ViewViewComponentResult Invoke(CafeViewModel cafe)
{
return View("~/Components/ViewComponents/Cafe/Default.cshtml", cafe);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
}
else
{
<a href="#" class="ourcoffee-tile-link">
<h2 class="ourcoffee-tile-text center-text">@Model.Name</h2>
<span class="cafe-overlay"> </span>
@if (!string.IsNullOrEmpty(Model.PhotoPath))
{
<img src="@Url.Content(Model.PhotoPath)" alt="@Model.PhotoShortDescription" title="@Model.Name" class="ourcoffee-tile-image" loading="lazy" />
}
</a>
<h2 class="ourcoffee-tile-text center-text">@Model.Name</h2>
<span class="cafe-overlay"> </span>
@if (!string.IsNullOrEmpty(Model.PhotoPath))
{
<img src="@Url.Content(Model.PhotoPath)" alt="@Model.PhotoShortDescription" title="@Model.Name" class="ourcoffee-tile-image" loading="lazy" />
}
}
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
using DancingGoat.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;

using CMS.Websites;

using DancingGoat.Models;

using Kentico.Content.Web.Mvc.Routing;

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
Expand All @@ -10,6 +18,37 @@ namespace DancingGoat.ViewComponents
/// </summary>
public class CafeCardSectionViewComponent : ViewComponent
{
public ViewViewComponentResult Invoke(IEnumerable<CafeViewModel> cafes) => View("~/Components/ViewComponents/CafeCardSection/Default.cshtml", cafes.Take(3));
private readonly ContactsPageRepository contactsPageRepository;
private readonly IWebPageUrlRetriever webPageUrlRetriever;
private readonly IPreferredLanguageRetriever currentLanguageRetriever;


public CafeCardSectionViewComponent(IPreferredLanguageRetriever currentLanguageRetriever, ContactsPageRepository contactsPageRepository, IWebPageUrlRetriever webPageUrlRetriever)
{
this.currentLanguageRetriever = currentLanguageRetriever;
this.contactsPageRepository = contactsPageRepository;
this.webPageUrlRetriever = webPageUrlRetriever;
}


public async Task<ViewViewComponentResult> InvokeAsync(IEnumerable<CafeViewModel> cafes)
{
string languageName = currentLanguageRetriever.Get();
string contactsPagePath = await GetContactsPagePath(languageName, HttpContext.RequestAborted);
var model = new CafeCardSectionViewModel(cafes, contactsPagePath);

return View("~/Components/ViewComponents/CafeCardSection/Default.cshtml", model);
}


private async Task<string> GetContactsPagePath(string languageName, CancellationToken cancellationToken)
{
const string CONTACTS_PAGE_TREE_PATH = "/Contacts";

var contactsPage = await contactsPageRepository.GetContactsPage(CONTACTS_PAGE_TREE_PATH, languageName, cancellationToken);
var url = await webPageUrlRetriever.Retrieve(contactsPage, cancellationToken);

return url.RelativePath;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;

using DancingGoat.Models;

namespace DancingGoat.ViewComponents
{
public record CafeCardSectionViewModel(IEnumerable<CafeViewModel> Cafes, string ContactsPagePath)
{
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@using DancingGoat.Models
@model IEnumerable<CafeViewModel>
@using DancingGoat.ViewComponents
@model CafeCardSectionViewModel

<div class="row cafe-cards">
<div class="title-wrapper">
<h1 class="title-tab">@HtmlLocalizer["Taste our coffee"]</h1>
</div>
<div class="row row--with-cols-padding">
@foreach (var cafe in Model)
@foreach (var cafe in Model.Cafes)
{
<div class="col-md-4">
<vc:cafe cafe="@cafe" />
<a href="@Model.ContactsPagePath" class="ourcoffee-tile-link">
<vc:cafe cafe="@cafe" />
</a>
</div>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using DancingGoat.Models;
using System.Threading.Tasks;

using DancingGoat.Models;

using Kentico.Content.Web.Mvc.Routing;

Expand All @@ -21,7 +23,7 @@ public CompanyAddressViewComponent(ContactRepository contactRepository, IPreferr

public async Task<IViewComponentResult> InvokeAsync()
{
string languageName = currentLanguageRetriever.Get();
var languageName = currentLanguageRetriever.Get();
var contact = await contactRepository.GetContact(languageName, HttpContext.RequestAborted);
var model = ContactViewModel.GetViewModel(contact);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DancingGoat.Models;
using DancingGoat.Search;
using System.Threading.Tasks;

using Kentico.Content.Web.Mvc.Routing;

Expand All @@ -21,17 +20,9 @@ public NavigationMenuViewComponent(NavigationService navigationService, IPreferr

public async Task<IViewComponentResult> InvokeAsync()
{
string languageName = currentLanguageRetriever.Get();
var languageName = currentLanguageRetriever.Get();

var navigationViewModels = (await navigationService.GetNavigationItemViewModels(languageName, HttpContext.RequestAborted)).ToList();

navigationViewModels.AddRange(new List<NavigationItemViewModel>
{
new($"Search", "/Search"),
new($"{nameof(SearchController.Geo)}Search", $"/Search/{nameof(SearchController.Geo)}"),
new($"{nameof(SearchController.Semantic)}Search", $"/Search/{nameof(SearchController.Semantic)}"),
new($"{nameof(SearchController.Simple)}Search", $"/Search/{nameof(SearchController.Simple)}"),
});
var navigationViewModels = await navigationService.GetNavigationItemViewModels(languageName, HttpContext.RequestAborted);

return View($"~/Components/ViewComponents/NavigationMenu/Default.cshtml", navigationViewModels);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using CMS.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

using CMS.Helpers;
using CMS.Websites;
using CMS.Websites.Routing;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using DancingGoat.Models;
using System.Linq;
using System.Threading.Tasks;

using DancingGoat.Models;

using Kentico.Content.Web.Mvc.Routing;

Expand All @@ -20,7 +23,7 @@ public SocialLinksViewComponent(SocialLinkRepository socialLinkRepository, IPref

public async Task<IViewComponentResult> InvokeAsync()
{
string languageName = currentLanguageRetriever.Get();
var languageName = currentLanguageRetriever.Get();

var socialLinks = await socialLinkRepository.GetSocialLinks(languageName, HttpContext.RequestAborted);

Expand Down
Loading

0 comments on commit cb853b4

Please sign in to comment.