Skip to main content

Extension

An extension variable is the definition of an ODSL platform extension.

Construction​

An extension is created using the Extension() function, e.g.

e = Extension()

Properties​

An extension has the following properties:

NameDescriptionType
_idUnique id for the extension (must be {publisher}.{code}String
publisherThe publisher of the extensionString
codeThe code id of the extensionString
nameThe name of the extensionString
descriptionThe long description of the extension to be shown in the extension catalogString
documentationA URL to some external documentationString
iconThe icon (bootstrap icons) to be shown next the extension name in the catalogString
viewsAn array of views to be shown in the portal or excel add-inExtensionView[]
resourcesA set of resources used by this extension that will be published/installedObject (See Below)

Extension View​

The Extension View entity is used to configure the views in the portal and excel add-in and contains the following:

NameDescriptionType
idThe unique identifier for this view in the extensionString
sectionThe section in the menu to display this view, defaults to ExtensionString
nameThe name of the view as shown in the menuString
descriptionA description of the viewString
tabnameThe name of the tab, defaults to 'Main'String
appnameThe name of the view in the Apps catalogue, only used if the tabname is 'Apps'String
excelTrue if this is an Excel Add-in view, defaults to falseBoolean
iconThe icon shown next to the name in the GUIString
featureThe feature policy used to determine if a user can see this viewString
scriptThe mustache script containing the code for this viewString
insightsSet this to true if this app is a new menu item and you want to show an Insights tabBoolean

Resources​

Extension resources are a list of entities which need to be installed with the extension. Resources are a SimpleObject, with each key in the document being a service name. The value of the service can either be key=values or an array, e.g.

e.resources.script.uninstall = "example-odsl\examples\Extension\odsl.example.uninstall"
e.resources.policy = ["extension.odsl.example"]

Methods​

An extension has the following methods:

NameDescriptionReturn Type
addView(name)Adds a view to an extension and returns the new viewExtensionView

Examples​

Creating a simple extension​

e = Extension()
e.id = "odsl.example"
e.publisher = "odsl"
e.code = "example"
e.name = "Example Extension"

e.resources.script.install = "example-odsl\examples\Extension\odsl.example.install"
e.resources.script.upgrade = "example-odsl\examples\Extension\odsl.example.upgrade"
e.resources.script.uninstall = "example-odsl\examples\Extension\odsl.example.uninstall"
e.resources.policy = ["extension.odsl.example"]

v = e.addView("test")
v.excel = false
v.feature = "odsl.example.test"
v.icon = "graph-up-arrow"
v.script = "example-odsl\examples\Extension\odsl.example.test"
v.section = "Examples"

save e

Publishing an extension​

e = ${extension:"odsl.example"}
publish e to "public"

Installing an extension​

e = ${extension:public/"odsl.example"}
publish e to "private"

Uninstalling an extension​

delete ${extension:"odsl.example"}
danger

If you run the command to uninstall an extension that has been created by you, it will be completely removed and would need to be re-created if needed

Further Reading​