Extensions API Reference

API Reference for the ChartSQL Studio Extensions API

Extensions are in development. They will allow you to customize the editor with additional functionality and third party tools.

Interface com.chartsql.studio.model.Extension

Every Extension entry point is a single class file that implements com.chartsql.studio.model.Extension interface

/**
*/
component accessors="true" implements="com.chartsql.studio.model.Extension" {

	property name="ChartSQLStudio";

	public void function onRequest(
		required struct context
	){

	}

	public void function onResult(
		required struct requestContext,
		required struct result
	){

	}

	public void function onRender(
		required struct requestContext,
		required struct result,
		required object doc
	){

	}

}

Extension Lifecycle Methods

Your Extension class has "lifecycle methods" that are called at different points in the request and rendering lifecycle. You use these lifecycle methods to intercept and implement UI features.

onRequest

Called at the start of a user HTTP request, the lifecycle method onRequest() allows you to inspect and inject data into the request context object prior to any work performed by ChartSQL Studio.

onRequest Function Arguments

NameTypeDescription

context

struct

The request context structure that contains all of the HTTP request

onResult

Called after ChartSQL Studio has finished processing the request but before it has rendered the HTML output. The onResult()lifecycle method allows you to change the ChartSQL Studio's data structure output that will be used by the rendering.

onResult Function Arguments

NameTypeDescription

requestContext

struct

The request context structure that contains all of the HTTP request

result

struct

The result of any controller processing for the request before rendering is completed.

onRender

Called after ChartSQL Studio has rendered the next response. The onRender() lifecycle methods allows you to manipulate the HTML output that will be sent to the user.

onRender Function Arguments

NameTypeDescription

requestContext

struct

The request context structure that contains all of the HTTP request

result

struct

The result of any controller processing for the request before rendering is completed.

doc

Jsoup Object

Jsoup document object model (DOM) that can be used to manipulate the content that will be returned to the UI

Remote HTTP Methods

You can add methods to your extension that can be called from the UI via HTML forms or HTTP POST. Remote HTTP methods allow you to wire up buttons and forms that communicate with the backend ChartSQLStudio process.

Defining a HTTP method requires annotating a function in your extension with the remote keyword.


remote struct function echo(
    required string foo,
    required string bazz
){
    return arguments;
}

You will then be able to POST to the function with HTML forms from the UI:

<form action="/studio/extensions/chartsql.sample.Sample/runRemote?method=echo" method="POST">
    <input type="hidden" name="params.foo" value="bar">
    <input type="hidden" name="params.bazz" value="buzz">
</form>

Class InfoPanelView

com.chartsql.studio.model.InfoPanelView

InfoPanelViews allow you to define additional panels that show up in the info area of the editor. Your Extension may instantiate instances of InfoPanelViews.

Constructor Arguments

NameRequired?DefaultTypeDescription

ChartSQLStudio

n/a

ChartSQLStudio

The instance of the ChartSQLStudio editor singleton.

Name

n/a

string

The name for your InfoPanelView which shows up in the tab name in the UI.

IconClass

n/a

string

The CSS class name for the icon to use for the tab. See https://tabler.io/icons

content

""

string

The HTML content for the body of the info panel view. You can set this on creation or update later.

Property Summary

NameTypeReadOnly?Description

Name

string

The name for your InfoPanelView which shows up in the tab name in the UI.

Link

string

The URL link to the InfoPanelView that is rendered in the UI. You do not set this directly, it will be calculated.

IconClass

string

The CSS class name for the icon to use for the tab. See https://tabler.io/icons

Content

string

The HTML content for the body of the info panel view. You can set this on creation or update later.

Class FileBrowserView

com.chartsql.studio.model.FileBrowserView

FileBrowserViews allow you to define additional views hat show up in the file broser area of the editor. Your Extension may instantiate instances of FileBrowserView

Constructor Arguments

NameRequired?DefaultTypeDescription

ChartSQLStudio

n/a

ChartSQLStudio

The instance of the ChartSQLStudio editor singleton.

Name

n/a

string

The name for your FileBrowserView which shows up in the tab name in the UI.

IconClass

n/a

string

The CSS class name for the icon to use for the tab. See https://tabler.io/icons

content

""

string

The HTML content for the body of the FileBrowserView. You can set this on creation or update later.

Property Summary

NameTypeReadOnly?Description

Name

string

The name for your FileBrowserView which shows up in the tab name in the UI.

Link

string

The URL link to the FileBrowserView that is rendered in the UI. You do not set this directly, it will be calculated.

IconClass

string

The CSS class name for the icon to use for the tab. See https://tabler.io/icons

Content

string

The HTML content for the body of the FileBrowserView. You can set this on creation or update later.

Last updated

Support

DiscordX

ChartSQL