You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Gerrit 2.14.3变更页面标签值描述文本显示配置求助

Adding Label Value Descriptions to Gerrit 2.14.3 Change Screen Votes

Hey there, let's figure out how to add those label value descriptions right next to the votes on your Gerrit 2.14.3 change screen! Since there's no built-in config setting for this, we'll need to customize the UI—here are two solid approaches:

This is the best path because it keeps your changes separate from Gerrit's core code, making future upgrades way less of a hassle.

  • Set up a Gerrit plugin development environment that's compatible with 2.14.3 (note: newer plugin tooling won't work with this older version, so stick to the 2.14-specific plugin SDK).
  • Build a plugin that hooks into the vote rendering logic on the change screen:
    1. Use GWT extension points to intercept the rendering of VoteEntry widgets.
    2. Pull the label's definition (which includes value descriptions) from Gerrit's API—look for the LabelValue class, which stores both the numeric vote value and its corresponding text description.
    3. Adjust the widget's DOM to append the description text right after the vote value. For example, change the displayed text from "-1" to "-1 Fails".

Option 2: Modify Gerrit's Built-In UI Templates (Quick, but Upgrade-Sensitive)

If you need a fast fix and don't mind re-applying changes when you upgrade Gerrit, you can edit the core UI templates directly:

  1. Extract the Gerrit WAR file: Run unzip gerrit.war to unpack the contents into a local directory.
  2. Locate the vote template: For 2.14.3, the file that handles vote rendering is typically WEB-INF/templates/change/votes.html (a Freemarker template).
  3. Edit the vote value output: Find the line that renders the vote value—it might look like this:
    <span class="vote-value">${vote.value}</span>
    
    Modify it to include the description by pulling from the template's context:
    <span class="vote-value">${vote.value} ${vote.label.getDescriptionForValue(vote.value)}</span>
    
  4. Re-package and redeploy: Zip the modified files back into a WAR with zip -r gerrit.war *, then restart your Gerrit instance.

Critical Pre-Requisite

First, make sure your labels are already configured with descriptions in your project's project.config file—Gerrit can't display descriptions that aren't defined! For example:

[label "Verified"]
     function = MaxWithBlock
     value = -1 Fails
     value =  0 No score
     value = +1 Passes

内容的提问来源于stack exchange,提问作者Peder

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:37:33