Implementing a custom JIRA UI using plugins 2.0 Andreas Knecht Plugins 2 & REST.

Post on 11-Jan-2016

221 views 2 download

transcript

Implementing a custom JIRA UI using plugins 2.0Andreas Knecht

Plugins 2 & REST

Overview

• How to implement a custom UI

• How to implement a REST resource

• Demo

• svn co https://labs.atlassian.com/svn/IPHONE/trunk

Excellent resource - This is a great app, not just because it looks good. It's also a great resource for JIRA 4.0 REST plugin development. Matt Doar (PAC - 2 Dec 09)

Excellent resource - This is a great app, not just because it looks good. It's also a great resource for JIRA 4.0 REST plugin development. Matt Doar (PAC - 2 Dec 09)

““””

Custom UI

• Why?

• Building BlocksoServlet FiltersoWebwork actionsoHTML/JS + REST

This is not a talk about REST!

JIRA Web-Interface for the iPhone

• Easy to use interface on the iPhone

• Plugins 2 plugin

• Most of the work done client-side

• Custom REST interface

Plugin structure

Some stats

• 2000+ downloads since November 09

• ~7000 LOC

• 20 20% days to develop

• 8 features

Custom UI - Filters

• Redirect certain users

• Inject content into pages

Custom UI - Define a Filter

• URL-Pattern

• Locationoafter-encoding, before-login, before-decoration,

before-dispatch

Custom UI - Webwork• Full MVC UI framework

• Views, Commands, Validation, Templating

• /secure/* is not secure• roles-required=”admin” does not work• /secure/* is not secure• roles-required=”admin” does not work

Securing Webworkhttp://localhost:2990/jira/OrderForm!default.jspa?id=10001http://localhost:2990/jira/OrderForm.jspa?id=10001

REST

• Simple for small data

• What about 100000 issues?

vs

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json?expand=result[1:2]

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json?expand=result[1:2]

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json?expand=result[1:2].issue.details

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json?expand=result[1:2].issue.details

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json?expand=result[1:2].issue.details.comments[1]

Expands to the Rescue.../rest/iphone/1.0/filter/10000.json?expand=result[1:2].issue.details.comments[1]

How do expands work?• Lists vs Objects

How to expand lists

How to expand objects

How to expand objects• REST provides com.atlassian.plugins.rest.common.expand.EntityExpanders

...

REST

• Backend doesn’t always support expands

• Tricky to implement expands

• #protip: Use services

Services keep you safe!

Demo

• Implement ‘Add Comment’ feature

• Requires some client side JS

• Server side REST resource

• Tools

Summary

• Use HTML/JS as much as possibleoFaster development turnaroundoGood frameworks (jQuery, GWT, jQTouch...)

• If our REST API doesn’t do it for you...

Questions

https://labs.atlassian.com/browse/IPHONE