generated from Kentico/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
4,903 additions
and
4,858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 55 additions & 55 deletions
110
src/Kentico.Xperience.AzureSearch/Admin/AzureSearchAdminModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
using CMS; | ||
using CMS.Base; | ||
using CMS.Core; | ||
|
||
using Kentico.Xperience.Admin.Base; | ||
using Kentico.Xperience.AzureSearch.Admin; | ||
using Kentico.Xperience.AzureSearch.Aliasing; | ||
using Kentico.Xperience.AzureSearch.Indexing; | ||
|
||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Options; | ||
|
||
[assembly: RegisterModule(typeof(AzureSearchAdminModule))] | ||
|
||
namespace Kentico.Xperience.AzureSearch.Admin; | ||
|
||
/// <summary> | ||
/// Manages administration features and integration. | ||
/// </summary> | ||
internal class AzureSearchAdminModule : AdminModule | ||
{ | ||
private IAzureSearchConfigurationStorageService storageService = null!; | ||
private AzureSearchModuleInstaller installer = null!; | ||
|
||
public AzureSearchAdminModule() : base(nameof(AzureSearchAdminModule)) { } | ||
|
||
protected override void OnInit(ModuleInitParameters parameters) | ||
{ | ||
base.OnInit(parameters); | ||
|
||
var options = Service.Resolve<IOptions<AzureSearchOptions>>(); | ||
|
||
if (!options.Value?.SearchServiceEnabled ?? false) | ||
{ | ||
return; | ||
} | ||
|
||
RegisterClientModule("kentico", "xperience-integrations-azuresearch"); | ||
|
||
var services = parameters.Services; | ||
|
||
installer = services.GetRequiredService<AzureSearchModuleInstaller>(); | ||
storageService = services.GetRequiredService<IAzureSearchConfigurationStorageService>(); | ||
|
||
ApplicationEvents.Initialized.Execute += InitializeModule; | ||
} | ||
|
||
private void InitializeModule(object? sender, EventArgs e) | ||
{ | ||
installer.Install(); | ||
|
||
AzureSearchIndexStore.SetIndicies(storageService); | ||
AzureSearchIndexAliasStore.SetAliases(storageService); | ||
} | ||
} | ||
using CMS; | ||
using CMS.Base; | ||
using CMS.Core; | ||
|
||
using Kentico.Xperience.Admin.Base; | ||
using Kentico.Xperience.AzureSearch.Admin; | ||
using Kentico.Xperience.AzureSearch.Aliasing; | ||
using Kentico.Xperience.AzureSearch.Indexing; | ||
|
||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Options; | ||
|
||
[assembly: RegisterModule(typeof(AzureSearchAdminModule))] | ||
|
||
namespace Kentico.Xperience.AzureSearch.Admin; | ||
|
||
/// <summary> | ||
/// Manages administration features and integration. | ||
/// </summary> | ||
internal class AzureSearchAdminModule : AdminModule | ||
{ | ||
private IAzureSearchConfigurationStorageService storageService = null!; | ||
private AzureSearchModuleInstaller installer = null!; | ||
|
||
public AzureSearchAdminModule() : base(nameof(AzureSearchAdminModule)) { } | ||
|
||
protected override void OnInit(ModuleInitParameters parameters) | ||
{ | ||
base.OnInit(parameters); | ||
|
||
var options = Service.Resolve<IOptions<AzureSearchOptions>>(); | ||
|
||
if (!options.Value?.SearchServiceEnabled ?? false) | ||
{ | ||
return; | ||
} | ||
|
||
RegisterClientModule("kentico", "xperience-integrations-azuresearch"); | ||
|
||
var services = parameters.Services; | ||
|
||
installer = services.GetRequiredService<AzureSearchModuleInstaller>(); | ||
storageService = services.GetRequiredService<IAzureSearchConfigurationStorageService>(); | ||
|
||
ApplicationEvents.Initialized.Execute += InitializeModule; | ||
} | ||
|
||
private void InitializeModule(object? sender, EventArgs e) | ||
{ | ||
installer.Install(); | ||
|
||
AzureSearchIndexStore.SetIndicies(storageService); | ||
AzureSearchIndexAliasStore.SetAliases(storageService); | ||
} | ||
} |
70 changes: 35 additions & 35 deletions
70
src/Kentico.Xperience.AzureSearch/Admin/AzureSearchAliasConfigurationModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
using Kentico.Xperience.Admin.Base.FormAnnotations; | ||
|
||
namespace Kentico.Xperience.AzureSearch.Admin; | ||
|
||
public class AzureSearchAliasConfigurationModel | ||
{ | ||
public int Id { get; set; } | ||
|
||
[TextInputComponent( | ||
Label = "Alias Name", | ||
Order = 1)] | ||
[Required] | ||
[MinLength(1)] | ||
[MaxLength(128)] | ||
[RegularExpression("^(?!-)[a-z0-9-]+(?<!-)$", ErrorMessage = "Alias name must only contain lowercase letters, digits or dashes, cannot start or end with dashes and is limited to 128 characters.")] | ||
public string AliasName { get; set; } = ""; | ||
|
||
[GeneralSelectorComponent(dataProviderType: typeof(ExistingIndexOptionsProvider), Label = "Index Names", Order = 2)] | ||
[MinLength(1, ErrorMessage = "You must select at least one index name")] | ||
public IEnumerable<string> IndexNames { get; set; } = Enumerable.Empty<string>(); | ||
|
||
public AzureSearchAliasConfigurationModel() | ||
{ } | ||
|
||
public AzureSearchAliasConfigurationModel( | ||
AzureSearchIndexAliasItemInfo alias, | ||
IEnumerable<string> aliasIndexes) | ||
{ | ||
Id = alias.AzureSearchIndexAliasItemId; | ||
AliasName = alias.AzureSearchIndexAliasItemIndexAliasName; | ||
IndexNames = aliasIndexes; | ||
} | ||
} | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
using Kentico.Xperience.Admin.Base.FormAnnotations; | ||
|
||
namespace Kentico.Xperience.AzureSearch.Admin; | ||
|
||
public class AzureSearchAliasConfigurationModel | ||
{ | ||
public int Id { get; set; } | ||
|
||
[TextInputComponent( | ||
Label = "Alias Name", | ||
Order = 1)] | ||
[Required] | ||
[MinLength(1)] | ||
[MaxLength(128)] | ||
[RegularExpression("^(?!-)[a-z0-9-]+(?<!-)$", ErrorMessage = "Alias name must only contain lowercase letters, digits or dashes, cannot start or end with dashes and is limited to 128 characters.")] | ||
public string AliasName { get; set; } = ""; | ||
|
||
[GeneralSelectorComponent(dataProviderType: typeof(ExistingIndexOptionsProvider), Label = "Index Names", Order = 2)] | ||
[MinLength(1, ErrorMessage = "You must select at least one index name")] | ||
public IEnumerable<string> IndexNames { get; set; } = Enumerable.Empty<string>(); | ||
|
||
public AzureSearchAliasConfigurationModel() | ||
{ } | ||
|
||
public AzureSearchAliasConfigurationModel( | ||
AzureSearchIndexAliasItemInfo alias, | ||
IEnumerable<string> aliasIndexes) | ||
{ | ||
Id = alias.AzureSearchIndexAliasItemId; | ||
AliasName = alias.AzureSearchIndexAliasItemIndexAliasName; | ||
IndexNames = aliasIndexes; | ||
} | ||
} |
Oops, something went wrong.