diff --git a/frontend-apps/src/main/webapp/i18n/messageBundle.properties b/frontend-apps/src/main/webapp/i18n/messageBundle.properties index 636c5bb83..3f71f9599 100755 --- a/frontend-apps/src/main/webapp/i18n/messageBundle.properties +++ b/frontend-apps/src/main/webapp/i18n/messageBundle.properties @@ -38,6 +38,7 @@ masterCreateSpaceTooltip=Create workspace Archives=Dependencies +Bloat=Bloat patchAnalysis=Vulnerabilities mavenVerified=Maven-verified archive testCoverageTitle=Testcoverage for diff --git a/frontend-apps/src/main/webapp/model/Formatter.js b/frontend-apps/src/main/webapp/model/Formatter.js index fd2acbb34..8cad8d71f 100755 --- a/frontend-apps/src/main/webapp/model/Formatter.js +++ b/frontend-apps/src/main/webapp/model/Formatter.js @@ -239,6 +239,12 @@ model.Formatter = { return a; }, + debloat: function(reach,traced,exec){ + if( reach==0 && traced==0 && exec>0) + return true; + else return false; + }, + parentDepth : function(parent) { let a=0; if(parent){ diff --git a/frontend-apps/src/main/webapp/view/Component.controller.js b/frontend-apps/src/main/webapp/view/Component.controller.js index c9484e7d7..dd5fbd717 100755 --- a/frontend-apps/src/main/webapp/view/Component.controller.js +++ b/frontend-apps/src/main/webapp/view/Component.controller.js @@ -70,6 +70,117 @@ sap.ui.controller("view.Component", { return emptyModel; }, + computeDebloatViewMetrics : function(_test){ + var archiveInScope = this.getView().byId("archiveInScope"); + var archiveDebloat = this.getView().byId("archiveDebloat"); + var archiveTraced = this.getView().byId("archiveTraced"); + var archiveReachable = this.getView().byId("archiveReachable"); + var archiveTotalTraces = this.getView().byId("archiveTotalTraces"); + + var archivesInTable = this.getView().byId("idBloatList").getModel().getObject("/"); + var archives = 0; + var traced = 0; + var reachable = 0; + var traces = 0; + var debloatable = 0; + for (var a=0;a0){ + traced++; + traces = traces + archivesInTable[a].tracedExecConstructsCounter; + } + if(archivesInTable[a].reachExecConstructsCounter>0){ + reachable++; + } + if(archivesInTable[a].tracedExecConstructsCounter==0 && archivesInTable[a].reachExecConstructsCounter==0 && archivesInTable[a].lib.constructTypeCounters.countExecutable>0){ + debloatable++; + } + } + } + + archiveInScope.setText("Archives in selected scopes: " + archives); + archiveDebloat.setText("Debloatable archives: " + debloatable); + archiveTraced.setText("Archives Traced: " + traced); + archiveReachable.setText("Archives Reachable: " + reachable); + archiveTotalTraces.setText("Total Number of Traces: " + traces); + + }, + +// includeTestDeps: function(){ +// if(this.getView().byId("showDebloat").getSelected()==true){ +// this.showDebloatableArchives(); +// } +// else{ +// var scopeColumn = this.getView().byId("scopeColumn"); +// var oBloatView = this.getView().byId("idBloatList"); +// if(scopeColumn.getFiltered()==true){ +// scopeColumn.setFilterValue(""); +// scopeColumn.setFiltered(false); +// oBloatView.filter(scopeColumn,"") +// this.computeDebloatViewMetrics(true); +// } +// else{ +// scopeColumn.setFilterValue("!=TEST"); +// scopeColumn.setFiltered(true); +// oBloatView.filter(scopeColumn,"!=TEST") +// this.computeDebloatViewMetrics(false); +// } +// } +// }, + + showDebloatableArchives: function(){ + var array=[]; + var scopeColumn = this.getView().byId("scopeColumn"); + if(this.getView().byId("showDebloat").getSelected()==true){ + var filter1 = new sap.ui.model.Filter( + "reachExecConstructsCounter", + sap.ui.model.FilterOperator.EQ, + "0"); + var filter2 = new sap.ui.model.Filter( + "tracedExecConstructsCounter", + sap.ui.model.FilterOperator.EQ, + "0"); + var filter3 = new sap.ui.model.Filter( + "lib/constructTypeCounters/countExecutable", + sap.ui.model.FilterOperator.NE, + "0"); + + array.push(filter1); + array.push(filter2); + array.push(filter3); + } + if(this.getView().byId("includeTest").getSelected()==false){ + var filter4 = new sap.ui.model.Filter( + "scope", + sap.ui.model.FilterOperator.NE, + "TEST"); + array.push(filter4); + scopeColumn.setFilterValue("!=TEST"); + scopeColumn.setFiltered(true); + this.computeDebloatViewMetrics(false); + } + else if (this.getView().byId("includeTest").getSelected()==true){ + scopeColumn.setFilterValue(""); + scopeColumn.setFiltered(false); + this.computeDebloatViewMetrics(true); + } + + if(array!=[]){ + var tableFilter = new sap.ui.model.Filter({ + filters: array, + and: true + }); + + this.getView().byId("idBloatList").getBinding("rows").filter(tableFilter); + } + else{ + this.getView().byId("idBloatList").getBinding("rows").filter(); + } + this.getView().byId("idBloatList").setVisibleRowCount(this.getView().byId("idBloatList").getBinding("rows").iLength); + + }, + // Vulnerabilities tab: Sets the 2 counters setVulnDepCounters:function(_archives, _vulns) { var archiveCount = this.getView().byId("archiveCount"); @@ -271,6 +382,10 @@ sap.ui.controller("view.Component", { oArchiveView.setModel(this.getEmptyModel()); oArchiveView.setBusy(true); + var oBloatView = this.getView().byId("idBloatList"); + oBloatView.setModel(this.getEmptyModel()); + oBloatView.setBusy(true); + //var oConstructView = this.getView().byId("idPatchAnalysisList"); //oConstructView.setModel(emptyModel); //oConstructView.setBusy(true); @@ -321,14 +436,28 @@ sap.ui.controller("view.Component", { } sUrl = model.Config.getArchivesServiceUrl(groupId,artifactId,versionId, cache); + var archiveTotal = this.getView().byId("archiveTotal"); + var archiveAvgAge = this.getView().byId("archiveAvgAge"); + + var archiveInScope = this.getView().byId("archiveInScope"); + var archiveDebloat = this.getView().byId("archiveDebloat"); var archiveTraced = this.getView().byId("archiveTraced"); + var archiveReachable = this.getView().byId("archiveReachable"); var archiveTotalTraces = this.getView().byId("archiveTotalTraces"); - var archiveAvgAge = this.getView().byId("archiveAvgAge"); + + var scopeColumn = this.getView().byId("scopeColumn"); + archiveTotal.setText("Archives Total: "); + archiveAvgAge.setText("Average age (in months): "); + + + archiveInScope.setText("Archives in selected scopes: "); + archiveDebloat.setText("Debloatable archives: "); archiveTraced.setText("Archives Traced: "); + archiveReachable.setText("Archives Reachable: "); archiveTotalTraces.setText("Total Number of Traces: "); - archiveAvgAge.setText("Average age (in months): "); + model.Config.addToQueue(oArchiveModel); model.Config.loadData(oArchiveModel, sUrl, 'GET'); @@ -338,16 +467,17 @@ sap.ui.controller("view.Component", { oArchiveView.setVisibleRowCount(oArchiveModel.getObject("/").length); oArchiveView.setModel(oArchiveModel); oArchiveView.setBusy(false); + + oBloatView.setModel(oArchiveModel); + scopeColumn.setFilterValue("!=TEST"); + scopeColumn.setFiltered(true); + oBloatView.filter(scopeColumn,"!=TEST") + oBloatView.setBusy(false); var archives = oArchiveModel.getObject("/"); - var traced = 0; - var traces = 0; var days = 0, archives_with_timestamp = 0, now = Date.now(); for(var a=0;a0){ - traced++; - traces = traces + archives[a].tracedExecConstructsCounter; - } + if(archives[a].lib.digestTimestamp!=null) { archives_with_timestamp++; var timestamp19 = archives[a].lib.digestTimestamp.substring(0,19); @@ -355,12 +485,12 @@ sap.ui.controller("view.Component", { days += Math.floor(Math.abs(now-timestamp)/86400000); } } - archiveTotal.setText("Archives Total: " + archives.length); - archiveTraced.setText("Archives Traced: " + traced); - archiveTotalTraces.setText("Total Number of Traces: " + traces); archiveAvgAge.setText("Average age (in months): " + (archives_with_timestamp==0 ? "n/a" : Math.floor(days/30/archives_with_timestamp))); - }); + + this.computeDebloatViewMetrics(false); + + }.bind(this)); } // Goal-Executions-Tab @@ -696,6 +826,7 @@ sap.ui.controller("view.Component", { // oEvent.getSource().removeSelections(); // }, + onSearchButtonPress : function() { // Search string diff --git a/frontend-apps/src/main/webapp/view/Component.view.xml b/frontend-apps/src/main/webapp/view/Component.view.xml index b2293dd5c..dcef462ec 100755 --- a/frontend-apps/src/main/webapp/view/Component.view.xml +++ b/frontend-apps/src/main/webapp/view/Component.view.xml @@ -219,16 +219,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -249,14 +249,14 @@ + sortProperty="scope" filterProperty="scope"> + sortProperty="transitive" filterProperty="transitive"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sortProperty="transitive" filterProperty="transitive"> + + + + sortProperty="tracedExecConstructsCounter" + filterProperty="tracedExecConstructsCounter" filtered="false"> + + + + + + +
diff --git a/rest-backend/src/main/java/org/eclipse/steady/backend/model/Library.java b/rest-backend/src/main/java/org/eclipse/steady/backend/model/Library.java index 0b4daba64..405565e5a 100644 --- a/rest-backend/src/main/java/org/eclipse/steady/backend/model/Library.java +++ b/rest-backend/src/main/java/org/eclipse/steady/backend/model/Library.java @@ -461,7 +461,7 @@ public Set getDevelopedIn() { * @return a {@link org.eclipse.steady.backend.model.ConstructIdFilter} object. */ @JsonProperty(value = "constructTypeCounters") - @JsonView(Views.CountDetails.class) + @JsonView(Views.Default.class) @JsonIgnoreProperties( value = {"constructTypeCounters"}, allowGetters = true)