Skip to content

Commit 85f8289

Browse files
committed
use state for fixing grouping maximum.
Collapse state is still an issue
1 parent 9696a2f commit 85f8289

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFo
927927
928928
var outerHtml = doc.DocumentNode.OuterHtml;
929929
var htmlSb = new StringBuilder(outerHtml);
930-
PreventBrowserHistory(htmlSb);
930+
FixGroupingMax(htmlSb);
931931
932932
var assembliesSearch = "var assemblies = [";
933933
var startIndex = outerHtml.IndexOf(assembliesSearch) + assembliesSearch.Length - 1;
@@ -1378,7 +1378,7 @@ function clearFCCWindowLogs(){{
13781378
coverageLogElement.textContent = '';
13791379
window.external.{nameof(ScriptManager.ClearFCCWindowLogs)}();
13801380
}}
1381-
1381+
13821382
function addCoverageLogElements(){{
13831383
var container = document.getElementsByClassName('container')[0];
13841384
var coverageLogContainer = document.createElement('div');
@@ -1554,6 +1554,41 @@ private void PreventBrowserHistory(StringBuilder documentStringBuilder)
15541554
@"{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)}}},",
15551555
@"{key:""onDonBeforeUnlodad"",value: function(){}},");
15561556
}
1557+
1558+
private void FixGroupingMax(StringBuilder documentStringBuilder)
1559+
{
1560+
documentStringBuilder.Replace(
1561+
@"{key:""ngOnInit"",value:function(){this.historicCoverageExecutionTimes=this.window.historicCoverageExecutionTimes,this.branchCoverageAvailable=this.window.branchCoverageAvailable,this.translations=this.window.translations;var e=!1;if(void 0!==this.window.history&&void 0!==this.window.history.replaceState&&null!==this.window.history.state&&null!=this.window.history.state.coverageInfoSettings)console.log(""Coverage info: Restoring from history"",this.window.history.state.coverageInfoSettings),e=!0,this.settings=JSON.parse(JSON.stringify(this.window.history.state.coverageInfoSettings));else{for(var t=0,n=this.window.assemblies,r=0;r<n.length;r++)for(var i=0;i<n[r].classes.length;i++)t=Math.max(t,(n[r].classes[i].name.match(/\./g)||[]).length);this.settings.groupingMaximum=t,console.log(""Grouping maximum: ""+t)}var o=window.location.href.indexOf(""?"");o>-1&&(this.queryString=window.location.href.substr(o)),this.updateCoverageInfo(),e&&this.restoreCollapseState()}}",
1562+
@"{key:""ngOnInit"",value:function(){
1563+
this.historicCoverageExecutionTimes=this.window.historicCoverageExecutionTimes;
1564+
this.branchCoverageAvailable=this.window.branchCoverageAvailable;
1565+
this.translations=this.window.translations;
1566+
var restoredFromHistory = false;
1567+
if(void 0!==this.window.history&&void 0!==this.window.history.replaceState&&null!==this.window.history.state&&null!=this.window.history.state.coverageInfoSettings){
1568+
restoredFromHistory = true;
1569+
this.settings=JSON.parse(JSON.stringify(this.window.history.state.coverageInfoSettings));
1570+
1571+
}
1572+
1573+
for(var t=0,n=this.window.assemblies,r=0;r<n.length;r++){
1574+
for(var i=0;i<n[r].classes.length;i++){
1575+
t=Math.max(t,(n[r].classes[i].name.match(/\./g)||[]).length);
1576+
}
1577+
}
1578+
this.settings.groupingMaximum=t;
1579+
if(this.settings.grouping > this.settings.groupingMaximum){
1580+
this.settings.grouping = this.settings.groupingMaximum;
1581+
}
1582+
1583+
this.updateCoverageInfo();
1584+
if(restoredFromHistory){
1585+
this.restoreCollapseState()
1586+
}
1587+
1588+
}}");
1589+
1590+
}
1591+
15571592
private void HideRowsFromOverviewTable(HtmlDocument doc)
15581593
{
15591594
var table = doc.DocumentNode.QuerySelectorAll("table.overview").First();

0 commit comments

Comments
 (0)