Split LeafOutputFile content into different table for performance

This commit is contained in:
2016-05-23 15:23:36 -04:00
parent 790e2494e3
commit 55f7b68bf8
21 changed files with 307 additions and 19 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ namespace LeafWeb.Web.Controllers
try
{
var curveIds = GetCurveIds(leafOutputFile.Contents);
var curveIds = GetCurveIds(leafOutputFile.FileContents.Contents);
var viewModel = new ChartViewModel
{
@@ -54,7 +54,7 @@ namespace LeafWeb.Web.Controllers
if (leafOutputFile == null)
throw new ArgumentOutOfRangeException(); // TODO: break
var curveData = GetCurveData(leafOutputFile.Contents, curveId);
var curveData = GetCurveData(leafOutputFile.FileContents.Contents, curveId);
if (curveData == null)
return File("/Content/favicon/apple-icon-57x57.png", "image/png"); // TODO: different image ?
+38 -1
View File
@@ -1,8 +1,9 @@
using System;
using System.Linq;
using System.Web.Mvc;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
using LeafWeb.Web.Attributes;
using LeafWeb.Web.ViewModels.LeafInput;
using LeafWeb.Web.ViewModels.Results;
using LeafWeb.Web.ViewModels.ResultsAdmin;
@@ -20,6 +21,42 @@ namespace LeafWeb.Web.Controllers
return View(viewModel);
}
public ActionResult Details(int id)
{
var leafInput = DataService.GetLeafInput(id);
var viewModel = new LeafInputViewModel(leafInput);
return View(viewModel);
}
public ActionResult DownloadOutputToUser(int id)
{
return GetOutputZip(id, LeafOutputFileType.ToUser);
}
public ActionResult DownloadOutputNotToUser(int id)
{
return GetOutputZip(id, LeafOutputFileType.NotToUser);
}
public ActionResult DownloadOutputCleanedInput(int id)
{
return GetOutputZip(id, LeafOutputFileType.CleanedInput);
}
private ActionResult GetOutputZip(int id, LeafOutputFileType type)
{
var leafInput = DataService.GetLeafInput(id);
if (leafInput == null)
return View("DownloadNotFound");
var zip = leafInput.GetOutputFileZip(type);
var filename = $"{leafInput.Identifier.FilterValidFilename()}_{type}.zip";
return new FileContentResult(zip, "application/zip") { FileDownloadName = filename };
}
public ActionResult Delete(int id)
{
var leafInput = DataService.GetLeafInput(id);
+3 -3
View File
@@ -61,7 +61,7 @@ namespace LeafWeb.Web.Services
var outputErrorMessage = leafInput.OutputErrorMessage;
if (outputErrorMessage != null)
SendLeafWebError(leafInput, outputErrorMessage.Contents.GetString());
SendLeafWebError(leafInput, outputErrorMessage.FileContents.Contents.GetString());
else
SendLeafWebSuccess(leafInput);
}
@@ -99,7 +99,7 @@ namespace LeafWeb.Web.Services
var fileStreams =
(from outputFile in
leafInput.OutputFiles
select Tuple.Create(outputFile, new MemoryStream(outputFile.Contents))).ToList();
select Tuple.Create(outputFile, new MemoryStream(outputFile.FileContents.Contents))).ToList();
try
{
foreach (var fileStream in fileStreams)
@@ -151,7 +151,7 @@ namespace LeafWeb.Web.Services
return Environment.NewLine + Environment.NewLine
+ "The following warning message was generated."
+ Environment.NewLine + Environment.NewLine
+ leafInput.OutputWarningMessage.Contents.GetString()
+ leafInput.OutputWarningMessage.FileContents.Contents.GetString()
+ Environment.NewLine;
return string.Empty;
}
+1 -1
View File
@@ -47,7 +47,7 @@ namespace LeafWeb.Web.Services.PiscalQueue
{
try
{
var parser = new LeafInputCsvParser(outputFile.Contents);
var parser = new LeafInputCsvParser(outputFile.FileContents.Contents);
var data = parser.Parse();
data.LeafInput = leafInput;
data.LeafOutputFile = outputFile;
+1 -1
View File
@@ -16,7 +16,7 @@
{
<div class="form-actions">
<input type="submit" value="Delete" class="btn btn-warning" />
@Html.ActionLink("Cancel", "Details", new { id = Model.LeafInputId }, new { @class = "btn" })
@Html.ActionLink("Cancel", "Index", new { id = Model.LeafInputId }, new { @class = "btn" })
</div>
}
</div>
+13
View File
@@ -0,0 +1,13 @@
@model LeafWeb.Web.ViewModels.ResultsAdmin.LeafInputViewModel
@{
ViewBag.Title = "Details";
}
<h1>@ViewBag.Title</h1>
<div class="center-content well">
@Html.DisplayForModel()
</div>
@@ -0,0 +1,10 @@
@{
ViewBag.Title = "Not Found";
}
<h1>
@ViewBag.Title
</h1>
<p>The given download link was not found.</p>
<code>@Html.Raw(Request.Url)</code>
+1 -1
View File
@@ -19,8 +19,8 @@
: Html.Raw("")),
grid.Column("Total Results: " + Model.Count(), format:
@<div class="btn-group" role="group">
@Html.ActionLink("Edit", "Edit", new { id = item.LeafInputId }, new { @class = "btn btn-default btn-xs", role = "button" })
@Html.ActionLink("Details", "Details", new { id = item.LeafInputId }, new { @class = "btn btn-default btn-xs", role = "button" })
@Html.ActionLink("Download", "DownloadOutputToUser", new { id = item.LeafInputId }, new { @class = "btn btn-default btn-xs", role = "button" })
@Html.ActionLink("Delete", "Delete", new { id = item.LeafInputId }, new { @class = "btn btn-default btn-xs", role="button" })
</div>)
),
+1 -1
View File
@@ -36,7 +36,7 @@
</appSettings>
<system.web>
<compilation targetFramework="4.5" debug="true" />
<customErrors mode="Off"/>
<!-- max 1GB --><httpRuntime targetFramework="4.5" executionTimeout="3600" maxRequestLength="1000000000" />
<globalization culture="en-US" uiCulture="en-US" enableClientBasedCulture="false" requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
+2
View File
@@ -703,6 +703,8 @@
<Content Include="Views\Chart\DataError.cshtml" />
<Content Include="Views\ResultsAdmin\Index.cshtml" />
<Content Include="Views\ResultsAdmin\Delete.cshtml" />
<Content Include="Views\ResultsAdmin\DownloadNotFound.cshtml" />
<Content Include="Views\ResultsAdmin\Details.cshtml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>