Files
LeafWeb/WebCms/Views/Queue/Index.cshtml
T
2017-02-03 22:26:00 -05:00

174 lines
5.8 KiB
Plaintext

@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Controllers
@model QueueViewModel
@{
var grid = new WebGrid(Model.Items, rowsPerPage: 45);
}
<div class="row panel">
<div class="col-lg-8">
Service description: @Model.ServerDescription
</div>
<div class="col-lg-4">
@using (Html.BeginUmbracoForm<QueueController>("Search", FormMethod.Post))
{
<div class="input-group">
<input name="query" type="text" class="form-control" placeholder="Search for..." value="@Model.Query">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Search</button>
</span>
</div><!-- /input-group -->
}
</div>
</div>
@if (Model.Items.Any())
{
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier"),
grid.Column("SiteId", "Site Id"),
grid.Column("Name", "Submitted By"),
grid.Column("TimeInProgress", "Time In Progress", item => TimeInProgress(item.Value)),
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
grid.Column("Total Results: " + Model.Items.Count(), format: item => Btns(item.Value))),
htmlAttributes: new {@class = "table table-striped table-bordered table-hover table-condensed"}
)
@grid.BootstrapPager()
}
else
{
<p>No results.</p>
}
@helper Status(LeafInput leafInput)
{
if (leafInput.IsPending)
{
<span class="text-nowrap">
<span class="text-muted" title="@leafInput.PendingPriority.ToString() Priority">
@Html.Partial("DisplayTemplates/PriorityIcon", leafInput.PendingPriority)
</span>
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput.CurrentStatus.ToString())
</span>
}
else
{
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput.CurrentStatus.ToString())
}
}
@helper Btns(LeafInput item)
{
<div class="btn-group text-nowrap" role="group">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Actions
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>@DetailsLink(item)</li>
<li @DisableItem(!item.HasLeafChart)>@ChartLink(item)</li>
@if (item.IsPending)
{
<li role="separator" class="divider"></li>
<li class="dropdown-header">Priority</li>
<li @DisableItem(item.PendingPriority == Priority.High)>@PriorityForm(item, Priority.High)</li>
<li @DisableItem(item.PendingPriority == Priority.Normal)>@PriorityForm(item, Priority.Normal)</li>
<li @DisableItem(item.PendingPriority == Priority.Low)>@PriorityForm(item, Priority.Low)</li>
}
@if (item.IsCancellable)
{
<li role="separator" class="divider"></li>
<li>@CancelLink(item)</li>
}
<li role="separator" class="divider"></li>
<li class="dropdown-header">Download</li>
<li>@DownloadInput(item)</li>
<li @DisableItem(!item.HasOutputFiles)>@DownloadOutputToUser(item)</li>
<li role="separator" class="divider"></li>
<li @DisableItem(!item.IsDeletable)>@DeleteLink(item)</li>
</ul>
</div>
</div>
}
@helper DetailsLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id)
}
@helper ChartLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id)
}
@helper DownloadInput(dynamic item)
{
<a href="@Url.Action("DownloadInput", "Queue", new {id = item.Id})">
<span class="glyphicon glyphicon-download"></span> Input
</a>
}
@helper DownloadOutputToUser(dynamic item)
{
<a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.Id})">
<span class="glyphicon glyphicon-download"></span> ToUser
</a>
}
@helper TimeInProgress(LeafInput leafInput)
{
var summary = new List<string> { "Added Time: " + leafInput.Added };
if (leafInput.StartTime.HasValue)
{
summary.Add("Start Time: " + leafInput.StartTime.Value);
}
if (leafInput.EndTime.HasValue)
{
summary.Add("End Time: " + leafInput.EndTime.Value);
}
var summaryText = string.Join(Environment.NewLine, summary);
<span class="text-nowrap" title="@summaryText">
@if (leafInput.TimeInProgress > TimeSpan.Zero)
{
<text>
<i class="fa fa-clock-o"></i> @leafInput.TimeInProgress.ToRoundedReadableString()
</text>
}
else if (leafInput.IsPending)
{
<text>
<i class="fa fa-hourglass-start"></i> @Html.Partial("DisplayTemplates/_TimeRemaining", Tuple.Create(leafInput, Model.CompletedLeafInput)) est.
</text>
}
@if (leafInput.IsRunning)
{
<text>
<br />
<i class="fa fa-hourglass-half"></i> @Html.Partial("DisplayTemplates/_TimeRemaining", Tuple.Create(leafInput, Model.CompletedLeafInput)) left
</text>
}
<br />
<i class="fa fa-file-o"></i> @leafInput.InputFiles.Count input files
</span>
}
@helper DeleteLink(LeafInput item)
{
@Html.Partial("DisplayTemplates/_DeleteForm", Tuple.Create(item.Id, item.Identifier, item.IsDeletable))
}
@helper CancelLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_CancelForm", (Tuple<int, string>)Tuple.Create(item.Id, item.Identifier))
}
@helper PriorityForm(dynamic item, Priority priority)
{
@Html.Partial("DisplayTemplates/_PriorityForm", (Tuple<int, Priority, Priority>)Tuple.Create(item.Id, item.PendingPriority, priority))
}
@helper DisableItem(bool disabled)
{
if (disabled)
{<text>class="disabled"</text>}
}