Designer
Last updated
Last updated
Method
Description
appmixer.ui.Designer(config)
Constructor function that accepts config
object. The config
object must contain at least the el
property that points to a container DOM element where the Designer will be rendered. el
can either be a CSS selector or a reference to a DOM element. Note that the recommended width of your container is at least 1200px for best Designer UI/UX. config.options.menu
can optionally define the flow menu inside Designer. For example: { options: { menu: [ { label: 'Rename', event: 'flow:rename' }, { label: 'Insights', event: 'flow:insights' }, { label: 'Clone', event: 'flow:clone' }, { label: 'Export to SVG', event: 'flow:export-svg' }, { label: 'Export to PNG', event: 'flow:export-png' }, { label: 'Print', event: 'flow:print' } ] }
defines a menu with 6 items. Note that each item can also optionally contain icon
property (which we omitted from the example above to save space. The icon
property is a URL of an image. It's important to note that the designer supports built-in events: "flow:rename"
, "flow:export-svg"
, "flow:export-png"
and "flow:print"
. These events cannot be re-defined. These events trigger built-in UX for renaming, exporting to SVG and PNG and printing flows. If you don't want to use this built-in behaviour, just redefine your menu with your own custom events. config.sharePermissions
can optionally define the sharing options for the flow. For example:
sharePermissions: [
{ label: 'Read', value: 'read' },
{ label: 'Start', value: 'start' },
{ label: 'Stop', value: 'stop' }
]
Define a share dialog box that gives the user permission to share the flow for all the read/start/stop permissions. Additionally, you can also define the scope of the share with config.shareTypes
:
shareTypes: [
{ label: 'Email', value: 'email', placeholder: 'Enter an email' },
{ label: 'Scope', value: 'scope', placeholder: 'Enter a scope' },
{ label: 'Domain', value: 'domain', placeholder: 'Enter a domain' },
]
set(property, value)
Set a property of the designer. Currently only "flowId" is supported. Use it to set the flow the designer should open for (set("flowId", "123abc456")
). You can also call this to change the currently opened flow in the designer dynamically.
get(property)
Return a property value.
open()
Render the Designer inside its container.
close()
Close the designer.
on(event, handler)
React on events of the designer. See below for the list of events the designer supports.
off([event, handler])
Remove event listeners. If no arguments are provided, remove all event listeners. If only the event
is provided, remove all listeners for that event. If both event
and handler
are given, remove the listener for that specific handler only.
state(name, value)
Change the state of the UI. Currently, only "loader"
and "error"
states are supported. For example, in order to show a loader in the flow manager UI, just call state("loader", true)
. If you want to display an error in the flow manager UI, call state("error", "Something went wrong.")
.
reload()
Re-render the designer. Call this when you changed flow's state (started/stopped) to make sure the state change is reflected.
Event
Callback
Triggered when...
flow:insights
function(flowId)
the user clicks the insights menu item.
flow:clone
function(flowId)
the user clicks the clone menu item.