Search for both LeafInput and LeafInputData

This commit is contained in:
2023-02-02 09:35:22 -05:00
parent 8e16510ad9
commit 680f139aa5
24 changed files with 808 additions and 281 deletions
+12 -8
View File
@@ -2,7 +2,6 @@
@model LeafWeb.WebCms.Models.ChartViewModel
@{
Html.RequiresJs("~/scripts/Chart.js");
Html.RequiresCss("~/Content/jquery.fancybox.min.css");
Html.RequiresJs("~/scripts/jquery.fancybox.min.js");
}
@@ -16,16 +15,21 @@
@foreach (var cId in Model.AvailableCurveId)
{
<p>
<a href="@Url.Action("ChartCurve", new {leafInputId = Model.LeafInputId, curveId = cId})"
data-fancybox
data-options='{"buttons" : ["zoom", "download", "close"]}'
class="btn btn-outline-secondary">
<i class="fa fa-picture-o"></i>
@cId Chart
</a>
@ChartLink(Model.LeafInputId, cId)
</p>
}
</div>
</div>
</div>
</div>
@helper ChartLink(int leafInputId, string curveId)
{
<a href="@Url.Action("ChartCurve", new { leafInputId, curveId})"
data-fancybox
data-options='{"buttons" : ["zoom", "download", "close"]}'
class="btn btn-outline-secondary">
<i class="fa fa-picture-o"></i>
@curveId Chart
</a>
}
+7 -62
View File
@@ -1,70 +1,15 @@
@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Controllers
@using LeafWeb.WebCms.Utility
@model SearchViewModel
@{
var grid = new WebGrid(Model.Items, rowsPerPage: 45);
}
@model SearchLeafInputViewModel
<div class="row align-items-end mb-3">
<div class="col-3 order-last order-sm-first font-italic font-weight-light ">
<strong>@Model.Items.Count()</strong> results
</div>
<div class="col-12 col-sm-9">
<div class="row align-items-end">
<div class="col-12 col-md-9 offset-md-3">
@Html.Partial("_LeafDataQuery", Model.Q,
new ViewDataDictionary{
{"actionName", "Search"},
{"controllerName", "Results"},
{"htmlFormAction", "/services/search/"}})
{"actionName", "Search"},
{"controllerName", "Results"},
{"htmlFormAction", "/services/search/"},
{"expand", true}})
</div>
</div>
@if (Model.Items.Any())
{
<div class="table-responsive">
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier"),
grid.Column("SiteId", "Site Id"),
//grid.Column("Name", "Submitted By"),
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
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. <a href="@UmbracoContext.Current.UrlProvider.GetUrl(LeafWebPageIds.LeafInputCreate)">Click here to submit Leaf Data.</a></p>
}
@helper Actions(LeafInput leafInput)
{
@Html.Partial("_LeafInputActions", leafInput)
}
@helper Status(LeafInput leafInput)
{
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
}
@helper DownloadResults()
{
<div class="btn-group" role="group" aria-label="Download">
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsInputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Input
</a>
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsOutputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Output
</a>
</div>
}
+69
View File
@@ -0,0 +1,69 @@
@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Utility
@model SearchLeafInputViewModel
@{
var grid = new WebGrid(Model.Results, rowsPerPage: 45);
}
<div class="row align-items-end mb-3">
<div class="col-3 order-last order-sm-first font-italic font-weight-light ">
<strong>@Model.Results.Count()</strong> results
</div>
<div class="col-12 col-sm-9">
@Html.Partial("_LeafDataQuery", Model.Q,
new ViewDataDictionary{
{"actionName", "Search"},
{"controllerName", "Results"},
{"htmlFormAction", "/services/search/"}})
</div>
</div>
@if (Model.Results.Any())
{
<div class="table-responsive">
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier"),
grid.Column("SiteId", "Site Id"),
//grid.Column("Name", "Submitted By"),
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
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
{
@Html.Partial("NoResults")
}
@helper Actions(LeafInput leafInput)
{
@Html.Partial("_LeafInputActions", leafInput)
}
@helper Status(LeafInput leafInput)
{
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
}
@helper DownloadResults()
{
<div class="btn-group" role="group" aria-label="Download">
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsInputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Input
</a>
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsOutputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Output
</a>
</div>
}
+84
View File
@@ -0,0 +1,84 @@
@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Controllers
@using LeafWeb.WebCms.Utility
@model SearchLeafInputDataViewModel
@{
var grid = new WebGrid(Model.Results, rowsPerPage: 45);
}
<div class="row align-items-end mb-3">
<div class="col-3 order-last order-sm-first font-italic font-weight-light ">
<strong>@Model.Results.Count()</strong> results
</div>
<div class="col-12 col-sm-9">
@Html.Partial("_LeafDataQuery", Model.Q,
new ViewDataDictionary{
{"actionName", "Search"},
{"controllerName", "Results"},
{"htmlFormAction", "/services/search/"}})
</div>
</div>
@if (Model.Results.Any())
{
<div class="table-responsive">
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier", data => data.LeafInput.Identifier), // TODO: link to LeafInput details
grid.Column("SiteId", "Site Id", data => data.LeafInput.SiteId),
grid.Column("", "Location: Lat., Long., Elev.", data => FormatLatLongEl(data.Site)),
grid.Column("CO2S", "CO2S [umol/mol]", data => data.CO2S_Range?.ToString("#.##")),
grid.Column("PARi", "PARi [umol/m2/s]", data => data.PARi_Range?.ToString("#.##")),
grid.Column("Tleaf", "Tleaf [oC]", data => data.Tleaf_Range?.ToString("#.##")),
grid.Column("PhiPS2", "PhiPS2", data => data.PhiPS2_Range?.ToString("#.##")),
grid.Column("", "", data => ChartLink(data.LeafInput))
),
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. <a href="@UmbracoContext.Current.UrlProvider.GetUrl(LeafWebPageIds.LeafInputCreate)">Click here to submit Leaf Data.</a></p>
}
@helper FormatLatLongEl(LeafInputDataSite site)
{
<text>@(site.Latitude?.ToString("#.00"))</text>if (site.Latitude != null){<text>&#176;</text>if (site.Longitude != null){<text>, </text>} }
<text>@(site.Longitude?.ToString("#.00"))</text>if (site.Longitude != null){<text>&#176;</text>if (site.Elevation != null){<text>, </text>}}
<text>@(site.Elevation?.ToString("#.#m"))</text>
}
@helper ChartLink(LeafInput item)
{
@Html.Partial("DisplayTemplates/_ChartLink", item.Id)
}
@helper Actions(LeafInput leafInput)
{
@Html.Partial("_LeafInputActions", leafInput)
}
@helper Status(LeafInput leafInput)
{
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
}
@helper DownloadResults()
{
<div class="btn-group" role="group" aria-label="Download">
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsInputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Input
</a>
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("ResultsOutputZip", "Download", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Output
</a>
</div>
}
+9
View File
@@ -0,0 +1,9 @@
@using LeafWeb.WebCms.Controllers
<div class="container-lg">
<div class="card card-body bg-light">
<p>No results.</p>
<p>
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(LeafWebPageIds.LeafInputCreate)">Click here to analyze your Leaf Data.</a>
</p>
</div>
</div>
+21 -13
View File
@@ -1,23 +1,31 @@
@using LeafWeb.Core.Entities
@using LeafWeb.WebCms.Controllers
@using LeafWeb.WebCms.Utility
@model IQueryable<LeafInput>
@{
var grid = new WebGrid(Model, rowsPerPage: 45);
}
<div class="table-responsive">
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier"),
grid.Column("SiteId", "Site Id"),
//grid.Column("Name", "Submitted By"),
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
grid.Column("", "", item => ChartLink(item.Value))
),
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
)
@grid.PagerList()
</div>
@if (Model.Any())
{
<div class="table-responsive">
@grid.Table(columns:
grid.Columns(
grid.Column("Identifier", "Identifier"),
grid.Column("SiteId", "Site Id"),
//grid.Column("Name", "Submitted By"),
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
grid.Column("", "", item => ChartLink(item.Value))
),
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
)
@grid.PagerList()
</div>
}
else
{
@Html.Partial("NoResults")
}
@helper ChartLink(LeafInput leafInput)
{
+48 -19
View File
@@ -12,6 +12,7 @@
var controllerName = string.Empty;
var htmlFormAction = string.Empty;
var admin = false;
var expand = false;
if (ViewData.ContainsKey("actionName"))
{
@@ -29,6 +30,10 @@
{
admin = true;
}
if (ViewData.ContainsKey("expand") || Model.HasExtendedParameters)
{
expand = true;
}
}
@using (Html.BeginUmbracoForm(actionName, controllerName, null, new { action = htmlFormAction, id = "leafdataquery" }))
{
@@ -38,21 +43,45 @@
</div>
<div class="col">
<div class="input-group">
<input name="q" type="text" class="form-control" placeholder="Search for..." value="@Model.q">
<input name="q" type="text" class="form-control" placeholder="Search for identifier..." value="@Model.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 class="btn btn-primary" type="submit">Search</button>
<button class="btn btn-outline-primary dropdown-toggle dropdown-toggle-split" type="button"
data-toggle="collapse" data-target=".search-toggle" aria-haspopup="true" aria-expanded="false"
title="Additional Parameters">
</button>
</span>
</div>
</div>
</div>
<!-- /input-group -->
<div class="row @if (Model.HasExtendedParameters) {<text>show</text>} collapse" id="additionalSearch">
<div class="row justify-content-end @if (!expand) {<text>show</text>} collapse search-toggle" id="showAdditionalSearch">
<div class="col text-right">
<a href="#" data-toggle="collapse" data-target=".search-toggle" aria-expanded="false"
title="Additional Search Options"><small class="text-muted"><i><i class="fa fa-caret-right"></i> Additional Parameters</i></small></a>
</div>
</div>
<div class="row @if (expand) {<text>show</text>} collapse search-toggle" id="additionalSearch">
<div class="col">
<div class="card card-body">
<div class="row">
<div class="col-3 offset-md-3">Result Type:</div>
<div class="col-6">
<div class="form-check">
<input class="form-check-input" type="radio" name="dsp" id="@LeafDataQuery.LeafInputSearchParam" value="@LeafDataQuery.LeafInputSearchParam" @if(Model.ShowLeafInput){<text>checked</text>} >
<label class="form-check-label" for="@LeafDataQuery.LeafInputSearchParam">
Leaf Input Sets
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="dsp" id="@LeafDataQuery.LeafInputDataSearchParam" value="@LeafDataQuery.LeafInputDataSearchParam" @if(Model.ShowLeafInputData){<text>checked</text>} >
<label class="form-check-label" for="@LeafDataQuery.LeafInputDataSearchParam">
Leaf Data
</label>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-6">
@Html.EditorFor(m => m.siteid)
@@ -63,23 +92,23 @@
</div>
<hr/>
<div class="row">
<div class="col-md-6">
<div class="col-lg-6">
<div class="row">
<div class="col-7">
@Html.EditorFor(m => m.lat, new {size = "small", append = "&deg;"})
@Html.EditorFor(m => m.lat, new { size = "small", append = "&deg;" })
</div>
<div class="col-5">
@Html.EditorFor(m => m.latr, new {size = "small", prepend = "&plusmn;", append = "&deg;"})
@Html.EditorFor(m => m.latr, new { size = "small", prepend = "&plusmn;", append = "&deg;" })
</div>
</div>
</div>
<div class="col-md-6 border-left">
<div class="col-lg-6 border-left">
<div class="row">
<div class="col-7">
@Html.EditorFor(m => m.lon, new {size = "small", append = "&deg;"})
@Html.EditorFor(m => m.lon, new { size = "small", append = "&deg;" })
</div>
<div class="col-5">
@Html.EditorFor(m => m.lonr, new {size = "small", prepend = "&plusmn;", append = "&deg;"})
@Html.EditorFor(m => m.lonr, new { size = "small", prepend = "&plusmn;", append = "&deg;" })
</div>
</div>
</div>
@@ -88,32 +117,32 @@
<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.co2s, new {size = "small", prepend = ">", append = "umol/m"})
@Html.EditorFor(m => m.co2s, new { size = "small", prepend = ">", append = "umol/m" })
</div>
<div class="col-md-6">
@Html.EditorFor(m => m.pari, new {size = "small", prepend = ">", append = "umol/m2/s"})
@Html.EditorFor(m => m.pari, new { size = "small", prepend = ">", append = "umol/m2/s" })
</div>
<div class="col-md-6">
@Html.EditorFor(m => m.tleaf, new {size = "small", prepend = ">", append = "oC"})
@Html.EditorFor(m => m.tleaf, new { size = "small", prepend = ">", append = "oC" })
</div>
<div class="col-md-6">
@Html.EditorFor(m => m.phips2, new {size = "small", prepend = ">"})
@Html.EditorFor(m => m.phips2, new { size = "small", prepend = ">" })
</div>
</div>
<hr/>
<div class="row">
<div class="col">
<div class="col offset-lg-6">
@Html.EditorFor(m => m.compl)
</div>
</div>
@if (admin)
{
<div class="row">
<div class="col">
<div class="col offset-lg-6">
@Html.EditorFor(m => m.erred)
</div>
</div>
}
}
</div>
</div>
</div>
+5 -5
View File
@@ -54,21 +54,21 @@
</div>
</div>
@helper Details_AdminLink(dynamic item)
@helper Details_AdminLink(LeafInput item)
{
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
@Html.Partial("DisplayTemplates/_Details_AdminLink", (int)item.Id, cssClass)
}
@helper Details_ResultsLink(dynamic item)
@helper Details_ResultsLink(LeafInput item)
{
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
@Html.Partial("DisplayTemplates/_Details_ResultsLink", (int)item.Id, cssClass)
}
@helper ChartLink(dynamic item)
@helper ChartLink(LeafInput item)
{
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
@@ -79,13 +79,13 @@
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id, cssClass)
}
@helper DownloadInput(dynamic item)
@helper DownloadInput(LeafInput item)
{
<a href="@Url.Action("Input", "Download", new {id = item.Id})" class="dropdown-item">
<span class="fa fa-download"></span> Input
</a>
}
@helper DownloadOutputToUser(dynamic item)
@helper DownloadOutputToUser(LeafInput item)
{
<a href="@Url.Action("OutputToUser", "Download", new {id = item.Id})" class="dropdown-item @DisableItem(!item.HasOutputFiles)">
<span class="fa fa-download"></span> Output