Skip to main content

system.kanoa.dashboard.addDashboard

Description

Adds a new dashboard.

Syntax

addDashboard(dashboardInfo, userId)

Parameters:
  • dashboardInfo (dict)
  • userId (int): User ID

  • Returns:
  • dashboardId (int)
  • msg (string): error message, None if successful
  • Dictionary

    ParameterTypeRequiredNotes
    dashboardNamestringThe name of the dashboard. This must be unique within the folder.
    dashboardDescriptionstringSome information about the dashboard.
    folderIdintThe id of the folder this dashboard is going into. Use None if the dashboard is going onto the root.
    privatebooleanIndicates if the dashboard is private or public. True for private, False for public
    iconPathstringThe path to the icon for this dashboard.
    iconColorstringThe color of the icon for this dashboard.
    roles[string]An array of roles that are able to view this dashboard.
    showOnMobilebooleanIndicates if the dashboard should be shown on mobile devices.
    enabledboolean
    sortOrderintDetermines where within the folder the dashboard is placed relative to other dashboards. If the same as another dashboard, then sorted by name.

    Code Examples

    # Example usage
    dashboardInfo = {
    "dashboardDescription": "Downtime By Asset",
    "dashboardName": "Asset Downtime",
    "enabled": True,
    "folderId": 1,
    "iconColor": "#AC5F00",
    "iconPath": "kanoa/maintenance",
    "private": False,
    "roles": None,
    "showOnMobile": false,
    "sortOrder": None
    }
    userId = 123
    dashboardId, msg = system.kanoa.dashboard.addDashboard(dashboardInfo, userId)
    if msg: system.perspective.sendMessage('showFailerToast', msg)
    else: system.perspective.sendMessage('showSuccessfulToast', 'Dashboard has been saved')