Skip to content

Commit

Permalink
#18 Display analyzer's license and author
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Apr 21, 2017
1 parent 4438c7d commit 2fb0814
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/models/Analyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ abstract class Analyzer {
val version: String
val description: String
val dataTypeList: Seq[String]
val author: String
val url: String
val license: String
val id = (name + "_" + version).replaceAll("\\.", "_")
}
3 changes: 3 additions & 0 deletions app/models/ExternalAnalyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ case class ExternalAnalyzer(
version: String,
description: String,
dataTypeList: Seq[String],
author: String,
url: String,
license: String,
command: Path,
config: JsObject)(implicit val ec: ExecutionContext) extends Analyzer {

Expand Down
5 changes: 4 additions & 1 deletion app/models/JsonFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ object JsonFormat {
"version" analyzer.version,
"description" analyzer.description,
"dataTypeList" analyzer.dataTypeList,
"author" analyzer.author,
"url" analyzer.url,
"license" analyzer.license,
"id" analyzer.id))

implicit val fileArtifactWrites = OWrites[FileArtifact](fileArtifact Json.obj(
Expand All @@ -40,4 +43,4 @@ object JsonFormat {
"date" job.date,
"artifact" job.artifact))

}
}
11 changes: 10 additions & 1 deletion app/services/Analyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,20 @@ class AnalyzerSrv(
command (info \ "command").asOpt[String] orElse {
log.warn(s"command is missing in $infoFile"); None
}
author (info \ "author").asOpt[String] orElse {
log.warn(s"author is missing in $infoFile"); None
}
url (info \ "url").asOpt[String] orElse {
log.warn(s"url is missing in $infoFile"); None
}
license (info \ "license").asOpt[String] orElse {
log.warn(s"license is missing in $infoFile"); None
}
config = (info \ "config").asOpt[JsObject].getOrElse(JsObject(Nil))
baseConfig = (info \ "baseConfig").asOpt[String].flatMap(c (analyzerConfig \ c).asOpt[JsObject]).getOrElse(JsObject(Nil))
absoluteCommand = analyzerPath.resolve(Paths.get(command.replaceAll("[\\/]", File.separator)))
_ = log.info(s"Register analyzer $name $version (${(name + "_" + version).replaceAll("\\.", "_")})")
} yield ExternalAnalyzer(name, version, description, dataTypeList, absoluteCommand, globalConfig deepMerge baseConfig deepMerge config)(analyzeExecutionContext)
} yield ExternalAnalyzer(name, version, description, dataTypeList, author, url, license, absoluteCommand, globalConfig deepMerge baseConfig deepMerge config)(analyzeExecutionContext)
}

private[services] def readInfo(file: Path): JsValue = {
Expand Down
7 changes: 6 additions & 1 deletion ui/app/views/analyzers.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ <h3 class="box-title">Data types</h3>
</div>
<div class="box box-primary" dir-paginate="analyzer in vm.analyzers | filter:vm.search | itemsPerPage: 25">
<div class="box-header with-border">
<h3 class="box-title">{{analyzer.name}} <small>(Version: {{analyzer.version}})</small></h3>
<h3 class="box-title">
<span class="mr-xxs">{{analyzer.name}}</span>
<small class="mr-xxs"><strong>Version:</strong> {{analyzer.version}}</small>
<small class="mr-xxs" ng-if="analyzer.author"><strong>Author:</strong> {{analyzer.author}}</small>
<small class="mr-xxs" ng-if="analyzer.license"><strong>License:</strong> {{analyzer.license}}</small>
</h3>
<div class="box-tools pull-right">
<a href ng-click="vm.run(analyzer)"><i class="fa fa-play"></i> Run</a>
</div>
Expand Down

0 comments on commit 2fb0814

Please sign in to comment.