Это перевод страницы документации с английского языка. Помогите нам сделать его лучше.

templatedashboard.update

Описание

object templatedashboard.update(объект/массив templateDashboards)

Этот метод позволяет обновлять существующие шаблоны информационных панелей.

Этот метод доступен только пользователям с типом доступа Администратор и Супер-администратор. Разрешения на вызов метода можно отозвать в настройках ролей пользователя. Дополнительную информацию см. в разделе Роли пользователей.

Parameters

(object/array) Template dashboard properties to be updated.

The dashboardid property must be specified for each dashboard, all other properties are optional. Only the specified properties will be updated.

Additionally to the standard template dashboard properties, the method accepts the following parameters.

Parameter Type Description
pages array Template dashboard pages to replace the existing dashboard pages.

Dashboard pages are updated by the dashboard_pageid property. New dashboard pages will be created for objects without dashboard_pageid property and the existing dashboard pages will be deleted if not reused. Dashboard pages will be ordered in the same order as specified. Only the specified properties of the dashboard pages will be updated. At least one dashboard page object is required for pages property.

Return values

(object) Returns an object containing the IDs of the updated template dashboards under the dashboardids property.

Примеры

Renaming a template dashboard

Rename a template dashboard to "Performance graphs".

Request:

{
           "jsonrpc": "2.0",
           "method": "templatedashboard.update",
           "params": {
               "dashboardid": "23",
               "name": "Performance graphs"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "dashboardids": [
                   "23"
               ]
           },
           "id": 1
       }

Updating template dashboard pages

Rename the first dashboard page, replace widgets on the second dashboard page and add a new page as the third one. Delete all other dashboard pages.

Request:

{
           "jsonrpc": "2.0",
           "method": "templatedashboard.update",
           "params": {
               "dashboardid": "2",
               "pages": [
                   {
                       "dashboard_pageid": 1,
                       "name": 'Renamed Page'
                   },
                   {
                       "dashboard_pageid": 2,
                       "widgets": [
                           {
                               "type": "clock",
                               "x": 0,
                               "y": 0,
                               "width": 4,
                               "height": 3
                           }
                       ]
                   },
                   {
                       "display_period": 60
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "dashboardids": [
                   "2"
               ]
           },
           "id": 2
       }

See also

Источник

CTemplateDashboard::update() в ui/include/classes/api/services/CTemplateDashboard.php.