Source
xxxxxxxxxx
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/common/testAuditlogCommon.php';
/**
* @backup dashboard
*/
class testAuditlogDashboard extends testAuditlogCommon {
/**
* Existing Dashboard ID.
*/
private const DASHBOARDID = 1;
public function testAuditlogDashboard_Create() {
$create = $this->call('dashboard.create', [
[
'name' => 'Audit dashboard',
'display_period' => 30,
'auto_start' => 1,
'pages' => [
[
'widgets' => [
[
'type' => 'problems',
'x' => 0,
'y' => 0,
'width' => 12,
'height' => 5,
'view_mode' => 0,
'fields' => [
[
'type' => 1,
'name' => 'tags.0.tag',
'value' => 'service'
],
[
'type' => 0,
'name' => 'tags.0.operator',
'value' => 1
],
[
'type' => 1,
'name' => 'tags.0.value',
'value' => 'zabbix_server'
]
]
]
]
]
],
'userGroups' => [
[
'usrgrpid' => 7,
'permission' => 2
]
],
'users' => [
[
'userid' => 1,
'permission' => 2
]
]
]
]);
$resourceid = $create['result']['dashboardids'][0];
$pageid = CDBHelper::getRow('SELECT dashboard_pageid FROM dashboard_page WHERE dashboardid='.zbx_dbstr($resourceid));
$widgetid = CDBHelper::getRow('SELECT widgetid FROM widget WHERE dashboard_pageid='.
zbx_dbstr($pageid['dashboard_pageid'])
);
$fieldid = CDBHelper::getAll('SELECT widget_fieldid FROM widget_field WHERE widgetid ='.
zbx_dbstr($widgetid['widgetid']).' ORDER BY widget_fieldid ASC'
);
$dashboard_userid = CDBHelper::getRow('SELECT dashboard_userid FROM dashboard_user WHERE dashboardid='.
zbx_dbstr($resourceid)
);