Intro Open Social and Dashboards

111
Intro to Atlassian Dashboards and OpenSocial Tim Moore, Atlassian Developer

description

Atlassian is unveiling a new dashboard that will be added to all of our products, based on the OpenSocial specification. This session explores Atlassian's use of OpenSocial, and details the new Atlassian dashboards and Gadgets.Atlassian Speaker: Tim MooreKey Takeaways: * Overview of OpenSocial * Deep-dive on Atlassian dashboards and Gadgets * Demos, how-tos and more

Transcript of Intro Open Social and Dashboards

Page 1: Intro Open Social and Dashboards

Intro to Atlassian Dashboards and

OpenSocial

Tim Moore, Atlassian Developer

Page 2: Intro Open Social and Dashboards

What Is the New Atlassian Dashboard?

Page 3: Intro Open Social and Dashboards

New Dashboardfor JIRA 4.0

Page 4: Intro Open Social and Dashboards

New Dashboardfor JIRA 4.0

Page 5: Intro Open Social and Dashboards

New Dashboardfor JIRA 4.0

Page 6: Intro Open Social and Dashboards

New Dashboardfor JIRA 4.0

Page 7: Intro Open Social and Dashboards

New Dashboardfor JIRA 4.0

Page 8: Intro Open Social and Dashboards

New Dashboardfor JIRA 4.0

Page 9: Intro Open Social and Dashboards
Page 10: Intro Open Social and Dashboards
Page 11: Intro Open Social and Dashboards

Integration with Non-Atlassian apps

Page 12: Intro Open Social and Dashboards
Page 13: Intro Open Social and Dashboards
Page 14: Intro Open Social and Dashboards
Page 15: Intro Open Social and Dashboards
Page 16: Intro Open Social and Dashboards

Solution:OpenSocial Gadgets

Page 17: Intro Open Social and Dashboards

What is OpenSocial?

Page 18: Intro Open Social and Dashboards

Social Data Model

Page 19: Intro Open Social and Dashboards

Web Service APIs

Page 20: Intro Open Social and Dashboards

Gadgets

Page 21: Intro Open Social and Dashboards
Page 22: Intro Open Social and Dashboards

Seem Familiar?

Page 23: Intro Open Social and Dashboards

Seem Familiar?

Page 24: Intro Open Social and Dashboards

Gadgets are a Great Solution for Dashboards

Page 25: Intro Open Social and Dashboards

Built for Sharing Content

Page 26: Intro Open Social and Dashboards

Open Standards,Industry Support

Page 27: Intro Open Social and Dashboards

Apache Shindig

Page 28: Intro Open Social and Dashboards

Transitioningfrom

Portlets

Page 29: Intro Open Social and Dashboards

Why Write Gadgets?

Page 30: Intro Open Social and Dashboards

Why Write Gadgets?

Easy!

Page 31: Intro Open Social and Dashboards

Why Write Gadgets?

Easy!Safe

Page 32: Intro Open Social and Dashboards

Why Write Gadgets?

Easy!SafeWrite Once, Display Everywhere

Page 33: Intro Open Social and Dashboards

Why Write Gadgets?

Easy!SafeWrite Once, Display EverywhereNon-Atlassian Containers, Too!

Page 34: Intro Open Social and Dashboards

What Do YouNeed to Know?

Page 35: Intro Open Social and Dashboards

What Do YouNeed to Know?

A Dashboard Dissected

Page 36: Intro Open Social and Dashboards

What Do YouNeed to Know?

A Dashboard DissectedAnatomy of a Gadget

Page 37: Intro Open Social and Dashboards

What Do YouNeed to Know?

A Dashboard DissectedAnatomy of a GadgetRequesting Data from Web Services

Page 38: Intro Open Social and Dashboards

What Do YouNeed to Know?

A Dashboard DissectedAnatomy of a GadgetRequesting Data from Web ServicesGadgets in an Atlassian Plugin

Page 39: Intro Open Social and Dashboards

What Do YouNeed to Know?

A Dashboard DissectedAnatomy of a GadgetRequesting Data from Web ServicesGadgets in an Atlassian PluginWhere to Go to Learn More

Page 40: Intro Open Social and Dashboards

A Dashboard Dissected

Page 41: Intro Open Social and Dashboards
Page 42: Intro Open Social and Dashboards
Page 43: Intro Open Social and Dashboards
Page 44: Intro Open Social and Dashboards
Page 45: Intro Open Social and Dashboards
Page 46: Intro Open Social and Dashboards
Page 47: Intro Open Social and Dashboards
Page 48: Intro Open Social and Dashboards
Page 49: Intro Open Social and Dashboards

Anatomy of a Gadget

Page 50: Intro Open Social and Dashboards

Anatomy of a Gadget

XML Spec File• Metadata, HTML Content, and JavaScript

Page 51: Intro Open Social and Dashboards

Anatomy of a Gadget

XML Spec File• Metadata, HTML Content, and JavaScript

Core JavaScript API• Access Preferences, Make Requests

Page 52: Intro Open Social and Dashboards

Anatomy of a Gadget

XML Spec File• Metadata, HTML Content, and JavaScript

Core JavaScript API• Access Preferences, Make Requests

Gadget Features• Additional, Optional Capabilities & APIs

Page 53: Intro Open Social and Dashboards

XML Spec File

Page 54: Intro Open Social and Dashboards

<ModulePrefs>

Page 55: Intro Open Social and Dashboards

<ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

Page 56: Intro Open Social and Dashboards

<ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

Page 57: Intro Open Social and Dashboards

<ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

Page 58: Intro Open Social and Dashboards

<UserPref>

<UserPref name="show_date" display_name="Show Dates?" datatype="bool" default_value="true"/> <UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/> <UserPref name="num_entries" display_name="Number of Entries:" default_value="5" required="true"/>

Page 59: Intro Open Social and Dashboards

<UserPref>

<UserPref name="show_date" display_name="Show Dates?" datatype="bool" default_value="true"/> <UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/> <UserPref name="num_entries" display_name="Number of Entries:" default_value="5" required="true"/>

Page 60: Intro Open Social and Dashboards

<UserPref>

<UserPref name="show_date" display_name="Show Dates?" datatype="bool" default_value="true"/> <UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/> <UserPref name="num_entries" display_name="Number of Entries:" default_value="5" required="true"/>

Page 62: Intro Open Social and Dashboards

JavaScript

// Create minimessage factoryvar msg = new gadgets.MiniMessage();// Show a small loading message to the uservar loadMessage = msg.createStaticMessage("loading...");

// Get configured user prefsvar prefs = new gadgets.Prefs();var showDate = prefs.getBool("show_date");var showSummary = prefs.getBool("show_summ");var numEntries = prefs.getInt("num_entries");

// Fetch issues when the gadget loadsgadgets.util.registerOnLoadHandler(fetchIssues);

Page 63: Intro Open Social and Dashboards

JavaScript

// Create minimessage factoryvar msg = new gadgets.MiniMessage();// Show a small loading message to the uservar loadMessage = msg.createStaticMessage("loading...");

// Get configured user prefsvar prefs = new gadgets.Prefs();var showDate = prefs.getBool("show_date");var showSummary = prefs.getBool("show_summ");var numEntries = prefs.getInt("num_entries");

// Fetch issues when the gadget loadsgadgets.util.registerOnLoadHandler(fetchIssues);

Page 64: Intro Open Social and Dashboards

JavaScript

// Create minimessage factoryvar msg = new gadgets.MiniMessage();// Show a small loading message to the uservar loadMessage = msg.createStaticMessage("loading...");

// Get configured user prefsvar prefs = new gadgets.Prefs();var showDate = prefs.getBool("show_date");var showSummary = prefs.getBool("show_summ");var numEntries = prefs.getInt("num_entries");

// Fetch issues when the gadget loadsgadgets.util.registerOnLoadHandler(fetchIssues);

Page 65: Intro Open Social and Dashboards

Requesting Data from Web Services

Page 66: Intro Open Social and Dashboards

Requesting Data from Web Services

AJAX + DOM

Page 67: Intro Open Social and Dashboards

Requesting Data from Web Services

AJAX + DOMRequest Proxy

Page 68: Intro Open Social and Dashboards

Requesting Data from Web Services

AJAX + DOMRequest ProxyTrusted Apps + OAuth

Page 69: Intro Open Social and Dashboards

gadgets.io.makeRequest()

Page 70: Intro Open Social and Dashboards

What Can You Call?

Page 71: Intro Open Social and Dashboards

What Can You Call?

Any URL

Page 72: Intro Open Social and Dashboards

What Can You Call?

Any URLXML and JSON are the most useful

Page 73: Intro Open Social and Dashboards

What Can You Call?

Any URLXML and JSON are the most usefulREST-style APIs are the most convenient

Page 74: Intro Open Social and Dashboards

Fetching Issues

function fetchIssues() { var url = "http://jira.atlassian.com/sr/" + "jira.issueviews:searchrequest-xml" + "/temp/SearchRequest.xml?" + "created%3Aprevious=-1w&resolution=-1" + "&sorter/field=issuekey&sorter/order=DESC" + "&sorter/field=created&sorter/order=DESC" + "&tempMax=20";

var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;

gadgets.io.makeRequest(url, handleResponse, params);}

Page 75: Intro Open Social and Dashboards

Handling the Response

function handleResponse(obj) { var domData = obj.data;

var jiraIssues = { title : getTitle(domData), items : getItems(domData) }; renderJiraIssues(jiraIssues);

msg.dismissMessage(loadMessage); gadgets.window.adjustHeight();}

Page 76: Intro Open Social and Dashboards

Handling the Response

function handleResponse(obj) { var domData = obj.data;

var jiraIssues = { title : getTitle(domData), items : getItems(domData) }; renderJiraIssues(jiraIssues);

msg.dismissMessage(loadMessage); gadgets.window.adjustHeight();}

Page 77: Intro Open Social and Dashboards

Questions?

Page 78: Intro Open Social and Dashboards

Gadgets in anAtlassian Plugin

Page 79: Intro Open Social and Dashboards

Gadgets in anAtlassian Plugin

Package into a Plugin JAR

Page 80: Intro Open Social and Dashboards

Gadgets in anAtlassian Plugin

Package into a Plugin JARAdd <gadget> plugin module

Page 81: Intro Open Social and Dashboards

Gadgets in anAtlassian Plugin

Package into a Plugin JARAdd <gadget> plugin moduleInstall

Page 82: Intro Open Social and Dashboards

Directory Structure

Page 83: Intro Open Social and Dashboards

atlassian-plugin.xml

Page 84: Intro Open Social and Dashboards

atlassian-plugin.xml

<atlassian-plugin key="com.atlassian.jira.issues-gadget" name="JIRA Issues Gadget Plugin" pluginsVersion="2"> <plugin-info> <version>1.0</version> </plugin-info>

Page 85: Intro Open Social and Dashboards

Resources

<resource type="download" name="jira-issues-thumbnail.png" location="jira-issues-thumbnail.png"/>

<web-resource key="resources"> <resource type="download" name="jira-issues.js" location="jira-issues.js"/> <resource type="download" name="jira-issues.css" location="jira-issues.css"/> </web-resource>

Page 86: Intro Open Social and Dashboards

atlassian-plugin.xml

<gadget key="jira-issues" location="jira-issues.xml"/>

Page 87: Intro Open Social and Dashboards

Gadget Pre-Processing

Page 88: Intro Open Social and Dashboards

Gadget Pre-Processing

__ATLASSIAN_BASE_URL__

Page 89: Intro Open Social and Dashboards

Gadget Pre-Processing

__ATLASSIAN_BASE_URL__

“#-directives”

Page 90: Intro Open Social and Dashboards

Gadget Pre-Processing

__ATLASSIAN_BASE_URL__

“#-directives”• #staticResourceUrl

Page 91: Intro Open Social and Dashboards

Gadget Pre-Processing

__ATLASSIAN_BASE_URL__

“#-directives”• #staticResourceUrl

• #requireResource, & #includeResources

Page 92: Intro Open Social and Dashboards

Gadget Pre-Processing

__ATLASSIAN_BASE_URL__

“#-directives”• #staticResourceUrl

• #requireResource, & #includeResources

More in the docs…

Page 93: Intro Open Social and Dashboards

Modified Gadget

Page 94: Intro Open Social and Dashboards

Modified Gadget

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

Page 95: Intro Open Social and Dashboards

Modified Gadget

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail="http://labs.atlassian.com/svn/GADGETS/trunk/jira-issues/basic/jira-issues-thumbnail.png" description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

<?xml version="1.0" encoding="UTF-8" ?><Module> <ModulePrefs title="JIRA Issues" author="Atlassian" thumbnail= '#staticResourceUrl("com.atlassian.jira.issues-gadget:jira-issues", "jira-issues-thumbnail.png")' description="A list of recently created Issues">

<Require feature="minimessage" /> <Require feature="dynamic-height" />

</ModulePrefs>

Page 97: Intro Open Social and Dashboards

Modified <Content>

<Content type="html"><![CDATA[ #requireResource("com.atlassian.jira.issues-gadget:resources") #includeResources()

<div id="content_div"></div> ]]></Content></Module>

Page 98: Intro Open Social and Dashboards

Modified <Content>

<Content type="html"><![CDATA[ #requireResource("com.atlassian.jira.issues-gadget:resources") #includeResources()

<div id="content_div"></div> ]]></Content></Module>

<Content type="html"><![CDATA[ #requireResource("com.atlassian.jira.issues-gadget:resources") <script> var url = "__ATLASSIAN_BASE_URL__/sr/" + "jira.issueviews:searchrequest-xml" + "/temp/SearchRequest.xml?" + "created%3Aprevious=-1w&resolution=-1" + "&sorter/field=issuekey&sorter/order=DESC" + "&sorter/field=created&sorter/order=DESC" + "&tempMax=20"; </script> #includeResources()

<div id="content_div"></div>

Page 99: Intro Open Social and Dashboards

What Can You Call from a Gadget Plugin?

Page 100: Intro Open Social and Dashboards

What Can You Call from a Gadget Plugin?

Existing URLs and REST APIs — no Java needed!

Page 101: Intro Open Social and Dashboards

What Can You Call from a Gadget Plugin?

Existing URLs and REST APIs — no Java needed!Custom servlet or WebWork plugins

Page 102: Intro Open Social and Dashboards

What Can You Call from a Gadget Plugin?

Existing URLs and REST APIs — no Java needed!Custom servlet or WebWork pluginsAtlassian REST Plugin Module Type

Page 103: Intro Open Social and Dashboards

OAuth

Page 104: Intro Open Social and Dashboards

Whatʼs Next?

Page 105: Intro Open Social and Dashboards

Whatʼs Next?

JavaScript Helper Libraries

Page 106: Intro Open Social and Dashboards

Whatʼs Next?

JavaScript Helper LibrariesDashboard in More Atlassian Apps

Page 107: Intro Open Social and Dashboards

Whatʼs Next?

JavaScript Helper LibrariesDashboard in More Atlassian AppsGadgets Everywhere!

Page 108: Intro Open Social and Dashboards

Whatʼs Next?

JavaScript Helper LibrariesDashboard in More Atlassian AppsGadgets Everywhere!More OpenSocial

Page 109: Intro Open Social and Dashboards

If You Donʼt Remember Anything Else…

Atlassian Dashboards are composed of Gadgets

Atlassian Gadgets are OpenSocial Gadgets

Gadgets are HTML, CSS, & JavaScript mini-apps that can be displayed in many containers

Gadgets are defined by a static XML spec file

Gadgets make use of web services via gadgets.io.makeRequest

Gadgets can be packaged in Atlassian Plugins for improved portability and integration

Page 110: Intro Open Social and Dashboards

haveasec.com/summitSURVEY!!