Feature: Job Queues

Also UI style, theme and element changes
This commit is contained in:
Gary Sharp
2014-02-03 14:50:08 +11:00
parent bdb3e1e6b4
commit 3f63281dc4
212 changed files with 17334 additions and 5441 deletions
@@ -9,22 +9,39 @@ namespace Disco.Web.Extensions
{
public static class JobSubTypeExtensions
{
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<JobSubType> SelectedItems)
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, IEnumerable<JobSubType> SelectedItems, bool IncludeQueueIcons = false)
{
List<string> selectedIds = default(List<string>);
if (SelectedItems != null)
selectedIds = SelectedItems.Select(i => string.Format("{0}_{1}", i.JobTypeId, i.Id)).ToList();
return jobSubTypes.ToSelectListItems(selectedIds);
}
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<string> SelectedIds = null)
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<string> SelectedIds = null, bool IncludeQueueIcons = false)
{
if (SelectedIds == null)
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = jst.Description }).ToList();
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = IncludeQueueIcons ? jst.DescriptionWithIcons() : jst.Description }).ToList();
else
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = jst.Description, Selected = (SelectedIds.Contains(string.Format("{0}_{1}", jst.JobTypeId, jst.Id))) }).ToList();
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = IncludeQueueIcons ? jst.DescriptionWithIcons() : jst.Description, Selected = (SelectedIds.Contains(string.Format("{0}_{1}", jst.JobTypeId, jst.Id))) }).ToList();
}
public static string DescriptionWithIcons(this JobSubType jst)
{
if (jst.JobQueues.Count > 0)
{
var sb = new System.Text.StringBuilder(System.Web.HttpUtility.HtmlEncode(jst.Description));
foreach (var jq in jst.JobQueues)
sb.AppendFormat("&nbsp;<i class=\"fa fa-{0} fa-fw d-{1}\" title=\"{2}\"></i>", jq.Icon, jq.IconColour, jq.Name);
return sb.ToString();
}
else
{
return System.Web.HttpUtility.HtmlEncode(jst.Description);
}
}
}
}
@@ -27,7 +27,7 @@ namespace Disco.Web.Extensions
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description, Selected = (SelectedId == jt.Id) }).ToList();
}
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, List<JobType> SelectedItems)
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, IEnumerable<JobType> SelectedItems)
{
List<string> selectedIds = default(List<string>);