Patch attached here; allows for new query param `limit` so projects that
are getting bogged down can just specify how many releases they want to see
on the page.

E.g.,
reporter.apache.org/addrelease.html?sling shows all releases
reporter.apache.org/addrelease.html?sling&limit=50 shows only the latest 50
releases
reporter.apache.org/addrelease.html?sling;2000 sets baseline year to 2000
reporter.apache.org/addrelease.html?sling;2000&limit=50 sets baseline year
to 2000 and limits to latest 50 releases
Probably would make sense to add a note above "Already registered releases"
to explain this.

Tested query param handling but not cutting off releases at limit since I
don't have a testing env. See if it looks reasonable.

[Y/n]?

On Wed, Feb 15, 2023 at 1:06 PM Andrew Musselman (Jira) <j...@apache.org>
wrote:

>
>     [
> https://issues.apache.org/jira/browse/COMDEV-227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689339#comment-17689339
> ]
>
> Andrew Musselman commented on COMDEV-227:
> -----------------------------------------
>
> Attaching proposed patch
>
> > Only list last X releases and the add/remove release page
> > ---------------------------------------------------------
> >
> >                 Key: COMDEV-227
> >                 URL: https://issues.apache.org/jira/browse/COMDEV-227
> >             Project: Community Development
> >          Issue Type: Improvement
> >          Components: Reporter Tool
> >            Reporter: Robert Munteanu
> >            Priority: Major
> >         Attachments: COMDEV-227.patch.txt
> >
> >
> > In the Apache Sling project we have a large number of releases as we
> have many independent modules. When loading the
> https://reporter.apache.org/addrelease.html?sling page, it takes upwards
> of 10 seconds to load. It would be great if only the last X (50?) releases
> were shown, and then a "load all" link would be available at the bottom.
> > This would greatly speed up our usage of this tool.
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.20.10#820010)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@community.apache.org
> For additional commands, e-mail: dev-h...@community.apache.org
>
>
Index: site/js/addrelease.js
===================================================================
--- site/js/addrelease.js       (revision 1907684)
+++ site/js/addrelease.js       (working copy)
@@ -1,6 +1,8 @@
 // location may have appended ;yyyy for debugging purposes
+// limit param can be passed as query param in URL to limit # of releases 
written to the page
+// This URL-handling section could use clean-up
  var srch = document.location.search.substr(1).split(';'); // drop ? from the 
search and split at semicolon
- var committee = srch[0]; // before the semi (if any)
+ var committee = srch[0].split('&')[0]; // before the semi (if any) and amp 
(if any)
  var baseyear = 1999;
  if (srch.length > 1) {
      baseyear = parseInt(srch[1]); // grab trailing start year
@@ -8,6 +10,9 @@
          baseyear=1999; // ensure sensible default value
      }
  }
+ const queryString = document.location.search;
+ const params = new URLSearchParams(queryString);
+ const limit = parseInt(params.get("limit"));
  document.getElementById('committee').value = committee;
  var xdate = document.getElementById('xdate');
  var done = false;
@@ -47,6 +52,9 @@
   var basedate = bd.getTime()/1000 // value as stored in the database
   var recent = new Array();
   for (version in json) {
+    if (limit && x == limit) {
+      break;
+    }
     if (json[version] > basedate) {
       recent.push(new Release(version, json[version]));
       x++;
@@ -69,4 +77,3 @@
   }
   document.getElementById('committee').value = committee;
  }
- 
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@community.apache.org
For additional commands, e-mail: dev-h...@community.apache.org

Reply via email to