Consolidate status markup.
Improved charting error reporting.
This commit is contained in:
@@ -73,7 +73,7 @@ namespace LeafWeb.Core.Parsers
|
||||
var values = GetNextCsvRowValues();
|
||||
if (CsvReader.IsRecordEmpty())
|
||||
//continue;
|
||||
throw new ParseException($"Encountered empty line while readding fitting info on line {CsvReader.Row}");
|
||||
throw new ParseException($"Encountered empty line while reading fitting info on line {CsvReader.Row}");
|
||||
if (values == null) // end of file
|
||||
yield break;
|
||||
if (matcher.IsPropertiesTitlesMatch(values))
|
||||
|
||||
@@ -1 +1 @@
|
||||
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.hrgrmhfg.dll
|
||||
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.vhztgt6b.dll
|
||||
@@ -22,6 +22,9 @@ h1 {
|
||||
p {
|
||||
padding: 12px 0; }
|
||||
|
||||
i {
|
||||
cursor: default; }
|
||||
|
||||
footer {
|
||||
margin-top: 24px !important; }
|
||||
|
||||
@@ -81,7 +84,8 @@ a.banner-link:hover {
|
||||
content: "\e012"; }
|
||||
|
||||
.status {
|
||||
white-space: nowrap; }
|
||||
white-space: nowrap;
|
||||
cursor: default; }
|
||||
.status:after {
|
||||
font-family: "Glyphicons Halflings";
|
||||
font-size: .8em;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
body.debug header .brand{position:relative;}body.debug header .brand:before{content:"";font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;color:#f00;font-size:60px;padding-right:.5em;position:absolute;top:10px;left:0;}h1{padding:24px 0 12px 0;}p{padding:12px 0;}footer{margin-top:24px !important;}.row-no-padding [class*="col-"]{padding-left:0 !important;padding-right:0 !important;}.home .dark .row:first-child .column:first-child h1{padding-top:0;}.home .blogarchive{padding-top:20px;}.top-buffer{margin-top:20px;}.detail-actions>a,.detail-actions>form>button{margin-top:20px;float:left;clear:left;}.banner-link{white-space:normal;padding:20px;background:#000;background:rgba(0,0,0,.5);-moz-border-radius:10px;border-radius:10px;}.banner-link .glyphicon{color:#8cc641;}a.banner-link:hover{text-decoration:none;background:rgba(0,0,0,.6);}a.banner-link:hover .glyphicon{color:#a8ed4f;}.headline-icon h1:after{color:rgba(172,214,118,.8);font-family:"Glyphicons Halflings";font-size:.8em;padding-left:10px;}.headline-icon.headline-icon-file h1:after{content:"";}.headline-icon.headline-icon-leaf h1:after{content:"";}.headline-icon.headline-icon-question h1:after{content:"";}.headline-icon.headline-icon-stats h1:after{content:"";}.headline-icon.headline-icon-user h1:after{content:"";}.headline-icon.headline-icon-list h1:after{content:"";}.status{white-space:nowrap;}.status:after{font-family:"Glyphicons Halflings";font-size:.8em;padding-left:5px;}.status.status-pending{color:#f0ad4e;}.status.status-pending:after{content:"";}.status.status-complete{color:#337ab7;}.status.status-complete:after{content:"";}.status.status-exception{color:#a94442;}.status.status-exception:after{content:"";}.status.status-running,.status.status-starting,.status.status-finishing{color:#3c763d;}.status.status-running:after{content:"";}.status.status-starting:after{content:"";}.status.status-finishing:after{content:"";}.status.status-cancelpending,.status.status-cancelling{color:#f0ad4e;}.status.status-cancelled{color:#ec971f;}.status.status-cancelpending:after{content:"";}.status.status-cancelling:after{content:"";}.status.status-cancelled:after{content:"";}#chart{padding-top:20px;}.btn-file{position:relative;overflow:hidden;}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;outline:none;background:#fff;cursor:inherit;display:block;}form .validation-summary-errors ul{list-style-type:none;}.autocomplete-suggestions{border:1px solid #999;background:#fff;overflow:auto;}.autocomplete-suggestion{padding:2px 5px;white-space:nowrap;overflow:hidden;}.autocomplete-selected{background:#f0f0f0;}.autocomplete-suggestions strong{font-weight:normal;color:#39f;}.autocomplete-group{padding:2px 5px;}.autocomplete-group strong{display:block;border-bottom:1px solid #000;}.toggle{width:15px;}.dropdown-menu li form .btn-link{display:block;color:#333;clear:both;float:left;font-size:1rem;font-weight:normal;line-height:1.42857;min-width:160px;padding:3px 20px;text-align:left;white-space:nowrap;}.dropdown-menu li form .btn-link:focus,.dropdown-menu li form .btn-link:hover{text-decoration:none;color:#262626;background-color:#f5f5f5;}.divider-right{border-right:1px dashed #333;}.read{overflow:hidden;font-size:16px !important;transition:all .3s;margin-bottom:10px;}.read-less{height:90px !important;}code,pre{line-height:1;}.alert{position:absolute;left:30%;top:10em;width:40%;z-index:1;}.copyright{font-size:.8em;color:#777 !important;cursor:default;}.withshadow{text-shadow:2px 2px 4px #000;}
|
||||
body.debug header .brand{position:relative;}body.debug header .brand:before{content:"";font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;color:#f00;font-size:60px;padding-right:.5em;position:absolute;top:10px;left:0;}h1{padding:24px 0 12px 0;}p{padding:12px 0;}i{cursor:default;}footer{margin-top:24px !important;}.row-no-padding [class*="col-"]{padding-left:0 !important;padding-right:0 !important;}.home .dark .row:first-child .column:first-child h1{padding-top:0;}.home .blogarchive{padding-top:20px;}.top-buffer{margin-top:20px;}.detail-actions>a,.detail-actions>form>button{margin-top:20px;float:left;clear:left;}.banner-link{white-space:normal;padding:20px;background:#000;background:rgba(0,0,0,.5);-moz-border-radius:10px;border-radius:10px;}.banner-link .glyphicon{color:#8cc641;}a.banner-link:hover{text-decoration:none;background:rgba(0,0,0,.6);}a.banner-link:hover .glyphicon{color:#a8ed4f;}.headline-icon h1:after{color:rgba(172,214,118,.8);font-family:"Glyphicons Halflings";font-size:.8em;padding-left:10px;}.headline-icon.headline-icon-file h1:after{content:"";}.headline-icon.headline-icon-leaf h1:after{content:"";}.headline-icon.headline-icon-question h1:after{content:"";}.headline-icon.headline-icon-stats h1:after{content:"";}.headline-icon.headline-icon-user h1:after{content:"";}.headline-icon.headline-icon-list h1:after{content:"";}.status{white-space:nowrap;cursor:default;}.status:after{font-family:"Glyphicons Halflings";font-size:.8em;padding-left:5px;}.status.status-pending{color:#f0ad4e;}.status.status-pending:after{content:"";}.status.status-complete{color:#337ab7;}.status.status-complete:after{content:"";}.status.status-exception{color:#a94442;}.status.status-exception:after{content:"";}.status.status-running,.status.status-starting,.status.status-finishing{color:#3c763d;}.status.status-running:after{content:"";}.status.status-starting:after{content:"";}.status.status-finishing:after{content:"";}.status.status-cancelpending,.status.status-cancelling{color:#f0ad4e;}.status.status-cancelled{color:#ec971f;}.status.status-cancelpending:after{content:"";}.status.status-cancelling:after{content:"";}.status.status-cancelled:after{content:"";}#chart{padding-top:20px;}.btn-file{position:relative;overflow:hidden;}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;outline:none;background:#fff;cursor:inherit;display:block;}form .validation-summary-errors ul{list-style-type:none;}.autocomplete-suggestions{border:1px solid #999;background:#fff;overflow:auto;}.autocomplete-suggestion{padding:2px 5px;white-space:nowrap;overflow:hidden;}.autocomplete-selected{background:#f0f0f0;}.autocomplete-suggestions strong{font-weight:normal;color:#39f;}.autocomplete-group{padding:2px 5px;}.autocomplete-group strong{display:block;border-bottom:1px solid #000;}.toggle{width:15px;}.dropdown-menu li form .btn-link{display:block;color:#333;clear:both;float:left;font-size:1rem;font-weight:normal;line-height:1.42857;min-width:160px;padding:3px 20px;text-align:left;white-space:nowrap;}.dropdown-menu li form .btn-link:focus,.dropdown-menu li form .btn-link:hover{text-decoration:none;color:#262626;background-color:#f5f5f5;}.divider-right{border-right:1px dashed #333;}.read{overflow:hidden;font-size:16px !important;transition:all .3s;margin-bottom:10px;}.read-less{height:90px !important;}code,pre{line-height:1;}.alert{position:absolute;left:30%;top:10em;width:40%;z-index:1;}.copyright{font-size:.8em;color:#777 !important;cursor:default;}.withshadow{text-shadow:2px 2px 4px #000;}
|
||||
@@ -28,6 +28,10 @@ p {
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
i {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: 24px !important;
|
||||
}
|
||||
@@ -118,6 +122,7 @@ a.banner-link:hover {
|
||||
|
||||
.status{
|
||||
white-space: nowrap;
|
||||
cursor: default;
|
||||
|
||||
&:after {
|
||||
font-family: "Glyphicons Halflings";
|
||||
|
||||
@@ -71,15 +71,15 @@ namespace LeafWeb.WebCms.Controllers
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound, e.Message);
|
||||
}
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound, $"Parse exception in {leafOutputFile.Filename}. {e.Message}" );
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound);
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound, $"Unhandled exception thrown wihle parsing {leafOutputFile.Filename}.");
|
||||
}
|
||||
|
||||
if (curveData == null)
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound);
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NotFound, $"No curve data was loaded from {leafOutputFile.Filename}.");
|
||||
|
||||
var charts = GetChartBitmaps(curveData).ToList();
|
||||
|
||||
@@ -91,7 +91,9 @@ namespace LeafWeb.WebCms.Controllers
|
||||
{
|
||||
combinedChart.Save(ms, ImageFormat.Png);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
return File(ms.ToArray(), "image/png", curveId.FilterValidFilename() + ".png");
|
||||
var base64String = Convert.ToBase64String(ms.ToArray());
|
||||
return Content(base64String, "image/png");
|
||||
//return File(ms.ToArray(), "image/png", curveId.FilterValidFilename() + ".png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +111,6 @@ namespace LeafWeb.WebCms.Controllers
|
||||
LogManager.GetLogger(GetType()).Warn(e);
|
||||
throw;
|
||||
}
|
||||
//return null;
|
||||
}
|
||||
|
||||
private string[] GetCurveIds(byte[] fileContents)
|
||||
|
||||
@@ -48,28 +48,7 @@ else
|
||||
|
||||
@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
|
||||
{
|
||||
<span class="text-nowrap">
|
||||
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput.CurrentStatus.ToString())
|
||||
@if (leafInput.OutputErrorMessage != null)
|
||||
{
|
||||
<i class="fa fa-warning text-danger" title="Generated Error Message"></i>
|
||||
} else if (leafInput.OutputWarningMessage != null)
|
||||
{
|
||||
<i class="fa fa-warning text-info" title="Generated Warning Message"></i>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
|
||||
}
|
||||
|
||||
@helper Btns(LeafInput item)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@model IQueryable<LeafWeb.Core.Entities.LeafInput>
|
||||
@using LeafWeb.Core.Entities
|
||||
@model IQueryable<LeafInput>
|
||||
|
||||
@{
|
||||
var grid = new WebGrid(Model, rowsPerPage: 45);
|
||||
@@ -9,14 +10,19 @@
|
||||
grid.Column("Identifier", "Identifier"),
|
||||
grid.Column("SiteId", "Site Id"),
|
||||
//grid.Column("Name", "Submitted By"),
|
||||
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus.ToString())),
|
||||
grid.Column("", "", item => ChartLink(item))
|
||||
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
|
||||
grid.Column("", "", item => ChartLink(item.Value))
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||
)
|
||||
@grid.BootstrapPager()
|
||||
|
||||
@helper ChartLink(dynamic item)
|
||||
@helper ChartLink(LeafInput leafInput)
|
||||
{
|
||||
@Html.Partial("DisplayTemplates/_ChartButton", (int)item.Id, new ViewDataDictionary { { "Disabled", !item.HasLeafChart }, {"xs", true} })
|
||||
}
|
||||
@Html.Partial("DisplayTemplates/_ChartButton", leafInput.Id, new ViewDataDictionary { { "Disabled", !leafInput.HasLeafChart }, {"xs", true} })
|
||||
}
|
||||
|
||||
@helper Status(LeafInput leafInput)
|
||||
{
|
||||
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
@using LeafWeb.Core.Utility
|
||||
@model string
|
||||
<span class="status status-@Model.ToLower()">@Model.SplitCamelCase()</span>
|
||||
@using LeafWeb.Core.Entities
|
||||
@model LeafInput
|
||||
|
||||
@if (Model.IsPending)
|
||||
{
|
||||
<span class="text-nowrap">
|
||||
<span class="text-muted" title="@Model.PendingPriority.ToString() Priority">
|
||||
@Html.Partial("DisplayTemplates/PriorityIcon", Model.PendingPriority)
|
||||
</span>
|
||||
@Html.Partial("DisplayTemplates/_Status", Model.CurrentStatus.ToString())
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-nowrap">
|
||||
@if (Model.IsRunning)
|
||||
{
|
||||
<span title="Time in progress: @Model.TimeInProgress.ToRoundedReadableString()">
|
||||
@Html.Partial("DisplayTemplates/_Status", Model.CurrentStatus.ToString())
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Partial("DisplayTemplates/_Status", Model.CurrentStatus.ToString())
|
||||
}
|
||||
|
||||
@if (Model.OutputErrorMessage != null)
|
||||
{
|
||||
<i class="fa fa-warning text-danger" title="Generated Error Message"></i>
|
||||
}
|
||||
else if (Model.OutputWarningMessage != null)
|
||||
{
|
||||
<i class="fa fa-warning text-info" title="Generated Warning Message"></i>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
@using LeafWeb.Core.Utility
|
||||
@model string
|
||||
<span class="status status-@Model.ToLower()">@Model.SplitCamelCase()</span>
|
||||
@@ -882,7 +882,7 @@
|
||||
<Content Include="Views\Shared\DisplayTemplates\Status.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\LeafInputStatusViewModels.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_ChartLink.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_LeafInputStatus.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_Status.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_DetailsLink.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_ChartButton.cshtml" />
|
||||
<Content Include="Views\EmptyPage.cshtml" />
|
||||
@@ -896,6 +896,7 @@
|
||||
<Content Include="Views\Shared\DisplayTemplates\PreReadMore.cshtml" />
|
||||
<Content Include="Views\Contact\Index.cshtml" />
|
||||
<Content Include="Views\MacroPartials\Contact.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_LeafInputStatus.cshtml" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
||||
Vendored
+45
-30
@@ -1,5 +1,10 @@
|
||||
$(function () {
|
||||
|
||||
var baseUrl = "/umbraco/surface/Chart/ChartCurve";
|
||||
var $chart = $("#chart");
|
||||
var $chartError = $('#chart-error');
|
||||
var $curveIdElem = $('#CurveId');
|
||||
|
||||
var getUrlParameter = function (sParam) {
|
||||
var sPageUrl = decodeURIComponent(window.location.search.substring(1)),
|
||||
sUrlVariables = sPageUrl.split('&'),
|
||||
@@ -15,38 +20,48 @@
|
||||
}
|
||||
};
|
||||
|
||||
var baseUrl = "/umbraco/surface/Chart/ChartCurve";
|
||||
var $chart = $("#chart");
|
||||
var $chartError = $('#chart-error');
|
||||
var addSpinner = function () {
|
||||
$chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>');
|
||||
}
|
||||
|
||||
$('#CurveId')
|
||||
.change(function () {
|
||||
$chartError.removeClass('text-danger').text('');
|
||||
|
||||
// this is the "Select CurveId" instruction
|
||||
if (this.selectedIndex === 0) {
|
||||
$chart.removeAttr('src');
|
||||
return;
|
||||
}
|
||||
|
||||
var curveId = $("option:selected", this).text();
|
||||
|
||||
$chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>');
|
||||
|
||||
var leafInputId = getUrlParameter("leafInputId");
|
||||
var url = baseUrl + "?leafInputId=" + leafInputId + "&curveId=" + curveId;
|
||||
|
||||
$chart.attr('src', url);
|
||||
});
|
||||
|
||||
$chart.load(function () {
|
||||
var removeSpinner = function () {
|
||||
$chart.next('span.gly-spin').remove(); // remove spinner
|
||||
})
|
||||
.error(function () {
|
||||
$chart.next('span.gly-spin').remove(); // remove spinner
|
||||
if ($chart.attr('src') != undefined) {
|
||||
};
|
||||
|
||||
var curveIdChangeAjax = function () {
|
||||
$chartError.html('');
|
||||
|
||||
// this is the "Select CurveId" instruction
|
||||
if (this.selectedIndex === 0) {
|
||||
$chart.removeAttr('src');
|
||||
$chartError.addClass('text-danger').text('A problem was encountered loading this chart.');
|
||||
return;
|
||||
}
|
||||
});
|
||||
var curveId = $("option:selected", this).text();
|
||||
|
||||
addSpinner();
|
||||
|
||||
var leafInputId = getUrlParameter("leafInputId");
|
||||
var url = baseUrl + "?leafInputId=" + leafInputId + "&curveId=" + curveId;
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
contentType: "image/png",
|
||||
success: function (data) {
|
||||
$chart.attr('src', "data:image/png;base64," + data);
|
||||
removeSpinner();
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
removeSpinner();
|
||||
$chart.removeAttr('src');
|
||||
var html = '<h3 class="text-danger">A problem was encountered loading this chart.</h3>';
|
||||
if (errorThrown != undefined) {
|
||||
html += "<h4>Detail:</h4><pre>" + errorThrown + "</pre>";
|
||||
}
|
||||
$chartError.html(html);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$curveIdElem.change(curveIdChangeAjax);
|
||||
});
|
||||
Reference in New Issue
Block a user