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