58 Commits

Author SHA1 Message Date
Kasper Nilsson
92ad99f345 Use the same text color throughout the app
Change-Id: I55f83e0dbdd83efcbe179683b87060440908e789
2018-04-16 10:15:33 +02:00
Wyatt Allen
ed22566dfe Guard comment textarea and overlays behind dom-if templates
Until the thread list was added, we rarely rendered a large number of
diff comments at once. A diff would add them incrementally in an
asynchronous loop, and even then, their number was reduced by being
filtered to to the given path and patch range.

Rendering all comments at once in the thread list exposed inefficiencies
in instantiating gr-diff-comments, and, for changes with many comments,
could temporarily lockup the browser.

The biggest cause of slowness in comment instantiation was the textarea
for editing. Because existing comments are not in an edit state by
default (...and because only the final comment in a thread can be edited
anyway ... assuming the user even chooses to edit ... assuming there
even is an authenticated user...) it's more efficient to put the
textarea in a dom-if until it's needed.

The overlays are also expensive but infrequently used. These are put
inside a dom-if as well.

Change-Id: I50702afe2b178221110ad3200c5e3862a7722c5d
2018-04-05 18:11:35 -07:00
Dave Borowitz
8cdc76ba4c Add @license tags to PG HTML and JS assets
These tags are preserved by the Closure compiler and vulcanize in order
to serve the license notices embedded in the outputs. In a standalone
Gerrit server, these license are also covered in the LICENSES.txt served
with the documentation. When serving PG assets from a CDN, it's less
obvious what the corresponding LICENSES.txt file is, since the CDN is
not directly linked to a running Gerrit server. Safer to embed the
licenses in the assets themselves.

Change-Id: Id1add1451fad1baa7916882a6bda02c326ccc988
2018-03-26 10:47:55 -04:00
Becky Siegel
07c44918f2 Robot comment styling updates
- Removes the blue background color
- Moves the robot comment specific buttons to be left aligned
- Makes the robot run ID selectable
- Displays the run ID as plain text if there's not a link

Bug: Issue 8514
Change-Id: Ic72caaf76977f5485655ef9ed45b4a7350397a9b
2018-03-15 16:59:13 +00:00
Becky Siegel
fc18085eeb Update gr-diff-comment unresolved toggle
This changes updates the unresolved toggle so that it only attempts to
save when explicitly tapped (as opposed to the value of resolved
changing on its own).

This was causing issues with comment synchronization between
gr-thread-view and diff comments, and also re-rendering the order of
comments in gr-thread-list within the dom-repeat.

This change also lets the resolved checkbox get selected via the enter
key.

Change-Id: I6065c745a0eabcf19df38f3cd6fd2c0d7e7434f3
2018-03-11 20:59:54 +00:00
Quinten Yearsley
9c056b7e73 Put robot comment actions inside a dom-if template
Change-Id: I3f971bf1001c9bf137670705efbd589d3bda1ec0
2018-02-20 11:18:33 -08:00
Kasper Nilsson
7d50910d77 Add confirmOnEnter prop to confirm dialog
For some dialogs, the confirm event should fire on enter. This change
adds this optional property.

Checking the disabled property before firing the confirm event should
prevent unintended side effects throughout the app.

Change-Id: I5603065b37bf87b1c4b36ff54376fb4066869afe
2018-02-12 18:23:25 -08:00
Kasper Nilsson
8f86afc906 Merge "Rename robot-comments-controls to robot-comment-controls" 2018-02-06 00:41:47 +00:00
Quinten Yearsley
b27908d897 Rename robot-comments-controls to robot-comment-controls
This would make the actual name consistent with the documentation
(https://gerrit-review.googlesource.com/Documentation/pg-plugin-endpoints.html)
and it also makes sense for comment to be singular in the context
of one comment.

Change-Id: I62d3f247c7b9a8356d5188cc4d6754d8efe0f8ca
2018-01-31 23:34:03 +00:00
Becky Siegel
d450a9eb57 Respect default font size preference from browsers
We encountered an issue where PolyGerrit was not respecting browser
font preferences. Browser font preferences include both a default font
size and a minimum font size.

In the event that a font declared in px is smaller than the minimum font
size, the size is increased to equal the minimum font size. However,
if the font is declared in px and greater than the minimum, the
preferred font size is not taken into account.

Browsers' default font size is 16px [1], So instead of declaring the
base font in px (previously 13px), this change makes it a percentage
of the default font size. If the user has changed their default, this
is taken into account.

From this point, all other fonts will be declared in rems, which makes
it easier to base the new size off of the base font size of the <html>
tag, rather than ems which bases it on the container[2]. This allows us
to declare font sizes in a way more similar to pixels, yet relative.

A follow-up change will change all font size declaration to use rem from
em for consistency.

[1] https://stackoverflow.com/questions/29511983/is-the-default-font-size-of-every-browser-16px-why
[2] https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984

Bug: Issue 8157
Change-Id: I04ec2c861b2fb288ec7556dfb655d7feea9c9157
2018-01-27 00:29:32 +00:00
Kasper Nilsson
3969b31414 Fix typo in element ID
Change-Id: I01a0fd76c0a0fc9f1f36857bb6982203fba0cbc8
2017-12-27 13:18:41 -08:00
Viktar Donich
3a12ebf262 Create a robot-comment-controls plugin endpoint
This is needed to add "Not important" link by a plugin.

Change-Id: Id8ef0a372e7111c12631cf41aafce9ac6a33e7f0
2017-12-06 14:02:52 -08:00
Kasper Nilsson
46a6c8eca2 Allow toggling resolved outside editing state
A recent change modified some comment editing UX. As a consequence, the
save button disabled state was erroneously based entirely on whether or
not the comment message had changed.

With this change:
- Save disabled state on a comment takes into account resolved state
- The resolved checkbox is always visible on an expanded draft comment
- When the resolved checkbox is modified on a non-`editing` draft
  comment, it is saved immediately

Bug: Issue 6023
Change-Id: I40b0b280129e5a76c13e38c97525f91a8e56482d
2017-12-05 13:20:22 -08:00
Becky Siegel
6de1489147 Refactor gr-button styling
A few changes:
- Utilize mixins within gr-button internally, so less styles have to be
  overridden by elements implementing their own button styles.
- All buttons have a hover background color, which is 12% black
  overlayed on top of its current background color.

Bug: Issue 7894
Change-Id: I4f2879aa0232912267bbf1290a1c800d024099a6
2017-12-01 16:15:19 -08:00
Kasper Nilsson
80ca288da5 Delete draft comment when saved with empty text
Recently, the comment editing UX was changed (the discard button was
removed from the editing view). This (obviously) made it impossible to
discard a draft comment whilst editing it.

Editing a comment, clearing the text, and saving now removes the
comment.

Bug: Issue 7832
Change-Id: I0dae814b9ce2e7a5b57530f839c708e59c215341
2017-11-27 16:37:11 -08:00
Kasper Nilsson
d66fb88099 Fix bad vertical align in collapsed comments
Bug: Issue 7762
Change-Id: I3b79b054a99b7ba5caf6b0ec9f48abdf6cdee0b7
2017-11-20 13:54:11 -08:00
Paladox none
1b3ea22cf5 PolyGerrit: Replace content with slot part 2
This change makes the following replacement:

<content select=".header"> replace it with
the slot equivalent.

Change-Id: Icc68576a3b44559775103163febd429194802981
2017-11-15 17:36:37 +00:00
Kasper Nilsson
786438b7a6 Re-style comment removal button on diff comments
Some modifications to the styling of paper-button within gr-button
overrode a few deliberate styling decisions made in the delete comment
button (namely, color and padding). This change moves those CSS props
inside a styling mixin so that they are properly applied, and overload
the defaults from inside gr-button.

Change-Id: Ifdfc0a3959f4131e1bb86e8b66d70db2fde79077
2017-11-09 09:18:16 -08:00
Kasper Nilsson
060b612810 Remove hidden attribute from cancel button
The hidden attribute was erroneously left on the cancel button in diff
comments, causing it to not show up by default.

It showed up upon editing an existing draft because the hideOnPublished
CSS overrode the hack for the [hidden] attribute.

In addition, the buggy behavior was actually enforced by a buggy test --
it asserted that the button was not visible, but was labelled as "Cancel
is visible".

Bug: Issue 7664
Change-Id: I9e08c33fc4adf0f1465a52055a3308210625ffde
2017-11-06 17:08:02 -08:00
Wyatt Allen
5eab49acc0 Show comment saving progress indicator inside comments themselves
Bug: Issue 7596
Change-Id: I194bce633c8d746c24f71fc7f4bbdf2b87e5b883
2017-11-03 21:00:56 +00:00
Kasper Nilsson
9725fac3b7 Hide "Discard" button while editing comment
Bug: Issue 7491
Change-Id: I3514fd3f2ba63f138cd6eb52d32034d1ec8e47b0
2017-11-01 12:15:19 -07:00
Wyatt Allen
489e2680a7 Show confirmation dialog before destructively discarding draft comments
The discard confirm dialog is added alongside the delete confirm dialog
and the dialog opening/closing code is refactored to work on either. The
confirm discard dialog only appears if the draft message is savable.

Feature: Issue 6984
Change-Id: I6d88a8734fa7736f685796790e02437b10c81f00
2017-10-19 13:11:54 -07:00
Becky Siegel
7eb2707811 Update order of buttons in gr-diff-comment
Because the order of buttons switched on most modals (cancel on left,
save on right) this updates the button order in gr-diff-comment for
consistency. Discard is moved to the left of 'save' and 'edit'.'

Change-Id: Ifa08976b77d99bb32fb1d6388f38843ad9e065fa
2017-10-16 09:43:23 -07:00
Becky Siegel
d1f95e97ae Update a few gr-button styles
- Diff preferences
  - Use link button, align right
- diff comment
  - use link button, modify colors

Change-Id: Ibdd232b1f30d2d0d3e36ce708afbd35470f6da44
2017-10-12 00:52:20 +00:00
Kasper Nilsson
aafba229bb Make comment removal element less obtrusive
This change moves the admin-only commment up above the comment next to
the date and styles it more subtly, saving vertical space.

Bug: Issue 7274
Change-Id: Id3095a5439e33055eec3191f6e31d17bb8640615
2017-09-23 00:48:28 +00:00
Kasper Nilsson
15cdbd4bd1 Invert comment action alignments
It makes the most sense (at least for left-to-right language speaking
locales) to have the most final and most destructive UI elements read
last, as interacting with those is the most permanent, and requires the
full context of the information in the element.

In diff comments, actions like 'Save' and 'Discard' (which affect the
entire comment) were on the left, whereas toggling the resolved state
was on the right. This change flips these alignments.

Bug: Issue 5924
Change-Id: Id00e19d662a983fad071df0fb866052b2001beb4
2017-09-22 13:39:47 -07:00
Becky Siegel
1a09820022 Update bold fonts to Roboto Medium
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
2017-09-08 16:06:35 -07:00
Becky Siegel
03690330ff Do not show overflow-y in gr-editable-content
Because of the way iron-autogrow-textarea works, There will never be
a need to have a vertical scroll bar, as the text area expands
accordingly.

In cases where a horizontal scrollbar appeared (due to long lines of
text), the height of the textarea shrank just enough for a vertical
scrollbar to be added as well. There also appeared to be some browser
quirks in which the scroll bars jumped around when they shouldn't.
In order to prevent this from happening, hide overflow-y.

Additionally, add box-sizing: border-box to all iron-autogrow-textarea
instances, so that scrollbars appear correctly in shadow dom.

Bug: Issue 6500
Change-Id: I28f3b47d656a246decd693f637040748ec4fd3a0
2017-07-24 18:13:13 +00:00
Becky Siegel
59f2b4ce83 Show helper text only when hovering over draft icon, not text
Previously, when you clicked 'reply' on a comment, the cursor would
automatically be hovering the 'DRAFT' text. This change makes it so
that only the ⓘ  is hoverable, but not the text itself.

Bug: Issue 5810
Change-Id: I0be8d1e777bcfe68fd4b192290c711fcb1430c3a
2017-07-06 21:12:08 +00:00
Kasper Nilsson
9fee82ef7d Migrate gr-diff-comment to iron-a11y-keys
Bug: Issue 4198
Change-Id: I68ca64a9b0ef5cc9e83f19521529971d260fda55
2017-06-22 10:32:05 -07:00
Becky Siegel
a4fc6de235 Fix various selectors for shadow dom
https://www.polymer-project.org/2.0/docs/devguide/style-shadow-dom

Bug: Issue 6372
Change-Id: I1918e86b31d4fa02b67d1b0e5ef9ae8f48877257
2017-06-05 22:42:22 +00: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
Wyatt Allen
3312df1741 Use monospaced font when composing diff comment
Bug: Issue 6349
Change-Id: Iaacd1472d1718e7e67e5b57f5eda05eed9bac78b
2017-05-31 11:46:10 -07:00
Becky Siegel
99625b5a6c Add gr-autogrow-textarea to gr-diff-comment
This replaces iron-autogrow-textarea so that the diff comments can have
emoji support.

Change-Id: I8bfa31b789604f28aca0ff28dc5c0836afdb6005
2017-05-25 10:08:33 -07:00
Becky Siegel
64cede2a14 Fix delete button again
In the previous fix, the function was not called and since it was
the function that set the class to 'hidden' it did not hide.

Change-Id: Ic8f908802cb515086860f20e2c82d0ddd06c0278
2017-05-19 23:08:16 +00:00
Becky Siegel
94cf669dc0 Do not show delete button for admins when comment is a draft
There was a formatting issue caused by delete buttons in a draft change.
It really does not make sense for the button to be there for drafts
anyway. This change hides the delete button for admins on draft changes.

Bug: Issue 6257
Change-Id: I236eff9db1f0ca76ed658f3048132c9c675ee407
2017-05-18 13:15:09 -07:00
Viktar Donich
9f047389f4 UI for comments deletion by admins
This change depends on API implemented in Change 105052.

Feature: Issue 4644
Change-Id: I91137aaa69eef419e08c8a568cef9350d8a1448b
2017-05-17 10:29:08 -07:00
Becky Siegel
c9e4a34e77 Introduce gr-tooltip-content element and add for draft comment
This change introduces an element that can wrap a tooltip around
arbitrary contents. Previously, we could only attach a tooltip to a
Polymer element, and want more granularity than that for the purposes
of positioning.

The new tooltip element takes the following arguments:
- title (the contents of the tooltip, required)
- showIcon (optional, to show an info icon)
- maxWidth (optional, to pass a max-width to the tooltip itself).

The tooltip itself will be attached to the content inside of the
<gr-tooltip-content> wrapper.

One tooltip has been added using this new element for the 'DRAFT' text
in the gr-diff-comment'.

Bug: Issue 4539
Change-Id: Iff05c785052c643ef1f1cc01d101b21c48c6299f
2017-03-14 13:17:30 -07:00
Kasper Nilsson
bdf4390476 Revert timezone in timestamp
Removes the timezone from the timestamps, as the tooltip shows UTC
offset on mouseover.

Also upgrades most instances of gr-date-formatter to use gr-tooltip.

Bug: Issue 5587
Change-Id: I57c7dcacf0618ffd967eff3cb4ff37a5e1876180
2017-03-09 11:35:22 -08:00
Becky Siegel
e76c79bc05 Fix problem where gr-formatted-text would sometimes not display
There was an issue where gr-formatted-text would not display when the
config was not loaded yet.  This change adds a function to display text
as is, in the event that the config is not yet loaded. It also refactors
the existing functions to make it more clear where config is needed.

Bug: Issue 5690
Change-Id: I74896bd59793b26b2b8fe289c13e5762c60fe8df
2017-03-06 09:38:05 -08:00
Kasper Nilsson
c617573db7 Add unresolved label to draft comments
Feature: Issue 5619
Change-Id: I5c053d37c51d71324ef7151f180cf7c8ad366c51
2017-02-22 17:05:05 -08:00
Becky Siegel
2c602323e1 Move reply buttons to comment thread
Move all buttons that generate a reply of some sort (done, ack, reply,
quote) to the comment thread instead of the comment [1].

When there is a draft for a particular comment thread, all reply buttons
are hidden [2].  For example, if you click reply, you cannot click done
on the same thread, unless you remove the draft.

Each thread can have up to 1 draft. It's also worth noting that if a
thread has a draft, and the user clicks on the line or 'c' at the same
range, the existing draft will switch to 'editing' form.

[1] With the exception of "please fix" for robot comments.
[2] In this case, The please fix button will be disabled when other
reply buttons are hidden.

Feature: Issue 5410
Change-Id: Id847ee0cba0d0ce4e5b6476f58141866d41ffdad
2017-02-09 16:07:32 -08:00
Kasper Nilsson
ee1ce06064 Wrap resolved checkbox in label tag
Increases the click surface for resolving comments.

Change-Id: Ibce18001426a3c283cd5df13482853a2185c2ab9
2017-01-24 14:46:31 -08:00
Kasper Nilsson
06c374d500 Add resolvable comments checkbox
Adds the 'resolved' checkbox to the front end. Unresolved comment
threads are indicated by #fcfaa6 as background-color, whereas resolved
threads have the background #fcfad6.

Feature: Issue 4879
Change-Id: Ie1eeba61ccba559f89b707542acab2198c99b8a7
2017-01-11 12:57:56 -08:00
Wyatt Allen
0a2250ee18 Tighten padding around inline comment editing
Bug: Issue 5243
Change-Id: I9e47c18b9352ca3b0a6f985640a2326875cfbc7f
2017-01-11 10:11:28 -08:00
Kasper Nilsson
8d1ac7e824 Display comment resolve state
This change tracks and exposes the resolved state of a comment thread
without exposing the UI for modifying that state. This enables features
to be built out while the API request does not exist in the backend.

Feature: Issue 4879
Change-Id: If002035024920a7762519cedf5a869221bbbc3c8
2017-01-09 20:21:48 +00: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
Aaron Gable
5be3252ead Add an 'Ack' button next to the 'Done' button
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=622838
Change-Id: Ie7db71615e2c657bbf24847cd8e6e2fc7606f5a9
2016-11-30 09:46:48 -08:00
Wyatt Allen
4f1b5c2dc9 Wiki-like formatting for PolyGerrit comments
This change is the PolyGerrit counterpart to [1].

Nicer rendering for reviewer comments in PolyGerrit using the Gerrit
Wiki-like format. Whereas, formerly, PG comments were set in PRE blocks
using monospaced font so that the original format and alignment of the
comment can be directly viewed. This change allows comments to default
to a variable-width font with wrapping while separately styling blocks
intended to be pre-formatted text, quotes and lists.

The logic to parse comment text into blocks is borrowed from the Java
implementation found in [1]. Test cases are additionally translated from
this change to ensure coincident behavior.

Introduces GR-FORMATTED-TEXT to display these comments, and which uses a
similar interface to GR-LINKED-TEXT. Much like [1], the comment is
parsed into a list of blocks. These blocks are then mapped to the DOM
nodes that get attached inside the element.

[1] I8e11d363b80bff0b6395f56e210b636f68db36fa

Feature: Issue 4861
Change-Id: I245d6782e2fd8982ac3eda438fe4ca80f3658195
2016-11-17 09:08:00 -08:00
Becky Siegel
0a59ac2565 Add autocomplete to iron-autogrow-textarea elements
Previously, iron-autogrow-textareas did not prompt autocomplete on
mobile devices. With this change, mobile browsers that support
autocomplete will suggest words to the user.

Bug: Issue 4683
Change-Id: I9286b998df95798f88c56f66fd63d731e5a88cc5
2016-11-16 01:26:41 +00:00