From ea7181c99d9fec8b9c53aefc25614d1f839a4e37 Mon Sep 17 00:00:00 2001 From: Jeroen Roefs <71811893+SoftAdviceJR@users.noreply.github.com> Date: Tue, 6 Jun 2023 17:15:36 +0200 Subject: [PATCH] Added order property and ordered by it (#104) --- .../DashboardQueueAndTaskDetails.cs | 5 +++++ ...ManagerExAsynchronousDashboardContentProvider.cs | 13 ++++++++++--- .../TaskQueues/ShowOnDashboardAttribute.cs | 5 +++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/DashboardQueueAndTaskDetails.cs b/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/DashboardQueueAndTaskDetails.cs index 9799f629..f5970855 100644 --- a/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/DashboardQueueAndTaskDetails.cs +++ b/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/DashboardQueueAndTaskDetails.cs @@ -44,5 +44,10 @@ public class DashboardQueueAndTaskDetails /// If this is a recurring process then details on the recurring frequency. /// public IRecurrenceConfiguration RecurrenceConfiguration { get; set; } + + /// + /// Determines the order the operations are shown on the dashboard. + /// + public int Order { get; set; } } } diff --git a/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/TaskManagerExAsynchronousDashboardContentProvider.cs b/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/TaskManagerExAsynchronousDashboardContentProvider.cs index c40961fb..18da79d9 100644 --- a/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/TaskManagerExAsynchronousDashboardContentProvider.cs +++ b/MFiles.VAF.Extensions/Dashboards/AsynchronousDashboardContent/TaskManagerExAsynchronousDashboardContentProvider.cs @@ -63,8 +63,12 @@ RecurringOperationConfigurationManager recurringOperationConfigu /// public IEnumerable>>> GetAsynchronousDashboardContent() { + + var items = new List>>>(); + if (null == TaskQueueResolver) - yield break; + return items; + foreach (var queue in TaskQueueResolver.GetQueues()) { @@ -184,7 +188,7 @@ public IEnumerable>> + items.Add(new KeyValuePair>> ( new DashboardQueueAndTaskDetails() { @@ -194,16 +198,19 @@ public IEnumerable(queue, processor.Type, MFTaskState.MFTaskStateInProgress) : TaskManager.GetAllExecutions(queue, processor.Type) - ); + )); } } + + return items.OrderBy(i => i.Key.Order); } } } diff --git a/MFiles.VAF.Extensions/Dashboards/TaskQueues/ShowOnDashboardAttribute.cs b/MFiles.VAF.Extensions/Dashboards/TaskQueues/ShowOnDashboardAttribute.cs index 5492fe01..76cc3424 100644 --- a/MFiles.VAF.Extensions/Dashboards/TaskQueues/ShowOnDashboardAttribute.cs +++ b/MFiles.VAF.Extensions/Dashboards/TaskQueues/ShowOnDashboardAttribute.cs @@ -97,6 +97,11 @@ public class ShowOnDashboardAttribute /// public string RunCommandDisplayText { get; set; } = ShowOnDashboardAttribute.DefaultRunCommandDisplayText; + /// + /// Used to determine the order in which the task processors are shown on the dashboard + /// + public int Order { get; set; } = 100; + public ShowOnDashboardAttribute(string name) { this.Name = name;