Closed Bug 573671 Opened 14 years ago Closed 12 years ago

TBPL could ellide the entries for long pushes

Categories

(Tree Management Graveyard :: TBPL, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 731261

People

(Reporter: db48x, Assigned: db48x)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch untested, but it looks right (obsolete) — Splinter Review
A push with a large number of commits soon becomes annoyingly long on the TBPL page. We should keep the number of visible commits to a reasonable number, with something the user can click to show the rest.
Assignee: nobody → db48x
Attachment #452974 - Attachment is obsolete: true
Attachment #453079 - Flags: review?(mstange)
Thanks Daniel, I'll look at it tomorrow. Unfortunately we've missed the Weave landing now :-)
There is still the IndexedDB landing to look forward to, IINM.  ;-)
err, there is at least one small problem with that patch :)
I set up http://db48x.net/tbpl/ as a test and found a few things to fix. "↓ 1919 hidden changesets [Expand]" is certainly nice to see :)

alas, clicking on the expander doesn't do anything. probably something I'm too tired to see; I'll look again in the morning.
Attachment #453079 - Attachment is obsolete: true
Attachment #453756 - Flags: review?(mstange)
Attachment #453079 - Flags: review?(mstange)
Comment on attachment 453756 [details] [diff] [review]
this one's tested and had the kinks worked out

>+      var patches = [];
>+      for each (p in push.patches)
>+        patches.push(p);

var patches = push.patches.slice();

>+      var nhidden = patches.length - 10;

Please put the 10 into Config.defaultVisibleNumberOfPatchesPerPush or something like that and increase it to 20.

>+      var hidden = (nhidden > 0) && patches.splice(10, nhidden);
>+      var experid = 'expander-'+ push.toprev;
>+      var expeeid = 'expandee-'+ push.toprev;
>+      var collapserid = 'collapser-'+ push.toprev;
>+      hidden && expanders.push([experid, expeeid, collapserid].map(function (id) { return "#"+ id; }));

I think putting this into an if (nhidden > 0) block would be clearer than the && magic.

>+      (hidden ? ('\n<span id="'+ experid +'" class="expander">â '+ nhidden +' hidden changesets <a href="#">[Expand]</a></span>\n'+
>+      '<div id="'+ expeeid +'" style="display: none;">\n'+
>+      hidden.map(buildHTMLForPushPatches).join("\n") +
>+      '\n<span id="'+ collapserid +'" class="expander">â '+ nhidden +' collapsable changesets <a href="#">[Collapse]</a></span>\n'+
>+      '</div>\n') : '')+

Please construct this string outside the concatenation chain. It's a little hard to see where the (hidden ? ... : ...) construct ends.
Putting <span>s and <div>s as direct children of a <ul> is unclean. Please wrap them in a <li>.
s/collapsable/collapsible/

>+    for each (e in expanders)

expanders.forEach(function (e) { ... }) please. Don't use for...in on arrays.

>+      var expander = $(e[0]);
>+      var expandee = $(e[1]);
>+      var collapser = $(e[2]);
>+      expander.bind("click", function () { expander.hide(); expandee.slideDown("fast"); });
>+      collapser.bind("click", function () { expandee.slideUp("fast", function () { expander.show(); }); });

This causes flickering. It's especially noticeable at the beginning of the collapse animation. I think that could be fixed by putting the collapser outside the expandee and showing and hiding it at the same time as hiding and showing the expander.
(In reply to comment #7)
> >+    for each (e in expanders)
> 
> expanders.forEach(function (e) { ... }) please. Don't use for...in on arrays.

Ooh, nice. Always did want to use modern javascript features on a webpage. :)
Attachment #453756 - Flags: review?(mstange)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Product: Webtools → Tree Management
Product: Tree Management → Tree Management Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: