Add Only my data to
This commit is contained in:
@@ -25,7 +25,8 @@ namespace LeafWeb.WebCms.Controllers
|
||||
var resultItems =
|
||||
DataService.GetLeafInputsOrdered();
|
||||
|
||||
resultItems = QueryFilter.Search(resultItems, query);
|
||||
resultItems
|
||||
= QueryFilter.Search(resultItems, query, Members.GetCurrentLoginStatus()?.Email);
|
||||
|
||||
var timeInProgressEstimater = TimeInProgressEstimater();
|
||||
|
||||
@@ -170,7 +171,8 @@ namespace LeafWeb.WebCms.Controllers
|
||||
var resultItems =
|
||||
DataService.GetLeafInputsOrdered();
|
||||
|
||||
resultItems = QueryFilter.Search(resultItems, query);
|
||||
resultItems
|
||||
= QueryFilter.Search(resultItems, query, Members.GetCurrentLoginStatus()?.Email);
|
||||
|
||||
if (resultItems == null)
|
||||
return View("DownloadNotFound");
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace LeafWeb.WebCms.Controllers
|
||||
var resultItems =
|
||||
DataService.GetLeafInputsOrdered();
|
||||
|
||||
resultItems = QueryFilter.Search(resultItems, query);
|
||||
resultItems =
|
||||
QueryFilter.Search(resultItems, query, Members.GetCurrentLoginStatus()?.Email);
|
||||
|
||||
var searchViewModel = new SearchViewModel
|
||||
{
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace LeafWeb.WebCms.Models
|
||||
[Display(Name = "Show Only Successfully Completed")]
|
||||
public bool compl { get; set; }
|
||||
|
||||
[Display(Name = "Only my data")]
|
||||
public bool usr { get; set; }
|
||||
|
||||
public bool HasExtendedParameters =>
|
||||
!(
|
||||
string.IsNullOrEmpty(siteid)
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace LeafWeb.WebCms.Utility
|
||||
{
|
||||
internal static class QueryFilter
|
||||
{
|
||||
public static IQueryable<LeafInput> Search(IQueryable<LeafInput> resultItems, LeafDataQuery query)
|
||||
public static IQueryable<LeafInput> Search(IQueryable<LeafInput> resultItems, LeafDataQuery query, string currentUserEmail)
|
||||
{
|
||||
// search functionality
|
||||
if (!string.IsNullOrEmpty(query.q))
|
||||
@@ -154,6 +154,15 @@ namespace LeafWeb.WebCms.Utility
|
||||
select li;
|
||||
}
|
||||
|
||||
if (query.usr && !string.IsNullOrEmpty(currentUserEmail))
|
||||
{
|
||||
resultItems =
|
||||
from li in resultItems
|
||||
where
|
||||
li.Email.Equals(currentUserEmail, StringComparison.OrdinalIgnoreCase)
|
||||
select li;
|
||||
}
|
||||
|
||||
return resultItems;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Service description: @Model.ServerDescription
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end">
|
||||
<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
|
||||
@*Est. processing time by LeafInput size -
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
@if (Model.Items.Any())
|
||||
{
|
||||
<div id="queue" class="table-responsive mt-3">
|
||||
<div id="queue" class="table-responsive">
|
||||
@grid.Table(columns:
|
||||
grid.Columns(
|
||||
grid.Column("Identifier", "Identifier"),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
var grid = new WebGrid(Model.Items, rowsPerPage: 45);
|
||||
}
|
||||
|
||||
<div class="row align-items-end">
|
||||
<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>
|
||||
|
||||
@@ -3,8 +3,15 @@
|
||||
@{
|
||||
Layout = null;
|
||||
var lowerPropertyName = StringExtensions.LowercaseFirst(ViewData.ModelMetadata.PropertyName);
|
||||
|
||||
var groupClass = $"form-group {lowerPropertyName}";
|
||||
|
||||
if (ViewBag.groupClass != null)
|
||||
{
|
||||
groupClass = string.Concat(groupClass, " ", ViewBag.groupClass);
|
||||
}
|
||||
}
|
||||
<div class="form-group @lowerPropertyName">
|
||||
<div class="@groupClass">
|
||||
@Html.LabelForModel()
|
||||
@RenderBody()
|
||||
@Html.ValidationMessage(string.Empty, new { @class = "text-danger"})
|
||||
|
||||
@@ -23,76 +23,84 @@
|
||||
htmlFormAction = (string)ViewData["htmlFormAction"];
|
||||
}
|
||||
}
|
||||
@using (Html.BeginUmbracoForm(actionName, controllerName, null, new {action = htmlFormAction}))
|
||||
@using (Html.BeginUmbracoForm(actionName, controllerName, null, new { action = htmlFormAction }))
|
||||
{
|
||||
<div class="input-group pl-5">
|
||||
<input name="q" type="text" class="form-control" placeholder="Search for..." 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>
|
||||
</span>
|
||||
</div>
|
||||
<!-- /input-group -->
|
||||
<div class="container">
|
||||
<div class="row justify-content-end">
|
||||
<div class="col text-right pt-2">
|
||||
@Html.EditorFor(m => m.usr, new ViewDataDictionary{{"groupClass", "mb-0"}})
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<input name="q" type="text" class="form-control" placeholder="Search for..." 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>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /input-group -->
|
||||
<div class="row @if (Model.HasExtendedParameters) {<text>show</text>} collapse" id="additionalSearch">
|
||||
<div class="col card card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
@Html.EditorFor(m => m.siteid)
|
||||
<div class="col">
|
||||
<div class="card card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
@Html.EditorFor(m => m.siteid)
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@Html.EditorFor(m => m.species)
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@Html.EditorFor(m => m.species)
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
@Html.EditorFor(m => m.lat, new {size = "small", append = "°"})
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
@Html.EditorFor(m => m.lat, new {size = "small", append = "°"})
|
||||
</div>
|
||||
<div class="col-5">
|
||||
@Html.EditorFor(m => m.latr, new {size = "small", prepend = "±", append = "°"})
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
@Html.EditorFor(m => m.latr, new {size = "small", prepend = "±", append = "°"})
|
||||
</div>
|
||||
<div class="col-md-6 border-left">
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
@Html.EditorFor(m => m.lon, new {size = "small", append = "°"})
|
||||
</div>
|
||||
<div class="col-5">
|
||||
@Html.EditorFor(m => m.lonr, new {size = "small", prepend = "±", append = "°"})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 border-left">
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
@Html.EditorFor(m => m.lon, new {size = "small", append = "°"})
|
||||
</div>
|
||||
<div class="col-5">
|
||||
@Html.EditorFor(m => m.lonr, new {size = "small", prepend = "±", append = "°"})
|
||||
</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.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"})
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@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 = ">"})
|
||||
</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.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"})
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@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 = ">"})
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@Html.EditorFor(m => m.compl)
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@Html.EditorFor(m => m.compl)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user