这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

获取

描述

integer/array templatedashboard.get(object parameters)

该方法允许根据给定的参数检索模板仪表盘。

这个方法任何用户类型都可以使用。在用户角色设置中可以撤销调用该方法的权限。查看 用户角色获取更多信息。

参数

(object) 定义所需输出的参数。

这个方法支持下列参数。

参数 类型 描述
dashboardids ID/array 仅返回具有指定 ID 的模版仪表盘。
templateids ID/array 仅返回属于指定模版的模版仪表盘。
selectPages query 返回一个包含模版仪表盘页面的 pages 属性,并按正确的顺序排列。
sortfield string/array 按照指定的属性对结果进行排序。

可能的值: dashboardid, name.
countOutput boolean 这些参数在所有 get 方法中都是通用的,在参考说明中有详细描述。
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

(integer/array) 返回两者其一:

  • 一个对象数组;
  • 如果使用了'countOutput'参数,则对检索对象进行计数。

示例

检索模版仪表盘

检索指定模板的所有带有组件的模板仪表盘。

请求:

{  "jsonrpc": "2.0",  "method": "templatedashboard.get",  "params": {  "output": "extend",  "selectPages": "extend",  "templateids": "10001"  },  "id": 1 }

响应:

{  "jsonrpc": "2.0",  "result": [  {  "dashboardid": "23",  "name": "Docker overview",  "templateid": "10001",  "display_period": "30",  "auto_start": "1",  "uuid": "6dfcbe0bc5ad400ea9c1c2dd7649282f",  "pages": [  {  "dashboard_pageid": "1",  "name": "",  "display_period": "0",  "widgets": [  {  "widgetid": "220",  "type": "graph",  "name": "",  "x": "0",  "y": "0",  "width": "36",  "height": "5",  "view_mode": "0",  "fields": [  {  "type": "6",  "name": "graphid",  "value": "1125"  }  ]  },  {  "widgetid": "221",  "type": "graph",  "name": "",  "x": "12",  "y": "0",  "width": "36",  "height": "5",  "view_mode": "0",  "fields": [  {  "type": "6",  "name": "graphid",  "value": "1129"  }  ]  },  {  "widgetid": "222",  "type": "graph",  "name": "",  "x": "0",  "y": "5",  "width": "36",  "height": "5",  "view_mode": "0",  "fields": [  {  "type": "6",  "name": "graphid",  "value": "1128"  }  ]  },  {  "widgetid": "223",  "type": "graph",  "name": "",  "x": "12",  "y": "5",  "width": "36",  "height": "5",  "view_mode": "0",  "fields": [  {  "type": "6",  "name": "graphid",  "value": "1126"  }  ]  },  {  "widgetid": "224",  "type": "graph",  "name": "",  "x": "0",  "y": "10",  "width": "36",  "height": "5",  "view_mode": "0",  "fields": [  {  "type": "6",  "name": "graphid",  "value": "1127"  }  ]  }  ]  }  ]  }  ],  "id": 1 }

参阅

来源

CTemplateDashboard::get() 在 ui/include/classes/api/services/CTemplateDashboard.php.