Source
xxxxxxxxxx
<?php
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
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 ='.