Added notice when there are some failed projects. This required some refactorings and fixes, that are also included in this commit.

This commit is contained in:
Šesták Vít
2016-05-13 19:31:47 +02:00
parent 604fc56d76
commit 6c8b2cf859
14 changed files with 104 additions and 51 deletions

View File

@@ -0,0 +1,12 @@
@import com.ysoft.odc.statistics.FailedProjects
@(failedProjects: FailedProjects)
@if(failedProjects.nonEmpty){
<div class="alert alert-danger">
Some projects are excluded from the report, because there is some failure for them:
<ul>
@for(proj <- failedProjects.failedProjectsSet.toIndexedSeq.sortBy(_.projectName.toLowerCase)){
<li>@proj.projectName</li>
}
</ul>
</div>
}

View File

@@ -1,5 +1,5 @@
@(projects: Seq[ReportInfo], watchedProjects: Set[String])(implicit req: DefaultRequest)
@import helper._
@(projects: Seq[ReportInfo], watchedProjects: Set[String], failedReports: Set[String])(implicit req: DefaultRequest)
@button(action: Call)(label: String) = {
@form(action, 'style -> "display: inline-block"){
@CSRF.formField
@@ -13,6 +13,7 @@
@for(
isWatchedDirectly <- Some(watchedProjects contains project.fullId); // hack allowing one to define a variable
isWatchedByParent = project.isNotBare && (watchedProjects contains project.bare.fullId);
isFailed = failedReports contains project.fullId; // actually fullId should be equal bare id in such cases
watchedChildCount = subprojects.count(p => watchedProjects contains p.fullId);
hasWatchedChild = watchedChildCount > 0;
hasButtons = !subprojects.isEmpty;
@@ -31,6 +32,9 @@
</span>
}
@friendlyProjectName(project)
@if(isFailed){
(!)
}
@if(project.isBare){
@if(isWatchedDirectly){
<span class="badge">You watch this project with all subprojects.</span>

View File

@@ -1,12 +1,15 @@
@import com.ysoft.odc.statistics.FailedProjects
@(
projectsWithSelection: ProjectsWithSelection,
allDependencies: Seq[GroupedDependency]
allDependencies: Seq[GroupedDependency],
failedProjects: FailedProjects
)(implicit header: DefaultRequest)
@main(
title = s"All libraries for ${projectsWithSelection.projectNameText}",
projectsOption = Some((projectsWithSelection, routes.Statistics.allLibraries(_)))
){
@healthReport(failedProjects)
@dependencyList(
"all",
allDependencies.sortBy(_.identifiers.toIndexedSeq.sortBy(i => (i.confidence.id, i.identifierType, i.name)).mkString(", ")),

View File

@@ -42,7 +42,7 @@
headExtension = he,
projectsOption = Some((projectsWithSelection, routes.Statistics.basic(_)))
){
@healthReport(lds.failedProjects)
All dependencies: @parsedReports.groupedDependencies.size <br>
Vulnerable dependencies: @parsedReports.vulnerableDependencies.size <br>
Vulnerabilities: @parsedReports.vulnerableDependencies.flatMap(_.vulnerabilities.map(_.name)).toSet.size<br>

View File

@@ -8,6 +8,7 @@
title = s"details for ${projectsWithSelection.projectNameText}${tagOption.map(_._2.name).fold("")(" and tag "+_)}",
projectsOption = Some((projectsWithSelection, x => routes.Statistics.vulnerabilities(x, tagOption.map(_._1))))
){
@healthReport(statistics.failedProjects)
We have @statistics.vulnerabilitiesToDependencies.size vulnerabilities
of @statistics.vulnerabilitiesToDependencies.flatMap(_._2).toSet.size dependencies (@statistics.vulnerabilitiesToDependencies.flatMap(_._2.flatMap(_.plainLibraryIdentifiers)).toSet.size libraries).
@if(!projectsWithSelection.isProjectSpecified){

View File

@@ -1,16 +1,19 @@
@import com.ysoft.odc.statistics.FailedProjects
@(
projectsWithSelection: ProjectsWithSelection,
vulnerability: Vulnerability,
affectedProjects: Map[ReportInfo, Set[GroupedDependency]],
vulnerableDependencies: Set[GroupedDependency],
affectedLibraries: Set[PlainLibraryIdentifier],
issueOption: Option[(ExportedVulnerability[String], String)]
issueOption: Option[(ExportedVulnerability[String], String)],
failedProjects: FailedProjects
)(implicit header: DefaultRequest)
@section = @{views.html.genericSection("vuln")("h2") _}
@main(
title = s"vulnerability ${vulnerability.name} for ${projectsWithSelection.projectNameText}",
projectsOption = Some((projectsWithSelection, p => routes.Statistics.vulnerability(vulnerability.name, p)))
) {
@healthReport(failedProjects)
@if(projectsWithSelection.isProjectSpecified){
<div class="alert alert-warning">The vulnerability details are limited to some subset of projects.<br><a class="btn btn-default" href="@routes.Statistics.vulnerability(vulnerability.name, None)">Show it for all projects!</a></div>
}

View File

@@ -1,12 +1,15 @@
@import com.ysoft.odc.statistics.FailedProjects
@(
projectsWithSelection: ProjectsWithSelection,
name: String
name: String,
failedProjects: FailedProjects
)(implicit header: DefaultRequest)
@main(
title = s"Unknown vulnerability $name for ${projectsWithSelection.projectNameText}",
projectsOption = Some((projectsWithSelection, p => routes.Statistics.vulnerability(name, p)))
){
@healthReport(failedProjects)
<div class="alert alert-warning">Vulnerability <i>@name</i> is not found@if(projectsWithSelection.isProjectSpecified){ for selected project(s)}.</div>
<h2>Possible solutions</h2>
<ul class="solutions">

View File

@@ -1,13 +1,15 @@
@(
projectsWithSelection: ProjectsWithSelection,
vulnerableDependencies: Seq[GroupedDependency],
allDependenciesCount: Int
allDependenciesCount: Int,
reports: DependencyCheckReportsParser.Result
)(implicit header: DefaultRequest)
@main(
title = s"Vulnerable libraries for ${projectsWithSelection.projectNameText} (${vulnerableDependencies.size} deps, ${vulnerableDependencies.flatMap(_.cpeIdentifiers.map(_.toCpeIdentifierOption.get)).toSet.size} CPEs)",
projectsOption = Some((projectsWithSelection, routes.Statistics.vulnerableLibraries(_)))
){
@healthReport(reports.failedProjects)
<script type="text/javascript" src="@routes.Assets.versioned("lib/jqplot/jquery.jqplot.min.js")"></script>
<script type="text/javascript" src="@routes.Assets.versioned("lib/jqplot/plugins/jqplot.pieRenderer.min.js")"></script>
<h2>Plot</h2>