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:
-rw-r--r--ui/app/controllers/CControllerHost.php6
-rw-r--r--ui/app/controllers/CControllerHostView.php10
-rw-r--r--ui/app/controllers/CControllerProblem.php4
-rw-r--r--ui/app/controllers/CControllerProblemView.php14
-rw-r--r--ui/js/class.tabfilter.js1
5 files changed, 23 insertions, 12 deletions
diff --git a/ui/app/controllers/CControllerHost.php b/ui/app/controllers/CControllerHost.php
index ac7020047c2..398163d2e0d 100644
--- a/ui/app/controllers/CControllerHost.php
+++ b/ui/app/controllers/CControllerHost.php
@@ -296,6 +296,10 @@ abstract class CControllerHost extends CController {
* @return array
*/
protected function cleanInput(array $input): array {
+ if (array_key_exists('filter_reset', $input) && $input['filter_reset']) {
+ return array_intersect_key(['filter_name' => ''], $input);
+ }
+
if (array_key_exists('tags', $input) && $input['tags']) {
$input['tags'] = array_filter($input['tags'], function($tag) {
return !($tag['tag'] === '' && $tag['value'] === '');
@@ -303,8 +307,6 @@ abstract class CControllerHost extends CController {
$input['tags'] = array_values($input['tags']);
}
- $input += ['severities' => []];
-
return $input;
}
}
diff --git a/ui/app/controllers/CControllerHostView.php b/ui/app/controllers/CControllerHostView.php
index 8d7eb96df5c..d2a20f3d4c9 100644
--- a/ui/app/controllers/CControllerHostView.php
+++ b/ui/app/controllers/CControllerHostView.php
@@ -46,6 +46,7 @@ class CControllerHostView extends CControllerHost {
'filter_custom_time' => 'in 1,0',
'filter_show_counter' => 'in 1,0',
'filter_counters' => 'in 1',
+ 'filter_reset' => 'in 1',
'counter_index' => 'ge 0'
];
@@ -88,11 +89,16 @@ class CControllerHostView extends CControllerHost {
->read()
->setInput($this->cleanInput($this->getInputAll()));
- foreach ($profile->getTabsWithDefaults() as $filter_tab) {
+ foreach ($profile->getTabsWithDefaults() as $index => $filter_tab) {
+ if ($index == $profile->selected) {
+ // Initialize multiselect data for filter_scr to allow tabfilter correctly handle unsaved state.
+ $filter_tab['filter_src']['filter_view_data'] = $this->getAdditionalData($filter_tab['filter_src']);
+ }
+
$filter_tabs[] = $filter_tab + ['filter_view_data' => $this->getAdditionalData($filter_tab)];
}
- $filter = $profile->getTabFilter($profile->selected);
+ $filter = $filter_tabs[$profile->selected];
$refresh_curl = new CUrl('zabbix.php');
$filter['action'] = 'host.view.refresh';
array_map([$refresh_curl, 'setArgument'], array_keys($filter), $filter);
diff --git a/ui/app/controllers/CControllerProblem.php b/ui/app/controllers/CControllerProblem.php
index b3f523c6f92..73fbedfbbd2 100644
--- a/ui/app/controllers/CControllerProblem.php
+++ b/ui/app/controllers/CControllerProblem.php
@@ -156,6 +156,10 @@ abstract class CControllerProblem extends CController {
* @return array
*/
protected function cleanInput(array $input): array {
+ if (array_key_exists('filter_reset', $input) && $input['filter_reset']) {
+ return array_intersect_key(['filter_name' => ''], $input);
+ }
+
if (array_key_exists('tags', $input) && $input['tags']) {
$input['tags'] = array_filter($input['tags'], function($tag) {
return !($tag['tag'] === '' && $tag['value'] === '');
diff --git a/ui/app/controllers/CControllerProblemView.php b/ui/app/controllers/CControllerProblemView.php
index e6205e65b1b..31387c02230 100644
--- a/ui/app/controllers/CControllerProblemView.php
+++ b/ui/app/controllers/CControllerProblemView.php
@@ -105,21 +105,21 @@ class CControllerProblemView extends CControllerProblem {
->read()
->setInput($this->cleanInput($this->getInputAll()));
- foreach ($profile->getTabsWithDefaults() as $filter_tab) {
+ foreach ($profile->getTabsWithDefaults() as $index => $filter_tab) {
if ($filter_tab['filter_custom_time']) {
$filter_tab['show'] = TRIGGERS_OPTION_ALL;
$filter_tab['filter_src']['show'] = TRIGGERS_OPTION_ALL;
}
- $filter_tabs[] = $filter_tab + ['filter_view_data' => $this->getAdditionalData($filter_tab)];
- }
-
- $filter = $profile->getTabFilter($profile->selected);
+ if ($index == $profile->selected) {
+ // Initialize multiselect data for filter_scr to allow tabfilter correctly handle unsaved state.
+ $filter_tab['filter_src']['filter_view_data'] = $this->getAdditionalData($filter_tab['filter_src']);
+ }
- if ($filter_tab['filter_custom_time']) {
- $filter_tab['show'] = TRIGGERS_OPTION_ALL;
+ $filter_tabs[] = $filter_tab + ['filter_view_data' => $this->getAdditionalData($filter_tab)];
}
+ $filter = $filter_tabs[$profile->selected];
$refresh_curl = (new CUrl('zabbix.php'));
$filter['action'] = 'problem.view.refresh';
array_map([$refresh_curl, 'setArgument'], array_keys($filter), $filter);
diff --git a/ui/js/class.tabfilter.js b/ui/js/class.tabfilter.js
index 25a3cdaa328..cb94aa80b1f 100644
--- a/ui/js/class.tabfilter.js
+++ b/ui/js/class.tabfilter.js
@@ -103,7 +103,6 @@ class CTabFilter extends CBaseComponent {
src_item;
filter_src.uniqid = filter_data.uniqid + '__clone';
- filter_src.filter_view_data = filter_data.filter_view_data;
filter_src.filter_configurable = filter_data.filter_configurable;
target.setAttribute('data-target', target.getAttribute('data-target') + '__clone');
src_item = this.create(target, filter_src);