diff options
author | Miks Kronkalns <miks.kronkalns@zabbix.com> | 2022-02-07 16:14:34 +0300 |
---|---|---|
committer | Miks Kronkalns <miks.kronkalns@zabbix.com> | 2022-02-07 16:14:34 +0300 |
commit | 4a8c6deeebaa44ab8f61199ed04b4c97b6060414 (patch) | |
tree | d94e41f9e6f4c00542b7dc414f818141de5fb8f8 /ui | |
parent | 1fad93cbdde41235f2691a9e003a07f92eb4f483 (diff) | |
parent | 2892e08d866caf4c27d1a4e5683b0116c6d1a4e3 (diff) |
..F....... [ZBX-19796] fixed macros tab indicator showing incorrect count when inherited option is selected and a new macro is added
* commit '2892e08d866caf4c27d1a4e5683b0116c6d1a4e3':
..F....... [ZBX-19796] fixed coding style and extended changelog message
..F....... [ZBX-19796] fixed macros tab indicator
.D........ [ZBX-19796] added changelog
..F....... [ZBX-19796] fixed macros tab indicator
Diffstat (limited to 'ui')
-rw-r--r-- | ui/js/class.tab-indicators.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ui/js/class.tab-indicators.js b/ui/js/class.tab-indicators.js index 8392bbf5764..195fe50c0c9 100644 --- a/ui/js/class.tab-indicators.js +++ b/ui/js/class.tab-indicators.js @@ -303,13 +303,25 @@ class TabIndicatorItem { class MacrosTabIndicatorItem extends TabIndicatorItem { + static ZBX_PROPERTY_INHERITED = 1; + constructor() { super(TAB_INDICATOR_TYPE_COUNT); } getValue() { - return document - .querySelectorAll('#tbl_macros tr.form_row > td:first-child > textarea:not(:placeholder-shown):not([readonly])') + return [...document.querySelectorAll('#tbl_macros .form_row')] + .filter((row) => { + const macro = row.querySelector('textarea[name$="[macro]"]'); + const inherited_type = row.querySelector('input[name$="[inherited_type]"]'); + + if (inherited_type !== null + && parseInt(inherited_type.value, 10) == MacrosTabIndicatorItem.ZBX_PROPERTY_INHERITED) { + return false; + } + + return (macro !== null && macro.value !== ''); + }) .length; } |