286 lines
11 KiB
Plaintext
286 lines
11 KiB
Plaintext
@using ClientDependency.Core.Mvc
|
|
@using LeafWeb.Core.Entities
|
|
@using LeafWeb.WebCms.Utility
|
|
@model QueueViewModel
|
|
|
|
@{
|
|
Html.RequiresJs("~/scripts/jquery.validate.min.js", 2);
|
|
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.min.js", 2);
|
|
Html.RequiresJs("~/scripts/jquery.validate.custom.js", 2);
|
|
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.bootstrap.js", 2);
|
|
Html.RequiresJs("~/scripts/Queue.js");
|
|
|
|
var grid = new WebGrid(Model.Items, rowsPerPage: 45);
|
|
}
|
|
|
|
@using (Html.BeginUmbracoForm("Search", "Queue", null, new { @action = "/leaf-data/manage-queue/" }))
|
|
{
|
|
<div class="row align-items-start">
|
|
<div class="col font-italic font-weight-light">
|
|
@Model.Items.Count() results<br />
|
|
Service description: @Model.ServerDescription
|
|
@*Est. processing time by LeafInput size -
|
|
<i class="fa fa-file-o"></i> 1: <strong>@Model.TimeInProgressEstimater.EstimateTimeInProgress(1).ToRoundedReadableString()</strong>
|
|
<i class="fa fa-file-o"></i> 10: <strong>@Model.TimeInProgressEstimater.EstimateTimeInProgress(10).ToRoundedReadableString()</strong>
|
|
<i class="fa fa-file-o"></i> 100: <strong>@Model.TimeInProgressEstimater.EstimateTimeInProgress(100).ToRoundedReadableString()</strong>*@
|
|
</div>
|
|
<div class="col">
|
|
<div class="input-group">
|
|
<input name="Q.q" type="text" class="form-control" placeholder="Search for..." value="@Model.Q.q">
|
|
<span class="input-group-append">
|
|
<button class="btn btn-outline-secondary" type="submit">Search</button>
|
|
<button class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" type="button"
|
|
data-toggle="collapse" data-target="#additionalSearch" aria-haspopup="true" aria-expanded="false"
|
|
title="Additional Search Options">
|
|
</button>
|
|
</span>
|
|
</div><!-- /input-group -->
|
|
</div>
|
|
</div>
|
|
<div class="row @if(Model.Q.HasExtendedParameters) {<text>show</text>} collapse ml-1 mr-1" id="additionalSearch">
|
|
|
|
<div class="col-lg-8 offset-lg-4 card card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
@Html.EditorFor(m => m.Q.siteid)
|
|
</div>
|
|
<div class="col-md-6">
|
|
@Html.EditorFor(m => m.Q.species)
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="row">
|
|
<div class="col-7">
|
|
@Html.EditorFor(m => m.Q.lat, new { size = "small", append = "°" })
|
|
</div>
|
|
<div class="col-5">
|
|
@Html.EditorFor(m => m.Q.latr, new { size = "small", prepend = "±", append = "°" })
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6 border-left">
|
|
<div class="row">
|
|
<div class="col-7">
|
|
@Html.EditorFor(m => m.Q.lon, new { size = "small", append = "°" })
|
|
</div>
|
|
<div class="col-5">
|
|
@Html.EditorFor(m => m.Q.lonr, new { size = "small", prepend = "±", append = "°" })
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="text-body font-weight-bold pb-3">Curve Variation range minimum</div>
|
|
<div class="row align-items-end">
|
|
<div class="col-md-6">
|
|
@Html.EditorFor(m => m.Q.co2s, new { size = "small", append = "umol/m", prepend = ">" })
|
|
</div>
|
|
<div class="col-md-6">
|
|
@Html.EditorFor(m => m.Q.pari, new { size = "small", append = "umol/m2/s", prepend = ">" })
|
|
</div>
|
|
<div class="col-md-6">
|
|
@Html.EditorFor(m => m.Q.tleaf, new { size = "small", append = "oC", prepend = ">" })
|
|
</div>
|
|
<div class="col-md-6">
|
|
@Html.EditorFor(m => m.Q.phips2, new { size = "small", prepend = ">" })
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="row">
|
|
<div class="col">
|
|
@Html.EditorFor(m => m.Q.completed)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
|
|
@if (Model.Items.Any())
|
|
{
|
|
<div id="queue" class="table-responsive mt-3">
|
|
@grid.Table(columns:
|
|
grid.Columns(
|
|
grid.Column("Identifier", "Identifier"),
|
|
grid.Column("SiteId", "Site Id"),
|
|
grid.Column("Name", "Submitted By"),
|
|
grid.Column("TimeInProgress", "Statistics", item => Statistics(item.Value), canSort: false),
|
|
grid.Column("CurrentStatus", "Status", item => Status(item.Value), canSort: false),
|
|
grid.Column("", format: item => Actions(item.Value), canSort: false)),
|
|
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
|
|
)
|
|
</div>
|
|
<div class="row justify-content-end">
|
|
<div class="col-sm">@grid.PagerList()</div>
|
|
<div class="col-sm col-lg-5 pl-4 pt-3 pt-sm-0" >
|
|
<span class="pr-2">Download Results</span>
|
|
@DownloadResults()
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<p>No results.</p>
|
|
}
|
|
|
|
@helper Status(LeafInput leafInput)
|
|
{
|
|
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
|
|
}
|
|
|
|
@helper Actions(LeafInput item)
|
|
{
|
|
<div class="btn-group text-nowrap" role="group">
|
|
<div class="btn-group" role="group">
|
|
<button id="actions(@item.Id)" type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle"
|
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Actions">
|
|
<span class="d-none d-sm-inline">Actions</span>
|
|
</button>
|
|
<div class="dropdown-menu" aria-labelledby="actions(@item.Id)">
|
|
@DetailsLink(item)
|
|
@ChartLink(item)
|
|
@if (item.IsPending)
|
|
{
|
|
<div class="dropdown-divider"></div>
|
|
<h6 class="dropdown-header">Priority</h6>
|
|
<button class="dropdown-item @DisableItem(item.PendingPriority == Priority.High)">@PriorityForm(item, Priority.High)</button>
|
|
<button class="dropdown-item @DisableItem(item.PendingPriority == Priority.Normal)">@PriorityForm(item, Priority.Normal)</button>
|
|
<button class="dropdown-item @DisableItem(item.PendingPriority == Priority.Low)">@PriorityForm(item, Priority.Low)</button>
|
|
}
|
|
@if (item.IsCancellable)
|
|
{
|
|
<div class="dropdown-divider"></div>
|
|
@CancelLink(item)
|
|
}
|
|
<div class="dropdown-divider"></div>
|
|
<h6 class="dropdown-header">Download</h6>
|
|
@DownloadInput(item)
|
|
@DownloadOutputToUser(item)
|
|
<div class="dropdown-divider"></div>
|
|
@DeleteLink(item)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
@helper DetailsLink(dynamic item)
|
|
{
|
|
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
|
|
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id, cssClass)
|
|
}
|
|
|
|
@helper ChartLink(dynamic item)
|
|
{
|
|
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
|
|
if (!item.HasLeafChart)
|
|
{
|
|
cssClass.SetCssDisabled();
|
|
}
|
|
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id, cssClass)
|
|
}
|
|
|
|
@helper DownloadInput(dynamic item)
|
|
{
|
|
<a href="@Url.Action("DownloadInput", "Queue", new {id = item.Id})" class="dropdown-item">
|
|
<span class="fa fa-download"></span> Input
|
|
</a>
|
|
}
|
|
@helper DownloadOutputToUser(dynamic item)
|
|
{
|
|
<a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.Id})" class="dropdown-item @DisableItem(!item.HasOutputFiles)">
|
|
<span class="fa fa-download"></span> ToUser
|
|
</a>
|
|
}
|
|
@helper Statistics(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">
|
|
<i class="fa fa-file-o"></i> @leafInput.InputFiles.Count @if (leafInput.InputFiles.Count > 1)
|
|
{<text>inputs</text>}
|
|
else
|
|
{ <text>input</text>}
|
|
<br />
|
|
@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.TimeInProgressEstimater)) est.
|
|
</text>
|
|
}
|
|
@if (leafInput.IsRunning)
|
|
{
|
|
<text>
|
|
<br />
|
|
<i class="fa fa-hourglass-half"></i> @Html.Partial("DisplayTemplates/_TimeRemaining", Tuple.Create(leafInput, Model.TimeInProgressEstimater)) left
|
|
</text>
|
|
}
|
|
</span>
|
|
}
|
|
@helper DeleteLink(LeafInput item)
|
|
{
|
|
var cssClass
|
|
= CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
if (!item.IsDeletable)
|
|
{
|
|
cssClass.SetCssDisabled();
|
|
}
|
|
@Html.Partial("DisplayTemplates/_DeleteForm", Tuple.Create(item.Id, item.Identifier), cssClass)
|
|
}
|
|
|
|
@helper CancelLink(LeafInput item)
|
|
{
|
|
var cssClass
|
|
= CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
if (!item.IsCancellable)
|
|
{
|
|
cssClass.SetCssDisabled();
|
|
}
|
|
@Html.Partial("DisplayTemplates/_CancelForm", Tuple.Create(item.Id, item.Identifier), cssClass)
|
|
}
|
|
|
|
@helper PriorityForm(LeafInput item, Priority priority)
|
|
{
|
|
var cssClass
|
|
= CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
|
|
@Html.Partial("DisplayTemplates/_PriorityForm", Tuple.Create(item.Id, item.PendingPriority, priority), cssClass)
|
|
}
|
|
|
|
@helper DisableItem(bool disabled)
|
|
{
|
|
if (disabled)
|
|
{<text>disabled</text>}
|
|
}
|
|
|
|
|
|
@helper DownloadResults()
|
|
{
|
|
<div class="btn-group" role="group" aria-label="Download">
|
|
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("DownloadResultsInputZip", "Queue", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
|
|
<span class="fa fa-download"></span> Input
|
|
</a>
|
|
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("DownloadResultsOutputZip", "Queue", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
|
|
<span class="fa fa-download"></span> Output
|
|
</a>
|
|
</div>
|
|
}
|
|
|