diff options
author | Dace Petra <dace.petra@zabbix.com> | 2022-06-20 11:50:54 +0300 |
---|---|---|
committer | Dace Petra <dace.petra@zabbix.com> | 2022-06-20 11:50:54 +0300 |
commit | 522fde6f6a3def719d91d5e60f97b6032ddc7bf0 (patch) | |
tree | 2456e725a070117bc6965be076b9db31b95aa5e4 /ui | |
parent | 0b857e7c0607681a1e1462145a189c327d5c904f (diff) | |
parent | 09bbb825b625a5aa1ad201bc31e6be71cab5491b (diff) |
..F....... [ZBX-20965] fixed positioning of change indicator and added help hint for the Position label in Units block of item value widget settings
* commit '09bbb825b625a5aa1ad201bc31e6be71cab5491b':
..F....... [ZBX-20965] fixed minor issues
..F....... [ZBX-20965] fixed coding style
..F....... [ZBX-20965] fixed positioning of change indicator and added help hint for the Position label in Units block of item value widget settings (dpetra).
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/views/monitoring.widget.item.view.php | 14 | ||||
-rw-r--r-- | ui/include/classes/widgets/CWidgetHelper.php | 10 | ||||
-rw-r--r-- | ui/include/classes/widgets/views/widget.item.form.view.php | 4 |
3 files changed, 15 insertions, 13 deletions
diff --git a/ui/app/views/monitoring.widget.item.view.php b/ui/app/views/monitoring.widget.item.view.php index a172ee2fff4..bab325bb799 100644 --- a/ui/app/views/monitoring.widget.item.view.php +++ b/ui/app/views/monitoring.widget.item.view.php @@ -168,6 +168,13 @@ function drawValueCell(array $cell_data): array { $item_content_div->addItem($item_decimals_div); } + // Units AFTER value. + if (array_key_exists('units', $cell_data['parts']) && $cell_data['units_pos'] == WIDGET_ITEM_POS_AFTER) { + $item_content_div->addItem($units_div); + } + + $item_cell[] = $item_content_div; + if (array_key_exists('change_indicator', $cell_data['parts'])) { $change_data = $cell_data['parts']['change_indicator']; $item_change_div = (new CDiv())->addClass('change-indicator'); @@ -191,13 +198,6 @@ function drawValueCell(array $cell_data): array { $item_content_div->addItem($item_change_div); } - // Units AFTER value. - if (array_key_exists('units', $cell_data['parts']) && $cell_data['units_pos'] == WIDGET_ITEM_POS_AFTER) { - $item_content_div->addItem($units_div); - } - - $item_cell[] = $item_content_div; - // Units BELOW value. if (array_key_exists('units', $cell_data['parts']) && $cell_data['units_pos'] == WIDGET_ITEM_POS_BELOW) { $item_cell[] = $units_div; diff --git a/ui/include/classes/widgets/CWidgetHelper.php b/ui/include/classes/widgets/CWidgetHelper.php index 3dc7b40bc2f..633a899d4d0 100644 --- a/ui/include/classes/widgets/CWidgetHelper.php +++ b/ui/include/classes/widgets/CWidgetHelper.php @@ -135,16 +135,16 @@ class CWidgetHelper { * @return CLabel */ public static function getLabel($field, $class = null, $hint = null) { + $help_icon = ($hint !== null) + ? makeHelpIcon($hint) + : null; + if ($field instanceof CWidgetFieldSelect) { - return (new CLabel($field->getLabel(), 'label-'.$field->getName())) + return (new CLabel([$field->getLabel(), $help_icon], 'label-'.$field->getName())) ->setAsteriskMark(self::isAriaRequired($field)) ->addClass($class); } - $help_icon = ($hint !== null) - ? makeHelpIcon($hint) - : null; - return (new CLabel([$field->getLabel(), $help_icon], $field->getName())) ->setAsteriskMark(self::isAriaRequired($field)) ->addClass($class); diff --git a/ui/include/classes/widgets/views/widget.item.form.view.php b/ui/include/classes/widgets/views/widget.item.form.view.php index 7253d34b46a..2581f69dd8b 100644 --- a/ui/include/classes/widgets/views/widget.item.form.view.php +++ b/ui/include/classes/widgets/views/widget.item.form.view.php @@ -138,7 +138,9 @@ $form_list ->addClass('form-field') ->addClass('field-fluid'), - CWidgetHelper::getLabel($fields['units_pos']), + CWidgetHelper::getLabel($fields['units_pos'], null, + _('Position is ignored for s, uptime and unixtime units.') + ), (new CDiv(CWidgetHelper::getSelect($fields['units_pos'])))->addClass('form-field'), CWidgetHelper::getLabel($fields['units_size']), |