Queue search

This commit is contained in:
2017-02-02 12:28:22 -05:00
parent e3779a323c
commit 77a35e87d3
11 changed files with 170 additions and 71 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
@using ClientDependency.Core.Mvc
@using LeafWeb.WebCms.Controllers
@inherits UmbracoTemplatePage
@{
Layout = null;
@@ -65,8 +66,8 @@
<script src="//oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<body @{if (CompileFlag.IsDebug()) {<text>class="debug"</text>}}>
<header>
<div class="container">
<div class="row">
+78 -57
View File
@@ -1,108 +1,129 @@
@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Controllers
@model QueueViewModel
@{
var grid = new WebGrid(Model.Items, rowsPerPage: 45);
}
<dl>
<dt>Service description</dt>
<dd>@Model.ServerDescription</dd>
</dl>
<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>
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier"),
grid.Column("SiteId", "Site Id"),
grid.Column("Name", "Submitted By"),
//grid.Column("FileCount", "Input files"),
grid.Column("TimeInProgress", "Time In Progress", item => TimeInProgress(item.TimeInProgress)),
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus.ToString())),
grid.Column("Total Results: " + Model.Items.Count(), format: item => Btns(item))),
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
)
@grid.BootstrapPager()
@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("FileCount", "Input files"),
grid.Column("TimeInProgress", "Time In Progress", item => TimeInProgress(item.TimeInProgress)),
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string) item.CurrentStatus.ToString())),
grid.Column("Total Results: " + Model.Items.Count(), format: item => Btns(item))),
htmlAttributes: new {@class = "table table-striped table-bordered table-hover table-condensed"}
)
@grid.BootstrapPager()
}
else
{
<p>No results.</p>
}
@helper Btns(dynamic 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)
{
<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">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 class="dropdown-header">Download</li>
<li>@DownloadInput(item)</li>
<li @DisableItem(!item.HasOutputFiles)>@DownloadOutputToUser(item)</li>
<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>
<li @DisableItem(!item.IsDeletable)>@DeleteLink(item)</li>
</ul>
</div>
</div>
</div>
}
@helper DetailsLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id)
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id)
}
@helper ChartLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id)
@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>
<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>
<a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.Id})">
<span class="glyphicon glyphicon-download"></span> ToUser
</a>
}
@helper TimeInProgress(TimeSpan timeSpan)
{
if (timeSpan > TimeSpan.Zero)
{
@timeSpan.ToRoundedReadableString()
@timeSpan.ToRoundedReadableString()
}
}
@helper DeleteLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_DeleteForm", (Tuple<int, string, bool>)Tuple.Create(item.Id, item.Identifier, item.IsDeletable))
@Html.Partial("DisplayTemplates/_DeleteForm", (Tuple<int, string, bool>)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))
@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))
@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>}
if (disabled)
{<text>class="disabled"</text>}
}