~jan0sch/smederee

Showing details for patch b76d19787c2d510d587405467da872095e2abb76.
2024-06-10 (Mon), 11:09 AM - Jens Grassel - b76d19787c2d510d587405467da872095e2abb76

VCS: Show last tag and link to details if present on the overview page.

Summary of changes
3 files modified with 13 lines added and 0 lines removed
  • modules/hub/src/main/resources/messages.properties with 2 added and 0 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala with 5 added and 0 removed lines
  • modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html with 6 added and 0 removed lines
diff -rN -u old-smederee/modules/hub/src/main/resources/messages.properties new-smederee/modules/hub/src/main/resources/messages.properties
--- old-smederee/modules/hub/src/main/resources/messages.properties	2025-01-11 14:38:26.565213842 +0000
+++ new-smederee/modules/hub/src/main/resources/messages.properties	2025-01-11 14:38:26.565213842 +0000
@@ -265,6 +265,8 @@
 
 repository.description.title=Summary:
 repository.description.forked-from=Forked from:
+repository.description.last-tag:Last tag set at {0,date,yyyy-MM-dd (E)}, {0,time,short} :
+repository.description.last-tag.link=Show details for tag {0}.
 
 repository.overview.clone.fork=Create your personal branch (fork).
 repository.overview.clone.title=Clone this repository
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-11 14:38:26.565213842 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-11 14:38:26.565213842 +0000
@@ -469,6 +469,10 @@
                         patch
                 }
             )
+            lastTag <- darcs
+                .log(directory.toNIO)(repositoryName.toString)(Chain(s"--from-tag=.", "--to-tag=.", "--xml-output"))
+                .map(log => scala.xml.XML.loadString(log.stdout.toList.mkString))
+                .map(xmlLog => (xmlLog \ "patch").flatMap(VcsRepositoryPatchMetadata.fromDarcsXmlLog).headOption)
             readmeData <- repo.traverse(repo => doLoadReadme(repo))
             readme <- readmeData match {
                 case Some((lines, Some(_), Some(renderableContent))) =>
@@ -502,6 +506,7 @@
                             repo,
                             vcsRepositoryBranches = branches,
                             vcsRepositoryHistory = patches,
+                            vcsRepositoryLastTag = lastTag,
                             vcsRepositoryParentFork = parentFork,
                             vcsRepositoryReadme = readme,
                             vcsRepositoryReadmeContent = readmeContent,
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html	2025-01-11 14:38:26.565213842 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositoryOverview.scala.html	2025-01-11 14:38:26.565213842 +0000
@@ -10,6 +10,7 @@
 )(vcsRepository: VcsRepository,
   vcsRepositoryBranches: List[(Username, VcsRepositoryName)],
   vcsRepositoryHistory: List[VcsRepositoryPatchMetadata],
+  vcsRepositoryLastTag: Option[VcsRepositoryPatchMetadata],
   vcsRepositoryParentFork: Option[VcsRepository] = None,
   vcsRepositoryReadme: Option[String] = None,
   vcsRepositoryReadmeContent: Option[RenderableContent] = None,
@@ -26,6 +27,11 @@
           <div class="repo-summary-description">
             <strong>@Messages("repository.description.title")</strong> @vcsRepository.description
           </div>
+          @for(lastTag <- vcsRepositoryLastTag) {
+            <div class="repo-summary-description">
+              <i>@Messages("repository.description.last-tag", java.util.Date.from(lastTag.timestamp.toInstant)) <a href="@actionBaseUri.addSegment("patch").addSegment(lastTag.hash.toString)" title="@Messages("repository.description.last-tag.link", lastTag.name)">@{lastTag.name}</a></i>
+            </div>
+          }
           @for(parentRepo <- vcsRepositoryParentFork) {
             <div class="repo-summary-description">
               <i>@Messages("repository.description.forked-from") <a href="@{baseUri.addSegment(s"~${parentRepo.owner.name.toString}").addSegment(parentRepo.name.toString)}">~@{parentRepo.owner.name}/@{parentRepo.name}</a></i>