Skip to content

Commit

Permalink
..F....... [ZBX-23936] fixed the state and styling of readonly fields
Browse files Browse the repository at this point in the history
* commit 'b379243ea9cdb4d90c4d1cc975a984586a2c65cf': (33 commits)
  .......... [ZBX-23936] fixed multiselect element isEnabled state
  .......... [ZBX-23936] added assertTrue in Selenium test
  ..F....... [ZBX-23936] fixed scheduled reports owner update when cloning the form
  .......... [ZBX-23936] fixed Selenium tests, added enabled filter for CheckboxList element and changed attributes to readonly
  .......... [ZBX-23936] added enabled condition to Selenium framework
  ..F....... [ZBX-23936] fixed proxy override timeout script input field readonly state
  .......... [ZBX-23936] fixed Selenium test, changed segmented readio element enabled attribute to readonly
  ..F....... [ZBX-23936] fixed discovered host inventory tab indicator change
  ..F....... [ZBX-23936] fixed discovered item custom interval radio buttons in readonly state
  ..F....... [ZBX-23936] reverted removed additional check for CRadioButtonList enabling
  ..F....... [ZBX-23936] reverted changes overwritten by update to latest master and fixed trigger, item and host prototype form radio button list readonly state behaviour on click
  ..F....... [ZBX-23936] fixed maintenance tag input fields readonly and disable state checks
  ..F....... [ZBX-23936] fixed host interface input field readonly status setting
  ..F....... [ZBX-23936] fixed radio button and checkbox readonly behaviour
  ..F....... [ZBX-23936] fixed scheduled reports readonly fields
  ..F....... [ZBX-23936] fixed undefined disabled parameter error for multiselect popups
  ..F....... [ZBX-23936] fixed coding style and additional readonly fields
  ..F....... [ZBX-23936] fixed additional readonly multiselects
  ..F....... [ZBX-23936] fixed multiselect readonly state and styling
  ..F....... [ZBX-23936] added readonly state and styling to checkboxes and checkbox list where applicable
  ...
  • Loading branch information
Diana Dauksa committed Jul 5, 2024
2 parents 46a6214 + b379243 commit e87b551
Show file tree
Hide file tree
Showing 57 changed files with 424 additions and 255 deletions.
1 change: 1 addition & 0 deletions ChangeLog.d/bugfix/ZBX-23936
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
..F....... [ZBX-23936] fixed the state and styling of readonly fields (ddauksa)
12 changes: 12 additions & 0 deletions sass/stylesheets/sass/components/_multiselect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
@extend %form-disabled;
}

&[aria-readonly] {
@extend %form-readonly;
}

input[type="text"] {
border: 0;
background: none;
Expand Down Expand Up @@ -128,6 +132,14 @@
}
}

[aria-readonly] {
.subfilter-enabled,
.btn-icon {
cursor: default;
background-color: $multiselect-item-disabled-bg-color;
}
}

div[aria-live] {
overflow: hidden;
position: absolute;
Expand Down
22 changes: 15 additions & 7 deletions sass/stylesheets/sass/components/_radio-list-control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,23 @@
box-shadow: 0 0 0 2px $btn-focus-outline-color;
}

&:checked[disabled] + label {
background-color: lighten($ui-bg-selected-color, 33%) !important;
transition: none;
&[readonly],
&[disabled] {
+ label {
transition: none;
cursor: default;
box-shadow: none;
@extend %form-disabled;
}

&:checked + label {
background-color: lighten($ui-bg-selected-color, 33%);
}
}

&[disabled] + label {
transition: none;
cursor: default;
@extend %form-disabled;
&[readonly]:checked + label {
color: $font-color;
-webkit-text-fill-color: $font-color;
}
}
}
14 changes: 13 additions & 1 deletion sass/stylesheets/sass/screen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,12 @@ select {
border-color: $form-border-color !important;
}
}

&:checked[readonly] + label span {
&::after {
border-color: $font-color !important;
}
}
}

&[type="radio"] {
Expand All @@ -1146,6 +1152,12 @@ select {
background-color: $form-border-color !important;
}
}

&:checked[readonly] + label span {
&::after {
background-color: $font-color !important;
}
}
}

&:focus + label span {
Expand Down Expand Up @@ -3751,7 +3763,7 @@ svg {
.table-col-function { width: 85px; }
.table-col-draw-style { width: 85px; }
.table-col-y-axis-side { width: 85px; }
.table-col-colour { width: 55px; }
.table-col-color { width: 55px; }
.table-col-action { width: 55px; }
}

Expand Down
2 changes: 1 addition & 1 deletion ui/app/controllers/CControllerPopupGeneric.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ protected function makeFilters(): array {
'object_name' => $src_name,
'data' => array_values($hosts),
'selectedLimit' => 1,
'disabled' => $this->hasInput('only_hostid'),
'readonly' => $this->hasInput('only_hostid'),
'popup' => [
'parameters' => [
'srctbl' => $src_name,
Expand Down
14 changes: 7 additions & 7 deletions ui/app/partials/configuration.host.edit.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
(new CMultiSelect([
'name' => 'groups[]',
'object_name' => 'hostGroup',
'disabled' => $host_is_discovered,
'readonly' => $host_is_discovered,
'add_new' => (CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN),
'data' => $data['groups_ms'],
'popup' => [
Expand Down Expand Up @@ -410,8 +410,8 @@
->addValue(_('Disabled'), HOST_INVENTORY_DISABLED)
->addValue(_('Manual'), HOST_INVENTORY_MANUAL)
->addValue(_('Automatic'), HOST_INVENTORY_AUTOMATIC)
->setEnabled(!$host_is_discovered)
->setModern(true),
->setReadonly($host_is_discovered)
->setModern(),
$host_is_discovered ? new CInput('hidden', 'inventory_mode', $data['host']['inventory_mode']) : null
])
]);
Expand Down Expand Up @@ -482,7 +482,7 @@
->addValue(_('PSK'), HOST_ENCRYPTION_PSK)
->addValue(_('Certificate'), HOST_ENCRYPTION_CERTIFICATE)
->setModern(true)
->setEnabled(!$host_is_discovered)
->setReadonly($host_is_discovered)
)
])
->addItem([
Expand All @@ -492,15 +492,15 @@
(new CCheckBox('tls_in_none'))
->setChecked(($tls_accept & HOST_ENCRYPTION_NONE))
->setLabel(_('No encryption'))
->setEnabled(!$host_is_discovered),
->setReadonly($host_is_discovered),
(new CCheckBox('tls_in_psk'))
->setChecked(($tls_accept & HOST_ENCRYPTION_PSK))
->setLabel(_('PSK'))
->setEnabled(!$host_is_discovered),
->setReadonly($host_is_discovered),
(new CCheckBox('tls_in_cert'))
->setChecked(($tls_accept & HOST_ENCRYPTION_CERTIFICATE))
->setLabel(_('Certificate'))
->setEnabled(!$host_is_discovered)
->setReadonly($host_is_discovered)
]))
->addClass(ZBX_STYLE_LIST_CHECK_RADIO),
new CInput('hidden', 'tls_accept', $tls_accept)
Expand Down
16 changes: 8 additions & 8 deletions ui/app/partials/item.edit.item.tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
->addValue(_('Raw data'), ZBX_POSTTYPE_RAW)
->addValue(_('JSON data'), ZBX_POSTTYPE_JSON)
->addValue(_('XML data'), ZBX_POSTTYPE_XML)
->setEnabled(!$readonly)
->setReadonly($readonly)
->setModern()
))->setId('js-item-post-type-field')
])
Expand Down Expand Up @@ -300,7 +300,7 @@
(new CLabel(_('Follow redirects'), 'follow_redirects'))->setId('js-item-follow-redirects-label'),
(new CFormField(
(new CCheckBox('follow_redirects', HTTPTEST_STEP_FOLLOW_REDIRECTS_ON))
->setEnabled(!$readonly)
->setReadonly($readonly)
->setChecked($item['follow_redirects'] == HTTPTEST_STEP_FOLLOW_REDIRECTS_ON)
))->setId('js-item-follow-redirects-field')
])
Expand All @@ -311,15 +311,15 @@
->addValue(_('Body'), HTTPTEST_STEP_RETRIEVE_MODE_CONTENT)
->addValue(_('Headers'), HTTPTEST_STEP_RETRIEVE_MODE_HEADERS)
->addValue(_('Body and headers'), HTTPTEST_STEP_RETRIEVE_MODE_BOTH)
->setEnabled(!($readonly || $item['request_method'] == HTTPCHECK_REQUEST_HEAD))
->setReadonly($readonly || $item['request_method'] == HTTPCHECK_REQUEST_HEAD)
->setModern()
))->setId('js-item-retrieve-mode-field')
])
->addItem([
(new CLabel(_('Convert to JSON'), 'output_format'))->setId('js-item-output-format-label'),
(new CFormField(
(new CCheckBox('output_format', HTTPCHECK_STORE_JSON))
->setEnabled(!$readonly)
->setReadonly($readonly)
->setChecked($item['output_format'] == HTTPCHECK_STORE_JSON)
))->setId('js-item-output-format-field')
])
Expand Down Expand Up @@ -363,15 +363,15 @@
(new CLabel(_('SSL verify peer'), 'verify_peer'))->setId('js-item-verify-peer-label'),
(new CFormField(
(new CCheckBox('verify_peer', ZBX_HTTP_VERIFY_PEER_ON))
->setEnabled(!$readonly)
->setReadonly($readonly)
->setChecked($item['verify_peer'] == ZBX_HTTP_VERIFY_PEER_ON)
))->setId('js-item-verify-peer-field')
])
->addItem([
(new CLabel(_('SSL verify host'), 'verify_host'))->setId('js-item-verify-host-label'),
(new CFormField(
(new CCheckBox('verify_host', ZBX_HTTP_VERIFY_HOST_ON))
->setEnabled(!$readonly)
->setReadonly($readonly)
->setChecked($item['verify_host'] == ZBX_HTTP_VERIFY_HOST_ON)
))->setId('js-item-verify-host-field')
])
Expand Down Expand Up @@ -410,7 +410,7 @@
'name' => 'master_itemid',
'object_name' => 'items',
'multiple' => false,
'disabled' => $readonly,
'readonly' => $readonly,
'data' => $item['master_item']
? [[
'id' => $item['master_item']['itemid'],
Expand Down Expand Up @@ -801,7 +801,7 @@
(new CMultiSelect([
'name' => 'valuemapid',
'object_name' => $item['context'] === 'host' ? 'valuemaps' : 'template_valuemaps',
'disabled' => $readonly,
'readonly' => $readonly,
'multiple' => false,
'data' => $item['valuemap']
? [[
Expand Down
27 changes: 14 additions & 13 deletions ui/app/partials/scheduledreport.formgrid.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @var CPartial $this
* @var array $data
*/

$form_grid = new CFormGrid();
Expand All @@ -24,7 +25,7 @@
'name' => 'userid',
'object_name' => 'users',
'multiple' => false,
'disabled' => (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) || !$data['allowed_edit'],
'readonly' => (CWebUser::getType() != USER_TYPE_SUPER_ADMIN) || !$data['allowed_edit'],
'data' => $data['ms_user'],
'popup' => [
'parameters' => [
Expand All @@ -42,7 +43,7 @@
'name' => 'dashboardid',
'object_name' => 'dashboard',
'multiple' => false,
'disabled' => !$data['allowed_edit'],
'readonly' => !$data['allowed_edit'],
'data' => $data['ms_dashboard'],
'popup' => [
'parameters' => [
Expand Down Expand Up @@ -82,7 +83,7 @@
->addValue(_('Previous week'), ZBX_REPORT_PERIOD_WEEK)
->addValue(_('Previous month'), ZBX_REPORT_PERIOD_MONTH)
->addValue(_('Previous year'), ZBX_REPORT_PERIOD_YEAR)
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
->setModern(true)
)
])
Expand All @@ -94,7 +95,7 @@
->addValue(_('Weekly'), ZBX_REPORT_CYCLE_WEEKLY)
->addValue(_('Monthly'), ZBX_REPORT_CYCLE_MONTHLY)
->addValue(_('Yearly'), ZBX_REPORT_CYCLE_YEARLY)
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
->setModern(true)
)
])
Expand All @@ -104,11 +105,11 @@
(new CDiv([
(new CNumericBox('hours', $data['hours'], 2))
->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)
->setEnabled($data['allowed_edit']),
->setReadonly(!$data['allowed_edit']),
' : ',
(new CNumericBox('minutes', $data['minutes'], 2))
->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
]))->addClass(ZBX_STYLE_FORM_FIELDS_INLINE)
)
]);
Expand Down Expand Up @@ -137,7 +138,7 @@
->setVertical(true)
->setColumns(3)
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
))
->setId('weekdays')
->addClass($show_weekdays ? null : ZBX_STYLE_DISPLAY_NONE)
Expand All @@ -148,7 +149,7 @@
(new CDateSelector('active_since', $data['active_since']))
->setDateFormat(ZBX_DATE)
->setPlaceholder(_('YYYY-MM-DD'))
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
)
])
->addItem([
Expand All @@ -157,7 +158,7 @@
(new CDateSelector('active_till', $data['active_till']))
->setDateFormat(ZBX_DATE)
->setPlaceholder(_('YYYY-MM-DD'))
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
)
])
->addItem([
Expand All @@ -166,7 +167,7 @@
(new CTextBox('subject', $data['subject']))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAttribute('maxlength', DB::getFieldLength('media_type_message', 'subject'))
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
)
])
->addItem([
Expand All @@ -175,7 +176,7 @@
(new CTextArea('message', $data['message']))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAttribute('maxlength', DB::getFieldLength('report_param', 'value'))
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
)
])
->addItem([
Expand All @@ -188,7 +189,7 @@
(new CTextArea('description', $data['description']))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setMaxLength(DB::getFieldLength('report', 'description'))
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
->setAriaRequired()
)
])
Expand All @@ -198,7 +199,7 @@
(new CCheckBox('status', ZBX_REPORT_STATUS_ENABLED))
->setChecked($data['status'] == ZBX_REPORT_STATUS_ENABLED)
->setUncheckedValue(ZBX_REPORT_STATUS_DISABLED)
->setEnabled($data['allowed_edit'])
->setReadonly(!$data['allowed_edit'])
)
]);

Expand Down
10 changes: 5 additions & 5 deletions ui/app/partials/trigger.edit.trigger.tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

if ($discovered_trigger) {
$trigger_form_grid->addItem([(new CVar('priority', (int) $data['priority']))->removeId()]);
$severity = new CSeverity('priority_names', (int) $data['priority'], false);
$severity = (new CSeverity('priority_names', (int) $data['priority']))->setReadonly($readonly);
}
else {
$severity = new CSeverity('priority', (int) $data['priority']);
Expand Down Expand Up @@ -156,7 +156,7 @@
->addValue(_('Recovery expression'), ZBX_RECOVERY_MODE_RECOVERY_EXPRESSION)
->addValue(_('None'), ZBX_RECOVERY_MODE_NONE)
->setModern()
->setEnabled(!$readonly)
->setReadonly($readonly)
)
]);

Expand Down Expand Up @@ -234,15 +234,15 @@
->addValue(_('Single'), TRIGGER_MULT_EVENT_DISABLED)
->addValue(_('Multiple'), TRIGGER_MULT_EVENT_ENABLED)
->setModern()
->setEnabled(!$readonly)
->setReadonly($readonly)
)
])
->addItem([new CLabel(_('OK event closes'), 'correlation_mode'),
(new CFormField((new CRadioButtonList('correlation_mode', (int) $data['correlation_mode']))
->addValue(_('All problems'), ZBX_TRIGGER_CORRELATION_NONE)
->addValue(_('All problems if tag values match'), ZBX_TRIGGER_CORRELATION_TAG)
->setModern()
->setEnabled(!$readonly)
->setReadonly($readonly)
))->setId('ok-event-closes')
])
->addItem([(new CLabel(_('Tag for matching'), 'correlation_tag'))->setAsteriskMark(),
Expand All @@ -255,7 +255,7 @@
new CFormField(
(new CCheckBox('manual_close', ZBX_TRIGGER_MANUAL_CLOSE_ALLOWED))
->setChecked($data['manual_close'] == ZBX_TRIGGER_MANUAL_CLOSE_ALLOWED)
->setEnabled(!$readonly)
->setReadonly($readonly)
)
])
->addItem([
Expand Down
Loading

0 comments on commit e87b551

Please sign in to comment.