Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,754
Community Members
 
Community Events
168
Community Groups

Adding web fragment to Service desk queue?

I am thinking this might not easily be doable.  I am wanting to inject some HTML into the servicedesk queue page.

At a glance, this is easy enough to do.  I just use javascript to inject some html after the correct element.  However it seems that this area of the page is constantly refreshing ever 5 seconds or so.  The HTML I inject seems to work initially, and then poof, it disappears, which appears to be due to some sort of page/area reload.

Does anyone have any tricks to adding HTML to the servicedesk queues?  

As a simple/dumb test:

Create a fragment -> Show a web panel

Location: servicedesk.project.sidebar

writer.write("""
<script type="text/javascript">
AJS.toInit(function() { 
AJS.\$('.ui-sortable-handle').after("<hr>");
});
</script>
""")

 This just tosses a horizontal line after every queue.  Works fine for about 5 seconds and disappears.  not sure if there is anything that can be done.

1 answer

Actually I think I got this figured out! Please let me know if there is a better way or if this will cause issues.

Lets say you want to add a line after the "Unassigned" queue:

writer.write("""
<script type="text/javascript">
\$(document).ajaxComplete(function() {
if(\$('#myhr').length === 0){
\$("span.navigator-item-label").filter(function() { return (\$(this).text() === 'Unassigned') }).closest('.section-item').after("<hr id='myhr'>");
}
});
</script>
""")

We are basically finding the span with the proper class, searching for the span that says "unassigned", finding the parent list object, and writing the HTML.  We also have to test and see if the item exists, or else we will just keep adding additional horizontal bars.  Pretty neat!

For whatever reason with how the page loads, I had to use $(document).ajaxComplete(function()... for this to persist. I don't know how expensive this is though.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

164 views 1 6
Read article

Atlassian Community Events