Script
You can create a custom script.
With every custom component you create you must use a custom script. Files with custom
scripts are specified in the action
property of the UI configuration
for a component.
async
methods on this object.General
{
"point":"com.reltio.plugins.ui.view",
"id":"com.reltio.plugins.entity.bbChartView",
"class":"com.reltio.plugins.ui.CustomActionView",
"caption":"B2B Integration",
"url":"https://cgraph-dev.reltio.com/custom-graph/bbChart?entityUri=",
"height":200,
"action":{
"files":[
"https://dl.dropboxusercontent.com/u/465285497/iframe.js"
]
}
}
In this example, the API path and UI configuration of the current custom component is shown, and then two call alerts on the UI client.
log
UI.log(message);
@param
message {String|Object} log message
setEnabled
UI.setEnabled(value);
This method allows a change to the enabled state of control (must be used only with custom buttons).
@param value {Boolean} is enabled
setVisibility
UI.setVisibility(value);
This method allows a change in the visibility of the control state.
@param value {String} "visible" | "hidden" | "excluded"
setHtml
UI.setEnabled(value);
Set widget's internal HTML (can be used only with custom view).
@param html {String?} HTML
setChildHtml
UI.setChildHtml(id, html);
@param id {String} widget child's id
@param html {String?} HTML
setHeight
UI.setHeight(height);
@param height {Number?} height in pixels
setWidth
UI.setWidth(width);
@param height {Number?} width in pixels
setToolTip
UI.setEnabled(value);
Set widget's tooltip.
@param toolTip {String?} tool tip
onAction
UI.onAction(function(){
//Some code
});
@deprecated
: Use UI.onEvent(...)
and listen for event
"execute"
instead.
The entry point of the script. When the all scripts are loaded, then the on action is invoked (can be used only with custom buttons and menu items/actions).
onEvent
UI.onEvent(function(type, data) {
});
The entry point of the script when a new event is thrown.
@param type {String} type of event
"execute"
: when you click a custom button or menu item."data"
is null."updateEntity"
: when a new entity is loaded from API."data"
is JSON of the entity."changeSearchQuery"
: when search criteria are changed."data"
is string with search query."changeVisibility"
: when visibility of custom component is changed."data"
istrue
orfalse
."uiAction"
: when specified ui action occurs on DOM element of custom view."data"
is JSON: {type:uiAction
, id:id
, event:event
}.uiAction
: name of action ("click"
,"mousemove"
,"mousedown"
, etc.).id
: id of target DOM element.event
: clone of javascript event object.
@param data {String} additional data (see above)
getEntityURI
UI.getEntityUri().then(function(entityUri){
//Code here
});
This method allows a get
of the current entity uri.
getEntity
UI.getEntity().then(function(entity){
//Code here
});
This method allows a get
of the current entity.
getApiPath
UI.getApiPath().then(function(apiPath){
//Code here
});
This method allows a get
of the api path url.
getSearchQuery
UI.getApiPath().then(function(apiPath){
//Code here
});
This method allows a get
of the current search query.
getTenant
UI.getTenant().then(function(tenant){
//Code here
});
The method allows a get
of the current tenant name.
getPerspective
UI.getPerspective().then(function(perspective){
//Code here
});
This method allows a get
of the current perspective id.
setPerspective
UI.setPerspective(perspective).then(function(){
//Code here
});
set
to the current perspective.@param perspective {String} perspective id
setEntityUri
UI.setEntityUri(entityUri).then(function(){
//Code here
});
set
to the entity uri.@param entityUri {String} entity URI.
api
UI.api(uetho,
tenant,
headers,
data).then(function(response){
//Code here
});
@param url {String} url.
@param method {String?} request method: GET, POST, PUT, DELETE
@param tenant {String?} tenant
@param headers {Object?} headers
@param data {Object|String?} request body
alert
UI.alert(text).then(function(){
//Code here
});
This method allows showing the alert box with text.
@param text {String} alert text
confirm
UI.confirm(text).then(function(response){
//Code here
});
@param text {String} confirm text
prompt
UI.prompt(text,
defaultText).then(function(response){
//Code here
});
This method allows showing the prompt box.
@param text {String} prompt text
@param defaultText {String?} prompt default value
getConfiguration
UI.getConfiguration().then(function(jsonApiConfiguration){
//Code here
});
Get metadata configuration.
getUiConfiguration
UI.getUiConfiguration().then(function(jsonUiConfiguration){
//Code here
});
Get UI configuration of current custom component.
openSearch
UI.openSearch(searchState).then(function(){
//Code here
});
Open search screen with some state.
@param searchState {Object?} search state json