Remaining time estimate
This commit is contained in:
@@ -30,10 +30,9 @@
|
||||
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))),
|
||||
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()
|
||||
@@ -43,7 +42,24 @@ else
|
||||
<p>No results.</p>
|
||||
}
|
||||
|
||||
@helper Btns(dynamic item)
|
||||
@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">
|
||||
@@ -61,12 +77,12 @@ else
|
||||
<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>
|
||||
@@ -100,16 +116,45 @@ else
|
||||
<span class="glyphicon glyphicon-download"></span> ToUser
|
||||
</a>
|
||||
}
|
||||
@helper TimeInProgress(TimeSpan timeSpan)
|
||||
@helper TimeInProgress(LeafInput leafInput)
|
||||
{
|
||||
if (timeSpan > TimeSpan.Zero)
|
||||
var summary = new List<string> { "Added Time: " + leafInput.Added };
|
||||
if (leafInput.StartTime.HasValue)
|
||||
{
|
||||
@timeSpan.ToRoundedReadableString()
|
||||
summary.Add("Start Time: " + leafInput.StartTime.Value);
|
||||
}
|
||||
}
|
||||
@helper DeleteLink(dynamic item)
|
||||
if (leafInput.EndTime.HasValue)
|
||||
{
|
||||
@Html.Partial("DisplayTemplates/_DeleteForm", (Tuple<int, string, bool>)Tuple.Create(item.Id, item.Identifier, item.IsDeletable))
|
||||
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)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<a href="@url?leafInputId=@Model"
|
||||
class="btn btn-default @{if (xs) {<text>btn-xs</text>}} @{if (disabled) {<text>disabled</text>}}"
|
||||
role="button"
|
||||
@{if (disabled) {<text>title="No chart has been generated"</text>}} />
|
||||
@{if (disabled) {<text>title="No chart has been generated"</text>}} >
|
||||
<span class="glyphicon glyphicon-stats"></span>
|
||||
Chart
|
||||
</a>
|
||||
@@ -0,0 +1,14 @@
|
||||
@using LeafWeb.Core.Entities
|
||||
@model Tuple<LeafInput,IQueryable<LeafInput>>
|
||||
@{
|
||||
var leafInput = Model.Item1;
|
||||
var observations = Model.Item2.Take(20);
|
||||
|
||||
var estimater = new TimeInProgressEstimater(observations);
|
||||
var totalTimeEstimate = estimater.EstimateTimeInProgress(leafInput);
|
||||
var remaining = totalTimeEstimate - leafInput.TimeInProgress;
|
||||
if (remaining > TimeSpan.Zero)
|
||||
{
|
||||
<text>@remaining.ToRoundedReadableString()</text>
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">€</span>@Html.TextBox(
|
||||
<span class="input-group-addon">€@Html.TextBox(
|
||||
"",
|
||||
Model == null ? "" : String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F2}", ViewData.ModelMetadata.Model),
|
||||
ViewBag.ClearTextField == true ? new { @class = "form-control clear-text-field input-block-level" } : new { @class = "form-control input-block-level" })</span>
|
||||
|
||||
Reference in New Issue
Block a user