forked from elsa-workflows/elsa-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JSON editor UI hint to HTTP activities
This commit introduces a JSON editor UI hint to HTTP activities within Elsa Workflow. It includes creating new classes for a JSON editor options provider and a handler for this UI hint. Also, these additions are registered within the Elsa Workflow. The hint is applied to the 'RequestHeaders' and 'ResponseHeaders' input fields found in HTTP-related activity classes.
- Loading branch information
1 parent
2a5cf04
commit 5202b39
Showing
6 changed files
with
44 additions
and
7 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
10 changes: 10 additions & 0 deletions
10
src/modules/Elsa.Workflows.Core/UIHints/JsonEditor/JsonCodeOptionsProvider.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Reflection; | ||
using Elsa.Workflows.UIHints.CodeEditor; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Elsa.CSharp.Activities; | ||
|
||
internal class JsonCodeOptionsProvider : CodeEditorOptionsProviderBase | ||
{ | ||
protected override string GetLanguage(PropertyInfo propertyInfo, object? context) => "json"; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/modules/Elsa.Workflows.Core/UIHints/JsonEditor/JsonEditorUIHintHandler.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Reflection; | ||
using Elsa.CSharp.Activities; | ||
using Elsa.Workflows.Contracts; | ||
|
||
namespace Elsa.Workflows.UIHints.JsonEditor; | ||
|
||
/// <inheritdoc /> | ||
public class JsonEditorUIHintHandler : IUIHintHandler | ||
{ | ||
/// <inheritdoc /> | ||
public string UIHint => InputUIHints.JsonEditor; | ||
|
||
/// <inheritdoc /> | ||
public ValueTask<IEnumerable<Type>> GetPropertyUIHandlersAsync(PropertyInfo propertyInfo, CancellationToken cancellationToken) | ||
{ | ||
return new(new[] { typeof(JsonCodeOptionsProvider) }); | ||
} | ||
} |