The saveReviewedState observer observes params.*, but should not set
reviewed state when view !== Gerrit.Nav.View.DIFF. This can (and did)
happen when the Gerrit.Nav API is used to change the view -- the
observer is triggered before the view is detached.
Bug: Issue 8192
Change-Id: I06c1875f6f515c0d001277e63eb7724728c85cba
When users navigate to the diff view with a line number specified at the
end, depending on their context preference, the line might be in a
shared region that gets collapsed when the diff renders. With this
change, the location specified in the URL is prevented from being
collapsed by marking it as a "key" location.
Bug: Issue 5247
Change-Id: Ifd5827cd922b022cddb1601911a9ecea6a054f35
The command to view the next file in the patch set with comments
navigates to the change view if there is no next file with comments. The
same behavior is applied to the previous file with comments shortcut.
A suite of tests is added for the skip methods.
Feature: Issue 5452
Change-Id: Iaa43e3a4ca1d1825fd0a205dd9b722b5f7cf59e4
Gerrit.Nav.setup() now takes a weblinks generator function as a third
parameter. Here's the function signature:
``` js
Gerrit.Nav.setup(navigate, generateUrl, generateWeblinks)
```
Weblinks generator function takes single payload parameter with
`type` property that determines which part of the UI is the consumer of
the weblinks. `type` property can be one of `file`, `change`, or
`patchset`.
For `file` type, payload will also contain string properties:
`repo`, `commit`, `file`.
For `pachset` type, payload will also contain string properties:
`repo`, `commit`.
For `change` type, payload will also contain string properties:
`repo`, `commit`.
If server provides weblinks, those will be passed as `options.weblinks`
property on the main payload object.
Change-Id: I0d9de3a295435304e2b6aad551112440075cf098
With this change, in merge changes, patch ranges can diff against a
specific parent (as indicated by a negative parent index) similarly to
the GWT UI.
- Parent options appear in patch range selectors when available.
- The router no longer redirects parent indexed patch ranges now that
they are supported.
- The RevisionInfo class is added to house revision related functions in
a form that's easily passed between components.
- On merge changes the default patch range base is labeled as
"AutoMerge" rather than "Base".
Feature: Issue 4760
Change-Id: I221ba97e28be52f225f7d90f5f8c5a0f17ddb8c2
This function also re-initializes a ChangeComment object, but uses the
old values for comments and robot comments, and only makes a request for
new drafts.
It's response is identical to loadAll for the purposes of elements using
these functions, but will reduce unneeded API calls.
Change-Id: I3c0872b86a0e24c9c378acf3311fe8cc3e078eda
The diff view file select used its own implementation of a dropdown,
which also had two versions, a native select for mobile and a custom
design for desktop.
gr-autocomplete-dropdown was designed so that it could be used in this
scenario as well, as it also has a native select built in.
This will also allow us to add comments in the dropdown (follow-up
change) and use Gerrit.Nav instead of generated URLs.
Change-Id: I5613bb8e327a3f6ae227bf69e64bfafbbfe09b6c
Since the diff view now has access to the same comment structure as the
change view/file list header via the comment api, patchsets can now
display comment counts in the dropdown.
Bug: Issue 7212
Change-Id: I85697c770862de48b2b2ce82649f1b8873ab9480
Previously, nested components (that are never standalone) were making
their own requests for comments, creating unecessary duplicate API
requests.
Some requests were made to the rest API directly (for example,
gr-change-view requested comments this way), and some were through the
gr-comment-api, which also helped handle comment manipulation and
reorganization.
Instead of ad-hoc comment requesting, move all comment requests to the
top level (standalone) component, and use an object prototype to
generate _changeComments as a property on gr-comment-api. This is an
immutable object that can be passed to the inner components
(file list, etc), and includes the methods needed to manipulate
comments into the forms
necessary.
When a child component needs to trigger a refresh of the comments, fire
an event that the parent event handles (see gr-file-list l.867).
Bug: Issue 6953
Change-Id: Ic4b6cf16520baae65d8cf956c311a60f2a70a2e1
This is a recent regression caused by the migration to paper-button.
Applying the user-select CSS to the paper-button instead of the
gr-button allows for users to highlight the file path.
Bug: Issue 7544
Change-Id: Ib5256f78fa567d5e39fbc21fc6fdf113b87f9b77
Previously, the patch range selector was updated to not use two way
bindings (https://gerrit-review.googlesource.com/c/gerrit/+/130453) but
the diff view's usage was not updated as well. This change updates the
diff view to use the patch range select in the same way as the file
list.
Bug: Issue 7420
Change-Id: I1baaf643e08d1a4661962021be890bafd6d5b4ef
Previously, PolyGerrit relied on the default value of the loading flag
in the diff view to show/hide the appropriate diff panels (or loading
message). Because of this, stale information is displayed when a user
navigates between different files within the same diff view.
With this change, the `_loading` flag is set before the major API calls
are made, and the loading message is made more obvious.
Bug: Issue 7381
Change-Id: Id70d981a2c72fef9f44a32c5463dc43c3ce41cf6
Mostly styling updates but notable changes:
- Common color in theme.html, should be used by all buttons and links.
- CSS mixin to style gr-button passed to paper button (used in
gr-label-score-row, gr-linked-chip)
- Some things that look like buttons but aren't exactly buttons get
text-transform uppercase to appear like a button.
- Primary and secondary buttons are both the same color, but for now
- have not removed secondary so that it's possible to style them
differently if we decide to.
Change-Id: Ib5ef3b0fc4883cd6dfc5c38e6d954925101d531f
This also moves the change reloading logic back to the change view,
where it gets updated patch ranges via a two-way data binding.
Change-Id: Ib09ad1a176ba96bac77a513d344226df029aef7b
With this change a blame column is added to the left side of diff
tables. The column is empty and hidden until blame is loaded. A button
is added to the change view to trigger a load of the blame for that
diff, as well as a unload it if already loaded. In this stage, the blame
information is non-interactive and only displays the SHA, date and
commit author.
Feature: Issue 6075
Change-Id: Ifcb951265d0e6339094e6b7c9574ec9c69e60b51
The gr-diff-cursor#getAddress method returns null when it has no
position or no address corresponds to it's position. However, the
gr-diff-view#_onLineSelected method did not account for this case and
attempted to use null addresses to construct URLs when moving the cursor
to a "File" line of a diff.
With this change, the diff view neither uses line number nor the diff
side when constructing URLs if the cursor does not yield an address.
Change-Id: I628658295bca1f49e0c2d3484e2e0d01e71bcd91
Slight refactoring required in order to satisfy both use cases:
- Fire an event when patch range changes and let parent element
handle it.
- Support comment strings
- availablePatches becomes an array of objects instead of an
array of integers.
Change-Id: Ia8da9296f41eb2d45c9358d03fbec3940273ad9d
Bold fonts were inconsistent across platforms and new design specs use
Roboto Medium instead, so switching all currently bold fonts to use
that.
Change-Id: Ibfc5ffc3fc33517acb85acc0194215b4d7864cae
Some URLs (for example, comment links in Gerrit emails) specify the line
number following an @-sign rather than in the hash using an octothorp
because the URL is already mostly inside a hash (for backward
compatibility with the GWT UI). When these URLs do not include the
project name (as they currently do not in Gerrit emails) the project is
loaded and the parsed route is "upgraded" to include the project.
However, when generating the upgrade URL, the `_generateUrl` method
looks for the `lineNum` and `leftSide` properties to generate the
address. While the address specified by the @-sign is properly converted
to an octothorp-hash before this point, it appears on the properties
object as `hash`, and is thus ignored by `_generateUrl`.
With this change, instead of passing the raw hash through the app params
and parsing it in the `gr-diff-view`, the hash is parsed into its
`leftSide` and `lineNum` values and attached to the `app.params` by the
router. In this way, the location is preserved through URL upgrade, the
param format used in navigation matches that used in URL generation and
the diff view no longer parses the route.
Bug: Issue 7087
Change-Id: Idb2e3cccf2884fae742247cf1ebbde1ad97e53ab
Formerly, the gr-diff-view generated and updated the URL hash that
indicates the location of the diff cursor, regardless of the hash
generation scheme implemented in _generateUrl. With this change, the
diff view uses the _generateUrl for the cursor-location-specific URL.
Change-Id: Ia70a298f114c9eae9cdc5b0a8f73d7ecab55896e
To prevent redundant (and sometimes incorrect) change/diff loads, this
change moves the logic for rewriting the URL schema to within the
router.
This has the drawback of adding a step -- and a potential API call --
between initial URL interpretation and first render, but ensures that
render will be correct. This only occurs when legacy routes are used.
Bug: Issue 7027
Change-Id: Ia1571e2f946f6d9e334626b6b0fd4a8c0c81f35d
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
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
Previously, opening the reply dialog was disabled when draft comments
were pending save. Now, the reply dialog is fully enabled, and will
silently wait for pending comments to be saved before proceeding with
any save/send operations.
Moreover, when diff drafts are in the process of saving, a label is
displayed below the comments list. When they finish saving, the list is
updated with the diff comments.
Change-Id: I2777f9e15b052e606aa210b5372dc7a89a076345
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
Because requests for a user's draft diff comments is always nested
within a check for whether a user is logged in, these can be combined
into the same REST API interface call. The updated call is given a JSDoc
to describe the additional functionality and call sites are simplified.
Change-Id: Idc0cc6298c7287579ba76e7cc35701e62142bca3
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