Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberts Lataria <roberts.lataria@zabbix.com>2019-09-25 11:47:58 +0300
committerRoberts Lataria <roberts.lataria@zabbix.com>2019-09-25 11:47:58 +0300
commit586bc348b0c0c0602489ec4bd5e465edf6cb8397 (patch)
treea3b12232a26def561b5259ca373aaad19c2c12b5
parente370d8997627139c0bf3ee4504a03912278b6e02 (diff)
parent0547f72da41cd8af39c0322496de836a6f20fcfe (diff)
..F....... [ZBX-7341] reworked template linking interface
* commit '0547f72da41cd8af39c0322496de836a6f20fcfe': .D........ [ZBX-7341] added changelog entry .......... [ZBX-7341] fixed Selenium tests, removed multiselect input in template tab ..F....... [ZBX-7341] fixed codestyle ..F....... [ZBX-7341] fixed codestyle ..F....... [ZBX-7341] fixed codestyle ..F....... [ZBX-7341] added multiselect to popup, fixed codestyle .......... [ZBX-7341] added copyright text ..F....... [ZBX-7341] fixed codestyle ..F....... [ZBX-7341] reworked template linking interface
-rw-r--r--ChangeLog.d/feature/ZBX-73411
-rw-r--r--frontends/php/app/controllers/CControllerPopupGeneric.php4
-rw-r--r--frontends/php/include/views/configuration.host.edit.php53
-rw-r--r--frontends/php/include/views/configuration.host.prototype.edit.php49
-rw-r--r--frontends/php/include/views/configuration.template.edit.php58
-rw-r--r--frontends/php/include/views/js/common.template.edit.js.php38
-rw-r--r--frontends/php/include/views/js/configuration.host.edit.js.php24
-rw-r--r--frontends/php/include/views/js/configuration.host.prototype.edit.js.php22
-rw-r--r--frontends/php/tests/selenium/testFormHost.php12
-rw-r--r--frontends/php/tests/selenium/testFormHostPrototype.php9
-rw-r--r--frontends/php/tests/selenium/testInheritanceHostPrototype.php11
11 files changed, 163 insertions, 118 deletions
diff --git a/ChangeLog.d/feature/ZBX-7341 b/ChangeLog.d/feature/ZBX-7341
new file mode 100644
index 00000000000..67e7ba1a676
--- /dev/null
+++ b/ChangeLog.d/feature/ZBX-7341
@@ -0,0 +1 @@
+..F....... [ZBX-7341] reworked template linking interface (rlataria)
diff --git a/frontends/php/app/controllers/CControllerPopupGeneric.php b/frontends/php/app/controllers/CControllerPopupGeneric.php
index d00567507eb..5dc24d11e80 100644
--- a/frontends/php/app/controllers/CControllerPopupGeneric.php
+++ b/frontends/php/app/controllers/CControllerPopupGeneric.php
@@ -579,7 +579,9 @@ class CControllerPopupGeneric extends CController {
'multiselect' => $this->getInput('multiselect', 0),
'patternselect' => $this->getInput('patternselect', 0),
'parent_discoveryid' => $this->getInput('parent_discoveryid', 0),
- 'reference' => $this->getInput('reference', $this->getInput('srcfld1', 'unknown'))
+ 'reference' => $this->getInput('reference', $this->getInput('srcfld1', 'unknown')),
+ 'disableids' => $this->getInput('disableids', []),
+ 'excludeids' => $this->getInput('excludeids', [])
];
$excludeids = $this->getInput('excludeids', []);
diff --git a/frontends/php/include/views/configuration.host.edit.php b/frontends/php/include/views/configuration.host.edit.php
index a2073bbbee1..19be577a878 100644
--- a/frontends/php/include/views/configuration.host.edit.php
+++ b/frontends/php/include/views/configuration.host.edit.php
@@ -20,6 +20,7 @@
require_once dirname(__FILE__).'/js/configuration.host.edit.js.php';
+require_once dirname(__FILE__).'/js/common.template.edit.js.php';
$widget = (new CWidget())
->setTitle(_('Hosts'))
@@ -31,14 +32,14 @@ if (!hasRequest('form_refresh')) {
}
$frmHost = (new CForm())
+ ->setId('hostsForm')
->setName('hostsForm')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE)
->addVar('form', $data['form'])
->addVar('clear_templates', $data['clear_templates'])
->addVar('flags', $data['flags'])
->addItem((new CVar('tls_connect', $data['tls_connect']))->removeId())
- ->addVar('tls_accept', $data['tls_accept'])
- ->setAttribute('id', 'hostForm');
+ ->addVar('tls_accept', $data['tls_accept']);
if ($data['hostid'] != 0) {
$frmHost->addVar('hostid', $data['hostid']);
@@ -549,8 +550,9 @@ if ($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED) {
->setAttribute('style', 'width: 100%;')
->setHeader([_('Name'), _('Action')]);
+ $n = 0;
foreach ($data['linked_templates'] as $template) {
- $tmplList->addVar('templates[]', $template['templateid']);
+ $tmplList->addVar('templates['.$n++.']', $template['templateid']);
if (array_key_exists($template['templateid'], $data['writable_templates'])) {
$template_link = (new CLink($template['name'],
@@ -584,41 +586,26 @@ if ($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED) {
$disableids[] = $template['templateid'];
}
+ $linkedTemplateTable->addRow([
+ (new CSimpleButton(_('Add')))
+ ->onClick('return PopUp("popup.generic",'.CJs::encodeJson([
+ 'dstfrm' => $frmHost->getName(),
+ 'dstfld1' => $frmHost->getName(),
+ 'srctbl' => 'templates',
+ 'srcfld1' => 'hostid',
+ 'templated_hosts' => '1',
+ 'popup_type' => 'templates',
+ 'multiselect' => 1,
+ 'disableids' => $disableids
+ ]).', null, this);')
+ ->addClass(ZBX_STYLE_BTN_LINK)
+ ]);
+
$tmplList->addRow(_('Linked templates'),
(new CDiv($linkedTemplateTable))
->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
->setAttribute('style', 'min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
);
-
- // create new linked template table
- $new_template_table = (new CTable())
- ->addRow([
- (new CMultiSelect([
- 'name' => 'add_templates[]',
- 'object_name' => 'templates',
- 'popup' => [
- 'parameters' => [
- 'srctbl' => 'templates',
- 'srcfld1' => 'hostid',
- 'srcfld2' => 'host',
- 'dstfrm' => $frmHost->getName(),
- 'dstfld1' => 'add_templates_',
- 'disableids' => $disableids
- ]
- ]
- ]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
- ])
- ->addRow([
- (new CSimpleButton(_('Add')))
- ->onClick('javascript: submitFormWithParam("'.$frmHost->getName().'", "add_template", "1");')
- ->addClass(ZBX_STYLE_BTN_LINK)
- ]);
-
- $tmplList->addRow((new CLabel(_('Link new templates'), 'add_templates__ms')),
- (new CDiv($new_template_table))
- ->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
- ->setAttribute('style', 'min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
- );
}
// templates for discovered hosts
else {
diff --git a/frontends/php/include/views/configuration.host.prototype.edit.php b/frontends/php/include/views/configuration.host.prototype.edit.php
index 7df29bda8ad..9b29b5c6107 100644
--- a/frontends/php/include/views/configuration.host.prototype.edit.php
+++ b/frontends/php/include/views/configuration.host.prototype.edit.php
@@ -25,6 +25,7 @@ $parentHost = $data['parent_host'];
require_once dirname(__FILE__).'/js/configuration.host.edit.js.php';
require_once dirname(__FILE__).'/js/configuration.host.prototype.edit.js.php';
+require_once dirname(__FILE__).'/js/common.template.edit.js.php';
$widget = (new CWidget())
->setTitle(_('Host prototypes'))
@@ -36,7 +37,8 @@ if (!hasRequest('form_refresh')) {
}
$frmHost = (new CForm())
- ->setName('hostPrototypeForm.')
+ ->setId('hostPrototypeForm')
+ ->setName('hostPrototypeForm')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE)
->addVar('form', getRequest('form', 1))
->addVar('parent_discoveryid', $discoveryRule['itemid'])
@@ -281,41 +283,26 @@ else {
$disableids[] = $template['templateid'];
}
+ $linkedTemplateTable->addRow([
+ (new CSimpleButton(_('Add')))
+ ->onClick('return PopUp("popup.generic",'.CJs::encodeJson([
+ 'dstfrm' => $frmHost->getName(),
+ 'dstfld1' => $frmHost->getName(),
+ 'srctbl' => 'templates',
+ 'srcfld1' => 'hostid',
+ 'templated_hosts' => '1',
+ 'popup_type' => 'templates',
+ 'multiselect' => 1,
+ 'disableids' => $disableids
+ ]).', null, this);')
+ ->addClass(ZBX_STYLE_BTN_LINK)
+ ]);
+
$tmplList->addRow(_('Linked templates'),
(new CDiv($linkedTemplateTable))
->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
->setAttribute('style', 'min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
);
-
- // create new linked template table
- $newTemplateTable = (new CTable())
- ->addRow([
- (new CMultiSelect([
- 'name' => 'add_templates[]',
- 'object_name' => 'templates',
- 'popup' => [
- 'parameters' => [
- 'srctbl' => 'templates',
- 'srcfld1' => 'hostid',
- 'srcfld2' => 'host',
- 'dstfrm' => $frmHost->getName(),
- 'dstfld1' => 'add_templates_',
- 'disableids' => $disableids
- ]
- ]
- ]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
- ])
- ->addRow([
- (new CSimpleButton(_('Add')))
- ->onClick('javascript: submitFormWithParam("'.$frmHost->getName().'", "add_template", "1");')
- ->addClass(ZBX_STYLE_BTN_LINK)
- ]);
-
- $tmplList->addRow((new CLabel(_('Link new templates'), 'add_templates__ms')),
- (new CDiv($newTemplateTable))
- ->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
- ->setAttribute('style', 'min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
- );
}
$divTabs->addTab('templateTab', _('Templates'), $tmplList);
diff --git a/frontends/php/include/views/configuration.template.edit.php b/frontends/php/include/views/configuration.template.edit.php
index ede8c617320..4d52b393d0d 100644
--- a/frontends/php/include/views/configuration.template.edit.php
+++ b/frontends/php/include/views/configuration.template.edit.php
@@ -19,6 +19,8 @@
**/
+require_once dirname(__FILE__).'/js/common.template.edit.js.php';
+
$widget = (new CWidget())->setTitle(_('Templates'));
if ($data['form'] !== 'clone' && $data['form'] !== 'full_clone') {
@@ -43,6 +45,7 @@ if ($data['templateid'] != 0) {
$frm_title .= SPACE.' ['.$this->data['dbTemplate']['name'].']';
}
$frmHost = (new CForm())
+ ->setId('templatesForm')
->setName('templatesForm')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE)
->addVar('form', $data['form']);
@@ -154,7 +157,7 @@ if ($data['form'] === 'full_clone') {
$templateList->addRow(_('Items'), $listBox);
}
-// Triggers
+ // Triggers
$hostTriggers = API::Trigger()->get([
'inherited' => false,
'hostids' => $data['templateid'],
@@ -175,7 +178,7 @@ if ($data['form'] === 'full_clone') {
$templateList->addRow(_('Triggers'), $listBox);
}
-// Graphs
+ // Graphs
$hostGraphs = API::Graph()->get([
'inherited' => false,
'hostids' => $data['templateid'],
@@ -243,7 +246,7 @@ if ($data['form'] === 'full_clone') {
$templateList->addRow(_('Item prototypes'), $listBox);
}
-// Trigger prototypes
+ // Trigger prototypes
$hostTriggerPrototypes = API::TriggerPrototype()->get([
'hostids' => $data['templateid'],
'discoveryids' => $hostDiscoveryRuleids,
@@ -264,7 +267,7 @@ if ($data['form'] === 'full_clone') {
$templateList->addRow(_('Trigger prototypes'), $listBox);
}
-// Graph prototypes
+ // Graph prototypes
$hostGraphPrototypes = API::GraphPrototype()->get([
'hostids' => $data['templateid'],
'discoveryids' => $hostDiscoveryRuleids,
@@ -379,43 +382,28 @@ foreach ($data['linkedTemplates'] as $template) {
$disableids[] = $template['templateid'];
}
+$linkedTemplateTable->addRow([
+ (new CSimpleButton(_('Add')))
+ ->onClick('return PopUp("popup.generic",'.CJs::encodeJson([
+ 'dstfrm' => $frmHost->getName(),
+ 'dstfld1' => $frmHost->getName(),
+ 'srctbl' => 'templates',
+ 'srcfld1' => 'hostid',
+ 'templated_hosts' => '1',
+ 'popup_type' => 'templates',
+ 'multiselect' => 1,
+ 'excludeids' => ($data['templateid'] == 0) ? [] : [$data['templateid']],
+ 'disableids' => $disableids
+ ]).', null, this);')
+ ->addClass(ZBX_STYLE_BTN_LINK)
+]);
+
$tmplList->addRow(_('Linked templates'),
(new CDiv($linkedTemplateTable))
->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
->setAttribute('style', 'min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
);
-// create new linked template table
-$newTemplateTable = (new CTable())
- ->addRow([
- (new CMultiSelect([
- 'name' => 'add_templates[]',
- 'object_name' => 'templates',
- 'popup' => [
- 'parameters' => [
- 'srctbl' => 'templates',
- 'srcfld1' => 'hostid',
- 'srcfld2' => 'host',
- 'dstfrm' => $frmHost->getName(),
- 'dstfld1' => 'add_templates_',
- 'excludeids' => $data['templateid'] != 0 ? [$data['templateid']] : [],
- 'disableids' => $disableids
- ]
- ]
- ]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
- ])
- ->addRow([
- (new CSimpleButton(_('Add')))
- ->onClick('javascript: submitFormWithParam("'.$frmHost->getName().'", "add_template", "1");')
- ->addClass(ZBX_STYLE_BTN_LINK)
- ]);
-
-$tmplList->addRow((new CLabel(_('Link new templates'), 'add_templates__ms')),
- (new CDiv($newTemplateTable))
- ->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
- ->setAttribute('style', 'min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
-);
-
$divTabs->addTab('tmplTab', _('Linked templates'), $tmplList);
// } TEMPLATES
diff --git a/frontends/php/include/views/js/common.template.edit.js.php b/frontends/php/include/views/js/common.template.edit.js.php
new file mode 100644
index 00000000000..044ccc59793
--- /dev/null
+++ b/frontends/php/include/views/js/common.template.edit.js.php
@@ -0,0 +1,38 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2001-2019 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.
+**/
+
+
+?>
+<script type="text/javascript">
+ /**
+ * @see init.js add.popup event
+ */
+ function addPopupValues(data) {
+ if (!isset('object', data) || data.object !== 'hostid') {
+ return false;
+ }
+
+ for (var i = 0, len = data.values.length; i < len; i++) {
+ create_var(data.parentId, 'add_templates[' + data.values[i].id + ']', data.values[i].id, false);
+ }
+
+ submitFormWithParam(data.parentId, "add_template", "1");
+ }
+</script>
diff --git a/frontends/php/include/views/js/configuration.host.edit.js.php b/frontends/php/include/views/js/configuration.host.edit.js.php
index d6b1770ad5e..a882b49307e 100644
--- a/frontends/php/include/views/js/configuration.host.edit.js.php
+++ b/frontends/php/include/views/js/configuration.host.edit.js.php
@@ -1,3 +1,25 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2001-2019 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.
+**/
+
+
+?>
<script type="text/x-jquery-tmpl" id="hostInterfaceRow">
<tr class="interfaceRow" id="hostInterfaceRow_#{iface.interfaceid}" data-interfaceid="#{iface.interfaceid}">
<td class="interface-drag-control <?= ZBX_STYLE_TD_DRAG_ICON ?>">
@@ -481,7 +503,7 @@
jQuery('input[name=tls_connect]').trigger('change');
// Depending on checkboxes, create a value for hidden field 'tls_accept'.
- jQuery('#hostForm').submit(function() {
+ jQuery('#hostsForm').submit(function() {
var tls_accept = 0x00;
if (jQuery('#tls_in_none').is(':checked')) {
diff --git a/frontends/php/include/views/js/configuration.host.prototype.edit.js.php b/frontends/php/include/views/js/configuration.host.prototype.edit.js.php
index d3a2a3bf125..e523b083f48 100644
--- a/frontends/php/include/views/js/configuration.host.prototype.edit.js.php
+++ b/frontends/php/include/views/js/configuration.host.prototype.edit.js.php
@@ -1,3 +1,25 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2001-2019 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.
+**/
+
+
+?>
<script type="text/x-jquery-tmpl" id="groupPrototypeRow">
<tr class="form_row">
<td>
diff --git a/frontends/php/tests/selenium/testFormHost.php b/frontends/php/tests/selenium/testFormHost.php
index 013f9b67f30..2a6c4691612 100644
--- a/frontends/php/tests/selenium/testFormHost.php
+++ b/frontends/php/tests/selenium/testFormHost.php
@@ -260,11 +260,10 @@ class testFormHost extends CLegacyWebTest {
$this->zbxTestClickLinkTextWait($this->host_for_template);
$this->zbxTestTabSwitch('Templates');
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', 'Templates');
$this->zbxTestClickLinkTextWait('Template OS Linux');
- $this->zbxTestClickXpathWait("//div[@id='templateTab']//button[contains(@onclick,'add_template')]");
$this->zbxTestTextPresent('Template OS Linux');
$this->zbxTestClick('update');
@@ -273,6 +272,9 @@ class testFormHost extends CLegacyWebTest {
$this->zbxTestTextPresent($this->host_for_template);
}
+ /**
+ * @depends testFormHost_TemplateLink
+ */
public function testFormHost_TemplateUnlink() {
// Unlink a template from a host from host properties page
@@ -322,11 +324,10 @@ class testFormHost extends CLegacyWebTest {
$this->zbxTestClickLinkTextWait($this->host_for_template);
$this->zbxTestTabSwitch('Templates');
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', 'Templates');
$this->zbxTestClickLinkTextWait('Template OS Linux');
- $this->zbxTestClickXpathWait("//div[@id='templateTab']//button[contains(@onclick,'add_template')]");
$this->zbxTestTextPresent('Template OS Linux');
$this->zbxTestClickWait('update');
@@ -335,6 +336,9 @@ class testFormHost extends CLegacyWebTest {
$this->zbxTestTextPresent($this->host_for_template);
}
+ /**
+ * @depends testFormHost_TemplateLinkUpdate
+ */
public function testFormHost_TemplateUnlinkAndClear() {
// Unlink and clear a template from a host from host properties page
diff --git a/frontends/php/tests/selenium/testFormHostPrototype.php b/frontends/php/tests/selenium/testFormHostPrototype.php
index 715c1a07e03..c9a01edc304 100644
--- a/frontends/php/tests/selenium/testFormHostPrototype.php
+++ b/frontends/php/tests/selenium/testFormHostPrototype.php
@@ -440,11 +440,10 @@ class testFormHostPrototype extends CLegacyWebTest {
if (array_key_exists('template', $data)) {
$this->zbxTestTabSwitch('Templates');
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', 'Templates');
$this->zbxTestClickLinkTextWait($data['template']);
- $this->zbxTestClickXpath('//button[contains(@onclick, "add_template")]');
}
if (array_key_exists('inventory', $data)) {
@@ -555,11 +554,10 @@ class testFormHostPrototype extends CLegacyWebTest {
if (array_key_exists('template', $data)) {
$this->zbxTestTabSwitch('Templates');
$this->zbxTestClickXpathWait('//button[contains(@onclick,"unlink")]');
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', 'Templates');
$this->zbxTestClickLinkText($data['template']);
- $this->zbxTestClickXpath('//div[@id="templateTab"]//button[text()="Add"]');
}
// Change inventory mode.
@@ -826,11 +824,10 @@ class testFormHostPrototype extends CLegacyWebTest {
if (array_key_exists('template', $data)) {
$this->zbxTestTabSwitch('Templates');
$this->zbxTestWaitForPageToLoad();
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', 'Templates');
$this->zbxTestClickLinkTextWait($data['template']);
- $this->zbxTestClickXpath('//div[@id="templateTab"]//button[text()="Add"]');
}
// Change inventory mode.
diff --git a/frontends/php/tests/selenium/testInheritanceHostPrototype.php b/frontends/php/tests/selenium/testInheritanceHostPrototype.php
index 79a76c76aa8..aee1d256b28 100644
--- a/frontends/php/tests/selenium/testInheritanceHostPrototype.php
+++ b/frontends/php/tests/selenium/testInheritanceHostPrototype.php
@@ -160,13 +160,12 @@ class testInheritanceHostPrototype extends CLegacyWebTest {
$this->zbxTestLaunchOverlayDialog('Host groups');
$this->zbxTestClickLinkTextWait($data['group']);
$this->zbxTestTabSwitch('Templates');
- $this->zbxTestClickButtonMultiselect('add_templates_');
- $this->zbxTestLaunchOverlayDialog('Templates');
foreach ($data['templates'] as $template) {
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
+ $this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', $template['group']);
$this->zbxTestClickLinkTextWait($template['name']);
- $this->zbxTestClickXpath('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestWaitForPageToLoad();
}
@@ -330,11 +329,10 @@ class testInheritanceHostPrototype extends CLegacyWebTest {
$this->zbxTestTabSwitch('Templates');
if (array_key_exists('templates', $data)) {
foreach ($data['templates'] as $template) {
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', $template['group']);
$this->zbxTestClickLinkTextWait($template['name']);
- $this->zbxTestClickXpath('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestWaitForPageToLoad();
}
}
@@ -451,11 +449,10 @@ class testInheritanceHostPrototype extends CLegacyWebTest {
// Change template.
if (array_key_exists('template', $data)) {
$this->zbxTestTabSwitch('Templates');
- $this->zbxTestClickButtonMultiselect('add_templates_');
+ $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
$this->zbxTestLaunchOverlayDialog('Templates');
$this->zbxTestDropdownSelectWait('groupid', 'Templates');
$this->zbxTestClickLinkTextWait($data['template']);
- $this->zbxTestClickXpathWait('//div[@id="templateTab"]//button[text()="Add"]');
}
// Change inventory mode.