Merge pull request #6393 from KnibbsyMan/feat/add-in-sql-editor

Removes Built In SQL Editor Configuration
This commit is contained in:
Sipke Schoorstra 2025-02-10 09:54:25 +01:00 committed by GitHub
commit 08f7bd7019
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 24 deletions

View file

@ -2,7 +2,7 @@ using System.Reflection;
using Elsa.Workflows.UIHints.CodeEditor;
// ReSharper disable once CheckNamespace
namespace Elsa.Workflows.UIHints.SqlEditor;
namespace Elsa.Sql.Activities;
internal class SqlCodeOptionsProvider : CodeEditorOptionsProviderBase
{

View file

@ -44,7 +44,9 @@ public class SqlCommand : Activity
/// </summary>
[Input(
Description = "Command to run against the database.",
UIHint = InputUIHints.SqlEditor)]
UIHint = InputUIHints.CodeEditor,
UIHandler = typeof(SqlCodeOptionsProvider)
)]
public Input<string?> Command { get; set; } = default!;

View file

@ -45,7 +45,9 @@ public class SqlQuery : Activity
/// </summary>
[Input(
Description = "Query to run against the database.",
UIHint = InputUIHints.SqlEditor)]
UIHint = InputUIHints.CodeEditor,
UIHandler = typeof(SqlCodeOptionsProvider)
)]
public Input<string?> Query { get; set; } = default!;

View file

@ -44,7 +44,9 @@ public class SqlSingleValue : Activity
/// </summary>
[Input(
Description = "Query to run against the database.",
UIHint = InputUIHints.SqlEditor)]
UIHint = InputUIHints.CodeEditor,
UIHandler = typeof(SqlCodeOptionsProvider)
)]
public Input<string?> Query { get; set; } = default!;

View file

@ -1,6 +1,7 @@
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Services;
using Elsa.Sql.Activities;
using Elsa.Sql.Contracts;
using Elsa.Sql.Factory;
using Elsa.Sql.Implimentations;
@ -51,7 +52,10 @@ public class SqlFeature : FeatureBase
})
.AddSingleton<ISqlClientFactory, SqlClientFactory>()
// Providers
.AddScoped<IPropertyUIHandler, SqlCodeOptionsProvider>()
.AddScoped<IPropertyUIHandler, SqlClientsDropDownProvider>()
.AddScoped<ISqlClientNamesProvider, SqlClientNamesProvider>();
}
}

View file

@ -24,7 +24,6 @@ using Elsa.Workflows.Services;
using Elsa.Workflows.UIHints.CheckList;
using Elsa.Workflows.UIHints.Dropdown;
using Elsa.Workflows.UIHints.JsonEditor;
using Elsa.Workflows.UIHints.SqlEditor;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Workflows.Features;
@ -232,13 +231,11 @@ public class WorkflowsFeature : FeatureBase
.AddScoped<IUIHintHandler, DropDownUIHintHandler>()
.AddScoped<IUIHintHandler, CheckListUIHintHandler>()
.AddScoped<IUIHintHandler, JsonEditorUIHintHandler>()
.AddScoped<IUIHintHandler, SqlEditorUIHintHandler>()
// UI property handlers.
.AddScoped<IPropertyUIHandler, StaticCheckListOptionsProvider>()
.AddScoped<IPropertyUIHandler, StaticDropDownOptionsProvider>()
.AddScoped<IPropertyUIHandler, JsonCodeOptionsProvider>()
.AddScoped<IPropertyUIHandler, SqlCodeOptionsProvider>()
// Logger state generators.
.AddSingleton(WorkflowLoggerStateGenerator)

View file

@ -21,6 +21,5 @@ public static class InputUIHints
public const string OutputPicker = "output-picker";
public const string OutcomePicker = "outcome-picker";
public const string JsonEditor = "json-editor";
public const string SqlEditor = "sql-editor";
public const string DynamicOutcomes = "dynamic-outcomes";
}

View file

@ -1,16 +0,0 @@
using System.Reflection;
namespace Elsa.Workflows.UIHints.SqlEditor;
/// <inheritdoc />
public class SqlEditorUIHintHandler : IUIHintHandler
{
/// <inheritdoc />
public string UIHint => InputUIHints.SqlEditor;
/// <inheritdoc />
public ValueTask<IEnumerable<Type>> GetPropertyUIHandlersAsync(PropertyInfo propertyInfo, CancellationToken cancellationToken)
{
return new([typeof(SqlCodeOptionsProvider)]);
}
}