Add support for custom title and description (#109)

This commit is contained in:
Sipke Schoorstra 2019-10-25 18:39:54 +02:00 committed by GitHub
parent 99ee3cacce
commit 06412c0cc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 6 deletions

View file

@ -2,6 +2,7 @@
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Elsa.Attributes;
using Elsa.Extensions;
using Elsa.Models;
using Elsa.Results;
@ -12,16 +13,32 @@ using Newtonsoft.Json.Linq;
namespace Elsa.Services
{
public abstract class ActivityBase : IActivity
{
{
public JObject State { get; set; } = new JObject();
public Variables Output { get; set; } = new Variables();
[JsonIgnore]
public Variables TransientOutput { get; } = new Variables();
public virtual string Type => GetType().Name;
[ActivityProperty(Label = "ID", Hint = "Optionally provide a custom ID for this activity. You can then reference this activity from expressions.")]
public string Id { get; set; }
[ActivityProperty(Hint = "Optionally provide a custom title for this activity.")]
public string Title
{
get => GetState<string>();
set => SetState(value);
}
[ActivityProperty(Hint = "Optionally provide a custom description for this activity.")]
public string Description
{
get => GetState<string>();
set => SetState(value);
}
public Task<bool> CanExecuteAsync(WorkflowExecutionContext context, CancellationToken cancellationToken) => OnCanExecuteAsync(context, cancellationToken);
public Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext context, CancellationToken cancellationToken) => OnExecuteAsync(context, cancellationToken);
public Task<ActivityExecutionResult> HaltedAsync(WorkflowExecutionContext context, CancellationToken cancellationToken) => OnHaltedAsync(context, cancellationToken);

View file

@ -32,8 +32,8 @@
<!-- CSS Files -->
<link href="~/_content/Elsa.Dashboard/assets/css/argon-dashboard.css?v=1.1.0" rel="stylesheet"/>
<link href="~/_content/Elsa.Dashboard/assets/css/elsa.css?v=1.1.0" rel="stylesheet"/>
<script type="module" src="https://unpkg.com/@@elsa-workflows/elsa-workflow-designer@0.0.59/dist/elsa-workflow-designer/elsa-workflow-designer.esm.js"></script>
<script nomodule="" src="https://unpkg.com/@@elsa-workflows/elsa-workflow-designer@0.0.59/dist/elsa-workflow-designer/elsa-workflow-designer.js"></script>
<script type="module" src="https://unpkg.com/@@elsa-workflows/elsa-workflow-designer@0.0.60/dist/elsa-workflow-designer/elsa-workflow-designer.esm.js"></script>
<script nomodule="" src="https://unpkg.com/@@elsa-workflows/elsa-workflow-designer@0.0.60/dist/elsa-workflow-designer/elsa-workflow-designer.js"></script>
@await RenderSectionAsync("HeadScripts", false)
</head>

View file

@ -61,7 +61,7 @@ namespace Elsa.WorkflowDesigner
var activityProperty = propertyInfo.GetCustomAttribute<ActivityPropertyAttribute>();
if (activityProperty == null)
yield break;
continue;
yield return new ActivityPropertyDescriptor
(