Simplify plugin element setup for tricium and buildbucket plugins. |
||
Issue descriptionCurrently, 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
,
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
,
Dec 20 2017
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).
,
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
,
Dec 20 2017
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?
,
Dec 20 2017
Yes.
,
Dec 20 2017
Cool, we should do that for both the buildbucket and tricium plugins. Filing bug 796638 for this. |
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, Dec 8 2017