[ZBX-12022] IT services expands all trigger descriptions Created: 2017 Apr 06  Updated: 2018 Oct 09  Resolved: 2017 Aug 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 3.0.8
Fix Version/s: 3.0.11rc1, 3.2.8rc1, 3.4.2rc1, 4.0.0alpha1, 4.0 (plan)

Type: Problem report Priority: Critical
Reporter: Alexey Pustovalov Assignee: Miks Kronkalns
Resolution: Fixed Votes: 0
Labels: itservices, trigger
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Team: Team B
Sprint: Sprint 5, Sprint 6, Sprint 7, Sprint 8, Sprint 9, Sprint 10, Sprint 14, Sprint 15
Story Points: 0.5

 Description   

IT services configuration and monitoring tabs expand all related trigger descriptions. Our all configuration tabs do not expand trigger macros, also it is better to expand trigger descriptions on IT services monitoring ONLY if trigger is in PROBLEM status.



 Comments   
Comment by Miks Kronkalns [ 2017 Apr 07 ]

(1) No translation string changes

iivs CLOSED

Comment by Miks Kronkalns [ 2017 Apr 07 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-12022

Comment by Ivo Kurzemnieks [ 2017 May 17 ]

(2) There are two more lists with services and trigger names that expand macros. Dependencies and Parent service. Macro resolving should also be removed from those two lists.

Miks.Kronkalns RESOLVED in r68574.

iivs Redundant code left. See (4).
CLOSED

Comment by Ivo Kurzemnieks [ 2017 May 17 ]

(3) I don't think you need to select trigger expression and triggerid in sub-query, since you now only need description.

Miks.Kronkalns RESOLVED in r68574.

iivs triggerid is still used in code that should be deleted. See (4).
CLOSED

Comment by Ivo Kurzemnieks [ 2017 May 17 ]

(4) Code related to trigger macros is redundant.

// triggers
$triggers = zbx_objectValues(
	array_filter($services, function($service) { return (bool) $service['trigger']; }), 'trigger'
);
$triggers = zbx_toHash($triggers, 'triggerid');

foreach ($services as &$service) {
	if ($service['trigger']) {
		$service['trigger'] = $triggers[$service['trigger']['triggerid']];
	}
}
unset($service);

Miks.Kronkalns RESOLVED in r68574.

iivs I gave an example of on piece of code, but there is more. For example:

// expand trigger descriptions
$triggers = zbx_objectValues(
	array_filter($parentServices, function($service) { return (bool) $service['trigger']; }), 'trigger'
);
$triggers = zbx_toHash($triggers, 'triggerid');

foreach ($parentServices as $key => $parentService) {
	$parentServices[$key]['trigger'] = !empty($parentService['trigger'])
		? $triggers[$parentService['trigger']['triggerid']]['description']
		: '';
}

All related code must be checked for redundancy.
This means that the code can be changed to

foreach ($parentServices as &$parentService) {
	$parentService['trigger'] = $parentService['trigger'] ? $parentService['trigger']['description'] : '';
}
unset($parentService);

REOPENED

Miks.Kronkalns RESOLVED in r68841.

iivs

  1. Why leave comments // expand trigger descriptions that make no sense?
  2. Using $child_service['triggerid'] is a bit wrong and ($child_service['triggerid'] == 0) should be used.

REOPENED

Miks.Kronkalns RESOLVED in r68966.

iivs CLOSED

Comment by Ivo Kurzemnieks [ 2017 May 17 ]

(5) Discussed with sasha and decided to fix another bug: when choosing a parent service the links in the popup list are broken. Current parent link should be non-clickable, but it currectly is clickable as well as other names. Other service names except for root, have hidden links, but no link style.

Miks.Kronkalns RESOLVED in r68574.

iivs $selected_parent_service = getRequest('parentid', null); by default getRequest() already returns null, so need to force it. But then again if (!$selected_parent_service) for checking null is incorrect. So it's better to write getRequest('parentid', 0); and then compare using if ($selected_parent_service == 0) and not if ($selected_parent_service != 0) because == is easier on eyes.
Maybe it's even better to rename it $parentid, since that what it is - an ID.
$selected_parent_service == $db_service['serviceid'] cosider using bccomp() for IDs.
REOPENED

Miks.Kronkalns RESOLVED in r68841.

iivs CLOSED

Comment by Miks Kronkalns [ 2017 May 26 ]

(6) Pupup window is too small. It should be in default size.

Miks.Kronkalns RESOLVED in r68574.

iivs Remove that from common.js and put either a normal size for services popup or
use the code

->onClick('return PopUp("services.php?pservices=1'.url_param('serviceid').'&parentid="+this.form.parentid.value);')

.
REOPENED

Miks.Kronkalns RESOLVED in r68841.

iivs Line overflows and that is not the only list.

REOPENED

Miks.Kronkalns RESOLVED in r68966.

iivs configuration.services.edit.php

  • L53 line overflow unresolved;
  • L127 Wrong code. Must be similar to one which is on line 53

configuration.services.parent.list.php

  • L79 extra indentation and closing parenthesis is on wrong line.

common.js

  • The fix is going for 3.0, remove coding style changes you made in r68966 (it's wrong anyway).

services.php

  • The fix is going for 3.0, remove coding style changes you made in r68966 (it's wrong anyway) except for that removed comment changes L291,329,384 and L390.

REOPENED

Miks.Kronkalns RESOLVED in r69108.

iivs Wrong again.
configuration.services.edit.php:

  • L54: Closing parenthesis is on the wrong line.
  • L129: Wrong code.
  • L267: Why was that code even touched? Anyway the formatting is wrong.

REOPENED

Miks.Kronkalns RESOLVED in r71174.

iivs Code in configuration.services.edit.php: L269-287 should be reverted.

REOPENED

Miks.Kronkalns RESOLVED in r71405.

iivs CLOSED

Comment by Miks Kronkalns [ 2017 Aug 17 ]

Merged latest changes from 3.0 in the working branch r71406 (without conflicts).

Comment by Miks Kronkalns [ 2017 Aug 28 ]

Fixed:

  • 3.0.11rc1 r71767
  • 3.2.8rc1 r71768
  • 3.4.2rc1 r71769
  • 4.0.0alpha1 (trunk) r71770
Generated at Fri Mar 29 11:56:19 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.