Lazy-load of dependency details

This commit is contained in:
Šesták Vít
2017-03-01 15:18:41 +01:00
parent 87ba3947ca
commit 90f785b865
8 changed files with 123 additions and 60 deletions

View File

@@ -121,6 +121,7 @@ object DependencyCheckReportsParser{
lazy val groupedDependencies = allDependencies.groupBy(_._1.hashes).values.map(GroupedDependency(_)).toSeq
lazy val groupedDependenciesByPlainLibraryIdentifier: Map[PlainLibraryIdentifier, Set[GroupedDependency]] =
groupedDependencies.toSet.flatMap((grDep: GroupedDependency) => grDep.plainLibraryIdentifiers.map(_ -> grDep)).groupBy(_._1).mapValues(_.map(_._2)).map(identity)
lazy val groupedDependenciesByHashes: Map[Hashes, GroupedDependency] = groupedDependencies.map(gd => gd.hashes -> gd).toMap
lazy val vulnerableDependencies = groupedDependencies.filter(_.vulnerabilities.nonEmpty)
lazy val suppressedOnlyDependencies = groupedDependencies.filter(gd => gd.vulnerabilities.isEmpty && gd.suppressedIdentifiers.nonEmpty)

View File

@@ -274,6 +274,17 @@ class Statistics @Inject()(
}
}
def dependencyDetails(selectorOption: Option[String], depPrefix: String, depId: Hashes) = ReadAction.async { implicit req =>
val (lastRefreshTime, resultsFuture) = projectReportsProvider.resultsForVersions(versions)
resultsFuture flatMap { allResults =>
println(selectorOption)
select(allResults, selectorOption).fold(Future.successful(notFound())) { selection =>
val dep = selection.result.groupedDependenciesByHashes(depId)
Future.successful(Ok(views.html.dependencyDetailsInner(depPrefix = depPrefix, dep = dep, selectorOption = selectorOption)))
}
}
}
def allFiles(selectorOption: Option[String]) = ReadAction.async { implicit req =>
val (lastRefreshTime, resultsFuture) = projectReportsProvider.resultsForVersions(versions)
resultsFuture flatMap { allResults =>