Skip to end of metadata
Go to start of metadata

The VisualScript Beta consists of 3 elements, and is available for JIRA and Confluence Server.

  1. The VisualScript app
  2. The VisualScript Gadget (Jira) or The VisualScript Macro (Confluence)
  3. A REST Endpoint which returns SDON

The VisualScript for Jira

Install VisualScript for Jira

Log-in as a Jira admin and visit the Jira admin dashboard

  • Click Jira Settings, then Add-ons, and finally Find New Apps.
  • Search the Marketplace for VisualScript.
  • Click Upload Add-on at the top right side of the page.
  • Click Free Trial to install VisualScript and begin an evaluation..
  • A confirmation message appears when VisualScript is successfully installed.

Configure a REST endpoint

You may use any REST endpoint that is configured to return SDON. To learn more about SDON visit https://www.smartdraw.com/developers/sdon

In this tutorial we will use ScriptRunner for Jira to setup the REST endpoint.

  • From the Admin dashboard, click Add-ons
  • Locate ScriptRunner in the left navigation panel, and click REST endpoints
  • Click Add New Item, then Custom Endpoint
  • Give it a descriptive name, we suggest “VisualScript Hello World”
  • Copy and paste the following sample script into the inline script panel
/*
This SR4J script is to provide a test REST endpoint for interacting with Jira and returning the results as SDON.

This is developed to work with the Adaptavist Visual Script for Jira and Confluence.

Date: 7/May/2018
Developers:  Johnson Howard, Neal Riley and Phill Fox

*/

import groovy.json.JsonBuilder
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonOutput
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import org.apache.log4j.Level
import org.apache.log4j.Logger
// Setup the log and leave a message to show what we're doing
Logger logger = log
logger.setLevel( Level.ALL )
@BaseScript CustomEndpointDelegate delegate

generateSDONWithParam(
    httpMethod: "GET"
) { MultivaluedMap queryParams, String body ->
    def param = queryParams.get("parameter")?.first()
    log.debug("Param :"+param)
    return Response.ok(JsonOutput.toJson(getSdon(param))).build()
}

def getSdon(def variable){
// Set Variables
    def sdonMap = [:]
    sdonMap.put('DiagramType', 'Flowchart')
    def label = [:]
    label.put('Label', variable)
    def baseShape = []
    baseShape.add(label)
    sdonMap.put('RootShape', baseShape)
    log.debug(sdonMap)
    return sdonMap //.toString()
}


  • Click add
  • Right click on the new endpoint and select copy link

Adding the Gadget

Once the VisualScript add-on is installed and you have an example REST endpoint, we will add the VisualScript dashboard gadget will be made available.

  • From a dashboard, click Add Gadget.
  • Click Load all gadgets
  • The Add Gadget dialog will appear, search for VisualScript.
  • In the VisualScript item, click Add gadget.
  • Close the modal
  • In the newly added VisualScript gadget, paste your REST endpoint
  • Click Set SDON URL

Using the Gadget

For the beta, the gadget has only one input, a URL field. In the field, enter the URL for a REST endpoint and click set URL.

If your endpoint is functioning properly, your report will display. Refreshing the page will get new data and update the report.

VisualScript for Confluence

Install for Confluence

  • Log-in as a Confluence admin and visit the Confluence admin console
  • Search the Marketplace for VisualScript.
  • Click Upload Add-on at the top right side of the page.
  • Click Free Trial to install VisualScript and begin an evaluation..
  • A confirmation message appears when VisualScript is successfully installed.

Configure a REST endpoint

You may use any REST endpoint that is configured to return SDON. To learn more about SDON visit https://www.smartdraw.com/developers/sdon

In this tutorial we will use ScriptRunner for Jira to setup the REST endpoint.

  • Navigate to the Confluence admin page
  • Locate ScriptRunner in the left navigation panel, and click REST endpoints
  • Click Add New Item, then Custom Endpoint
  • Give it a descriptive name, we suggest “VisualScript Hello World”
  • Copy and paste the following sample script into the inline script panel.
/*
This SR4J script is to provide a test REST endpoint for interacting with Jira and returning the results as SDON.

This is developed to work with the Adaptavist Visual Script for Jira and Confluence.

Date: 7/May/2018
Developers:  Johnson Howard, Neal Riley and Phill Fox

*/

import groovy.json.JsonBuilder
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonOutput
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import org.apache.log4j.Level
import org.apache.log4j.Logger
// Setup the log and leave a message to show what we're doing
Logger logger = log
logger.setLevel( Level.ALL )
@BaseScript CustomEndpointDelegate delegate

generateSDONWithParam(
    httpMethod: "GET"
) { MultivaluedMap queryParams, String body ->
    def param = queryParams.get("parameter")?.first()
    log.debug("Param :"+param)
    return Response.ok(JsonOutput.toJson(getSdon(param))).build()
}

def getSdon(def variable){
// Set Variables
    def sdonMap = [:]
    sdonMap.put('DiagramType', 'Flowchart')
    def label = [:]
    label.put('Label', variable)
    def baseShape = []
    baseShape.add(label)
    sdonMap.put('RootShape', baseShape)
    log.debug(sdonMap)
    return sdonMap //.toString()
}


  • Click add
  • Right click on the new endpoint and select copy link

Adding the Macro

Once the VisualScript add-on is installed, a new macro will be available as well as a new page template. To get started, we will use the page template.

  • Click Add Page.
  • Give your page a title
  • Click in the body of the page and type {VisualScript}, select VisualScript from the menu to insert the VisualScript Macro
  • In the newly added VisualScript macro a new URL popup will be displayed, paste your REST endpoint in the popup and click OK
  • In the next popup set your macro height, we recommend 0 for auto, click OK

Using the Macro

For the beta the macro has only one property, a URL field. 

Publish your page to set the macro.

If your endpoint is functioning properly, your visual will display on the page.

To learn more about VisualScript, Intelligent formatting and SDON, checkout To learn more about SDON visit https://www.smartdraw.com/developers/sdon.

  • No labels