diff --git a/Core/Parsers/LeafGasComparisonParser.cs b/Core/Parsers/LeafGasComparisonParser.cs index f640c6e..c6e06b7 100644 --- a/Core/Parsers/LeafGasComparisonParser.cs +++ b/Core/Parsers/LeafGasComparisonParser.cs @@ -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)) diff --git a/WebCms/App_Data/Models/all.dll.path b/WebCms/App_Data/Models/all.dll.path index f4f1363..41f2a98 100644 --- a/WebCms/App_Data/Models/all.dll.path +++ b/WebCms/App_Data/Models/all.dll.path @@ -1 +1 @@ -C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.hrgrmhfg.dll \ No newline at end of file +C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.vhztgt6b.dll \ No newline at end of file diff --git a/WebCms/Content/style.css b/WebCms/Content/style.css index 2e4122f..ffbda5a 100644 --- a/WebCms/Content/style.css +++ b/WebCms/Content/style.css @@ -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; diff --git a/WebCms/Content/style.min.css b/WebCms/Content/style.min.css index 9da8595..d0a89a0 100644 --- a/WebCms/Content/style.min.css +++ b/WebCms/Content/style.min.css @@ -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;} \ No newline at end of file +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;} \ No newline at end of file diff --git a/WebCms/Content/style.scss b/WebCms/Content/style.scss index 3665c8c..c731883 100644 --- a/WebCms/Content/style.scss +++ b/WebCms/Content/style.scss @@ -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"; diff --git a/WebCms/Controllers/ChartController.cs b/WebCms/Controllers/ChartController.cs index bc8c640..dceaa36 100644 --- a/WebCms/Controllers/ChartController.cs +++ b/WebCms/Controllers/ChartController.cs @@ -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) diff --git a/WebCms/Views/Queue/Index.cshtml b/WebCms/Views/Queue/Index.cshtml index 2465169..e567eef 100644 --- a/WebCms/Views/Queue/Index.cshtml +++ b/WebCms/Views/Queue/Index.cshtml @@ -48,28 +48,7 @@ else @helper Status(LeafInput leafInput) { - if (leafInput.IsPending) - { - - - @Html.Partial("DisplayTemplates/PriorityIcon", leafInput.PendingPriority) - - @Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput.CurrentStatus.ToString()) - - } - else - { - - @Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput.CurrentStatus.ToString()) - @if (leafInput.OutputErrorMessage != null) - { - - } else if (leafInput.OutputWarningMessage != null) - { - - } - - } + @Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput) } @helper Btns(LeafInput item) diff --git a/WebCms/Views/Results/Index.cshtml b/WebCms/Views/Results/Index.cshtml index b9fb899..646a296 100644 --- a/WebCms/Views/Results/Index.cshtml +++ b/WebCms/Views/Results/Index.cshtml @@ -1,4 +1,5 @@ -@model IQueryable +@using LeafWeb.Core.Entities +@model IQueryable @{ 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} }) -} \ No newline at end of file + @Html.Partial("DisplayTemplates/_ChartButton", leafInput.Id, new ViewDataDictionary { { "Disabled", !leafInput.HasLeafChart }, {"xs", true} }) +} + +@helper Status(LeafInput leafInput) +{ + @Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput) +} diff --git a/WebCms/Views/Shared/DisplayTemplates/_LeafInputStatus.cshtml b/WebCms/Views/Shared/DisplayTemplates/_LeafInputStatus.cshtml index 40e1198..3b7c579 100644 --- a/WebCms/Views/Shared/DisplayTemplates/_LeafInputStatus.cshtml +++ b/WebCms/Views/Shared/DisplayTemplates/_LeafInputStatus.cshtml @@ -1,3 +1,36 @@ -@using LeafWeb.Core.Utility -@model string -@Model.SplitCamelCase() \ No newline at end of file +@using LeafWeb.Core.Entities +@model LeafInput + +@if (Model.IsPending) +{ + + + @Html.Partial("DisplayTemplates/PriorityIcon", Model.PendingPriority) + + @Html.Partial("DisplayTemplates/_Status", Model.CurrentStatus.ToString()) + +} +else +{ + + @if (Model.IsRunning) + { + + @Html.Partial("DisplayTemplates/_Status", Model.CurrentStatus.ToString()) + + } + else + { + @Html.Partial("DisplayTemplates/_Status", Model.CurrentStatus.ToString()) + } + + @if (Model.OutputErrorMessage != null) + { + + } + else if (Model.OutputWarningMessage != null) + { + + } + +} diff --git a/WebCms/Views/Shared/DisplayTemplates/_Status.cshtml b/WebCms/Views/Shared/DisplayTemplates/_Status.cshtml new file mode 100644 index 0000000..efcb1cf --- /dev/null +++ b/WebCms/Views/Shared/DisplayTemplates/_Status.cshtml @@ -0,0 +1,3 @@ +@using LeafWeb.Core.Utility +@model string +@Model.SplitCamelCase() diff --git a/WebCms/WebCms.csproj b/WebCms/WebCms.csproj index 435b9c2..b4b3638 100644 --- a/WebCms/WebCms.csproj +++ b/WebCms/WebCms.csproj @@ -882,7 +882,7 @@ - + @@ -896,6 +896,7 @@ + Web.config diff --git a/WebCms/scripts/Chart.js b/WebCms/scripts/Chart.js index 928fd30..02cca0d 100644 --- a/WebCms/scripts/Chart.js +++ b/WebCms/scripts/Chart.js @@ -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(''); + } - $('#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(''); - - 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 = '

A problem was encountered loading this chart.

'; + if (errorThrown != undefined) { + html += "

Detail:

" + errorThrown + "
"; + } + $chartError.html(html); + } + }); + }; + + $curveIdElem.change(curveIdChangeAjax); }); \ No newline at end of file