Custom JIRAfielddisplayer for JIRA Macro doesn't work for "status" field

Hi,

I tried to change the fielddisplayer for the field “status”, so that it shows me the status as text instead of an Icon.

For this I tried out the example in the “Jira Macro” desription, to add a new fielddisplayer by xwiki components.

{{groovy}}
import org.xwiki.rendering.block.*
import org.xwiki.rendering.listener.reference.*

def field = xcontext.method.input.get(0)
def issue = xcontext.method.input.get(1)
def parameters = xcontext.method.input.get(2)
String text = xcontext.method.defaultDisplayer.displayField(field, issue,parameters).get(0).getProtectedString()

def reference = new ResourceReference(text, ResourceType.URL)
def labelBlocks = [new WordBlock("Lien")]
xcontext.method.output.value = [new LinkBlock(labelBlocks, reference, true)]
{{/groovy}}

For the field “summary” it works perfectly, but “status” seems to ignore it.

{{jira fields="status!lien,summary!lien,status!lien" id="6753" source="jql"}}
fixVersion = "Januar- Version 2025"  AND type = Bug
{{/jira}}

Dows anyone has an idea how I can change the status too, so it shows the text instead of a Icon?

I am completly new to groovy, so sorry if I am missing some obvious things.

Hi, the reason is that there’s already a JIRAFieldDisplayer dedicated for status: jira/jira-macro/jira-macro-default/src/main/java/org/xwiki/contrib/jira/macro/internal/displayer/field/StatusJIRAFieldDisplayer.java at b835315d329693fcace35b29dfb04caaacae4b34 · xwiki-contrib/jira · GitHub

Thus, right now, it’s used. In other words, right now, it’s not possible to replace a dedicated JIRAFieldDisplayer by a custom type displayer. We could decide to improve this so that writing status!lien would force using a type displayer for status.

The reason it works for summary is that there’s no dedicated JIRAFieldDisplayer for it, and instead it’s configured to use a type/text type field displayer (jira/jira-macro/jira-macro-default/src/main/java/org/xwiki/contrib/jira/macro/JIRAField.java at 70e13ea617afd2997f56b9689e7f7b70d48a0147 · xwiki-contrib/jira · GitHub).

Right now, the way to replace any field displayer is to override the existing component by doing what you did above but use status instead of type/lien for the component hint. And use a priority < 1000 so that it takes precedence over the default one.

For the usage, there’s nothing to specify, whenever the status field is displayed, it’ll used your custom component.

Hope it helps

PS: I’ve updated a bit the doc at https://extensions.xwiki.org/xwiki/bin/view/Extension/JIRA%20Macro#HExampleusingawikicomponent

Thank you very much, for the fast resopnse. That solves my problem.
I