32 Commits

Author SHA1 Message Date
Wyatt Allen
3d8dc2edda Merge "Render inline diffs sequentially" 2017-02-08 00:42:09 +00:00
Wyatt Allen
206966a5ae Render inline diffs sequentially
Changes with large numbers of files could overwhelm PolyGerrit when a
user selects [Expand all] for inline diffs. This was because the
asynchronous processing/rendering/annotating process would be kicked off
for all unexpanded diffs simultaneously, resulting in browser lock-up
and general slowness even after rendering had completed.

With this change, inline diffs are rendered in serial rather than
parallel. In this way the benefits of the async features of diff
rendering extend to the file list, even for changes with many large
diffs (such as the one in the linked issue).

With this change, the `__expanded` property is removed from file objects
in GR-FILE-LIST. Instead, that element maintains a list
(`_expandedFilePaths`) which records the same information. Because the
expanded files are recorded in a list, however, splices on the list can
be observed, batch diff expansion can be handled sequentially.

Tests are updated to respect the new expanded paths list.

Bug: Issue 5396
Change-Id: Ib83ff5157177e1c890db8a82fbc25df8fecbe065
2017-02-07 16:17:56 -08:00
Becky Siegel
41bdc04cb8 Don't merge threads on same line left/right
Goes along with c/95273/. Adds commentSide attribute to comments to see
which side of the diff view they belong on. This is also used as part
of the locationRange for the gr-diff-comment-thread-group, so that two
thread groups can be on the same line or range for the unified group (
one for the right, one for the left).

Note: there is already a 'side' attribute on the gr-diff-comment, which
is confusing. This side actually references 'PARENT' or 'REVISION', to
identify whether the comment belongs to the parent or any revision. On
diffs where two revisions are compared to each other, this cannot be
used to determine left/right. However, because 'side' is part of
the CommentInfo entity[1], it is difficult to change the name and make
more sense out of that.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info

Bug: Issue 5114
Change-Id: I5cc4c17d4bb134e31e5cc07ff9b08ed349488c97
2017-02-07 21:00:52 +00:00
Becky Siegel
562a30493e Allow multiple threads per line, with different ranges
- Add concept of diff comment thread groups, which are all of the
  threads at a particular line number.

- The thread group is responsible for breaking up comments into threads
  based on the range of the comment.

- Thread groups are ordered by the updated time of the first comment in
  the group.

- Thread groups are given a key, based on comment range, which is used
  to determine what thread group a new comment should go in (or if it
  needs a new one).

Feature: Issue 5292
Change-Id: If544e8bb879262de3ce5397e86124837b66ada04
2017-02-01 16:10:08 -08:00
Becky Siegel
35a7682262 Add robot comments to PolyGerrit
This change adds an API request to get robot comments for displaying
inline in the diff view. They are styled in a different color, contain
build and robotId information, and a "please fix" action rather than the
standard set of actions.

Feature: Issue 5089
Change-Id: I1f5954a2ed01920bb7c3dc897e3285687ff7d3ca
2016-12-15 11:20:25 -08:00
Wyatt Allen
603d03c669 Cleanup test format
Change-Id: I8606412953d507b877a67c816d3e7a059265cc77
2016-11-07 13:19:47 -08:00
Becky Siegel
6a7085e5ab Make line marker more distinguished
Previously, the line marker was only subtly visible by the highlighted
line number. This change adds a bottom border to the selected line if
the user is using keycodes (j, k, up, down) to more the cursor. When
the escape key is pressed, the distinguished line marker will dissapear.

Feature: Issue 4739
Change-Id: If8c751efc137ef87cfdad1c8bf7d905de1219107
2016-11-03 13:34:07 -07:00
Urs Wolfer
a010547eef Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Id16d7abe53d5f65c97bf778dc532e404b41283d8
2016-10-20 20:41:00 +02:00
Andrew Bonventre
fd434afe59 First round cleanup of network requests & errors from tests
+ These were slowing down tests in cases where it would actually hit a
  live server, potentially adding the latency from the network to the
  test.
+ Other fixes involve removing unused imports of util.js amongst other
  small tweaks/fixes.

Bug: Issue 4016
Change-Id: I442deefebeffc6a701e4922faccfe1c74b3a35b6
2016-10-16 06:56:37 +00:00
Wyatt Allen
1be7c31e66 Gracefully handle HTTP 409 for diff API
If a file is too large for the server to deliver the diff, the API will
respond with HTTP 409. PolyGerrit interprets th this as a network error
and covers the entire page with an error message. Furthermore, the
handler for loading the diff is not written for this kind of failure and
tries to dereference the diff object -- null in that case.

With this change, the 409 message does not block use of the whole page
and the handler does not break when the diff is null.

Issue: Bug 4770
Change-Id: I68fe50c474fc03d4217e969649f62df38ca5b632
2016-10-13 11:50:14 -07:00
Wyatt Allen
056e40c01c Fix diff expanded/collapsed binding
Refactors bindings in file lists to change the expanded state of a diff
using a property name that does not collide with the hidden attribute.

Change-Id: I7f7e38a910a8d4dd19be2d591033be6f6d3cb7a1
2016-10-05 21:49:33 -07:00
Kasper Nilsson
93b0ad4964 Add expand inline functionality to diffs
This commit enables the user to manually expand individual diffs
inline in the file list of the change view.

Bug: Issue 4382
Change-Id: I87d5af9971fed3aa5e1eb64523f4623a5ff2ac8d
2016-08-26 10:36:30 -07:00
Viktar Donich
c282d7b282 Toggle left diff on Shift+A
Feature: Issue 3926
Change-Id: Ia52334f2aefeae4b3f115e5779da3b61af25ba11
2016-08-10 12:54:49 -07:00
Viktar Donich
b34d1f87c7 Show file weblinks (e.g. gitles) in diff view
Bug: Issue 4205
Change-Id: Ib5c832bb29453aa51ebe73732c7b8e6885e7e12f
2016-08-03 14:52:13 -07:00
Urs Wolfer
33df005810 Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ic1437333fcf82473ac57f8bdea25ee8188ddbfee
2016-07-15 20:32:27 +02:00
Wyatt Allen
66bfe0005d Move the diff cursor when the diff content is tapped
When a user taps a line number in a diff, the cursor is moved to that
line and that side of the diff. However, if the user taps the text
content of a diff, the cursor was not moved. With this change, the
cursor is moved to the appropriate line and side of a diff when either
is tapped.

Bug: Issue 4215
Change-Id: I47d24f678f487eb3f8173ea5572865a589d845e4
2016-06-21 13:58:22 -07:00
Viktar Donich
0f02cda57e Make gr-builder a Polymer component
Updated tests, fixed draft comments, context expanding.

Change-Id: Ic4bd9682c63edd8e80fbc2abcb4fa5e406a202ab
2016-06-03 10:22:47 -07:00
Andrew Bonventre
6c9d862e10 Revert "Make gr-builder a Polymer component"
This reverts commit 56689af0f92ce13f90ff9369544c5f9cc0412f09.

Reason for revert: This change broke adding draft comments in the diff
view.

Change-Id: Icfbd3eb4e24cce3e1690e7eaf12e14e5705c7e3e
2016-06-03 13:07:33 +00:00
Viktar Donich
56689af0f9 Make gr-builder a Polymer component
Change-Id: I0d99775332b0ef473459ad481970ad6033427c7d
2016-06-02 13:09:39 -07:00
Viktar Donich
7ad28920e9 Gr-diff retrofit: store comment state
Fixing UI data pipe line, re-rendering:
 - side, draft text and editing status in UI comment objects
 - update gr-diff UI model on comment save/update

Feature: Issue 3910
Change-Id: I96f714c7de9add6e316dcf64bb7d566690b9d3ae
2016-05-27 10:46:54 -07:00
Viktar Donich
b7c2cce46a Gr-diff retrofit: implement re-render.
Feature: Issue 3910
Change-Id: Ia85bb2302f8435fd6066873ce87bc9c08b9c63b1
2016-05-26 14:57:18 -07:00
Wyatt Allen
88678da403 Add support for images in diffs
If gr-diff recognizes that the file difference it's representing is
between images, it uses a different diff-builder that displays images
in a side-by-side-manner. In this case gr-diff will also make requests
for the image data itself, which it can pass down into the image-based
diff-builder.

Adds methods to gr-rest-api-interface to support rendering the data
relevant to image diffs. For images that are revisions of the current
change, provides "getChangeFileContents". For images that come from the
parent tree (i.e. if the basePatchNum is "PARENT") the interface
provides "getCommitInfo" to determine the SHA of the parent commit, and
"getCommitFileContents" which can get file contents for a given commit.

Bug: Issue 3822
Change-Id: I9be025b4e549fca97c87cdbeede6cb64dea5eac0
2016-05-26 12:02:29 -07:00
Urs Wolfer
c37b69ab9b Fix issues detected by 'JSHint' and 'JSCS'
Change-Id: Ibee5d0843da5776ab1ad43158227178105467d2e
2016-04-29 22:25:51 +02:00
Andrew Bonventre
2aa22125b6 Move gr-diff-new to gr-diff
Change-Id: Ifaad016f806c31f3df43143b3238b757faa18b20
2016-03-25 17:56:08 -04:00
Andrew Bonventre
6a9312f7b1 Properly remove discarded comments from model in gr-new-diff
Change-Id: Icb5d3ba1edd2cd3a75aa6568a152bacc5e0babda
2016-03-25 16:17:06 +00:00
Urs Wolfer
f531d0aeb9 Fix tests which are wonky in Safari
Change-Id: I5f60afd9302581204c9ab08eda10a2273677b4fa
2016-03-14 17:12:03 +01:00
Andrew Bonventre
8e5ac9d92a Move fake-app.js to test folder
Also exclude *_test.html files from BUCK app glob

Change-Id: If1890b46ffb7d4657bdea83786de5262343835ff
2016-03-10 19:30:31 -05:00
Shawn Pearce
54e7de87a5 Merge changes Idea54a38,Iaa77c408
* changes:
  Fetch diff comments via getDiffComments call
  Add getDiff() method to gr-rest-api-interface
2016-03-07 22:06:58 +00:00
Andrew Bonventre
af1c602139 Fetch diff comments via getDiffComments call
+ Cleans up interface for grouping comments within
  gr-rest-api-interface.
+ Removes gr-diff’s dep on gr-ajax and rest-client-behavior.

Change-Id: Idea54a38fa5d0b136ff00b7ec7322bd24ad5d1bd
2016-03-07 16:55:04 -05:00
Urs Wolfer
b603694158 Remove 'element#async' usages in tests
Tests which are using 'element#async' are wonky in Safari.
'flush' is also the documented way of testing dom manipulations.

Change-Id: I3ea99c7c80c952fa1c15bbd6289690e57bf8414b
2016-03-06 17:23:36 +01:00
Andrew Bonventre
cba7d44e69 Add getDiff() method to gr-rest-api-interface
+ Replace use of gr-ajax for retrieving the diff in gr-diff.
+ Add opt_params to fetchJSON so that query parameters can be
  passed.

Change-Id: Iaa77c4082d6e83099e23f49205d859a5c938dd31
2016-03-05 19:20:09 -05:00
Andrew Bonventre
78792e8e98 Refactor directory structure of components
There is no change in functionality. Only moving things around.

+ Separate html from the js.
+ Place the unit test for a component within the same folder.
+ Organize the components in subfolders.

Change-Id: I51fdc510db75fc1b33f040ca63decbbdfd4d5513
2016-03-04 18:02:24 -05:00