Gerrit banner

173 views
Skip to first unread message

Kiran Shinde

unread,
Aug 28, 2023, 9:47:07 AM8/28/23
to Repo and Gerrit Discussion
Hi All,

We are planning to add Banner to the top of our Gerrit instance for important announcements and downtime. I have implemented the banner.js as below:

Gerrit.install(plugin => {
const endpoint = 'banner';
plugin.hook(endpoint).onAttached(element => {
const el = element.appendChild(document.createElement('div'));
el.textContent = "This gerrit instance will be migrated from LDAP to MS Azure AD on 15th of Sep 2023, between 17:00 to 19:00 CET. Please reach out to us on our Teams channel if you have any questions."
el.style = 'background: pink; line-height: 4em; text-align: center;';
});
});

This is getting displayed at the top of the screen in a single line.
I would like to break this text on 2 lines instead of one.
I tried adding \n and <br\> to the above text but it doesn't help.
Also, I would like to insert a link to our teams channel.

I have tried to look for documentation or any examples online but in vain.
The usual html code does not seem to work.
Can someone please help me with my above queries?

Best Regards,
Kiran

Ben Rohlfs

unread,
Aug 28, 2023, 9:50:15 AM8/28/23
to Kiran Shinde, Repo and Gerrit Discussion
Just use `el.innerHTML = ...` instead of `el.textContent = ...`. That should work with HTML. You can then use <br> and <a> as desired. -Ben


--
--
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/2709b806-b856-4e30-b136-f25b151ed566n%40googlegroups.com.

Kiran Shinde

unread,
Aug 28, 2023, 10:20:48 AM8/28/23
to Repo and Gerrit Discussion
Your suggestion worked really well.
Thank you very much Ben for your quick help.

Best Regards,
Kiran

Reply all
Reply to author
Forward
0 new messages