pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0022-WebUI-Add-support-for-suppressing-warnings.patch

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