How to get UI to refresh or reload plugin after Code Review

169 views
Skip to first unread message

prince.ti...@gmail.com

unread,
Jun 17, 2021, 9:51:45 AM6/17/21
to Repo and Gerrit Discussion
I created a plugin using Javascript API and load it on showchange
plugin.on('showchange', onShowChangePolyGerrit);


The problem is that when a Verified+1 and CodeReview+2 is sent, the new Gerrit 3.X UI seems not to refresh the whole page but just loads the necessary buttons. The problem is that my plugin is a button also in the primary action area which should be pulled also but it's not being pulled(because it's a plugin and not part of the core)

When I refresh the page, the plugin is loaded so that works without any problems. However, the new UI does not refresh the page. Is there a way to get the page to refresh or to get the plugin reloaded again when a new comment is created?

It does not trigger the showchange line. I tried
plugin.on('comment', onShowChangePolyGerrit);
it doesn't seem to work either

Titus

Dhruv Srivastava

unread,
Jun 17, 2021, 10:53:56 AM6/17/21
to prince.ti...@gmail.com, Repo and Gerrit Discussion
>> Is there a way to get the page to refresh or to get the plugin reloaded again when a new comment is created?
gr-change-view has the listener to the event 'reload' for reloading the page which your plugin can fire to get the page to reload.


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/bf33dfba-0ac9-4ad8-98e6-3a8a61765187n%40googlegroups.com.

prince.ti...@gmail.com

unread,
Jun 17, 2021, 5:22:12 PM6/17/21
to Repo and Gerrit Discussion
Thanks. I'm not sure I understand how to do it. Let us say


Gerrit.install(plugin => {

const replyApi = plugin.changeReply();

let wasSuggested = false;

plugin.on('showchange', () => {

wasSuggested = false;

});

});


How do I implement what you are saying? Please help

Ben Rohlfs

unread,
Jun 18, 2021, 2:17:23 AM6/18/21
to prince.ti...@gmail.com, Repo and Gerrit Discussion
Maybe try

plugin.on('labelchange', ...);

That should fire when labels change.

prince.ti...@gmail.com

unread,
Jun 18, 2021, 5:04:08 AM6/18/21
to Repo and Gerrit Discussion
Do you know if there's documentation for labelchange anywhere? I didn't see it in the API documentation. I just tried it and it works quite well

TItus
Reply all
Reply to author
Forward
0 new messages