18
PAWEL MURAWSKI TEAM LEADER SPARTEZ [email protected] One Code To Rule Them All How to use the same codebase for JIRA Server and Cloud plugins

One code to rule them all - how to use the same codebase for Server and Cloud versions of your plugin

  • Upload
    spartez

  • View
    540

  • Download
    0

Embed Size (px)

Citation preview

PAWEL MURAWSKI • TEAM LEADER • SPARTEZ • [email protected]

One Code To Rule Them All

How to use the same codebase for JIRA Server and Cloud plugins

A R C H I T E C T U R E

H I S TO RY

O U R ‘ O W N ’ C O N N E C T

P R O S & C O N S

Agenda

HISTORY

From the Server to the Cloud…

and back again.

JIRA Server plugin again

Cards created in Java - PDF file.

JIRA Cloud pluginCards created using JS, HTML and CSS.

JIRA Server plugin

Reused code from JIRA Cloud plugin.

One little problem left..Our photo scanning algorithm has been written in JAVA and is only available on JIRA Server. Let’s rewrite it in JavaScript!

“ This is madness. It cannot work!”

E V E RY B O D Y, E X C E P T O U R T E A M

ARCHITECTURE

One MavenProject

Frontend code

Standard P2 plugin.

JIRA Cloud pluginJava Spring application - Connect plugin.

JIRA Server plugin

Copied during build process as resource to Server and Cloud plugin modules.

JIRA Cloudplugin

JIRA Serverplugin

OUR ‘OWN’ CONNECT

Outside iframe - showView()

method

Sets URL on iframe

Inside passed DOM element.

Resizes iframeTimer FTW!

Creates iframe

Parameters like ac-view, context path, locale, user name etc.

Inside iframe - wrapper for the

AP library

Current location

Standard AJAX calls.

MessagesAJS from parent is used.

JIRA requests

window.parent.location.href

AC plugin servlet

HTML template - showView()

Iframe - different index.html for Server and Cloud

App router - ac-view parameter

Final app view

Rendering the view in iframe on JIRA Server

Pros & Cons

Pros go to the left, cons to the right

No interference with JIRA frontend code

Which means less bugs

Same codebase for JIRA Server and Cloud plugins

Write once, run everywhere

Build process is a little bit more complicatedAnd you need file watchers

Plugin has to be written in JSAnd sometimes you just want Java

Some Connect functionalities have to be implemented for P2 pluginAlso you need to keep your plugin inside

an iframe

Virtually no limits in choosing frontend technologies

Any hipstery JS framework can be used

Thank you!

PAWEL MURAWSKI • TEAM LEADER • SPARTEZ • [email protected]