The Shortcut feature is open to developers to implement frequently used or complex UQL queries, or to explore experimental and extended functions. This flexibility empowers developers to enhance their workflows, customize their UQL queries, and extend the capabilities of Ultipa Manager according to their specific needs.
All shortcuts are managed in the Shortcut drawer. Shortcuts can be accessed in the UQL Editor and any embedded webpage.
Create Shortcut
Click on Create shortcut to enter the editing page:
1. Script Writing
Writing script in the command line pane, here is an example:
/**
* PluginDo
* Refer to online doc for how to edit this part: https://www.ultipa.com/document/ultipa-manager-user-guide/shortcut/v4.3
*/
async init() {
console.log('init');
}
/**
* @param {*} formData (Data from the form)
* @param {*} client (Use client.uql(uqlString) to get UQL results)
* @param {*} rootDOM
* @param {*} axios
* @param {*} echarts
* @param {*} Highcharts
* @param {*} moment
* @param {*} lodash
*/
async execute({formData, client, rootDOM, axios, ...args}) {
console.log('execute')
const { node_id, limit } = formData;
const response = await client.uql(`find().nodes({_id == '${node_id}'}) as n return n{*} limit ${limit || 10}`)
return {
type:'ultipaPlugin',
data: response // uql response
}
// return {
// type:'customPlugin',
// data:rootDOM //ElementDOM
// }
}
async destory() {
console.log('destory')
}
The two custom varibles node_id
and limit
are used in a find().nodes()
UQL query, where limit
is assigned a default value 10, node_id
does not have any default value.
2. Form Configuration
Add the variables in the Form Configurations pane to construct the variable input form. Here is the configuration for each variable:
Item |
Content | Specification |
---|---|---|
Variable | Name of the variable | Must be consistent with what is specified in the script |
Label | Custom label of the variable field | / |
Placeholder | Placeholder of the variable field | / |
Type | Type of the variable field | Certain types offer further configurations |
3. Test
Click the Test button to execute this shortcut using either the default variables or any previously saved variables. To edit the saved variables, click on the gear icon next to the button.
The shortcut will be executed within the current graphset, and you can review the results in the Results Preview pane.
4. Settings and Sharing
Click on the configuration icon next to the default shortcut name My Plugin. From there, you can customize the shortcut's name and thumbnail (preferably in .png format with a size of 180px*180px). You can also enable the iframe, which provides an embeddable code. This code can be copied and pasted into any webpage where you want to integrate this shortcut. The embedded shortcut can be utilized within that webpage until its expiration date. Alternatively, you can directly open the link provided in the code in a web browser.
Use Shortcut
The UQL Editor can be toggled between the UQL editor mode and shortcut mode:
The variable input form is displayed when selecting a shortcut to use:
You can rearrange the order of shortcuts and pin specific ones to the front, enabling you to customize the arrangement of your shortcuts based on your preferences.
Import Shortcut
Gather the following files into a folder, compress the folder into a ZIP archive, and then upload the ZIP file to Ultipa Manager. The name of the folder will be used as the name of the shortcut.
Content | Filename and File Type | Specification |
---|---|---|
Script | code.js | Mandatory |
Form configuration | form.json | Mandatory |
Thumbnail | image.png | Optional. Recommended size: 180px*180px |
It is recommended to export a shortcut from Ultipa Manager and use it as a template. This enables you to easily make the desired modification. Any change on the filename or file type will cause import failure.
Multiple shortcuts can be imported simultaneously by compressing the folders of the shortcuts into a single ZIP file and uploading it to Ultipa Manager.