Skip to content

Commit

Permalink
Added order property and ordered by it (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftAdviceJR authored Jun 6, 2023
1 parent ad6f174 commit ea7181c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ public class DashboardQueueAndTaskDetails
/// If this is a recurring process then details on the recurring frequency.
/// </summary>
public IRecurrenceConfiguration RecurrenceConfiguration { get; set; }

/// <summary>
/// Determines the order the operations are shown on the dashboard.
/// </summary>
public int Order { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ RecurringOperationConfigurationManager<TConfiguration> recurringOperationConfigu
/// <inheritdoc />
public IEnumerable<KeyValuePair<DashboardQueueAndTaskDetails, IEnumerable<TaskInfo<TaskDirective>>>> GetAsynchronousDashboardContent()
{

var items = new List<KeyValuePair<DashboardQueueAndTaskDetails, IEnumerable<TaskInfo<TaskDirective>>>>();

if (null == TaskQueueResolver)
yield break;
return items;


foreach (var queue in TaskQueueResolver.GetQueues())
{
Expand Down Expand Up @@ -184,7 +188,7 @@ public IEnumerable<KeyValuePair<DashboardQueueAndTaskDetails, IEnumerable<TaskIn
.TryGetValue(queue, processor.Type, out recurrenceConfiguration);

// Return the data.
yield return new KeyValuePair<DashboardQueueAndTaskDetails, IEnumerable<TaskInfo<TaskDirective>>>
items.Add(new KeyValuePair<DashboardQueueAndTaskDetails, IEnumerable<TaskInfo<TaskDirective>>>
(
new DashboardQueueAndTaskDetails()
{
Expand All @@ -194,16 +198,19 @@ public IEnumerable<KeyValuePair<DashboardQueueAndTaskDetails, IEnumerable<TaskIn
Description = showOnDashboardAttribute?.Description,
Commands = commands,
TasksInQueue = waitingTasks,
Order = showOnDashboardAttribute?.Order ?? 100,
RecurrenceConfiguration = recurrenceConfiguration
},
// Get known executions (prior, running and future).
showDegraded
? TaskManager.GetExecutions<TaskDirective>(queue, processor.Type, MFTaskState.MFTaskStateInProgress)
: TaskManager.GetAllExecutions<TaskDirective>(queue, processor.Type)
);
));

}
}

return items.OrderBy(i => i.Key.Order);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public class ShowOnDashboardAttribute
/// </summary>
public string RunCommandDisplayText { get; set; } = ShowOnDashboardAttribute.DefaultRunCommandDisplayText;

/// <summary>
/// Used to determine the order in which the task processors are shown on the dashboard
/// </summary>
public int Order { get; set; } = 100;

public ShowOnDashboardAttribute(string name)
{
this.Name = name;
Expand Down

0 comments on commit ea7181c

Please sign in to comment.