From 8d7d72f17701a72d3bd1ece34f083eb162eb5e36 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sun, 29 Sep 2019 10:43:11 +0200 Subject: [PATCH] Fix workflow instance details view --- .../Areas/Elsa/Controllers/WorkflowInstanceController.cs | 8 +++++++- .../Areas/Elsa/ViewModels/WorkflowInstanceDetailsModel.cs | 2 ++ .../Elsa/Views/Shared/WorkflowDefinitionEditor.cshtml | 2 +- .../Areas/Elsa/Views/WorkflowInstance/Details.cshtml | 2 +- .../ViewComponents/WorkflowDesignerViewComponent.cs | 3 ++- .../ViewModels/WorkflowDesignerViewComponentModel.cs | 1 + .../Shared/Components/WorkflowDesigner/Default.cshtml | 2 +- 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/dashboard/Elsa.Dashboard/Areas/Elsa/Controllers/WorkflowInstanceController.cs b/src/dashboard/Elsa.Dashboard/Areas/Elsa/Controllers/WorkflowInstanceController.cs index cfe12511d..3fc3afe4a 100644 --- a/src/dashboard/Elsa.Dashboard/Areas/Elsa/Controllers/WorkflowInstanceController.cs +++ b/src/dashboard/Elsa.Dashboard/Areas/Elsa/Controllers/WorkflowInstanceController.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Elsa.Dashboard.Areas.Elsa.ViewModels; using Elsa.Dashboard.Extensions; using Elsa.Dashboard.Models; +using Elsa.Dashboard.Options; using Elsa.Dashboard.Services; using Elsa.Extensions; using Elsa.Models; @@ -12,6 +13,7 @@ using Elsa.Serialization; using Elsa.Serialization.Formatters; using Jint.Native.Json; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; namespace Elsa.Dashboard.Areas.Elsa.Controllers { @@ -21,17 +23,20 @@ namespace Elsa.Dashboard.Areas.Elsa.Controllers { private readonly IWorkflowInstanceStore workflowInstanceStore; private readonly IWorkflowDefinitionStore workflowDefinitionStore; + private readonly IOptions options; private readonly IWorkflowSerializer serializer; private readonly INotifier notifier; public WorkflowInstanceController( IWorkflowInstanceStore workflowInstanceStore, IWorkflowDefinitionStore workflowDefinitionStore, + IOptions options, IWorkflowSerializer serializer, INotifier notifier) { this.workflowInstanceStore = workflowInstanceStore; this.workflowDefinitionStore = workflowDefinitionStore; + this.options = options; this.serializer = serializer; this.notifier = notifier; } @@ -92,7 +97,8 @@ namespace Elsa.Dashboard.Areas.Elsa.Controllers ReturnUrl = returnUrl, Json = json, WorkflowDefinition = definition, - WorkflowInstance = instance + WorkflowInstance = instance, + ActivityDefinitions = options.Value.ActivityDefinitions.ToArray() }; return View(model); diff --git a/src/dashboard/Elsa.Dashboard/Areas/Elsa/ViewModels/WorkflowInstanceDetailsModel.cs b/src/dashboard/Elsa.Dashboard/Areas/Elsa/ViewModels/WorkflowInstanceDetailsModel.cs index 456d11ae1..15198ad04 100644 --- a/src/dashboard/Elsa.Dashboard/Areas/Elsa/ViewModels/WorkflowInstanceDetailsModel.cs +++ b/src/dashboard/Elsa.Dashboard/Areas/Elsa/ViewModels/WorkflowInstanceDetailsModel.cs @@ -1,4 +1,5 @@ using Elsa.Models; +using ActivityDefinition = Elsa.WorkflowDesigner.Models.ActivityDefinition; namespace Elsa.Dashboard.Areas.Elsa.ViewModels { @@ -8,5 +9,6 @@ namespace Elsa.Dashboard.Areas.Elsa.ViewModels public string Json { get; set; } public WorkflowDefinitionVersion WorkflowDefinition { get; set; } public WorkflowInstance WorkflowInstance { get; set; } + public ActivityDefinition[] ActivityDefinitions { get; set; } } } \ No newline at end of file diff --git a/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/Shared/WorkflowDefinitionEditor.cshtml b/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/Shared/WorkflowDefinitionEditor.cshtml index c68670459..d100420e9 100644 --- a/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/Shared/WorkflowDefinitionEditor.cshtml +++ b/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/Shared/WorkflowDefinitionEditor.cshtml @@ -25,7 +25,7 @@
- +
diff --git a/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/WorkflowInstance/Details.cshtml b/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/WorkflowInstance/Details.cshtml index 3a58403d2..11ed6e11c 100644 --- a/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/WorkflowInstance/Details.cshtml +++ b/src/dashboard/Elsa.Dashboard/Areas/Elsa/Views/WorkflowInstance/Details.cshtml @@ -18,7 +18,7 @@
- + diff --git a/src/dashboard/Elsa.WorkflowDesigner/ViewComponents/WorkflowDesignerViewComponent.cs b/src/dashboard/Elsa.WorkflowDesigner/ViewComponents/WorkflowDesignerViewComponent.cs index c2f4b67ac..717c742a2 100644 --- a/src/dashboard/Elsa.WorkflowDesigner/ViewComponents/WorkflowDesignerViewComponent.cs +++ b/src/dashboard/Elsa.WorkflowDesigner/ViewComponents/WorkflowDesignerViewComponent.cs @@ -8,10 +8,11 @@ namespace Elsa.WorkflowDesigner.ViewComponents { public class WorkflowDesignerViewComponent : ViewComponent { - public IViewComponentResult Invoke(ActivityDefinition[] activityDefinitions) + public IViewComponentResult Invoke(ActivityDefinition[] activityDefinitions, string id) { var model = new WorkflowDesignerViewComponentModel { + Id = id, ActivityDefinitionsJson = GetActivityDefinitionOptions(activityDefinitions) }; diff --git a/src/dashboard/Elsa.WorkflowDesigner/ViewModels/WorkflowDesignerViewComponentModel.cs b/src/dashboard/Elsa.WorkflowDesigner/ViewModels/WorkflowDesignerViewComponentModel.cs index d44b897f4..e56125b4f 100644 --- a/src/dashboard/Elsa.WorkflowDesigner/ViewModels/WorkflowDesignerViewComponentModel.cs +++ b/src/dashboard/Elsa.WorkflowDesigner/ViewModels/WorkflowDesignerViewComponentModel.cs @@ -2,6 +2,7 @@ namespace Elsa.WorkflowDesigner.ViewModels { public class WorkflowDesignerViewComponentModel { + public string Id { get; set; } public string ActivityDefinitionsJson { get; set; } } } \ No newline at end of file diff --git a/src/dashboard/Elsa.WorkflowDesigner/Views/Shared/Components/WorkflowDesigner/Default.cshtml b/src/dashboard/Elsa.WorkflowDesigner/Views/Shared/Components/WorkflowDesigner/Default.cshtml index 0136beb44..27084f1c1 100644 --- a/src/dashboard/Elsa.WorkflowDesigner/Views/Shared/Components/WorkflowDesigner/Default.cshtml +++ b/src/dashboard/Elsa.WorkflowDesigner/Views/Shared/Components/WorkflowDesigner/Default.cshtml @@ -1,3 +1,3 @@ @model Elsa.WorkflowDesigner.ViewModels.WorkflowDesignerViewComponentModel - \ No newline at end of file + \ No newline at end of file