generated from Kentico/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Kentico/feat/dotnet-format
Add dotnet format check
- Loading branch information
Showing
59 changed files
with
4,112 additions
and
4,103 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
194 changes: 97 additions & 97 deletions
194
src/Kentico.Xperience.Lucene.Admin/Components/LuceneIndexConfigurationComponent.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,97 +1,97 @@ | ||
using CMS.DataEngine; | ||
|
||
using Kentico.Xperience.Admin.Base; | ||
using Kentico.Xperience.Admin.Base.FormAnnotations; | ||
using Kentico.Xperience.Admin.Base.Forms; | ||
using Kentico.Xperience.Lucene.Admin; | ||
using Kentico.Xperience.Lucene.Core.Indexing; | ||
|
||
[assembly: RegisterFormComponent( | ||
identifier: LuceneIndexConfigurationComponent.IDENTIFIER, | ||
componentType: typeof(LuceneIndexConfigurationComponent), | ||
name: "Lucene Search Index Configuration")] | ||
|
||
namespace Kentico.Xperience.Lucene.Admin; | ||
|
||
#pragma warning disable S2094 // intentionally empty class | ||
public class LuceneIndexConfigurationComponentProperties : FormComponentProperties | ||
{ | ||
} | ||
#pragma warning restore | ||
|
||
public class LuceneIndexConfigurationComponentClientProperties : FormComponentClientProperties<IEnumerable<LuceneIndexIncludedPath>> | ||
{ | ||
public IEnumerable<LuceneIndexContentType>? PossibleContentTypeItems { get; set; } | ||
} | ||
|
||
public sealed class LuceneIndexConfigurationComponentAttribute : FormComponentAttribute | ||
{ | ||
} | ||
|
||
[ComponentAttribute(typeof(LuceneIndexConfigurationComponentAttribute))] | ||
public class LuceneIndexConfigurationComponent : FormComponent<LuceneIndexConfigurationComponentProperties, LuceneIndexConfigurationComponentClientProperties, IEnumerable<LuceneIndexIncludedPath>> | ||
{ | ||
public const string IDENTIFIER = "kentico.xperience-integrations-lucene-admin.lucene-index-configuration"; | ||
|
||
internal List<LuceneIndexIncludedPath>? Value { get; set; } | ||
|
||
public override string ClientComponentName => "@kentico/xperience-integrations-lucene-admin/LuceneIndexConfiguration"; | ||
|
||
public override IEnumerable<LuceneIndexIncludedPath> GetValue() => Value ?? []; | ||
public override void SetValue(IEnumerable<LuceneIndexIncludedPath> value) => Value = value.ToList(); | ||
|
||
[FormComponentCommand] | ||
public Task<ICommandResponse<RowActionResult>> DeletePath(string path) | ||
{ | ||
var toRemove = Value?.Find(x => Equals(x.AliasPath == path, StringComparison.OrdinalIgnoreCase)); | ||
if (toRemove != null) | ||
{ | ||
Value?.Remove(toRemove); | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
|
||
[FormComponentCommand] | ||
public Task<ICommandResponse<RowActionResult>> SavePath(LuceneIndexIncludedPath path) | ||
{ | ||
var value = Value?.SingleOrDefault(x => Equals(x.AliasPath == path.AliasPath, StringComparison.OrdinalIgnoreCase)); | ||
|
||
if (value is not null) | ||
{ | ||
Value?.Remove(value); | ||
} | ||
|
||
Value?.Add(path); | ||
|
||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
|
||
[FormComponentCommand] | ||
public Task<ICommandResponse<RowActionResult>> AddPath(string path) | ||
{ | ||
if (Value?.Exists(x => x.AliasPath == path) ?? false) | ||
{ | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
else | ||
{ | ||
Value?.Add(new LuceneIndexIncludedPath(path)); | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
} | ||
|
||
protected override async Task ConfigureClientProperties(LuceneIndexConfigurationComponentClientProperties properties) | ||
{ | ||
var allWebsiteContentTypes = DataClassInfoProvider.ProviderObject | ||
.Get() | ||
.WhereEquals(nameof(DataClassInfo.ClassContentTypeType), "Website") | ||
.GetEnumerableTypedResult() | ||
.Select(x => new LuceneIndexContentType(x.ClassName, x.ClassDisplayName, 0)); | ||
|
||
properties.Value = Value ?? []; | ||
properties.PossibleContentTypeItems = allWebsiteContentTypes.ToList(); | ||
|
||
await base.ConfigureClientProperties(properties); | ||
} | ||
} | ||
using CMS.DataEngine; | ||
|
||
using Kentico.Xperience.Admin.Base; | ||
using Kentico.Xperience.Admin.Base.FormAnnotations; | ||
using Kentico.Xperience.Admin.Base.Forms; | ||
using Kentico.Xperience.Lucene.Admin; | ||
using Kentico.Xperience.Lucene.Core.Indexing; | ||
|
||
[assembly: RegisterFormComponent( | ||
identifier: LuceneIndexConfigurationComponent.IDENTIFIER, | ||
componentType: typeof(LuceneIndexConfigurationComponent), | ||
name: "Lucene Search Index Configuration")] | ||
|
||
namespace Kentico.Xperience.Lucene.Admin; | ||
|
||
#pragma warning disable S2094 // intentionally empty class | ||
public class LuceneIndexConfigurationComponentProperties : FormComponentProperties | ||
{ | ||
} | ||
#pragma warning restore | ||
|
||
public class LuceneIndexConfigurationComponentClientProperties : FormComponentClientProperties<IEnumerable<LuceneIndexIncludedPath>> | ||
{ | ||
public IEnumerable<LuceneIndexContentType>? PossibleContentTypeItems { get; set; } | ||
} | ||
|
||
public sealed class LuceneIndexConfigurationComponentAttribute : FormComponentAttribute | ||
{ | ||
} | ||
|
||
[ComponentAttribute(typeof(LuceneIndexConfigurationComponentAttribute))] | ||
public class LuceneIndexConfigurationComponent : FormComponent<LuceneIndexConfigurationComponentProperties, LuceneIndexConfigurationComponentClientProperties, IEnumerable<LuceneIndexIncludedPath>> | ||
{ | ||
public const string IDENTIFIER = "kentico.xperience-integrations-lucene-admin.lucene-index-configuration"; | ||
|
||
internal List<LuceneIndexIncludedPath>? Value { get; set; } | ||
|
||
public override string ClientComponentName => "@kentico/xperience-integrations-lucene-admin/LuceneIndexConfiguration"; | ||
|
||
public override IEnumerable<LuceneIndexIncludedPath> GetValue() => Value ?? []; | ||
public override void SetValue(IEnumerable<LuceneIndexIncludedPath> value) => Value = value.ToList(); | ||
|
||
[FormComponentCommand] | ||
public Task<ICommandResponse<RowActionResult>> DeletePath(string path) | ||
{ | ||
var toRemove = Value?.Find(x => Equals(x.AliasPath == path, StringComparison.OrdinalIgnoreCase)); | ||
if (toRemove != null) | ||
{ | ||
Value?.Remove(toRemove); | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
|
||
[FormComponentCommand] | ||
public Task<ICommandResponse<RowActionResult>> SavePath(LuceneIndexIncludedPath path) | ||
{ | ||
var value = Value?.SingleOrDefault(x => Equals(x.AliasPath == path.AliasPath, StringComparison.OrdinalIgnoreCase)); | ||
|
||
if (value is not null) | ||
{ | ||
Value?.Remove(value); | ||
} | ||
|
||
Value?.Add(path); | ||
|
||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
|
||
[FormComponentCommand] | ||
public Task<ICommandResponse<RowActionResult>> AddPath(string path) | ||
{ | ||
if (Value?.Exists(x => x.AliasPath == path) ?? false) | ||
{ | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
else | ||
{ | ||
Value?.Add(new LuceneIndexIncludedPath(path)); | ||
return Task.FromResult(ResponseFrom(new RowActionResult(false))); | ||
} | ||
} | ||
|
||
protected override async Task ConfigureClientProperties(LuceneIndexConfigurationComponentClientProperties properties) | ||
{ | ||
var allWebsiteContentTypes = DataClassInfoProvider.ProviderObject | ||
.Get() | ||
.WhereEquals(nameof(DataClassInfo.ClassContentTypeType), "Website") | ||
.GetEnumerableTypedResult() | ||
.Select(x => new LuceneIndexContentType(x.ClassName, x.ClassDisplayName, 0)); | ||
|
||
properties.Value = Value ?? []; | ||
properties.PossibleContentTypeItems = allWebsiteContentTypes.ToList(); | ||
|
||
await base.ConfigureClientProperties(properties); | ||
} | ||
} |
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,37 +1,38 @@ | ||
using CMS; | ||
using CMS.Base; | ||
using CMS.Core; | ||
|
||
using Kentico.Xperience.Admin.Base; | ||
using Kentico.Xperience.Lucene.Admin; | ||
using Kentico.Xperience.Lucene.Core; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
[assembly: RegisterModule(typeof(LuceneAdminModule))] | ||
|
||
namespace Kentico.Xperience.Lucene.Admin; | ||
|
||
/// <summary> | ||
/// Manages administration features and integration. | ||
/// </summary> | ||
internal class LuceneAdminModule : AdminModule | ||
{ | ||
private LuceneModuleInstaller installer = null!; | ||
public LuceneAdminModule() : base(nameof(LuceneAdminModule)) { } | ||
|
||
protected override void OnInit(ModuleInitParameters parameters) | ||
{ | ||
base.OnInit(parameters); | ||
|
||
RegisterClientModule("kentico", "xperience-integrations-lucene-admin"); | ||
|
||
var services = parameters.Services; | ||
|
||
installer = services.GetRequiredService<LuceneModuleInstaller>(); | ||
|
||
ApplicationEvents.Initialized.Execute += InitializeModule; | ||
} | ||
|
||
private void InitializeModule(object? sender, EventArgs e) => | ||
installer.Install(); | ||
} | ||
using CMS; | ||
using CMS.Base; | ||
using CMS.Core; | ||
|
||
using Kentico.Xperience.Admin.Base; | ||
using Kentico.Xperience.Lucene.Admin; | ||
using Kentico.Xperience.Lucene.Core; | ||
|
||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
[assembly: RegisterModule(typeof(LuceneAdminModule))] | ||
|
||
namespace Kentico.Xperience.Lucene.Admin; | ||
|
||
/// <summary> | ||
/// Manages administration features and integration. | ||
/// </summary> | ||
internal class LuceneAdminModule : AdminModule | ||
{ | ||
private LuceneModuleInstaller installer = null!; | ||
public LuceneAdminModule() : base(nameof(LuceneAdminModule)) { } | ||
|
||
protected override void OnInit(ModuleInitParameters parameters) | ||
{ | ||
base.OnInit(parameters); | ||
|
||
RegisterClientModule("kentico", "xperience-integrations-lucene-admin"); | ||
|
||
var services = parameters.Services; | ||
|
||
installer = services.GetRequiredService<LuceneModuleInstaller>(); | ||
|
||
ApplicationEvents.Initialized.Execute += InitializeModule; | ||
} | ||
|
||
private void InitializeModule(object? sender, EventArgs e) => | ||
installer.Install(); | ||
} |
Oops, something went wrong.