URL: https://github.com/freeipa/freeipa/pull/2754
Author: serg-cymbaluk
 Title: #2754: [Backport][ipa-4-7]  Fix "Configured size limit exceeded" 
warning on Web UI
Action: opened

PR body:
"""
This PR was opened automatically because PR #2739 was pushed to master and 
backport to ipa-4-7 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/2754/head:pr2754
git checkout pr2754
From 57f4d16ed6df2e37a1bfde691d2dc0dac27a7919 Mon Sep 17 00:00:00 2001
From: Serhii Tsymbaliuk <stsym...@redhat.com>
Date: Wed, 9 Jan 2019 15:43:33 +0100
Subject: [PATCH] Fix "Configured size limit exceeded" warning on Web UI

Suppress size limit warning in 'refresh' command.

Ticket: https://pagure.io/freeipa/issue/7603
---
 install/ui/src/freeipa/rpc.js      |  9 +++++++++
 install/ui/src/freeipa/search.js   |  3 ++-
 install/ui/src/freeipa/widget.js   |  2 +-
 ipatests/test_webui/test_config.py | 26 ++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/install/ui/src/freeipa/rpc.js b/install/ui/src/freeipa/rpc.js
index 84282f78d9..1fa2308a26 100644
--- a/install/ui/src/freeipa/rpc.js
+++ b/install/ui/src/freeipa/rpc.js
@@ -1105,5 +1105,14 @@ rpc.extract_objects = function(values) {
     return values;
 };
 
+/**
+ * Server side error/warning codes
+ *
+ * Add new errors from ipalib.messages only if necessary.
+ */
+rpc.errors = {
+    search_result_truncated: 13017
+};
+
 return rpc;
 });
diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js
index 0966403c35..6a6dcbdfff 100644
--- a/install/ui/src/freeipa/search.js
+++ b/install/ui/src/freeipa/search.js
@@ -291,7 +291,8 @@ IPA.search_facet = function(spec, no_init) {
             name: that.get_search_command_name(),
             entity: that.managed_entity.name,
             method: 'find',
-            args: args
+            args: args,
+            suppress_warnings: [rpc.errors.search_result_truncated]
         });
 
         command.set_options(that.get_refresh_command_options());
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index ef4cd1922b..1fb636e0f6 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -5021,7 +5021,7 @@ IPA.entity_select_widget = function(spec) {
             method: 'find',
             args: [filter],
             options: that.filter_options,
-            suppress_warnings: [13017]
+            suppress_warnings: [rpc.errors.search_result_truncated]
         });
         var no_members = metadata.get('@mc-opt:' + cmd.get_command() + ':no_members');
         if (no_members) {
diff --git a/ipatests/test_webui/test_config.py b/ipatests/test_webui/test_config.py
index 09a87de5ef..b411ef8d5b 100644
--- a/ipatests/test_webui/test_config.py
+++ b/ipatests/test_webui/test_config.py
@@ -164,6 +164,32 @@ def test_size_limits(self):
         self.fill_input(size_limit_s, def_val)
         self.facet_button_click('save')
 
+    @screenshot
+    def test_size_limit_notification(self):
+        """
+        Test if no notification is shown when size limit exceeded
+        """
+        self.init_app()
+        self.navigate_to_entity(config_data.ENTITY)
+
+        size_limit_s = 'ipasearchrecordslimit'
+        def_val = self.get_field_value(size_limit_s)
+
+        self.fill_input(size_limit_s, '10')
+        self.facet_button_click('save')
+
+        self.navigate_to_entity('cert')
+        # wait for a half sec for notification to appear
+        self.wait(0.5)
+        warning = self.find_by_selector('div.notification-area .alert-warning')
+        try:
+            assert not warning, "Warning present: {}".format(warning.text)
+        finally:
+            # restore previous value
+            self.navigate_to_entity(config_data.ENTITY)
+            self.fill_input(size_limit_s, def_val)
+            self.facet_button_click('save')
+
     @screenshot
     def test_time_limits(self):
         """
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to