Styling specific css element.

40 views
Skip to first unread message

Lawrence Dubé

unread,
Jan 17, 2022, 6:06:57 PM1/17/22
to Repo and Gerrit Discussion
I spent a few hours parsing through plug-ins example and the documentation trying to see if it's possible to style that icon, ideally i'd just apply a "display: none" on it, but it doesn't seem possible?image.png
We would like to remove that icon, because we don't care if the commit is signed or not, but we don't want to disable enableSignedPush = true in case someone uploads a project that has signed commits. 

Is something like this possible?

Thanks!

Ben Rohlfs

unread,
Jan 18, 2022, 2:42:58 AM1/18/22
to Lawrence Dubé, Repo and Gerrit Discussion, דוד אוסטרובסקי‎
Hi Lawrence,

I don't know much about the enableSignedPush feature. AFAIK this was a community contributed feature and I have tried adding someone who knows more about it.

The computation of the icon is done here:

This was introduced in 2018:

I let others comment on whether the feature could be changed/enhanced such that the help icon is not shown in the absence of the `key` property.

As to hiding the icon by means of a js plugin and css rules, that is not directly supported. Your only (fragile and roundabout) chance to get at the icon is manually piercing the shadow of all the parent components like so:

const a = document.querySelector('gr-app')
const e = a.shadowRoot.querySelector('gr-app-element')
const c = e.shadowRoot.querySelector('gr-change-view')
const m = c.shadowRoot.querySelector('gr-change-metadata')
m.querySelector('iron-icon.help')

HTH, 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/CAGKo9fbtZEp_4Ly_XgC%3DgUjFjg7jDju%2BXboh1y2CrxkwCOJMyw%40mail.gmail.com.

David Ostrovsky

unread,
Jan 18, 2022, 6:45:49 AM1/18/22
to Repo and Gerrit Discussion
bro...@google.com schrieb am Dienstag, 18. Januar 2022 um 08:42:58 UTC+1:
Hi Lawrence,

I don't know much about the enableSignedPush feature. AFAIK this was a community contributed feature and I have tried adding someone who knows more about it.

This is not quite accurate. Signed push feature was contributed by Google,
mostly by Dave Borowitz: The relevants topics are:

The issue and CL you linked to was just finalizing of GWT UI to PG UI migration.
The original CL authored by Dave Borowitz that added the icon on the change
screen for GWT UI:

Lawrence Dubé

unread,
Jan 18, 2022, 12:52:42 PM1/18/22
to David Ostrovsky, Repo and Gerrit Discussion
On Tue, Jan 18, 2022 at 6:45 AM David Ostrovsky <david.o...@gmail.com> wrote:

bro...@google.com schrieb am Dienstag, 18. Januar 2022 um 08:42:58 UTC+1:
Hi Lawrence,

I don't know much about the enableSignedPush feature. AFAIK this was a community contributed feature and I have tried adding someone who knows more about it.

This is not quite accurate. Signed push feature was contributed by Google,
mostly by Dave Borowitz: The relevants topics are:



Yeah, looks like the only way (without touching the shadowroot) to disable the icon right now, is to disable signed push all together. Ideally if another option could be added like "disable_signed_push_warning" it'd be ideal.
 

The issue and CL you linked to was just finalizing of GWT UI to PG UI migration.
The original CL authored by Dave Borowitz that added the icon on the change
screen for GWT UI:

 


I let others comment on whether the feature could be changed/enhanced such that the help icon is not shown in the absence of the `key` property.

As to hiding the icon by means of a js plugin and css rules, that is not directly supported. Your only (fragile and roundabout) chance to get at the icon is manually piercing the shadow of all the parent components like so:

const a = document.querySelector('gr-app')
const e = a.shadowRoot.querySelector('gr-app-element')
const c = e.shadowRoot.querySelector('gr-change-view')
const m = c.shadowRoot.querySelector('gr-change-metadata')
m.querySelector('iron-icon.help')

HTH, Ben

This is what I ended up using for now anyway. (If you see a simplification to this, I'm all ears)

const removeSignedWarningIcon = async function(changeinfo, revisioninfo) {
    const gr_app = document.querySelector('gr-app')
    const gr_app_element = gr_app.shadowRoot.querySelector('gr-app-element')
    const gr_change_view = gr_app_element.shadowRoot.querySelector('gr-change-view')
    const gr_change_metadata = gr_change_view.shadowRoot.querySelector('gr-change-metadata')
    const gr_external_style = gr_change_metadata.shadowRoot.querySelector('gr-external-style');
    const gr_account_chip = gr_external_style.querySelector('gr-account-chip');
    const icon_to_hide = gr_account_chip.parentNode.querySelector('gr-tooltip-content')
    icon_to_hide.style.display = "none";
};

Gerrit.install(plugin => {
    PLUGIN = plugin;
    PLUGIN.on("showchange", removeSignedWarningIcon);
});

Thanks
 









On Tue, 18 Jan 2022 at 00:06, Lawrence Dubé <ld...@audiokinetic.com> wrote:
I spent a few hours parsing through plug-ins example and the documentation trying to see if it's possible to style that icon, ideally i'd just apply a "display: none" on it, but it doesn't seem possible?image.png
We would like to remove that icon, because we don't care if the commit is signed or not, but we don't want to disable enableSignedPush = true in case someone uploads a project that has signed commits. 

Is something like this possible?

Thanks!

--
--
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/CAGKo9fbtZEp_4Ly_XgC%3DgUjFjg7jDju%2BXboh1y2CrxkwCOJMyw%40mail.gmail.com.

--
--
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.
Reply all
Reply to author
Forward
0 new messages