Fix key not found error when blueprint doesn't exist

This commit is contained in:
Sipke Schoorstra 2020-12-18 13:02:57 +01:00
parent a24483cb3b
commit 07ad72ecda
4 changed files with 11 additions and 4 deletions

View file

@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{71
Dockerfile = Dockerfile
Nuget.Config = Nuget.Config
README.md = README.md
appveyor.yml = appveyor.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elsa.Abstractions", "src\core\Elsa.Abstractions\Elsa.Abstractions.csproj", "{3130C574-557C-4DA2-933E-AED7A9EBE48A}"

View file

@ -1,4 +1,5 @@
{
"private": true,
"scripts": {
"serve": "cross-env NODE_ENV=development concurrently \"postcss src/tailwind.css -o public/tailwind.css --watch\" \"live-server ./public\"",
"build:css:blazor": "cross-env NODE_ENV=production postcss src/tailwind.css -o ../../ElsaDashboard.Application/wwwroot/tailwind.css",

View file

@ -1,4 +1,5 @@
@page "/workflow-instances"
@using Elsa.Client.Models
<!-- Page title & actions -->
<div class="border-b border-gray-200 px-4 py-4 sm:flex sm:items-center sm:justify-between sm:px-6 lg:px-8">
<div class="flex-1 min-w-0">
@ -33,7 +34,7 @@
</div>
<ButtonDropdown Text="@SelectedWorkflowText" Items="@WorkflowFilterItems" IconType="@typeof(Icons.Squares)"/>
<ButtonDropdown Text="@SelectedWorkflowStatusText" Items="@WorkflowStatusFilterItems" IconType="@typeof(Icons.PlayCircle)"/>
<ButtonDropdown Text="@SelectedOrderByText" Items="@OrderByItems" IconType="@typeof(Icons.SortDescending)" />
<ButtonDropdown Text="@SelectedOrderByText" Items="@OrderByItems" IconType="@typeof(Icons.SortDescending)"/>
</div>
<!-- Workflow instances (only on smallest breakpoint) -->
@ -86,8 +87,9 @@
<tbody class="bg-white divide-y divide-gray-100">
@foreach (var workflowInstance in WorkflowInstances.Items)
{
var workflowBlueprint = WorkflowBlueprints[(workflowInstance.DefinitionId, workflowInstance.Version)];
var displayName = workflowBlueprint.DisplayName;
var workflowKey = (workflowInstance.DefinitionId, workflowInstance.Version);
var workflowBlueprint = WorkflowBlueprints.ContainsKey(workflowKey) ? WorkflowBlueprints[workflowKey] : new WorkflowBlueprint { DisplayName = "(Blueprint Not Found)" };
var displayName = workflowBlueprint.DisplayName!;
var statusColor = GetStatusColor(workflowInstance.WorkflowStatus);
var viewUrl = $"workflow-instances/{workflowInstance.EntityId}/viewer";
<tr>

View file

@ -59,8 +59,11 @@
@code {
private RenderFragment RenderPageButtons(int start, int end)
private RenderFragment? RenderPageButtons(int start, int end)
{
if (start - end <= 1)
return null;
return
@<text>
@for (var i = start; i < end; i++)