483b06
From 3d8b42ac1e532168c2dae96ab0de3d83df0268d0 Mon Sep 17 00:00:00 2001
483b06
From: Pavel Vomacka <pvomacka@redhat.com>
483b06
Date: Fri, 17 Mar 2017 15:10:42 +0100
483b06
Subject: [PATCH] WebUI: Add support for suppressing warnings
483b06
483b06
Each command can have specified an array of warning codes which will
483b06
be suppressed and won't be shown.
483b06
483b06
For specifying this it is necessary to set command property
483b06
'supressed_warnings: [codes_of_warning]'
483b06
483b06
Part of: https://pagure.io/freeipa/issue/6618
483b06
483b06
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
483b06
---
483b06
 install/ui/src/freeipa/rpc.js | 7 +++++++
483b06
 1 file changed, 7 insertions(+)
483b06
483b06
diff --git a/install/ui/src/freeipa/rpc.js b/install/ui/src/freeipa/rpc.js
483b06
index 1880f8d5732f982c25924b787b273c9e56636b20..84282f78d940ac2d18d00df92a7430ca51bbf389 100644
483b06
--- a/install/ui/src/freeipa/rpc.js
483b06
+++ b/install/ui/src/freeipa/rpc.js
483b06
@@ -72,6 +72,12 @@ rpc.command = function(spec) {
483b06
     that.options = $.extend({}, spec.options || {});
483b06
 
483b06
     /**
483b06
+     * @property {Array} suppress_warnings array of message codes which
483b06
+     * are suppressed
483b06
+     */
483b06
+    that.suppress_warnings = spec.suppress_warnings || [];
483b06
+
483b06
+    /**
483b06
      * Success handler
483b06
      * @property {Function}
483b06
      * @param {Object} data
483b06
@@ -219,6 +225,7 @@ rpc.command = function(spec) {
483b06
 
483b06
         for (var i=0,l=msgs.length; i
483b06
             var msg = lang.clone(msgs[i]);
483b06
+            if (that.suppress_warnings.indexOf(msg.code) > -1) continue;
483b06
             // escape and reformat message
483b06
             msg.message = util.beautify_message(msg.message);
483b06
             IPA.notify(msg.message, msg.type);
483b06
-- 
483b06
2.12.1
483b06