Skip to content

Commit

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

* fix(npm): update versions
  • Loading branch information
bkapustik authored Oct 14, 2024
1 parent 3e8ec7e commit f0656d6
Show file tree
Hide file tree
Showing 89 changed files with 3,437 additions and 2,505 deletions.
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Kentico.Xperience.Admin" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.Azurestorage" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.Cloud" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.Core" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.Imageprocessing" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.WebApp" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.Core.Tests" Version="29.3.3" />
<PackageVersion Include="Kentico.Xperience.Admin" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Azurestorage" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Cloud" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Core" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Imageprocessing" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.WebApp" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Core.Tests" Version="29.5.3" />
<PackageVersion Include="Kentico.Xperience.Lucene" Version="" Condition="'$(LOCAL_NUGET)' == 'true'" />
<PackageVersion Include="Lucene.Net" Version="4.8.0-beta00016" />
<PackageVersion Include="Lucene.Net.Analysis.Common" Version="4.8.0-beta00016" />
Expand Down
83 changes: 0 additions & 83 deletions examples/DancingGoat/$CDRepository/repository.config

This file was deleted.

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.4.3",
"version": "29.5.3",
"commands": [
"kentico-xperience-dbmanager"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class SampleDataGeneratorApplication : OverviewPageBase
private readonly IEventLogService eventLogService;
private readonly IInfoProvider<ConsentInfo> consentInfoProvider;
private readonly IInfoProvider<BizFormInfo> bizFormInfoProvider;
private readonly IContactGroupInfoProvider contactGroupInfoProvider;
private readonly ISettingsKeyInfoProvider settingsKeyInfoProvider;
private readonly IInfoProvider<ContactGroupInfo> contactGroupInfoProvider;
private readonly IInfoProvider<SettingsKeyInfo> settingsKeyInfoProvider;
private readonly IInfoProvider<WebsiteChannelInfo> websiteChannelInfoProvider;


Expand All @@ -62,8 +62,8 @@ public SampleDataGeneratorApplication(
IEventLogService eventLogService,
IInfoProvider<ConsentInfo> consentInfoProvider,
IInfoProvider<BizFormInfo> bizFormInfoProvider,
IContactGroupInfoProvider contactGroupInfoProvider,
ISettingsKeyInfoProvider settingsKeyInfoProvider,
IInfoProvider<ContactGroupInfo> contactGroupInfoProvider,
IInfoProvider<SettingsKeyInfo> settingsKeyInfoProvider,
IInfoProvider<WebsiteChannelInfo> websiteChannelInfoProvider)
{
this.formBuilderConfigurationSerializer = formBuilderConfigurationSerializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task<ViewViewComponentResult> InvokeAsync(WebPageRelatedItem articl
{
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(null, Enumerable.Empty<ArticleViewModel>(), string.Empty));
Expand All @@ -55,11 +55,11 @@ 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);
}

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

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

Expand Down
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,8 +1,13 @@
using System.Collections.Generic;
using System.Linq;
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 @@ -13,9 +18,37 @@ namespace DancingGoat.ViewComponents
/// </summary>
public class CafeCardSectionViewComponent : ViewComponent
{
public ViewViewComponentResult Invoke(IEnumerable<CafeViewModel> cafes)
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)
{
return View("~/Components/ViewComponents/CafeCardSection/Default.cshtml", cafes.Take(3));
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
Expand Up @@ -54,15 +54,15 @@ public async Task<IViewComponentResult> InvokeAsync()
{
ConsentShortText = (await consent.GetConsentTextAsync(currentLanguage)).ShortText,
ReturnPageUrl = webPageDataContextRetriever.TryRetrieve(out var currentWebPageContext)
? (await urlRetriever.Retrieve(currentWebPageContext.WebPage.WebPageItemID, currentLanguage)).RelativePath
? (await urlRetriever.Retrieve(currentWebPageContext.WebPage.WebPageItemID, currentLanguage, cancellationToken: HttpContext.RequestAborted)).RelativePath
: (HttpContext.Request.PathBase + HttpContext.Request.Path).Value
};

var contact = ContactManagementContext.CurrentContact;
if ((contact != null) && consentAgreementService.IsAgreed(contact, consent))
{
consentModel.IsConsentAgreed = true;
consentModel.PrivacyPageUrl = Url.Content((await urlRetriever.Retrieve(PrivacyPageConstants.PRIVACY_PAGE_TREE_PATH, websiteChannelContext.WebsiteChannelName, currentLanguage)).RelativePath);
consentModel.PrivacyPageUrl = Url.Content((await urlRetriever.Retrieve(PrivacyPageConstants.PRIVACY_PAGE_TREE_PATH, websiteChannelContext.WebsiteChannelName, currentLanguage, cancellationToken: HttpContext.RequestAborted)).RelativePath);
}

return View("~/Components/ViewComponents/TrackingConsent/Default.cshtml", consentModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ProductCardListViewModel
/// </summary>
/// <param name="products">Collection of products.</param>
/// <returns>Hydrated ViewModel.</returns>
public static ProductCardListViewModel GetViewModel(IEnumerable<Coffee> products)
public static ProductCardListViewModel GetViewModel(IEnumerable<IProductFields> products)
{
var productModels = new List<ProductCardViewModel>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

using CMS.ContentEngine;

using DancingGoat.Models;

using Kentico.PageBuilder.Web.Mvc;
using Kentico.Xperience.Admin.Base.FormAnnotations;

Expand All @@ -17,7 +15,7 @@ public class ProductCardProperties : IWidgetProperties
/// <summary>
/// Selected products.
/// </summary>
[ContentItemSelectorComponent(Coffee.CONTENT_TYPE_NAME, Label = "Selected products", Order = 1)]
[ContentItemSelectorComponent(typeof(ProductCardSchemaFilter), Label = "Selected products", Order = 1)]
public IEnumerable<ContentItemReference> SelectedProducts { get; set; } = new List<ContentItemReference>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Generic;

using DancingGoat.Models;

using Kentico.Xperience.Admin.Base.FormAnnotations;

namespace DancingGoat.Widgets
{
/// <summary>
/// Product card widget filter for content item selector.
/// </summary>
public class ProductCardSchemaFilter : IReusableFieldSchemasFilter
{
/// <inheritdoc/>
IEnumerable<string> IReusableFieldSchemasFilter.AllowedSchemaNames => new List<string> { IProductFields.REUSABLE_FIELD_SCHEMA_NAME };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ public class ProductCardViewModel
/// </summary>
/// <param name="product">Product.</param>
/// <returns>Hydrated ViewModel.</returns>
public static ProductCardViewModel GetViewModel(Coffee product)
public static ProductCardViewModel GetViewModel(IProductFields product)
{
if (product == null)
{
return null;
}

return new ProductCardViewModel
{
Heading = product.Name,
ImagePath = (product.Image.FirstOrDefault())?.ImageFile.Url,
Text = product.CoffeeShortDescription
};
{
Heading = product.ProductFieldsName,
ImagePath = product.ProductFieldsImage.FirstOrDefault()?.ImageFile.Url,
Text = product.ProductFieldsShortDescription
};
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using System.Threading.Tasks;

using CMS.ContentEngine;

using DancingGoat.Models;
using DancingGoat.Widgets;

Expand All @@ -26,7 +27,7 @@ public class ProductCardWidgetViewComponent : ViewComponent
public const string IDENTIFIER = "DancingGoat.LandingPage.ProductCardWidget";


private readonly CoffeeRepository repository;
private readonly ProductRepository repository;
private readonly IPreferredLanguageRetriever currentLanguageRetriever;


Expand All @@ -35,7 +36,7 @@ public class ProductCardWidgetViewComponent : ViewComponent
/// </summary>
/// <param name="repository">Repository for retrieving products.</param>
/// <param name="currentLanguageRetriever">Retrieves preferred language name for the current request. Takes language fallback into account.</param>
public ProductCardWidgetViewComponent(CoffeeRepository repository, IPreferredLanguageRetriever currentLanguageRetriever)
public ProductCardWidgetViewComponent(ProductRepository repository, IPreferredLanguageRetriever currentLanguageRetriever)
{
this.repository = repository;
this.currentLanguageRetriever = currentLanguageRetriever;
Expand All @@ -46,8 +47,8 @@ public async Task<ViewViewComponentResult> InvokeAsync(ProductCardProperties pro
{
var languageName = currentLanguageRetriever.Get();
var selectedProductGuids = properties.SelectedProducts.Select(i => i.Identifier).ToList();
IEnumerable<Coffee> products = (await repository.GetCoffees(selectedProductGuids, languageName))
.OrderBy(p => selectedProductGuids.IndexOf(p.SystemFields.ContentItemGUID));
var products = (await repository.GetProducts(selectedProductGuids, languageName))
.OrderBy(p => selectedProductGuids.IndexOf(((IContentItemFieldsSource)p).SystemFields.ContentItemGUID));
var model = ProductCardListViewModel.GetViewModel(products);

return View("~/Components/Widgets/ProductCardWidget/_ProductCardWidget.cshtml", model);
Expand Down
Loading

0 comments on commit f0656d6

Please sign in to comment.