New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 788815 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Simplify plugin element setup for tricium and buildbucket plugins.

Project Member Reported by qyears...@chromium.org, Nov 27 2017

Issue description

Currently, the Buildbucket Gerrit plugin and the Tricium Gerrit plugin load the UI element by registering a JavaScript plugin .js file, which loads and then loads the actual UI element and inserts it into the page:

https://chromium.googlesource.com/infra/gerrit-plugins/tricium/+/master/src/main/java/com/googlesource/chromium/plugins/tricium/TriciumModule.java

https://chromium.googlesource.com/infra/gerrit-plugins/tricium/+/master/src/main/resources/static/tricium.js

This can now be simplified, due to improvements in Gerrit. Notes from viktard@:

> If you use .html-based plugin, it should be possible to use <link rel="import" directly.

> It should be possible to do following instead:
> plugin.registerCustomComponent('change-view-integration', 'tricium-view')
> This also removes the need to use plugin.on().

> Please use "change-view-integration" endpoint.
> I've also went ahead and added change and revision params in https://gerrit-review.googlesource.com/c/gerrit/+/142771
> https://gerrit-review.googlesource.com/Documentation/pg-plugin-endpoints.html
 
Project Member

Comment 1 by bugdroid1@chromium.org, Dec 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/gerrit-plugins/buildbucket/+/df3692cd01780ce647d22598968d0e858461ca15

commit df3692cd01780ce647d22598968d0e858461ca15
Author: Quinten Yearsley <qyearsley@chromium.org>
Date: Fri Dec 08 17:14:07 2017

Buildbucket plugin: Use Plugin.registerCustomComponent.

Similar to https://crrev.com/c/815014, the purpose of this CL is to
simplify the buidbucket view element activation; one consequence of
this change would be that new instances of cr-buildbucket-view would
be created for different change page.

Bug:  788815 
Change-Id: I8ce0e4ed53212b8631ed4c9629ee64c0ed04b237
Reviewed-on: https://chromium-review.googlesource.com/814619
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/df3692cd01780ce647d22598968d0e858461ca15/src/main/resources/static/buildbucket.js
[delete] https://crrev.com/cf4085c83a2cb9bfc67edc27964309a8fd3578f5/test/buildbucket_test.html
[modify] https://crrev.com/df3692cd01780ce647d22598968d0e858461ca15/test/index.html
[modify] https://crrev.com/df3692cd01780ce647d22598968d0e858461ca15/src/main/resources/static/cr-buildbucket-view.js

Project Member

Comment 2 by bugdroid1@chromium.org, Dec 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/gerrit-plugins/tricium/+/81e24fffcb8db288300a79ce5d9bf881a2794151

commit 81e24fffcb8db288300a79ce5d9bf881a2794151
Author: Quinten Yearsley <qyearsley@chromium.org>
Date: Tue Dec 12 18:15:40 2017

Tricium plugin: Use Plugin.registerCustomComponent.

This CL uses registerCustomComponent to handle attaching a
tricium-view element at the right place in the in DOM and
setting the change, revision and plugin properties.

After this change, one change in behavior is: a different instance
of tricium-view is used on different change pages, rather than one
tricium-view instance being saved and reused for different change
pages.

Bug:  788815 
Change-Id: I6fe950984757c04f32888aed7d6501f0abb9385c
Reviewed-on: https://chromium-review.googlesource.com/815014
Reviewed-by: Emma Söderberg <emso@chromium.org>

[modify] https://crrev.com/81e24fffcb8db288300a79ce5d9bf881a2794151/src/main/resources/static/tricium.js
[modify] https://crrev.com/81e24fffcb8db288300a79ce5d9bf881a2794151/src/main/resources/static/tricium-view.js
[delete] https://crrev.com/8e9c53826441ffd7ff305f2bfd5aa47de5af4058/test/tricium_test.html
[modify] https://crrev.com/81e24fffcb8db288300a79ce5d9bf881a2794151/test/index.html

Status: Fixed (was: Assigned)
Changing the plugins to use registerCustomComponent was the main thing here, and now it appears as though changing the plugins to be html-based may not be supported currently if the plugins require config (in their own config file or project.config).

Comment 4 by vikt...@google.com, Dec 20 2017

You're mostly correct - plugin-specific configuration at the moment requires plugin to implement it in .java code.

However, it should be also possible to use .html plugins in this case:

https://gerrit-review.googlesource.com/Documentation/pg-plugin-migration.html#migration
So you mean we could migrate to having a .html file (which loads the custom element with html import) while still keeping the plugin config the same? Although for now, keeping the plugin config the same still requires some Java code?

Comment 6 by vikt...@google.com, Dec 20 2017

Yes.
Cool, we should do that for both the buildbucket and tricium plugins. Filing  bug 796638  for this.

Sign in to add a comment