Exposing AgileZen stories in Confluence Wiki
This is more of a hint than a question :) but i though others might be interested so here's how i managed to get a list of stories shown in Confluence Wiki (4.1).
(I'm assuming an API key etc. has been setup and that you want to display stories based on tags)
First off, add a new "Wiki Markup" macro so that you can get
around the new editor.
Then add this javascript:
{html}
<div id="AgileZen"></div>
<script type="text/javascript">
var project = <project number>;
var apikey = '<api key>';
var tag = '<tag>';
var url = "https://agilezen.com/api/v1/projects/" + project + "/stories?callback=displayStories&apikey=" + apikey + "&where=tag:" + tag;
function displayStories(res) {
var html = "";
html += "<table class='confluenceTable'>";
html += " <tbody>";
html += " <tr>";
html += " <th class='confluenceTh'>ID</th>";
html += " <th class='confluenceTh'>Text</th>";
html += " <th class='confluenceTh'>Size</th>";
html += " <th class='confluenceTh'>Priority</th>";
html += " <th class='confluenceTh'>Status</th>";
html += " <th class='confluenceTh'>Owner</th>";
html += " </tr>";
var i;
for (i=0;i<res.items.length;i++) {
html += " <tr>";
html += " <td class='confluenceTd'>" + res.items[i]["id"] + "</td>";
html += " <td class='confluenceTd'>" + res.items[i]["text"] + "</td>";
html += " <td class='confluenceTd'>" + res.items[i]["size"] + "</td>";
html += " <td class='confluenceTd'>" + res.items[i]["priority"] + "</td>";
html += " <td class='confluenceTd'>" + res.items[i]["status"] + "</td>";
html += " <td class='confluenceTd'>" + res.items[i]["owner"]["name"] + "</td>";
html += " </tr>";
}
html += "</tbody></table>";
document.getElementById("AgileZen").innerHTML = html;
}
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= url;
head.appendChild(script);
</script>
{html}
Remember to add your own project, API key and tag.
Save the page and you should now see a nice wiki-formatted table of stories
-
agilezen_in_wiki.png
13.9 KB
Support Staff 2 Posted by Mary on 20 Apr, 2012 06:35 PM
Hi Dennis,
I just wanted to let you know how much we appreciate you sharing your Javascript for the wiki, this is great! Thank you and have a great weekend :)
Sincerely,
Mary
3 Posted by Dennis Newel on 23 Apr, 2012 03:47 PM
:) no worries.
It's still working quite well and i'm using it to expose my personal kanban board to the rest of the company.
4 Posted by JBB on 28 Apr, 2012 07:41 PM
Wow - thanks for this. Very useful!