system.kanoa.dashboard.updateWidget
Description
Updates a widgetSyntax
updateWidget(attrInfo, userId)Parameters:
Returns:
Dictionary
| Parameter | Type | Required | Notes |
|---|---|---|---|
| widgetId | int | ||
| widgetName | string | The name of the widget | |
| widgetDescription | string | Some information about the widget | |
| viewPath | string | path to the widget view created in the designer | |
| viewParams | string | the view paramters for this widget | |
| sortOrder | int | ||
| enabled | bool | ||
| widgetCategoryName | string | Name of the widget category to store this widget under |
Code Examples
# Example usage
userId = 123
widgetInfo = {
"widgetId": 36,
"widgetName": "Asset Downtime Bar Chart",
"widgetDescription": "Display Downtime By Asset",
"enabled": True,
"sortOrder": None,
"viewParams": "{"assetPath": None, "downtimeBy": "Interval", "showDowntimeBySelector": True}",
"viewPath": "kanoa/core/dbp/widgets/analytics/assetDowntimeBarChart",
"widgetCategoryName": 'Analysis'
}
retVal, msg = system.kanoa.dashboard.updateWidget(widgetInfo, userId)
if msg: system.perspective.sendMessage('showFailerToast', msg)
else: system.perspective.sendMessage('showSuccessfulToast', 'Widget parameter has been saved')