diff --git a/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs b/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs index 0d0825d0..7c3a27e1 100644 --- a/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs +++ b/SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs @@ -927,6 +927,8 @@ public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFo var outerHtml = doc.DocumentNode.OuterHtml; var htmlSb = new StringBuilder(outerHtml); + FixGroupingMax(htmlSb); + FixCollapse(htmlSb); var assembliesSearch = "var assemblies = ["; var startIndex = outerHtml.IndexOf(assembliesSearch) + assembliesSearch.Length - 1; @@ -1377,7 +1379,7 @@ function clearFCCWindowLogs(){{ coverageLogElement.textContent = ''; window.external.{nameof(ScriptManager.ClearFCCWindowLogs)}(); }} - + function addCoverageLogElements(){{ var container = document.getElementsByClassName('container')[0]; var coverageLogContainer = document.createElement('div'); @@ -1547,6 +1549,94 @@ Risk Hotspots }); } + private void PreventBrowserHistory(StringBuilder documentStringBuilder) + { + documentStringBuilder.Replace( + @"{key:""onDonBeforeUnlodad"",value:function(){if(this.saveCollapseState(),void 0!==this.window.history&&void 0!==this.window.history.replaceState){console.log(""Coverage info: Updating history"",this.settings);var e=null;(e=null!==window.history.state?JSON.parse(JSON.stringify(this.window.history.state)):new Gc).coverageInfoSettings=JSON.parse(JSON.stringify(this.settings)),window.history.replaceState(e,null)}}},", + @"{key:""onDonBeforeUnlodad"",value: function(){}},"); + } + + private void FixCollapse(StringBuilder documentStringBuilder) + { + documentStringBuilder.Replace( + @"{key:""saveCollapseState"",value:function(){var e=this;this.settings.collapseStates=[],function t(n){for(var r=0;rt&&(r[i].collapsed=e.settings.collapseStates[t]),t++,n(r[i].subElements)}(this.codeElements)}}", + @"{ + key:""saveCollapseState"", + value:function(){ + var e=this; + this.settings.collapseStates=[]; + function t(level,n){ + for(var r=0;r-1&&(this.queryString=window.location.href.substr(o)),this.updateCoverageInfo(),e&&this.restoreCollapseState()}}", + @"{key:""ngOnInit"",value:function(){ + this.historicCoverageExecutionTimes=this.window.historicCoverageExecutionTimes; + this.branchCoverageAvailable=this.window.branchCoverageAvailable; + this.translations=this.window.translations; + var restoredFromHistory = false; + if(void 0!==this.window.history&&void 0!==this.window.history.replaceState&&null!==this.window.history.state&&null!=this.window.history.state.coverageInfoSettings){ + restoredFromHistory = true; + this.settings=JSON.parse(JSON.stringify(this.window.history.state.coverageInfoSettings)); + + } + + for(var t=0,n=this.window.assemblies,r=0;r this.settings.groupingMaximum){ + this.settings.grouping = this.settings.groupingMaximum; + } + + this.updateCoverageInfo(); + if(restoredFromHistory){ + this.restoreCollapseState() + } + + }}"); + + } + private void HideRowsFromOverviewTable(HtmlDocument doc) { var table = doc.DocumentNode.QuerySelectorAll("table.overview").First();