diff --git a/src/main/scala/app/RepositoryViewerServlet.scala b/src/main/scala/app/RepositoryViewerServlet.scala index 99add05..6bff314 100644 --- a/src/main/scala/app/RepositoryViewerServlet.scala +++ b/src/main/scala/app/RepositoryViewerServlet.scala @@ -15,17 +15,50 @@ import org.eclipse.jgit.revwalk.RevWalk // TODO Should models move to other package? +/** + * The repository data. + * + * @param owner the user name of the repository owner + * @param repository the repository name + * @param url the repository URL + * @param branchList the list of branch names + * @param tags the list of tags + */ case class RepositoryInfo(owner: String, name: String, url: String, branchList: List[String], tags: List[String]) +/** + * The file data for the file list of the repository viewer. + * + * @param id the object id + * @param isDirectory whether is it directory + * @param name the file (or directory) name + * @param time the last modified time + * @param message the last commit message + * @param committer the last committer name + */ case class FileInfo(id: ObjectId, isDirectory: Boolean, name: String, time: Date, message: String, committer: String) +/** + * The commit data. + * + * @param id the commit id + * @param time the commit time + * @param committer the commiter name + * @param message the commit message + */ case class CommitInfo(id: String, time: Date, committer: String, message: String){ def this(rev: org.eclipse.jgit.revwalk.RevCommit) = this(rev.getName, rev.getCommitterIdent.getWhen, rev.getCommitterIdent.getName, rev.getFullMessage) } case class DiffInfo(changeType: ChangeType, oldPath: String, newPath: String, oldContent: Option[String], newContent: Option[String]) - + +/** + * The file content data for the file content view of the repository viewer. + * + * @param viewType "image", "large" or "other" + * @param content the string content + */ case class ContentInfo(viewType: String, content: Option[String]) /** @@ -38,6 +71,7 @@ */ get("/:owner") { val owner = params("owner") + html.user(owner, getRepositories(owner).map(JGitUtil.getRepositoryInfo(owner, _, servletContext))) }