Add OrderBy LastExecuted

This commit is contained in:
Sipke Schoorstra 2021-01-15 00:11:49 +01:00
parent 218bd5a851
commit 5e7fed05d2
4 changed files with 4 additions and 1 deletions

View file

@ -3,6 +3,7 @@
public enum OrderBy
{
Started,
LastExecuted,
Finished
}
}

View file

@ -50,7 +50,7 @@ namespace ElsaDashboard.Application.Pages.WorkflowInstances
}.Select(x => new ButtonDropdownItem(x?.ToString() ?? "All", x.ToString(), BuildFilterUrl(SelectedWorkflowId, x, SelectedOrderBy), x == SelectedWorkflowStatus));
private IEnumerable<ButtonDropdownItem> OrderByItems =>
new[] { OrderBy.Finished, OrderBy.Started }.Select(x => new ButtonDropdownItem(x.ToString(), x.ToString(), BuildFilterUrl(SelectedWorkflowId, SelectedWorkflowStatus, x), x == SelectedOrderBy));
new[] { OrderBy.Finished, OrderBy.LastExecuted, OrderBy.Started }.Select(x => new ButtonDropdownItem(x.ToString(), x.ToString(), BuildFilterUrl(SelectedWorkflowId, SelectedWorkflowStatus, x), x == SelectedOrderBy));
private string SelectedWorkflowText => SelectedWorkflowId == null ? "Workflow" : LatestWorkflowBlueprints.FirstOrDefault(x => x.Id == SelectedWorkflowId)?.DisplayName ?? "Workflow";
private string SelectedWorkflowStatusText => SelectedWorkflowStatus?.ToString() ?? "Status";

View file

@ -70,6 +70,7 @@ namespace Elsa.Server.Api.Endpoints.WorkflowInstances
orderBySpecification = orderBy switch
{
OrderBy.Started => OrderBySpecification.OrderByDescending<WorkflowInstance>(x => x.CreatedAt),
OrderBy.LastExecuted => OrderBySpecification.OrderByDescending<WorkflowInstance>(x => x.LastExecutedAt!),
OrderBy.Finished => OrderBySpecification.OrderByDescending<WorkflowInstance>(x => x.FinishedAt!),
_ => OrderBySpecification.OrderByDescending<WorkflowInstance>(x => x.FinishedAt!)
};

View file

@ -3,6 +3,7 @@
public enum OrderBy
{
Started,
LastExecuted,
Finished
}
}