63 Commits

Author SHA1 Message Date
Kasper Nilsson
5f1f0c6f4e Disable reviewed checkbox in diff view for edit
Modifying the reviewed state of an edit patchset is an illogical action,
and should be disabled.

This change adds an _editLoaded property to gr-diff-view to
conditionally hide the reviewed checkbox. In addition, attempts to
modify the reviewed state are treated as a no-op.

TODO: Further utilize this approach to conditionally show buttons for
modifying an edit patchset. Will be done in a later change.

Bug: Issue 4437
Change-Id: I0ea98e49c5ec66e73f45fef9db5e3849d6e594df
2017-08-10 14:54:57 -07:00
David Ostrovsky
e6a6f44f8c Render change edits on change and diff screens
ORIGINALLY: Iafd4b80af53624027c347f0f443b4cdfde292e29

This change makes the change view and the diff view change edit aware.
Mutation operations on edit itself, like editing files in editor, are
beyond the scope of this change.

Change edits must be fetched with a separate change edit endpoint and
merged into the change.revisions object. The _number of an editInfo is
'edit'. It has a special property called 'basePatchNum' that marks
which patch set the edit is based on. In patch set selectors, the edit
is sorted right after its basePatchNum.

Alternative implementation considerations:

It could be easier to handle edits on the Polygerrit UI, if

  GET /changes/<id>/detail endpoint

would optionally include the change edit in the resulting
change.revsions map.

TODOs:
* Overwrite change.current_revision with change edit commit in some
  use cases
* Mark the change edit as Change Edit in the header of the change view
* Allow for modification of the edit in the change/diff view
* Disable commenting on files in edit patchsets
* Modify file list rows to have appropriate actions when edit is
  selected (e.g. allow revert, disable marking as reviewed)
* Identify and whitelist valid change/revision actions for an edit 

Bug: Issue 4437
Change-Id: Ia4690d20954de730cd625ac76920e849beb12f7c
2017-08-08 13:44:50 -07:00
Wyatt Allen
f0eb4bbf53 Harden gr-formatted-text agains slow/failed project configs
Formerly, if a formatted text component tried to render without the
project config (used by inner linked text components) it would
temporarily fall-back to rendering the unformatted (and un-linkified)
text via `.textContent` -- mirroring the behavior of gr-linked-text.

The result is formatted text elements (when rendered without a project
config) appear as one long line of text. Unlike linkification, however,
text can be accurately formatted with or without the project config --
so this disruptive, poor UX is unnecessary.

The formatted text component is updated to format text when the project
config has not provided, and to re-render when the config has been
provided.

In order to propagate project config loads to the formatted text
components hosted by diff comments, the REST calls must be made by the
diff thread component. To make this call, the thread must have the
project's name, so gr-diff-builder is updated to provide this name to
thread components.

Bug: Issue 6686
Change-Id: I8d09c740930500e99cb5f87b92f4d72f3f50a9ce
2017-08-01 16:14:45 -07:00
Wyatt Allen
dc8782d762 Centralized comment requests
Formerly, gr-diff would make its own REST calls for diff comments in the
patch range and path being viewed. However, these calls by the diff view
were redundant to the more general comment requests made by either
gr-diff-view (which requests all comments to support skipping to the
next file with comments) or gr-change-view (which requests comments
individually for each inline diff).

With this change, the diff component no longer loads comments for
itself, but is rather provided the comments from its host view via a
public property. In this way the host view can load the more-general
comment data, and filter it down for the diff view's params.

Introduces the gr-comment-api component to simplify loading and
filtering diff comments for use by diff views. By using this new
component:
* The diff view makes only one request for comments (including drafts
  and robot comments) to support skipping to the next comment and
  displaying comments in the diff view.
* The change view makes only one request for comments for all inline
  diffs.

Bug: Issue 5299
Change-Id: Ia14a01619f1f9881aa0d253fd3f49af9a17f3dce
2017-08-01 14:15:38 -07:00
Jean-François Geyelin
b880740359 Make dropdown arrow non selectable
Change-Id: I7c2ec54822a91b10a5de64327f433049f01e8fb1
2017-07-28 17:31:29 +00:00
Kasper Nilsson
9060cfd1a5 Replace patchNum compare with utility function
In preparation for implementation of in-app editing, the instances of
parseInt(patchNum) must be swapped out, as a patchNum may now be either
a number or a string.

This change adds the patchNumEquals function to gr-patch-set-behavior,
and uses it everywhere patchNum is compared.

Bug: Issue 4437
Change-Id: Ib1176508cd88d60c79e952b99dd5f57b994baa77
2017-07-25 09:51:04 -07:00
Kasper Nilsson
3c2e121c9d Add more fields to Gerrit.Nav.View and utilize in app
Previously, the app relied on string matching of the view tag names in
order to perform view-based actions (e.g. routing).

This change refactors those instances to utilise the Gerrit.Nav.View
enum.

Bug: Issue 6708
Change-Id: If0212fde93e0167e3207af19006beee1a602df60
2017-07-19 17:02:08 -07:00
Wyatt Allen
de9cb0be99 Update usage of <iron-dropdown> for future-compatibility with Polymer 2
Change-Id: I1be81cdbdd385175601e639fcf71c4946bf01128
2017-07-10 21:25:26 +00:00
Wyatt Allen
830c9354eb Merge "Allow user selection of file path in diff view" 2017-07-06 23:51:02 +00:00
Kasper Nilsson
6f79c9b700 Allow user selection of file path in diff view
Bug: Issue 4798
Change-Id: I7c8276d7339931ffbf0d9c34cbc8ccaa8af40f9b
2017-07-06 16:16:20 -07:00
Wyatt Allen
c310f4fbab Update URL generation in gr-diff-view
Bug: Issue 6446
Change-Id: I21be5ac4e3e89390745a6f04582cbfb9dc6535a3
2017-07-06 15:28:42 -07:00
Becky Siegel
8e174ab23a Update gr-select for Polymer 2
Polymer2 does not support type extension. As such, elements that rely on
it are  updated.

Instead of
<select is="gr-select"><select>

This will now be..
<gr-select>
  <select></select>
</gr-select>

This is similar to the implementation of iron-input, except that is more
complex, as it is supporting both type extention and non-type extension.
https://github.com/PolymerElements/iron-input/blob/master/iron-input.html

Bug: Issue 6371
Change-Id: I31091ff24791a9dc073b3325c7b0daa1580b69ef
2017-07-05 14:12:44 -07:00
Viktar Donich
168bbc96a4 Add a setting to disable diff panel floating
window.PANEL_FLOATING_DISABLED=true prevents diff header detaching from
the page flow and sticking to the window top border.

Change-Id: Idafab7f73fb52a9165b7610ae609e0a8fe52bbd9
2017-06-19 14:50:09 -07:00
Kasper Nilsson
a19706d995 Limit height of diff view file dropdown
When the file list was very long, it could be hidden partially behind
horizontal scrollbars, and was generally difficult to use.

Limiting the dropdown content height to 70vh ensures the content stays
on screen.

Bug: Issue 6375
Change-Id: I3d8b22e6d829816821ef8f1d1343141721d07654
2017-06-19 10:30:17 -07:00
Becky Siegel
b159a7f5cc Update styles for shadow dom
- Create a shared style module that is included in every custom element
- Add the shared style module to each existing element

Change-Id: I1ee382955afe4ff630548a6640e7c4d03688849d
2017-06-02 14:54:03 -07:00
Viktar Donich
09c98980e8 Move mobile file navigator block into diff view header panel
Change-Id: I647472e083febdd8c2600233e63cdfe66ff24c0b
2017-05-30 16:16:02 -07:00
Viktar Donich
87d50f367c Make app footer stay in place on horizontal scroll
Change-Id: I50ae67993f6abd8c7810314f3ab16c22795edd82
2017-05-30 15:34:56 -07:00
Viktar Donich
eeb2d53331 Put horizontal scrolling on screen, take 3
Diff header scrolls with content and sticks to the top, too.
Doesn't scroll the footer horizontally with the header.

Bug: Issue 4491
Change-Id: I5d76aad38a7ae76c15528abcb572cf993f7f595e
2017-05-26 14:16:57 -07:00
Wyatt Allen
75bf2ce32e Merge "Remove polyfilled image API" 2017-05-11 17:27:41 +00:00
Wyatt Allen
26880b6f09 Remove polyfilled image API
Bug: Issue 5751
Change-Id: Ie668e79dfe5762799f46e9f77fbb8239155a08de
2017-05-11 17:27:03 +00:00
Becky Siegel
70a8269b52 Add diff preferences to change view
Noteworthy decisions:
- Preferences are hidden when diff prefs are not loaded or the user is not
logged in.
- Preferences are hidden on small screens
- The trigger button is in gr-change-view but the gr-diff-preferences
  is part of gr-file-list. This is because gr-file-list because diff
  preferences and local preferences are more closely tied with that
  than the change view. In order to put it in the change view, local
  prefs would also have to be two-way bound back.

Also fixes computePrefsButtonHidden in gr-diff-view as well. The
function did not work as intended before. If preferences didn't exist,
the function would not get called, and the container would not be
hidden.

Bug: Issue 5426
Change-Id: I361cdf132c6e15b5ae2f15e62af318cfa05161ce
2017-05-10 15:55:57 -07:00
Paladox none
2280cbbcbc PolyGerrit: Fix gr-diff-view arrows to use html code
See https://www.toptal.com/designers/htmlarrows/

Change-Id: I5255ec40da179292718ade64a93536f27a4fc6a8
2017-04-21 16:41:59 +00:00
Becky Siegel
7a45400e24 Move diff overlay to gr-diff-preferences
Previously, gr-diff-preferences was the contents that was displayed in
an overlay contained in the gr-diff-view.  There were a handful of
functions that crossed between the two-- the diff preferences element
would fire events that needed to be handled by the diff view.

Because the gr-diff-preferences element will be added to the change
view as well, the overlay has been moved to be part of the diff
preferences element. This way, the element can handle all of the actions
taken by the panel, and all the parent element needs to do is call
the open function.

A separate change will come with the addition of diff preferences in the
change view.

Bug: Issue 5426
Change-Id: Id7396147e73354122ea3825bde2c324b5daa1d26
2017-04-19 13:25:25 -07:00
Paladox none
8b0d046dfb Fix PolyGerrit URLs to support prefixed URL
This updates most of polygerrit links to use the implementation added in
I2b2d704fe33c90ea2f2a2183fc79897642a48175 .

Change-Id: Ib3bb694969e903fd76a1dad13cfb642bde086142
2017-04-13 23:44:31 +01:00
Paladox none
d43abe9fe8 Adds a up button to diff's screen in polygerrit
GWT UI has this button but polygerrit dosen't. Makes it easier to view
your other diff's if you need to pick another file but it is way down
the list.

Change-Id: Ic62480315b3b00d7623d4ac444a0b554d255b4d1
2017-03-31 15:53:51 +00:00
Viktar Donich
3dd0ff4dd0 Fix dropdown bug on page scroll
Hard to describe, here's the bug:
http://imgur.com/a/O3aTl

Change-Id: I2d8b3f6258d3be5a135efbd7f00edb2ef8d8f102
2017-03-13 15:07:18 -07:00
Becky Siegel
fe99e263f6 Don't wrap prev/next text on diff view
This change prevents the wrapping of prev/next text in the diff view so
that the links are placed consistently on each page.

Bug: Issue 5195
Change-Id: Ic5a2c896858c00e43b8506b227c80458a3b85aed
2017-01-03 11:53:55 -08:00
Becky Siegel
a2ea634774 Changes to diff view for mobile
- Hide download link and file web links from patchsets.
- Add a full file path.
- Change next/prev buttons to be arrows on either side of full path
- Change subheader to flex/wrap so that the display mode wraps to the
next line instead of the second patch set item.

Bug: Issue 5114
Change-Id: Iefb8afe9d7e2417f8aa2070e52073708c052fa4f
2016-12-19 14:44:20 -08:00
Kasper Nilsson
d01ad017e4 Fix improper implementation of getKeyboardEvent
Bug: Issue 5088
Change-Id: Iee82c135230f78f823c25982aaeba1ea6ece1709
2016-12-09 11:00:44 -08:00
Andrew Bonventre
a289623b51 Don’t cause scrollbar to hide when dropdowns are shown
Bug: Issue 5095
Bug: Issue 4808
Change-Id: I92d0cd0f0217bcef18bb0b7346112a7d6c5b99bf
2016-12-08 09:15:20 -08:00
Andrew Bonventre
4d22c7e835 Cleanup: use iron-a11y-keys-behavior for keyboard shortcuts
+ This does not cover on-keydown handlers within elements.
  A follow-up change will account for those.
+ Keyboard shortcuts are disabled within gr-overlay, input,
  and textarea elements.
+ Added tests for new behavior (plus some missing ones covering
  broken behavior).
+ Removed blur hacks used on elements to placate the kb
  shortcuts due to restrictions that have been removed.

Bug: Issue 4198
Change-Id: Ide8009a3bfc340a35a8ec8b9189a85b49c8a95aa
2016-11-17 15:27:59 -08:00
Kasper Nilsson
3ea4311f66 Utilize patch set description in PG
This change adds the patch set description, if it exists, in every patch
set select in the change view and the diff view. Also includes
refactoring of an existing function into a behavior for use in other
files, and removes some unnecessary DOM nodes from the change-view.

http://imgur.com/a/rEhOF

Feature: Issue 4544
Change-Id: Id5f8d2d5750f3f7afc677e16c411327f53487b19
2016-11-11 10:47:37 -08:00
Andrew Bonventre
4b60a0bd7e Merge changes I63f4aa2e,I805f31b2
* changes:
  Revert "Make horizontal scrolling visible on diff page"
  Revert "Allow diff to scroll for inline diff"
2016-11-02 19:20:23 +00:00
Viktar Donich
bcab19889b Revert "Make horizontal scrolling visible on diff page"
This reverts commit 52c943d88e088894e61e054964ec91ffe410a0bc.

Change-Id: I63f4aa2efd386300c070521c5bccf1c6ac5c594e
2016-11-02 19:10:30 +00:00
Wyatt Allen
20693de09f Properly encode file path in diff view
Bug: Issue 4827
Change-Id: Ia0815aca6649324fe9f3ad7c5e2168c25d1f8a7d
2016-11-01 16:11:07 -07:00
Kasper Nilsson
c59e88058e Add raw diff download link to PG diff-view
A dependent change added the ability to download a single file diff to
Gerrit. This change utilizes that new feature via a download link in the
diff-view.

Feature: Issue 4669
Change-Id: I87ef2324ff2cd7fab6eb4b2e066dd08defe7c4f0
2016-10-31 18:06:51 -07:00
Viktar Donich
52c943d88e Make horizontal scrolling visible on diff page
Diff header scrolls with content and sticks to the top.
Implemented custom gr-header wrapper to accomodate this.

Bug: Issue 4491
Change-Id: I451ecd4f6c454fd9ab3085ad8f9c5bdd27cb9269
2016-10-28 12:31:58 -07:00
Viktar Donich
cc6b8300d1 Revert "Fix app size to make scrollbars visible"
This reverts commit a7b89441bda7a1ea7e98969462c2def989bd68c2.

Reason for revert: Got a better idea for app layout, will send follow-up change.

Change-Id: I7b7c86288fb070114e76dd68701e05c539089eab
2016-10-24 20:53:30 +00:00
Viktar Donich
a7b89441bd Fix app size to make scrollbars visible
Fixes footer at the bottom of the page for all pages and changes
scrolling behavior for diff page.

On the diff page:
- horizontal scrolling is right above footer when required
- all headers stay in place when scrolling

Bug: Issue 4491
Change-Id: I62fdf130376b210c26fadcadc90bf452361ac15d
2016-10-20 12:09:57 -07:00
Becky Siegel
6c06e78cf6 Fix horizontal scrolling in file dropdown, comments, and gr diff view
Previously, long file names would display outside of the window size,
causing a horizontal scroll on mobile browsers.

With this change:
* In the file list on the change view, the rightControls are adjusted so
that they wrap on a new line on smaller/mobile screens.
* In the comment list, word-wrapping is used for long file paths
displayed above each comment.
* In the diff view, instead of displaying full paths in the dropdown,
the path is truncated to include an ellipsis, a slash and the file name
so that it can be seen both in the dropdown and also the native browser
select.

Bug: Issue 4722
Change-Id: Icd4644a45db71bc6666c21d62c864d91e9874654
2016-10-13 15:44:59 -07:00
Kasper Nilsson
bf457dd412 Fix data binding in gr-file-list, introduced in 86117
In https://gerrit-review.googlesource.com/c/86117/ the data binding
between the _files array and the dom-repeat in gr-file-list was not
properly enforced. This change fixes that, and also properly
references a static file-list property.

In addition, tests were implemented to ensure this regression is caught
in the future.

Bug: Issue 4575
Change-Id: I32a5645ec47d953ee6a7a71f4b14fc8c9483df3d
2016-09-30 13:04:15 -07:00
Andrew Bonventre
648121b946 Revert "Add 'Show 75 more' button to gr-file-list"
This reverts commit I84c7fc352da80609d424217250830f19a599c940.

Reason for revert: Neither “Show all diffs” nor the keyboard shortcuts
appear to work. However, clicking on the triangle works.

Original issue's description:
> Add 'Show 75 more' button to gr-file-list
> 
> gr-file-list has an issue handling very large (500+) amounts of files
> due to the dynamic rendering of many DOM elements. This change caps the
> number of files shown initially at 75, and allows the user to view more
> in chunks of 75.
> 
> Also added is a button that allows the user to show all files.
> 
> Bug: Issue 4575
> Change-Id: I84c7fc352da80609d424217250830f19a599c940
> 

Change-Id: I7acfad051e0a255d09ee6e02f9dfc0137d5d37ff
2016-09-27 06:49:54 +00:00
Kasper Nilsson
d311e7f7e6 Add 'Show 75 more' button to gr-file-list
gr-file-list has an issue handling very large (500+) amounts of files
due to the dynamic rendering of many DOM elements. This change caps the
number of files shown initially at 75, and allows the user to view more
in chunks of 75.

Also added is a button that allows the user to show all files.

Bug: Issue 4575
Change-Id: I84c7fc352da80609d424217250830f19a599c940
2016-09-23 12:07:51 -07:00
beckysiegel
c47410c816 Focus and tab between diff preferences inputs
Previously, the diff preferences form did not automatically focus to the
first textfield and did not allow tabbing between input fields. This
change adds autofocus when the overlay is opened and allows for tabbing
between the other input fields in the modal.

Bug: Issue 4140
Change-Id: If15812bb4404ca4061597755eeaf68d4cae23b3f
2016-09-20 18:30:29 -07:00
Andrew Bonventre
04e57d6361 Add next/prev links to the diff view
Bug: Issue 4514
Change-Id: I39927b397fda8d6bb80b7e3a9144e5cfe620fb5a
2016-09-07 18:28:47 -04:00
Kasper Nilsson
0deb7e3fb7 Blur dropdowns after selection
Blurring dropdowns after selection enables a more shortcut-based
workflow.

Bug: Issue 3868
Change-Id: Ie35e5458f10540d0498b32d9bf03f5a6888c2232
2016-08-31 11:42:34 -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
Viktar Donich
60d8bce771 Release range comments
Remove beta diff setting and enable range comments for all.

Change-Id: I0cee7e1717574ab54317cdce9e2332c8cda7a0cb
2016-07-14 14:45:15 -07:00
Wyatt Allen
a68b48e1f5 Update the URL hash with the selected diff line
Sets the URL hash to the address of the cursor when a user selects a
diff line (either by clicking the line number or using the 'c' hotkey).
If the cursor is on a line of the revision, the address is the line
number. If the cursor is on a line of the base patch, the address is the
letter 'b' followed by the line number. Otherwise the address is the
empty string.

Bug: Issue 4206
Change-Id: Ic85da197eb6264ea1111cc34e781dccbc24d4d40
2016-06-20 14:14:55 -07:00
Viktar Donich
5008b4491f Add a checkbox to hide ranged comments behind
Also adds concept of locally stored preferences.

Change-Id: Ib074a682228d5360a932af696e18967e8e3473be
2016-06-08 15:29:11 -07:00